From 5a46538c70d2e901f8db60be95f6435f035f9fe3 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 10:16:49 +0200 Subject: [PATCH 001/134] Simplify the repository layout [#320] Move the headers to include/webfront/ (included as ), the browser sources to js/core and js/developer, the tests to test/{unit,web, fuzz,cmake}, and the documentation, CI and container files to docs/, .github/ and .devcontainer/. Remove the historical prototype and the unused compressed header. Add the RepositoryLayout CTest case. The generated-provider include changed, so the developer distribution is bumped to 0.4.1; its publication is a separate maintainer step. --- .codescene/code-health-rules.json | 10 +- Dockerfile => .devcontainer/Dockerfile | 0 .devcontainer/devcontainer.json | 2 +- .gitattributes | 45 +- CONTRIBUTING.md => .github/CONTRIBUTING.md | 0 codecov.yml => .github/codecov.yml | 2 +- .github/workflows/BuildAndTest.yml | 24 +- .github/workflows/DeveloperDistribution.yml | 48 +-- .github/workflows/MddlogIntegration.yml | 4 +- .github/workflows/ReleaseVersion.yml | 2 +- .gitignore | 2 +- AGENTS.md | 30 +- CMakeLists.txt | 16 +- CTestConfig.cmake | 0 README.md | 4 +- assets/developer/bundles.json | 34 -- cmake/MddlogIntegration.cmake | 2 +- cmake/WKWebViewSupport.cmake | 2 +- cmake/WebKitGTKSupport.cmake | 4 +- cmake/WebView2Support.cmake | 2 +- {logging => cmake/mddlog}/Logger.cpp | 2 +- CHANGELOG.md => docs/CHANGELOG.md | 14 + docs/DEVELOPER_ENVIRONMENT.md | 24 +- Doxyfile.in => docs/Doxyfile.in | 0 {cmake => docs}/Doxygen.cmake | 0 docs/EMBEDDED_ASSETS.md | 18 +- docs/FRONTENDS.md | 10 +- docs/HTTP_ASSETS.md | 2 +- docs/PROJECT_STATUS.md | 33 +- docs/UI_COMPONENTS.md | 24 +- docs/WEBKITGTK.md | 2 +- docs/WKWEBVIEW.md | 4 +- docs/adr/ADR-001-coeur-cpp23-header-only.md | 6 +- ...DR-002-systemes-de-fichiers-composables.md | 8 +- .../ADR-003-protocole-binaire-et-bornes.md | 10 +- .../ADR-004-appels-asynchrones-et-erreurs.md | 6 +- .../ADR-005-evolution-reseau-asio-stdnet.md | 8 +- .../ADR-006-taches-structurees-et-arret.md | 6 +- docs/adr/ADR-007-frontends-explicites.md | 6 +- ...DR-008-contenu-de-confiance-et-origines.md | 6 +- ...DR-009-modules-et-assets-reproductibles.md | 8 +- ...ADR-010-composants-et-outils-optionnels.md | 8 +- docs/adr/ADR-011-diagnostics-optionnels.md | 8 +- docs/adr/ADR-012-preuves-et-tests.md | 4 +- docs/adr/README.md | 2 +- docs/mddlog-integration.md | 4 +- .../tools}/render-life-bootstrap.py | 0 examples/hello-world/HelloWorld.cpp | 2 +- examples/life/LifeDeveloper.cpp | 2 +- examples/life/LifeEmbedded.cpp | 2 +- include/WebFront220128.hpp.gz | Bin 12745 -> 0 bytes include/system/DeveloperReleaseData.hpp | 10 - include/system/TerminalModuleData.hpp | 343 --------------- include/system/ToolManagerModuleData.hpp | 392 ----------------- include/{ => webfront}/ApplicationOrigin.hpp | 0 include/{ => webfront}/ContentPolicy.hpp | 0 include/{ => webfront}/DeveloperApp.hpp | 0 include/{ => webfront}/JsFunction.hpp | 0 include/{ => webfront}/JsFunctionSender.hpp | 0 include/{ => webfront}/Task.hpp | 0 include/{ => webfront}/UISubscribers.hpp | 0 include/{ => webfront}/WebFront.hpp | 0 .../{ => webfront}/components/Terminal.hpp | 0 .../{ => webfront}/components/ToolManager.hpp | 0 .../{ => webfront}/details/C++20Support.hpp | 0 .../{ => webfront}/details/C++23Support.hpp | 0 include/{ => webfront}/frontend/Action.hpp | 0 include/{ => webfront}/frontend/CEF.hpp | 0 include/{ => webfront}/frontend/CEFPaths.hpp | 0 .../frontend/DefaultBrowser.hpp | 0 include/{ => webfront}/frontend/Frontend.hpp | 0 .../{ => webfront}/frontend/NativeWebView.hpp | 0 include/{ => webfront}/frontend/Url.hpp | 0 include/{ => webfront}/frontend/WKWebView.hpp | 0 include/{ => webfront}/frontend/WebKitGTK.hpp | 0 .../frontend/WebKitGTKPolicy.hpp | 0 include/{ => webfront}/frontend/WebView2.hpp | 0 .../{ => webfront}/http/AcceptEncoding.hpp | 0 include/{ => webfront}/http/BuffersPolicy.hpp | 0 include/{ => webfront}/http/Encodings.hpp | 0 include/{ => webfront}/http/Gzip.hpp | 0 include/{ => webfront}/http/HTTPServer.hpp | 0 include/{ => webfront}/http/MimeType.hpp | 0 include/{ => webfront}/http/WebSocket.hpp | 0 .../networking/BasicNetworking.hpp | 0 .../networking/NetworkingMock.hpp | 0 .../networking/SenderHeaders.hpp | 0 .../networking/TCPNetworkingStdnet.hpp | 0 .../{ => webfront}/networking/TCPSockets.hpp | 0 include/{ => webfront}/networking/Tasks.hpp | 0 include/{ => webfront}/system/BabelData.hpp | 0 include/{ => webfront}/system/BabelFS.hpp | 0 include/{ => webfront}/system/DefaultFS.hpp | 0 .../system/DeveloperBootstrapData.hpp | 0 include/{ => webfront}/system/DeveloperFS.hpp | 0 .../{ => webfront}/system/DeveloperFiles.hpp | 0 .../system/DeveloperIndexHtmlData.hpp | 0 .../{ => webfront}/system/DeveloperPaths.hpp | 0 .../webfront/system/DeveloperReleaseData.hpp | 10 + .../{ => webfront}/system/DeveloperStore.hpp | 0 .../system/FallbackIndexHtmlData.hpp | 0 .../system/FallbackModuleData.hpp | 0 include/{ => webfront}/system/FileSystem.hpp | 2 +- include/{ => webfront}/system/IndexFS.hpp | 0 .../{ => webfront}/system/JasmineBootData.hpp | 0 .../{ => webfront}/system/JasmineCssData.hpp | 0 include/{ => webfront}/system/JasmineFS.hpp | 0 .../system/JasmineFaviconData.hpp | 0 .../{ => webfront}/system/JasmineHtmlData.hpp | 0 .../{ => webfront}/system/JasmineJsData.hpp | 0 include/{ => webfront}/system/NativeFS.hpp | 0 include/{ => webfront}/system/PackageFS.hpp | 0 include/{ => webfront}/system/ReactFS.hpp | 0 .../system/ReactRuntimeData.hpp | 0 include/{ => webfront}/system/TerminalFS.hpp | 0 .../system/TerminalIndexHtmlData.hpp | 0 .../webfront/system/TerminalModuleData.hpp | 343 +++++++++++++++ .../{ => webfront}/system/ToolManagerFS.hpp | 0 .../webfront/system/ToolManagerModuleData.hpp | 393 ++++++++++++++++++ include/{ => webfront}/system/ToolStore.hpp | 0 .../{ => webfront}/system/WebFrontJsData.hpp | 0 .../{ => webfront}/system/WindowsCompat.hpp | 0 .../{ => webfront}/system/XtermCssData.hpp | 0 .../system/XtermFitAddonData.hpp | 0 .../{ => webfront}/system/XtermModuleData.hpp | 0 include/{ => webfront}/tooling/HexDump.hpp | 0 include/{ => webfront}/tooling/Logger.hpp | 0 include/{ => webfront}/tooling/LoggerApi.hpp | 0 .../{ => webfront}/tooling/MddlogLogger.hpp | 0 include/{ => webfront}/tooling/PathUtils.hpp | 2 +- include/{ => webfront}/utils/Json.hpp | 0 .../utils/TypeErasedFunction.hpp | 0 include/{ => webfront}/weblink/Messages.hpp | 0 .../{ => webfront}/weblink/PendingCalls.hpp | 0 include/{ => webfront}/weblink/WebLink.hpp | 0 {cmake => js/core}/EmbedTextAsset.cmake | 2 +- {assets => js/core}/WebFront.js | 0 {cmake => js/core}/WebFrontAssets.cmake | 38 +- .../core/bootstrap}/bootstrap.bundle.mjs | 0 .../core/bootstrap}/index.html | 0 {assets => js/core}/fallback/index.html | 0 .../core}/fallback/webfront-fallback.mjs | 0 .../developer}/components/terminal/index.html | 0 .../components/terminal/terminal.mjs | 2 +- .../developer}/components/tools/wf.mjs | 2 +- .../environment}/PACKAGES-LICENSE.txt | 0 .../developer/environment}/archive.mjs | 0 .../environment}/bootstrap-entry.mjs | 0 .../developer/environment}/bootstrap.mjs | 0 .../developer/environment}/bundler.mjs | 0 js/developer/environment/bundles.json | 34 ++ .../developer/environment}/compiler.mjs | 0 .../developer/environment}/conditions.mjs | 0 .../developer/environment}/embed.mjs | 4 +- .../developer/environment}/entry.mjs | 0 .../developer/environment}/io.mjs | 0 .../developer/environment}/lock.mjs | 0 .../environment}/packages.bundle.mjs | 0 .../developer/environment}/packages.mjs | 0 .../developer/environment}/paths.mjs | 0 .../developer/environment}/peers.mjs | 0 .../developer/environment}/pins.mjs | 0 .../developer/environment}/recipe.mjs | 0 .../developer/environment}/registry.mjs | 0 .../developer/environment}/resolve.mjs | 0 .../developer/environment}/runtime.mjs | 4 +- .../developer/environment}/starter.mjs | 0 .../developer/tools}/PUBLISHING.md | 14 +- .../developer/tools}/RELEASE_NOTES.md | 0 .../developer/tools}/archive-release.mjs | 2 +- .../developer/tools}/archive.mjs | 0 .../developer/tools}/build.mjs | 42 +- .../developer/tools}/check.mjs | 16 +- .../developer/tools}/distribution-check.mjs | 4 +- .../developer/tools}/distribution.json | 2 +- .../developer/tools}/fixtures.mjs | 12 +- .../developer/tools}/pages.mjs | 0 .../developer/tools}/release-check.mjs | 0 .../developer => js/developer/tools}/site.mjs | 4 +- .../developer/tools}/starters/pi/main.tsx | 0 .../developer/tools}/starters/pi/style.css | 0 .../assets => js/developer/vendor}/check.mjs | 6 +- .../assets => js/developer/vendor}/gzip.mjs | 2 +- .../developer/vendor}/package-lock.json | 0 .../developer/vendor}/package.json | 0 .../assets => js/developer/vendor}/update.mjs | 12 +- .../cmake}/CheckCEFTestingState.cmake | 4 +- .../cmake}/CheckFrontendGenerators.cmake | 4 +- .../cmake}/CheckFrontendSelection.cmake | 10 +- {cmake => test/cmake}/CheckNewcomerDocs.cmake | 2 +- .../cmake}/CheckReleaseVersion.cmake | 2 +- .../cmake}/CheckReleaseVersionTests.cmake | 8 +- test/cmake/CheckRepositoryLayout.cmake | 59 +++ .../cmake}/CheckWKWebViewSupport.cmake | 0 .../cmake}/CheckWebView2Architecture.cmake | 6 +- .../cmake}/CheckWebView2Toolchain.cmake | 0 .../cmake}/FrontendTestHelpers.cmake | 0 {cmake => test/cmake}/TestHardening.cmake | 0 .../cmake}/WKWebViewTestInfo.plist.in | 0 .../cmake}/WebKitGTKTestEnvironment.cmake | 0 test/{ => cmake}/cef-testing/CMakeLists.txt | 0 .../cef-testing/dependency/CMakeLists.txt | 0 test/{ => cmake}/consumer/CMakeLists.txt | 0 test/{ => cmake}/consumer/CheckOptions.cmake | 0 test/{ => cmake}/consumer/main.cpp | 2 +- test/{ => cmake}/frontends/CMakeLists.txt | 6 +- test/{ => cmake}/frontends/TestSupport.cmake | 0 {fuzz => test/fuzz}/CMakeLists.txt | 0 {fuzz => test/fuzz}/GzipFuzz.cpp | 2 +- {fuzz => test/fuzz}/HTTPFuzz.cpp | 2 +- {fuzz => test/fuzz}/MessagesFuzz.cpp | 2 +- {fuzz => test/fuzz}/README.md | 4 +- {fuzz => test/fuzz}/WebSocketFuzz.cpp | 2 +- {fuzz => test/fuzz}/corpus/gzip/bad-crc | Bin .../fuzz}/corpus/gzip/distanceCount31 | Bin .../fuzz}/corpus/gzip/distanceCount32 | Bin {fuzz => test/fuzz}/corpus/gzip/dynamic | Bin {fuzz => test/fuzz}/corpus/gzip/empty | Bin {fuzz => test/fuzz}/corpus/gzip/fixed | Bin .../fuzz}/corpus/gzip/invalidDistance | Bin {fuzz => test/fuzz}/corpus/gzip/missingEnd | Bin {fuzz => test/fuzz}/corpus/gzip/optional | Bin .../fuzz}/corpus/gzip/oversubscribed | Bin .../fuzz}/corpus/gzip/repeatOverflow | Bin .../fuzz}/corpus/gzip/repeatWithoutPrevious | Bin .../fuzz}/corpus/gzip/reserved-block | Bin .../fuzz}/corpus/gzip/reservedDistance | Bin .../fuzz}/corpus/gzip/reservedLiteral | Bin {fuzz => test/fuzz}/corpus/gzip/stored | Bin {fuzz => test/fuzz}/corpus/gzip/truncated | Bin .../fuzz}/corpus/http/accept-encoding | 0 {fuzz => test/fuzz}/corpus/http/get | 0 .../fuzz}/corpus/http/unknown-method | 0 {fuzz => test/fuzz}/corpus/http/upgrade | 0 .../fuzz}/corpus/http/version-overflow | 0 {fuzz => test/fuzz}/corpus/http/x-gzip | 0 {fuzz => test/fuzz}/corpus/messages/array-10 | Bin {fuzz => test/fuzz}/corpus/messages/array-11 | Bin {fuzz => test/fuzz}/corpus/messages/array-12 | Bin {fuzz => test/fuzz}/corpus/messages/array-13 | Bin {fuzz => test/fuzz}/corpus/messages/array-14 | Bin {fuzz => test/fuzz}/corpus/messages/array-15 | Bin {fuzz => test/fuzz}/corpus/messages/array-16 | Bin {fuzz => test/fuzz}/corpus/messages/array-17 | Bin {fuzz => test/fuzz}/corpus/messages/array-8 | Bin {fuzz => test/fuzz}/corpus/messages/array-9 | Bin {fuzz => test/fuzz}/corpus/messages/array-u8 | 0 .../fuzz}/corpus/messages/empty-small-string | Bin .../fuzz}/corpus/messages/empty-string | Bin .../fuzz}/corpus/messages/function-return | Bin {fuzz => test/fuzz}/corpus/messages/handshake | Bin .../fuzz}/corpus/messages/integer-overflow | Bin {fuzz => test/fuzz}/corpus/messages/number | Bin .../fuzz}/corpus/messages/print-call | Bin {fuzz => test/fuzz}/corpus/messages/tuple | Bin {fuzz => test/fuzz}/corpus/websocket/empty | Bin {fuzz => test/fuzz}/corpus/websocket/extended | Bin .../fuzz}/corpus/websocket/masked-hello | 0 .../fuzz}/corpus/websocket/oversized | Bin test/{ => unit}/AcceptEncodingTests.cpp | 2 +- test/{ => unit}/ApplicationTaskTests.cpp | 2 +- test/{ => unit}/ApplicationUrlTests.cpp | 2 +- test/{ => unit}/BabelFSTests.cpp | 2 +- test/{ => unit}/CEFMacrosTests.cpp | 4 +- test/{ => unit}/CEFPathsTests.cpp | 2 +- test/{ => unit}/CMakeLists.txt | 23 +- test/{ => unit}/ContentPolicyTests.cpp | 8 +- test/{ => unit}/DefaultFSTests.cpp | 4 +- test/{ => unit}/DeveloperTests.cpp | 6 +- test/{ => unit}/EmbeddedAssetChecks.hpp | 2 +- test/{ => unit}/EncodingsTests.cpp | 2 +- test/{ => unit}/FileSystemTests.cpp | 2 +- test/{ => unit}/FrontendContractTests.cpp | 4 +- test/{ => unit}/FrontendUrlTests.cpp | 4 +- test/{ => unit}/GzipFixtures.hpp | 0 test/{ => unit}/GzipTests.cpp | 2 +- test/{ => unit}/HTTPEncodingTests.cpp | 4 +- test/{ => unit}/HTTPServerTests.cpp | 6 +- test/{ => unit}/IndexFSTests.cpp | 8 +- test/{ => unit}/InjectableNetworking.hpp | 4 +- test/{ => unit}/InlineTaskScope.hpp | 2 +- test/{ => unit}/JSFunctionTests.cpp | 6 +- test/{ => unit}/JasmineFSTests.cpp | 2 +- test/{ => unit}/JsFunctionSenderTests.cpp | 2 +- test/{ => unit}/LifeTests.cpp | 2 +- test/{ => unit}/LoggerTests.cpp | 2 +- test/{ => unit}/MddlogHeaderConsumer.cpp | 2 +- test/{ => unit}/MddlogLoggerTests.cpp | 2 +- test/{ => unit}/MddlogTransportTests.cpp | 4 +- test/{ => unit}/MessagesTests.cpp | 8 +- test/{ => unit}/MimeTypeTests.cpp | 2 +- test/{ => unit}/Mocks.hpp | 2 +- test/{ => unit}/ModuleHTTPServerTests.cpp | 14 +- test/{ => unit}/NativeFSTests.cpp | 2 +- test/{ => unit}/ReactFSTests.cpp | 2 +- test/{ => unit}/SignalDemoTests.cpp | 2 +- test/{ => unit}/StdnetShutdownTests.cpp | 10 +- test/{ => unit}/StructuredShutdownTests.cpp | 6 +- test/{ => unit}/TemporaryDirectory.hpp | 0 test/{ => unit}/TerminalFSTests.cpp | 6 +- test/{ => unit}/TerminalTests.cpp | 2 +- test/{ => unit}/ToolManagerTests.cpp | 8 +- test/{ => unit}/ToolStoreTests.cpp | 4 +- test/{ => unit}/TypeErasedFunctionTests.cpp | 2 +- test/{ => unit}/UISubscribersTests.cpp | 2 +- test/{ => unit}/Version.hpp.in | 0 test/{ => unit}/WebFrontTests.cpp | 6 +- test/{ => unit}/WebKitGTKPolicyTests.cpp | 2 +- test/{ => unit}/WebLinkTests.cpp | 4 +- test/{ => unit}/WebSocketTests.cpp | 4 +- test/{ => unit}/WebView2ControllerMock.hpp | 2 +- test/{ => unit}/WebView2PolicyMocks.hpp | 2 +- test/{ => unit}/WebView2Tests.cpp | 2 +- {webtest => test/web}/CEFContentPolicy.cpp | 6 +- {webtest => test/web}/CMakeLists.txt | 4 +- .../web}/DeveloperEmbeddedTest.cpp | 6 +- {webtest => test/web}/DeveloperTest.cpp | 8 +- {webtest => test/web}/FrontendLifecycle.cpp | 4 +- {webtest => test/web}/JasmineTest.cpp | 42 +- {webtest => test/web}/LifeEmbeddedTest.cpp | 6 +- .../web}/RejectedWebSocketServer.hpp | 4 +- {webtest => test/web}/SpecRunner.html | 0 .../web}/WKWebViewClassImages.cpp | 2 +- .../web}/WKWebViewClassModule.cpp | 2 +- .../web}/WKWebViewHeaderConsumer.cpp | 2 +- {webtest => test/web}/WKWebViewLifecycle.cpp | 2 +- {webtest => test/web}/WebKitGTKLifecycle.cpp | 4 +- .../web}/WebView2HeaderConsumer.cpp | 2 +- {webtest => test/web}/WebView2Lifecycle.cpp | 4 +- {webtest => test/web}/content-policy.html | 0 {webtest => test/web}/developer-specs.mjs | 0 {webtest => test/web}/encoded path #.html | 0 {webtest => test/web}/fixtures/react.html | 0 .../web}/js/content-policy-specs.mjs | 0 {webtest => test/web}/js/module-fixture.mjs | 0 {webtest => test/web}/js/origin-probe.mjs | 0 {webtest => test/web}/js/react-demo-specs.mjs | 0 {webtest => test/web}/js/terminal-specs.mjs | 2 +- {webtest => test/web}/js/tools-specs.mjs | 4 +- {webtest => test/web}/js/webfront-specs.mjs | 0 {webtest => test/web}/no-bridge.html | 0 {webtest => test/web}/origin-probe.html | 0 {webtest => test/web}/policy-controls.html | 0 {webtest => test/web}/policy-escaped.html | 0 .../web}/registry/make_fixture.py | 4 +- {webtest => test/web}/registry/search.json | 0 .../tarballs/webfront-test-tool-1.0.0.tgz | Bin .../web}/registry/webfront-test-corrupt | 0 .../web}/registry/webfront-test-tool | 0 {webtest => test/web}/rejected-ready.html | 0 {webtest => test/web}/slow-page.html | 0 {webtest => test/web}/slow-resource.js | 0 webfront/DOM/HTTPServer.cpp | 21 - webfront/DOM/HTTPServer.vcxproj | 132 ------ webfront/DOM/HTTPServer.vcxproj.filters | 144 ------- webfront/DOM/http_connexion.cpp | 155 ------- webfront/DOM/http_connexion.h | 20 - webfront/DOM/http_request.cpp | 356 ---------------- webfront/DOM/http_request.h | 42 -- webfront/DOM/page.h | 29 -- webfront/DOM/socket_helper.h | 44 -- webfront/DOM/socket_server.cpp | 143 ------- webfront/DOM/socket_server.h | 34 -- webfront/DOM/thread_pool.cpp | 80 ---- webfront/DOM/thread_pool.h | 19 - webfront/DOM/webfront.cpp | 79 ---- webfront/DOM/webfront.h | 28 -- webfront/DOM/xmldoc.cpp | 33 -- webfront/DOM/xmldoc.h | 34 -- webfront/DOM/xmldoc_attr.cpp | 52 --- webfront/DOM/xmldoc_attr.h | 27 -- webfront/DOM/xmldoc_c_data_section.h | 14 - webfront/DOM/xmldoc_character_data.cpp | 144 ------- webfront/DOM/xmldoc_character_data.h | 28 -- webfront/DOM/xmldoc_comment.h | 18 - webfront/DOM/xmldoc_document.cpp | 122 ------ webfront/DOM/xmldoc_document.h | 54 --- webfront/DOM/xmldoc_document_fragment.h | 17 - webfront/DOM/xmldoc_document_type.cpp | 58 --- webfront/DOM/xmldoc_document_type.h | 29 -- webfront/DOM/xmldoc_dom_exception.h | 25 -- webfront/DOM/xmldoc_dom_implementation.cpp | 165 -------- webfront/DOM/xmldoc_dom_implementation.h | 30 -- webfront/DOM/xmldoc_element.cpp | 164 -------- webfront/DOM/xmldoc_element.h | 30 -- webfront/DOM/xmldoc_entity_reference.h | 17 - webfront/DOM/xmldoc_named_node_map.cpp | 141 ------- webfront/DOM/xmldoc_named_node_map.h | 31 -- webfront/DOM/xmldoc_node.cpp | 195 --------- webfront/DOM/xmldoc_node.h | 96 ----- webfront/DOM/xmldoc_node_list.h | 23 - webfront/DOM/xmldoc_processing_instruction.h | 22 - webfront/DOM/xmldoc_text.cpp | 29 -- webfront/DOM/xmldoc_text.h | 21 - webfront/net/Socket.hpp | 184 -------- webfront/net/SocketLibOS.hpp | 163 -------- webfront/net/TCPServer.hpp | 44 -- webfront/net/UDPSocket.hpp | 108 ----- webfront/system/Socket.hpp | 149 ------- webfront/system/SocketLibOS.hpp | 159 ------- webfront/system/UDPSocket.hpp | 107 ----- webfront/utils/Delegate.hpp | 59 --- webfront/utils/StringHash.hpp | 72 ---- 403 files changed, 1341 insertions(+), 5242 deletions(-) rename Dockerfile => .devcontainer/Dockerfile (100%) rename CONTRIBUTING.md => .github/CONTRIBUTING.md (100%) rename codecov.yml => .github/codecov.yml (90%) delete mode 100644 CTestConfig.cmake delete mode 100644 assets/developer/bundles.json rename {logging => cmake/mddlog}/Logger.cpp (99%) rename CHANGELOG.md => docs/CHANGELOG.md (81%) rename Doxyfile.in => docs/Doxyfile.in (100%) rename {cmake => docs}/Doxygen.cmake (100%) rename {tools/docs => docs/tools}/render-life-bootstrap.py (100%) delete mode 100644 include/WebFront220128.hpp.gz delete mode 100644 include/system/DeveloperReleaseData.hpp delete mode 100644 include/system/TerminalModuleData.hpp delete mode 100644 include/system/ToolManagerModuleData.hpp rename include/{ => webfront}/ApplicationOrigin.hpp (100%) rename include/{ => webfront}/ContentPolicy.hpp (100%) rename include/{ => webfront}/DeveloperApp.hpp (100%) rename include/{ => webfront}/JsFunction.hpp (100%) rename include/{ => webfront}/JsFunctionSender.hpp (100%) rename include/{ => webfront}/Task.hpp (100%) rename include/{ => webfront}/UISubscribers.hpp (100%) rename include/{ => webfront}/WebFront.hpp (100%) rename include/{ => webfront}/components/Terminal.hpp (100%) rename include/{ => webfront}/components/ToolManager.hpp (100%) rename include/{ => webfront}/details/C++20Support.hpp (100%) rename include/{ => webfront}/details/C++23Support.hpp (100%) rename include/{ => webfront}/frontend/Action.hpp (100%) rename include/{ => webfront}/frontend/CEF.hpp (100%) rename include/{ => webfront}/frontend/CEFPaths.hpp (100%) rename include/{ => webfront}/frontend/DefaultBrowser.hpp (100%) rename include/{ => webfront}/frontend/Frontend.hpp (100%) rename include/{ => webfront}/frontend/NativeWebView.hpp (100%) rename include/{ => webfront}/frontend/Url.hpp (100%) rename include/{ => webfront}/frontend/WKWebView.hpp (100%) rename include/{ => webfront}/frontend/WebKitGTK.hpp (100%) rename include/{ => webfront}/frontend/WebKitGTKPolicy.hpp (100%) rename include/{ => webfront}/frontend/WebView2.hpp (100%) rename include/{ => webfront}/http/AcceptEncoding.hpp (100%) rename include/{ => webfront}/http/BuffersPolicy.hpp (100%) rename include/{ => webfront}/http/Encodings.hpp (100%) rename include/{ => webfront}/http/Gzip.hpp (100%) rename include/{ => webfront}/http/HTTPServer.hpp (100%) rename include/{ => webfront}/http/MimeType.hpp (100%) rename include/{ => webfront}/http/WebSocket.hpp (100%) rename include/{ => webfront}/networking/BasicNetworking.hpp (100%) rename include/{ => webfront}/networking/NetworkingMock.hpp (100%) rename include/{ => webfront}/networking/SenderHeaders.hpp (100%) rename include/{ => webfront}/networking/TCPNetworkingStdnet.hpp (100%) rename include/{ => webfront}/networking/TCPSockets.hpp (100%) rename include/{ => webfront}/networking/Tasks.hpp (100%) rename include/{ => webfront}/system/BabelData.hpp (100%) rename include/{ => webfront}/system/BabelFS.hpp (100%) rename include/{ => webfront}/system/DefaultFS.hpp (100%) rename include/{ => webfront}/system/DeveloperBootstrapData.hpp (100%) rename include/{ => webfront}/system/DeveloperFS.hpp (100%) rename include/{ => webfront}/system/DeveloperFiles.hpp (100%) rename include/{ => webfront}/system/DeveloperIndexHtmlData.hpp (100%) rename include/{ => webfront}/system/DeveloperPaths.hpp (100%) create mode 100644 include/webfront/system/DeveloperReleaseData.hpp rename include/{ => webfront}/system/DeveloperStore.hpp (100%) rename include/{ => webfront}/system/FallbackIndexHtmlData.hpp (100%) rename include/{ => webfront}/system/FallbackModuleData.hpp (100%) rename include/{ => webfront}/system/FileSystem.hpp (99%) rename include/{ => webfront}/system/IndexFS.hpp (100%) rename include/{ => webfront}/system/JasmineBootData.hpp (100%) rename include/{ => webfront}/system/JasmineCssData.hpp (100%) rename include/{ => webfront}/system/JasmineFS.hpp (100%) rename include/{ => webfront}/system/JasmineFaviconData.hpp (100%) rename include/{ => webfront}/system/JasmineHtmlData.hpp (100%) rename include/{ => webfront}/system/JasmineJsData.hpp (100%) rename include/{ => webfront}/system/NativeFS.hpp (100%) rename include/{ => webfront}/system/PackageFS.hpp (100%) rename include/{ => webfront}/system/ReactFS.hpp (100%) rename include/{ => webfront}/system/ReactRuntimeData.hpp (100%) rename include/{ => webfront}/system/TerminalFS.hpp (100%) rename include/{ => webfront}/system/TerminalIndexHtmlData.hpp (100%) create mode 100644 include/webfront/system/TerminalModuleData.hpp rename include/{ => webfront}/system/ToolManagerFS.hpp (100%) create mode 100644 include/webfront/system/ToolManagerModuleData.hpp rename include/{ => webfront}/system/ToolStore.hpp (100%) rename include/{ => webfront}/system/WebFrontJsData.hpp (100%) rename include/{ => webfront}/system/WindowsCompat.hpp (100%) rename include/{ => webfront}/system/XtermCssData.hpp (100%) rename include/{ => webfront}/system/XtermFitAddonData.hpp (100%) rename include/{ => webfront}/system/XtermModuleData.hpp (100%) rename include/{ => webfront}/tooling/HexDump.hpp (100%) rename include/{ => webfront}/tooling/Logger.hpp (100%) rename include/{ => webfront}/tooling/LoggerApi.hpp (100%) rename include/{ => webfront}/tooling/MddlogLogger.hpp (100%) rename include/{ => webfront}/tooling/PathUtils.hpp (98%) rename include/{ => webfront}/utils/Json.hpp (100%) rename include/{ => webfront}/utils/TypeErasedFunction.hpp (100%) rename include/{ => webfront}/weblink/Messages.hpp (100%) rename include/{ => webfront}/weblink/PendingCalls.hpp (100%) rename include/{ => webfront}/weblink/WebLink.hpp (100%) rename {cmake => js/core}/EmbedTextAsset.cmake (98%) rename {assets => js/core}/WebFront.js (100%) rename {cmake => js/core}/WebFrontAssets.cmake (71%) rename {assets/developer => js/core/bootstrap}/bootstrap.bundle.mjs (100%) rename {assets/developer => js/core/bootstrap}/index.html (100%) rename {assets => js/core}/fallback/index.html (100%) rename {assets => js/core}/fallback/webfront-fallback.mjs (100%) rename {assets => js/developer}/components/terminal/index.html (100%) rename {assets => js/developer}/components/terminal/terminal.mjs (99%) rename {assets => js/developer}/components/tools/wf.mjs (99%) rename {assets/developer => js/developer/environment}/PACKAGES-LICENSE.txt (100%) rename {assets/developer => js/developer/environment}/archive.mjs (100%) rename {assets/developer => js/developer/environment}/bootstrap-entry.mjs (100%) rename {assets/developer => js/developer/environment}/bootstrap.mjs (100%) rename {assets/developer => js/developer/environment}/bundler.mjs (100%) create mode 100644 js/developer/environment/bundles.json rename {assets/developer => js/developer/environment}/compiler.mjs (100%) rename {assets/developer => js/developer/environment}/conditions.mjs (100%) rename {assets/developer => js/developer/environment}/embed.mjs (96%) rename {assets/developer => js/developer/environment}/entry.mjs (100%) rename {assets/developer => js/developer/environment}/io.mjs (100%) rename {assets/developer => js/developer/environment}/lock.mjs (100%) rename {assets/developer => js/developer/environment}/packages.bundle.mjs (100%) rename {assets/developer => js/developer/environment}/packages.mjs (100%) rename {assets/developer => js/developer/environment}/paths.mjs (100%) rename {assets/developer => js/developer/environment}/peers.mjs (100%) rename {assets/developer => js/developer/environment}/pins.mjs (100%) rename {assets/developer => js/developer/environment}/recipe.mjs (100%) rename {assets/developer => js/developer/environment}/registry.mjs (100%) rename {assets/developer => js/developer/environment}/resolve.mjs (100%) rename {assets/developer => js/developer/environment}/runtime.mjs (98%) rename {assets/developer => js/developer/environment}/starter.mjs (100%) rename {tools/developer => js/developer/tools}/PUBLISHING.md (87%) rename {tools/developer => js/developer/tools}/RELEASE_NOTES.md (100%) rename {tools/developer => js/developer/tools}/archive-release.mjs (93%) rename {tools/developer => js/developer/tools}/archive.mjs (100%) rename {tools/developer => js/developer/tools}/build.mjs (56%) rename {tools/developer => js/developer/tools}/check.mjs (95%) rename {tools/developer => js/developer/tools}/distribution-check.mjs (98%) rename {tools/developer => js/developer/tools}/distribution.json (74%) rename {tools/developer => js/developer/tools}/fixtures.mjs (75%) rename {tools/developer => js/developer/tools}/pages.mjs (100%) rename {tools/developer => js/developer/tools}/release-check.mjs (100%) rename {tools/developer => js/developer/tools}/site.mjs (95%) rename {tools/developer => js/developer/tools}/starters/pi/main.tsx (100%) rename {tools/developer => js/developer/tools}/starters/pi/style.css (100%) rename {tools/assets => js/developer/vendor}/check.mjs (90%) rename {tools/assets => js/developer/vendor}/gzip.mjs (85%) rename {tools/assets => js/developer/vendor}/package-lock.json (100%) rename {tools/assets => js/developer/vendor}/package.json (100%) rename {tools/assets => js/developer/vendor}/update.mjs (87%) rename {cmake => test/cmake}/CheckCEFTestingState.cmake (90%) rename {cmake => test/cmake}/CheckFrontendGenerators.cmake (87%) rename {cmake => test/cmake}/CheckFrontendSelection.cmake (98%) rename {cmake => test/cmake}/CheckNewcomerDocs.cmake (98%) rename {cmake => test/cmake}/CheckReleaseVersion.cmake (97%) rename {cmake => test/cmake}/CheckReleaseVersionTests.cmake (92%) create mode 100644 test/cmake/CheckRepositoryLayout.cmake rename {cmake => test/cmake}/CheckWKWebViewSupport.cmake (100%) rename {cmake => test/cmake}/CheckWebView2Architecture.cmake (95%) rename {cmake => test/cmake}/CheckWebView2Toolchain.cmake (100%) rename {cmake => test/cmake}/FrontendTestHelpers.cmake (100%) rename {cmake => test/cmake}/TestHardening.cmake (100%) rename {cmake => test/cmake}/WKWebViewTestInfo.plist.in (100%) rename {cmake => test/cmake}/WebKitGTKTestEnvironment.cmake (100%) rename test/{ => cmake}/cef-testing/CMakeLists.txt (100%) rename test/{ => cmake}/cef-testing/dependency/CMakeLists.txt (100%) rename test/{ => cmake}/consumer/CMakeLists.txt (100%) rename test/{ => cmake}/consumer/CheckOptions.cmake (100%) rename test/{ => cmake}/consumer/main.cpp (96%) rename test/{ => cmake}/frontends/CMakeLists.txt (97%) rename test/{ => cmake}/frontends/TestSupport.cmake (100%) rename {fuzz => test/fuzz}/CMakeLists.txt (100%) rename {fuzz => test/fuzz}/GzipFuzz.cpp (91%) rename {fuzz => test/fuzz}/HTTPFuzz.cpp (95%) rename {fuzz => test/fuzz}/MessagesFuzz.cpp (98%) rename {fuzz => test/fuzz}/README.md (92%) rename {fuzz => test/fuzz}/WebSocketFuzz.cpp (97%) rename {fuzz => test/fuzz}/corpus/gzip/bad-crc (100%) rename {fuzz => test/fuzz}/corpus/gzip/distanceCount31 (100%) rename {fuzz => test/fuzz}/corpus/gzip/distanceCount32 (100%) rename {fuzz => test/fuzz}/corpus/gzip/dynamic (100%) rename {fuzz => test/fuzz}/corpus/gzip/empty (100%) rename {fuzz => test/fuzz}/corpus/gzip/fixed (100%) rename {fuzz => test/fuzz}/corpus/gzip/invalidDistance (100%) rename {fuzz => test/fuzz}/corpus/gzip/missingEnd (100%) rename {fuzz => test/fuzz}/corpus/gzip/optional (100%) rename {fuzz => test/fuzz}/corpus/gzip/oversubscribed (100%) rename {fuzz => test/fuzz}/corpus/gzip/repeatOverflow (100%) rename {fuzz => test/fuzz}/corpus/gzip/repeatWithoutPrevious (100%) rename {fuzz => test/fuzz}/corpus/gzip/reserved-block (100%) rename {fuzz => test/fuzz}/corpus/gzip/reservedDistance (100%) rename {fuzz => test/fuzz}/corpus/gzip/reservedLiteral (100%) rename {fuzz => test/fuzz}/corpus/gzip/stored (100%) rename {fuzz => test/fuzz}/corpus/gzip/truncated (100%) rename {fuzz => test/fuzz}/corpus/http/accept-encoding (100%) rename {fuzz => test/fuzz}/corpus/http/get (100%) rename {fuzz => test/fuzz}/corpus/http/unknown-method (100%) rename {fuzz => test/fuzz}/corpus/http/upgrade (100%) rename {fuzz => test/fuzz}/corpus/http/version-overflow (100%) rename {fuzz => test/fuzz}/corpus/http/x-gzip (100%) rename {fuzz => test/fuzz}/corpus/messages/array-10 (100%) rename {fuzz => test/fuzz}/corpus/messages/array-11 (100%) rename {fuzz => test/fuzz}/corpus/messages/array-12 (100%) rename {fuzz => test/fuzz}/corpus/messages/array-13 (100%) rename {fuzz => test/fuzz}/corpus/messages/array-14 (100%) rename {fuzz => test/fuzz}/corpus/messages/array-15 (100%) rename {fuzz => test/fuzz}/corpus/messages/array-16 (100%) rename {fuzz => test/fuzz}/corpus/messages/array-17 (100%) rename {fuzz => test/fuzz}/corpus/messages/array-8 (100%) rename {fuzz => test/fuzz}/corpus/messages/array-9 (100%) rename {fuzz => test/fuzz}/corpus/messages/array-u8 (100%) rename {fuzz => test/fuzz}/corpus/messages/empty-small-string (100%) rename {fuzz => test/fuzz}/corpus/messages/empty-string (100%) rename {fuzz => test/fuzz}/corpus/messages/function-return (100%) rename {fuzz => test/fuzz}/corpus/messages/handshake (100%) rename {fuzz => test/fuzz}/corpus/messages/integer-overflow (100%) rename {fuzz => test/fuzz}/corpus/messages/number (100%) rename {fuzz => test/fuzz}/corpus/messages/print-call (100%) rename {fuzz => test/fuzz}/corpus/messages/tuple (100%) rename {fuzz => test/fuzz}/corpus/websocket/empty (100%) rename {fuzz => test/fuzz}/corpus/websocket/extended (100%) rename {fuzz => test/fuzz}/corpus/websocket/masked-hello (100%) rename {fuzz => test/fuzz}/corpus/websocket/oversized (100%) rename test/{ => unit}/AcceptEncodingTests.cpp (99%) rename test/{ => unit}/ApplicationTaskTests.cpp (99%) rename test/{ => unit}/ApplicationUrlTests.cpp (98%) rename test/{ => unit}/BabelFSTests.cpp (92%) rename test/{ => unit}/CEFMacrosTests.cpp (92%) rename test/{ => unit}/CEFPathsTests.cpp (96%) rename test/{ => unit}/CMakeLists.txt (87%) rename test/{ => unit}/ContentPolicyTests.cpp (98%) rename test/{ => unit}/DefaultFSTests.cpp (97%) rename test/{ => unit}/DeveloperTests.cpp (99%) rename test/{ => unit}/EmbeddedAssetChecks.hpp (95%) rename test/{ => unit}/EncodingsTests.cpp (99%) rename test/{ => unit}/FileSystemTests.cpp (99%) rename test/{ => unit}/FrontendContractTests.cpp (99%) rename test/{ => unit}/FrontendUrlTests.cpp (98%) rename test/{ => unit}/GzipFixtures.hpp (100%) rename test/{ => unit}/GzipTests.cpp (99%) rename test/{ => unit}/HTTPEncodingTests.cpp (99%) rename test/{ => unit}/HTTPServerTests.cpp (99%) rename test/{ => unit}/IndexFSTests.cpp (94%) rename test/{ => unit}/InjectableNetworking.hpp (99%) rename test/{ => unit}/InlineTaskScope.hpp (87%) rename test/{ => unit}/JSFunctionTests.cpp (98%) rename test/{ => unit}/JasmineFSTests.cpp (96%) rename test/{ => unit}/JsFunctionSenderTests.cpp (99%) rename test/{ => unit}/LifeTests.cpp (97%) rename test/{ => unit}/LoggerTests.cpp (98%) rename test/{ => unit}/MddlogHeaderConsumer.cpp (95%) rename test/{ => unit}/MddlogLoggerTests.cpp (99%) rename test/{ => unit}/MddlogTransportTests.cpp (99%) rename test/{ => unit}/MessagesTests.cpp (99%) rename test/{ => unit}/MimeTypeTests.cpp (98%) rename test/{ => unit}/Mocks.hpp (96%) rename test/{ => unit}/ModuleHTTPServerTests.cpp (94%) rename test/{ => unit}/NativeFSTests.cpp (99%) rename test/{ => unit}/ReactFSTests.cpp (93%) rename test/{ => unit}/SignalDemoTests.cpp (97%) rename test/{ => unit}/StdnetShutdownTests.cpp (98%) rename test/{ => unit}/StructuredShutdownTests.cpp (98%) rename test/{ => unit}/TemporaryDirectory.hpp (100%) rename test/{ => unit}/TerminalFSTests.cpp (96%) rename test/{ => unit}/TerminalTests.cpp (99%) rename test/{ => unit}/ToolManagerTests.cpp (98%) rename test/{ => unit}/ToolStoreTests.cpp (99%) rename test/{ => unit}/TypeErasedFunctionTests.cpp (97%) rename test/{ => unit}/UISubscribersTests.cpp (99%) rename test/{ => unit}/Version.hpp.in (100%) rename test/{ => unit}/WebFrontTests.cpp (99%) rename test/{ => unit}/WebKitGTKPolicyTests.cpp (99%) rename test/{ => unit}/WebLinkTests.cpp (99%) rename test/{ => unit}/WebSocketTests.cpp (99%) rename test/{ => unit}/WebView2ControllerMock.hpp (98%) rename test/{ => unit}/WebView2PolicyMocks.hpp (99%) rename test/{ => unit}/WebView2Tests.cpp (99%) rename {webtest => test/web}/CEFContentPolicy.cpp (98%) rename {webtest => test/web}/CMakeLists.txt (97%) rename {webtest => test/web}/DeveloperEmbeddedTest.cpp (95%) rename {webtest => test/web}/DeveloperTest.cpp (97%) rename {webtest => test/web}/FrontendLifecycle.cpp (99%) rename {webtest => test/web}/JasmineTest.cpp (94%) rename {webtest => test/web}/LifeEmbeddedTest.cpp (97%) rename {webtest => test/web}/RejectedWebSocketServer.hpp (96%) rename {webtest => test/web}/SpecRunner.html (100%) rename {webtest => test/web}/WKWebViewClassImages.cpp (97%) rename {webtest => test/web}/WKWebViewClassModule.cpp (94%) rename {webtest => test/web}/WKWebViewHeaderConsumer.cpp (92%) rename {webtest => test/web}/WKWebViewLifecycle.cpp (99%) rename {webtest => test/web}/WebKitGTKLifecycle.cpp (98%) rename {webtest => test/web}/WebView2HeaderConsumer.cpp (85%) rename {webtest => test/web}/WebView2Lifecycle.cpp (99%) rename {webtest => test/web}/content-policy.html (100%) rename {webtest => test/web}/developer-specs.mjs (100%) rename {webtest => test/web}/encoded path #.html (100%) rename {webtest => test/web}/fixtures/react.html (100%) rename {webtest => test/web}/js/content-policy-specs.mjs (100%) rename {webtest => test/web}/js/module-fixture.mjs (100%) rename {webtest => test/web}/js/origin-probe.mjs (100%) rename {webtest => test/web}/js/react-demo-specs.mjs (100%) rename {webtest => test/web}/js/terminal-specs.mjs (98%) rename {webtest => test/web}/js/tools-specs.mjs (98%) rename {webtest => test/web}/js/webfront-specs.mjs (100%) rename {webtest => test/web}/no-bridge.html (100%) rename {webtest => test/web}/origin-probe.html (100%) rename {webtest => test/web}/policy-controls.html (100%) rename {webtest => test/web}/policy-escaped.html (100%) rename {webtest => test/web}/registry/make_fixture.py (95%) rename {webtest => test/web}/registry/search.json (100%) rename {webtest => test/web}/registry/tarballs/webfront-test-tool-1.0.0.tgz (100%) rename {webtest => test/web}/registry/webfront-test-corrupt (100%) rename {webtest => test/web}/registry/webfront-test-tool (100%) rename {webtest => test/web}/rejected-ready.html (100%) rename {webtest => test/web}/slow-page.html (100%) rename {webtest => test/web}/slow-resource.js (100%) delete mode 100644 webfront/DOM/HTTPServer.cpp delete mode 100644 webfront/DOM/HTTPServer.vcxproj delete mode 100644 webfront/DOM/HTTPServer.vcxproj.filters delete mode 100644 webfront/DOM/http_connexion.cpp delete mode 100644 webfront/DOM/http_connexion.h delete mode 100644 webfront/DOM/http_request.cpp delete mode 100644 webfront/DOM/http_request.h delete mode 100644 webfront/DOM/page.h delete mode 100644 webfront/DOM/socket_helper.h delete mode 100644 webfront/DOM/socket_server.cpp delete mode 100644 webfront/DOM/socket_server.h delete mode 100644 webfront/DOM/thread_pool.cpp delete mode 100644 webfront/DOM/thread_pool.h delete mode 100644 webfront/DOM/webfront.cpp delete mode 100644 webfront/DOM/webfront.h delete mode 100644 webfront/DOM/xmldoc.cpp delete mode 100644 webfront/DOM/xmldoc.h delete mode 100644 webfront/DOM/xmldoc_attr.cpp delete mode 100644 webfront/DOM/xmldoc_attr.h delete mode 100644 webfront/DOM/xmldoc_c_data_section.h delete mode 100644 webfront/DOM/xmldoc_character_data.cpp delete mode 100644 webfront/DOM/xmldoc_character_data.h delete mode 100644 webfront/DOM/xmldoc_comment.h delete mode 100644 webfront/DOM/xmldoc_document.cpp delete mode 100644 webfront/DOM/xmldoc_document.h delete mode 100644 webfront/DOM/xmldoc_document_fragment.h delete mode 100644 webfront/DOM/xmldoc_document_type.cpp delete mode 100644 webfront/DOM/xmldoc_document_type.h delete mode 100644 webfront/DOM/xmldoc_dom_exception.h delete mode 100644 webfront/DOM/xmldoc_dom_implementation.cpp delete mode 100644 webfront/DOM/xmldoc_dom_implementation.h delete mode 100644 webfront/DOM/xmldoc_element.cpp delete mode 100644 webfront/DOM/xmldoc_element.h delete mode 100644 webfront/DOM/xmldoc_entity_reference.h delete mode 100644 webfront/DOM/xmldoc_named_node_map.cpp delete mode 100644 webfront/DOM/xmldoc_named_node_map.h delete mode 100644 webfront/DOM/xmldoc_node.cpp delete mode 100644 webfront/DOM/xmldoc_node.h delete mode 100644 webfront/DOM/xmldoc_node_list.h delete mode 100644 webfront/DOM/xmldoc_processing_instruction.h delete mode 100644 webfront/DOM/xmldoc_text.cpp delete mode 100644 webfront/DOM/xmldoc_text.h delete mode 100644 webfront/net/Socket.hpp delete mode 100644 webfront/net/SocketLibOS.hpp delete mode 100644 webfront/net/TCPServer.hpp delete mode 100644 webfront/net/UDPSocket.hpp delete mode 100644 webfront/system/Socket.hpp delete mode 100644 webfront/system/SocketLibOS.hpp delete mode 100644 webfront/system/UDPSocket.hpp delete mode 100644 webfront/utils/Delegate.hpp delete mode 100644 webfront/utils/StringHash.hpp diff --git a/.codescene/code-health-rules.json b/.codescene/code-health-rules.json index 3077539b..a4f7355c 100644 --- a/.codescene/code-health-rules.json +++ b/.codescene/code-health-rules.json @@ -3,7 +3,7 @@ "rule_sets": [ { "matching_content_path": "third_party/**", - "matching_content_path_doc": "Vendored third-party code, refreshed only with cmake/UpdateXterm.cmake or tools/assets/update.mjs.", + "matching_content_path_doc": "Vendored third-party code, refreshed only with cmake/UpdateXterm.cmake or js/developer/vendor/update.mjs.", "rules": [ { "name": "Complex Method", "weight": 0.0 }, { "name": "Bumpy Road Ahead", "weight": 0.0 }, @@ -22,15 +22,15 @@ ] }, { - "matching_content_path": "include/components/Terminal.hpp", + "matching_content_path": "include/webfront/components/Terminal.hpp", "matching_content_path_doc": "A text command-line interface: its API and helpers take command names, help texts and command lines, which are strings by nature. Wrapping them in structs only to lower the ratio would make the public API (terminal.command(name, help, handler)) harder to read.", "rules": [ { "name": "String Heavy Function Arguments", "weight": 0.0 } ] }, { - "matching_content_path": "assets/developer/*.bundle.mjs", - "matching_content_path_doc": "Minified esbuild output of the sources next to it, checked in so that the bootstrap and package resolver need no Node.js at consumption time. It is regenerated by tools/developer/build.mjs --refresh-bootstrap and verified against assets/developer/bundles.json, never edited by hand; the readable sources are analysed instead.", + "matching_content_path": "js/*/**/*.bundle.mjs", + "matching_content_path_doc": "Minified esbuild output of the sources next to it, checked in so that the bootstrap and package resolver need no Node.js at consumption time. It is regenerated by js/developer/tools/build.mjs --refresh-bootstrap and verified against js/developer/environment/bundles.json, never edited by hand; the readable sources are analysed instead.", "rules": [ { "name": "Complex Method", "weight": 0.0 }, { "name": "Bumpy Road Ahead", "weight": 0.0 }, @@ -49,7 +49,7 @@ ] }, { - "matching_content_path": "include/system/DeveloperStore.hpp", + "matching_content_path": "include/webfront/system/DeveloperStore.hpp", "matching_content_path_doc": "The store implements the webfront.developer.* bridge callbacks, whose identifiers, project paths, offsets and flags arrive as primitives from the browser. Wrapping them in types only to lower the ratio would obscure the bridge contract.", "rules": [ { "name": "String Heavy Function Arguments", "weight": 0.0 }, diff --git a/Dockerfile b/.devcontainer/Dockerfile similarity index 100% rename from Dockerfile rename to .devcontainer/Dockerfile diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3ed41f49..36f97be0 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,7 @@ { "name": "C++", "build": { - "dockerfile": "../Dockerfile", + "dockerfile": "Dockerfile", "context": ".." }, "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"], diff --git a/.gitattributes b/.gitattributes index 0e89bd2b..82f4bab2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -51,25 +51,26 @@ # Embedded headers hold the exact bytes of their text sources. Freshness tests # re-read those sources, so Windows checkouts must preserve LF for every asset. -assets/WebFront.js text eol=lf -include/system/WebFrontJsData.hpp text eol=lf -assets/fallback/index.html text eol=lf -assets/fallback/webfront-fallback.mjs text eol=lf -include/system/FallbackIndexHtmlData.hpp text eol=lf -include/system/FallbackModuleData.hpp text eol=lf -assets/components/terminal/* text eol=lf -assets/components/tools/* text eol=lf -include/system/ToolManagerModuleData.hpp text eol=lf +js/core/WebFront.js text eol=lf +js/core/bootstrap/* text eol=lf +include/webfront/system/WebFrontJsData.hpp text eol=lf +js/core/fallback/index.html text eol=lf +js/core/fallback/webfront-fallback.mjs text eol=lf +include/webfront/system/FallbackIndexHtmlData.hpp text eol=lf +include/webfront/system/FallbackModuleData.hpp text eol=lf +js/developer/components/terminal/* text eol=lf +js/developer/components/tools/* text eol=lf +include/webfront/system/ToolManagerModuleData.hpp text eol=lf third_party/xterm/* text eol=lf -include/system/TerminalIndexHtmlData.hpp text eol=lf -include/system/TerminalModuleData.hpp text eol=lf -include/system/XtermModuleData.hpp text eol=lf -include/system/XtermCssData.hpp text eol=lf -include/system/XtermFitAddonData.hpp text eol=lf +include/webfront/system/TerminalIndexHtmlData.hpp text eol=lf +include/webfront/system/TerminalModuleData.hpp text eol=lf +include/webfront/system/XtermModuleData.hpp text eol=lf +include/webfront/system/XtermCssData.hpp text eol=lf +include/webfront/system/XtermFitAddonData.hpp text eol=lf # The fake npm registry of the browser integration test: its packuments are served byte for byte. -webtest/registry/* text eol=lf -webtest/registry/tarballs/* binary +test/web/registry/* text eol=lf +test/web/registry/tarballs/* binary # Serialisation *.json text @@ -168,7 +169,7 @@ webtest/registry/tarballs/* binary # Fuzzer seeds retain exact protocol bytes, including HTTP CRLF. -fuzz/corpus/** binary +test/fuzz/corpus/** binary # Pinned third-party sources and generated dependency data keep exact bytes on Windows. third_party/react/* text eol=lf @@ -176,13 +177,13 @@ third_party/babel/* text eol=lf third_party/jasmine/* text eol=lf third_party/jasmine/*.png binary third_party/fflate/* text eol=lf -include/system/*Data.hpp text eol=lf +include/webfront/system/*Data.hpp text eol=lf # Browser-powered developer bootstrap sources and generated payloads. -assets/developer/* text eol=lf -tools/assets/package-lock.json text eol=lf +js/developer/environment/* text eol=lf +js/developer/vendor/package-lock.json text eol=lf # Starter archives and every hashed distribution input must be identical on Windows. -tools/developer/starters/pi/* text eol=lf +js/developer/tools/starters/pi/* text eol=lf examples/life/ui/* text eol=lf -tools/developer/* text eol=lf +js/developer/tools/* text eol=lf diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md diff --git a/codecov.yml b/.github/codecov.yml similarity index 90% rename from codecov.yml rename to .github/codecov.yml index cb759f37..a27a2211 100644 --- a/codecov.yml +++ b/.github/codecov.yml @@ -8,5 +8,5 @@ coverage: default: target: 95% ignore: - - "webtest/**" + - "test/web/**" - "examples/**" diff --git a/.github/workflows/BuildAndTest.yml b/.github/workflows/BuildAndTest.yml index cb18157a..a1de5d4e 100644 --- a/.github/workflows/BuildAndTest.yml +++ b/.github/workflows/BuildAndTest.yml @@ -55,7 +55,7 @@ jobs: with: node-version: 24 cache: npm - cache-dependency-path: tools/assets/package-lock.json + cache-dependency-path: js/developer/vendor/package-lock.json - uses: jwlawson/actions-setup-cmake@0d6a7d60b009d01c9e7523be22153ff8f19460d3 # v2 with: cmake-version: '4.4.4' @@ -63,7 +63,7 @@ jobs: - uses: actions/cache@v4 with: path: .cache/CPM - key: cpm-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'cmake/*.cmake', 'test/CMakeLists.txt') }} + key: cpm-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'cmake/*.cmake', 'test/unit/CMakeLists.txt') }} restore-keys: cpm-${{ runner.os }}- - name: Initialize MSVC environment if: runner.os == 'Windows' @@ -90,9 +90,9 @@ jobs: sccache --version - name: Prepare offline developer fixtures run: | - npm ci --prefix tools/assets --ignore-scripts - node tools/developer/build.mjs build-developer-environment - node tools/developer/fixtures.mjs build-developer-environment + npm ci --prefix js/developer/vendor --ignore-scripts + node js/developer/tools/build.mjs build-developer-environment + node js/developer/tools/fixtures.mjs build-developer-environment # ENABLE_CACHE controls automatic ccache discovery; the explicit sccache launcher stays enabled. - name: Configure run: >- @@ -208,18 +208,18 @@ jobs: shell: bash run: | set -euo pipefail - mkdir -p build-sanitizers/fuzz/artifacts + mkdir -p build-sanitizers/test/fuzz/artifacts for decoder in messages http websocket gzip; do - build-sanitizers/fuzz/fuzz_$decoder build-sanitizers/fuzz/corpus/$decoder \ + build-sanitizers/test/fuzz/fuzz_$decoder build-sanitizers/test/fuzz/corpus/$decoder \ -max_total_time=30 -timeout=5 -max_len=65536 -rss_limit_mb=1024 \ - -artifact_prefix=build-sanitizers/fuzz/artifacts/$decoder- + -artifact_prefix=build-sanitizers/test/fuzz/artifacts/$decoder- done - name: Upload fuzz findings if: failure() && matrix.sanitizer == 'address-undefined' uses: actions/upload-artifact@v4 with: name: fuzz-findings - path: build-sanitizers/fuzz/artifacts/ + path: build-sanitizers/test/fuzz/artifacts/ if-no-files-found: ignore web-integration: @@ -258,9 +258,9 @@ jobs: - name: Prepare offline developer environment and starter fixtures run: | - npm ci --prefix tools/assets --ignore-scripts - node tools/developer/build.mjs build-developer-environment - node tools/developer/fixtures.mjs build-developer-environment + npm ci --prefix js/developer/vendor --ignore-scripts + node js/developer/tools/build.mjs build-developer-environment + node js/developer/tools/fixtures.mjs build-developer-environment - name: Configure CEF integration build run: cmake . -B ${{github.workspace}}/build-cef -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=ON -DWEBFRONT_BUILD_EXAMPLES=OFF -DENABLE_TESTING=ON -DWEBFRONT_DEVELOPER_FIXTURES=${{github.workspace}}/build-developer-environment diff --git a/.github/workflows/DeveloperDistribution.yml b/.github/workflows/DeveloperDistribution.yml index 08bba2ad..8789fdcf 100644 --- a/.github/workflows/DeveloperDistribution.yml +++ b/.github/workflows/DeveloperDistribution.yml @@ -5,24 +5,24 @@ on: tags: ['developer-v*'] branches: [develop, master] paths: - - 'assets/developer/**' - - 'assets/components/tools/**' - - 'tools/developer/starters/pi/**' + - 'js/developer/environment/**' + - 'js/developer/components/tools/**' + - 'js/developer/tools/starters/pi/**' - 'examples/life/ui/**' - - 'tools/developer/**' - - 'tools/assets/package*.json' - - 'include/system/DeveloperReleaseData.hpp' + - 'js/developer/tools/**' + - 'js/developer/vendor/package*.json' + - 'include/webfront/system/DeveloperReleaseData.hpp' - '.github/workflows/DeveloperDistribution.yml' pull_request: branches: [develop, master] paths: - - 'assets/developer/**' - - 'assets/components/tools/**' - - 'tools/developer/starters/pi/**' + - 'js/developer/environment/**' + - 'js/developer/components/tools/**' + - 'js/developer/tools/starters/pi/**' - 'examples/life/ui/**' - - 'tools/developer/**' - - 'tools/assets/package*.json' - - 'include/system/DeveloperReleaseData.hpp' + - 'js/developer/tools/**' + - 'js/developer/vendor/package*.json' + - 'include/webfront/system/DeveloperReleaseData.hpp' - '.github/workflows/DeveloperDistribution.yml' workflow_dispatch: inputs: @@ -47,23 +47,23 @@ jobs: with: node-version: 24 cache: npm - cache-dependency-path: tools/assets/package-lock.json + cache-dependency-path: js/developer/vendor/package-lock.json - name: Install pinned maintenance dependencies - run: npm ci --prefix tools/assets --ignore-scripts + run: npm ci --prefix js/developer/vendor --ignore-scripts - name: Build and verify the environment and starter packages run: | - node tools/developer/build.mjs build-distribution - node tools/developer/build.mjs build-distribution-repeat + node js/developer/tools/build.mjs build-distribution + node js/developer/tools/build.mjs build-distribution-repeat cmp build-distribution/environment.tgz build-distribution-repeat/environment.tgz cmp build-distribution/pi-starter.tgz build-distribution-repeat/pi-starter.tgz cmp build-distribution/life-starter.tgz build-distribution-repeat/life-starter.tgz - cmp include/system/DeveloperReleaseData.hpp build-distribution/DeveloperReleaseData.hpp - node --test tools/developer/check.mjs tools/developer/distribution-check.mjs + cmp include/webfront/system/DeveloperReleaseData.hpp build-distribution/DeveloperReleaseData.hpp + node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs - name: Check the dedicated release tag if: startsWith(github.ref, 'refs/tags/developer-v') env: RELEASE_TAG: ${{ github.ref_name }} - run: node tools/developer/release-check.mjs "$RELEASE_TAG" + run: node js/developer/tools/release-check.mjs "$RELEASE_TAG" - uses: actions/upload-artifact@v4 with: name: developer-distribution @@ -97,7 +97,7 @@ jobs: name: developer-distribution path: build-distribution - name: Check the configured Pages source before pushing - run: node tools/developer/pages.mjs --check + run: node js/developer/tools/pages.mjs --check - name: Preserve existing versions and publish the static branch shell: bash run: | @@ -114,19 +114,19 @@ jobs: elif [ "$result" != 2 ]; then exit "$result" fi - node tools/developer/site.mjs build-distribution "$site" + node js/developer/tools/site.mjs build-distribution "$site" git -C "$site" config user.name "$GITHUB_ACTOR" git -C "$site" config user.email "$GITHUB_ACTOR@users.noreply.github.com" git -C "$site" add .nojekyll index.html developer if ! git -C "$site" diff --cached --quiet; then - version=$(node -p "require('./tools/developer/distribution.json').version") + version=$(node -p "require('./js/developer/tools/distribution.json').version") git -C "$site" commit -m "Publish developer packages $version [#288]" git -C "$site" push origin HEAD:refs/heads/gh-pages fi - name: Request the configured Pages build - run: node tools/developer/pages.mjs + run: node js/developer/tools/pages.mjs - name: Archive tagged packages in a dedicated prerelease if: startsWith(github.ref, 'refs/tags/developer-v') env: RELEASE_TAG: ${{ github.ref_name }} - run: node tools/developer/archive-release.mjs "$RELEASE_TAG" build-distribution + run: node js/developer/tools/archive-release.mjs "$RELEASE_TAG" build-distribution diff --git a/.github/workflows/MddlogIntegration.yml b/.github/workflows/MddlogIntegration.yml index 192d277e..d7f9e909 100644 --- a/.github/workflows/MddlogIntegration.yml +++ b/.github/workflows/MddlogIntegration.yml @@ -136,7 +136,7 @@ jobs: run: | for iteration in 1 2 3 4 5; do echo "Transport iteration $iteration" - ./build-sanitized/test/tests "[transport],[weblink]" --order rand + ./build-sanitized/test/unit/tests "[transport],[weblink]" --order rand done - name: Run every test once - run: ./build-sanitized/test/tests --order rand + run: ./build-sanitized/test/unit/tests --order rand diff --git a/.github/workflows/ReleaseVersion.yml b/.github/workflows/ReleaseVersion.yml index 851cc110..8134cfde 100644 --- a/.github/workflows/ReleaseVersion.yml +++ b/.github/workflows/ReleaseVersion.yml @@ -29,4 +29,4 @@ jobs: shell: bash run: | version=$(sed -n 's/^CMAKE_PROJECT_VERSION:STATIC=//p' build/CMakeCache.txt) - cmake -DROOT="$GITHUB_WORKSPACE" -DEXPECTED_VERSION="$version" -DRELEASE_TAG="$RELEASE_TAG" -P cmake/CheckReleaseVersion.cmake + cmake -DROOT="$GITHUB_WORKSPACE" -DEXPECTED_VERSION="$version" -DRELEASE_TAG="$RELEASE_TAG" -P test/cmake/CheckReleaseVersion.cmake diff --git a/.gitignore b/.gitignore index 61b050db..848e2955 100644 --- a/.gitignore +++ b/.gitignore @@ -53,4 +53,4 @@ Thumbs.db .webfront/ # Maintenance-only npm tooling -/tools/assets/node_modules/ +/js/developer/vendor/node_modules/ diff --git a/AGENTS.md b/AGENTS.md index d8304aff..3f076a26 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -12,25 +12,25 @@ The README introduces WebFront through the Game of Life walkthrough, demonstrati ## Repository map -- `include/`: public header-only library. `WebFront.hpp` is the main orchestration API. -- `include/http/`: HTTP and WebSocket protocol implementation. -- `include/weblink/`: bridge message encoding and routing. -- `include/system/`: layered virtual filesystems and embedded web resources. -- `include/frontend/`: system-browser, CEF, optional Windows WebView2 and macOS WKWebView frontend adapters. -- `include/components/`: opt-in UI components (`Terminal.hpp`, `ToolManager.hpp`); their assets are served by embedded providers such as `include/system/TerminalFS.hpp`, and installed tools by `include/system/PackageFS.hpp` from `ToolStore.hpp`'s project directory. +- `include/webfront/`: public header-only library, included as ``. `WebFront.hpp` is the main orchestration API. +- `include/webfront/http/`: HTTP and WebSocket protocol implementation. +- `include/webfront/weblink/`: bridge message encoding and routing. +- `include/webfront/system/`: layered virtual filesystems and embedded web resources. +- `include/webfront/frontend/`: system-browser, CEF, optional Windows WebView2 and macOS WKWebView frontend adapters. +- `include/webfront/components/`: opt-in UI components (`Terminal.hpp`, `ToolManager.hpp`); their assets are served by embedded providers such as `include/webfront/system/TerminalFS.hpp`, and installed tools by `include/webfront/system/PackageFS.hpp` from `ToolStore.hpp`'s project directory. - `examples/`: only Hello World (`hello-world/`) and Game of Life (`life/`, with console, developer and embedded stages). -- `assets/`: readable browser bridge, fallback, component and developer-environment sources; production C++ remains header-only in `include/`. -- `tools/developer/starters/pi/`, `test/fixtures/`, `webtest/fixtures/`: retained package and regression fixtures, not public example applications. -- `test/`: Catch2 unit tests. -- `webtest/`: Jasmine real-browser integration test. -- `cmake/` and `.github/workflows/`: build support and CI. +- `js/core/`: readable browser bridge, fallback and bootstrap loader compiled into `include/webfront/`, plus the embedding CMake modules; `js/developer/`: developer environment, terminal/`wf` components, build and vendoring tools. Production C++ remains header-only in `include/webfront/`. +- `js/developer/tools/starters/pi/`, `test/fixtures/`, `test/web/fixtures/`: retained package and regression fixtures, not public example applications. +- `test/unit/`: Catch2 unit tests; `test/web/`: Jasmine real-browser integration test; `test/fuzz/`, `test/fixtures/`; `test/cmake/`: CMake test scripts and sub-projects. The `RepositoryLayout` CTest case pins the tracked root. +- `cmake/`: build modules (frontends, CEF, CPM, compiler options); `.github/`: workflows, `CONTRIBUTING.md`, `codecov.yml`. +- `.devcontainer/`: devcontainer and its Dockerfile; `docs/`: documentation, `CHANGELOG.md`, `Doxyfile.in`. - `third_party/xterm/`: vendored xterm.js distribution embedded by the terminal component; refresh it only with `cmake/UpdateXterm.cmake`. - `docs/PROJECT_STATUS.md`: evidence-based status snapshot and known limitations. - `docs/adr/README.md`: architecture decision index, Git history, tradeoffs and implementation rules; read the relevant ADRs before changing their contracts. - `docs/UI_COMPONENTS.md`: UI component architecture, the terminal component and the planned `wf` tool manager. - `docs/ISSUE_AUDIT.md`: recommendations for the current GitHub backlog. -The legacy `webfront/`, `tests/`, and `webtest` directories are not interchangeable: use `test/` for current C++ tests and `webtest/` for browser tests. Do not revive legacy code without a specific issue and regression coverage. +The historical `webfront/` prototype and the former top-level `webtest/` are gone: use `test/unit/` for current C++ tests and `test/web/` for browser tests. Do not revive legacy code without a specific issue and regression coverage. ## Build and test commands @@ -51,7 +51,7 @@ cmake --build build --parallel ctest --test-dir build --output-on-failure # Run one Catch2 scenario directly -./build/test/tests "Scenario: JsFunction" +./build/test/unit/tests "Scenario: JsFunction" # Linux real-browser integration test cmake -S . -B build-cef -DCMAKE_BUILD_TYPE=Release \ @@ -91,8 +91,8 @@ Exception: a purely C++ change that reuses an existing encoding, introduces no n ## Coding and testing conventions -- Use C++23, four-space indentation, the repository `.clang-format`, and the naming rules in `CONTRIBUTING.md`. -- Keep production implementation header-only under `include/`; `examples/` contains the two public examples; browser resources live in `assets/`. +- Use C++23, four-space indentation, the repository `.clang-format`, and the naming rules in `.github/CONTRIBUTING.md`. +- Keep production implementation header-only under `include/`; `examples/` contains the two public examples; browser resources live in `js/`. - Prefer standard-library facilities and explicit ownership. Keep public headers ODR-safe (`inline`/templates as appropriate). - Catch2 tests use `SCENARIO`/`GIVEN`/`WHEN`/`THEN` and deterministic mocks. - Jasmine tests use native modules and must report completion to C++, close themselves, return a meaningful process status, and have a CTest timeout. diff --git a/CMakeLists.txt b/CMakeLists.txt index 909465f0..7121eb19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,9 +18,9 @@ if(WEBFRONT_USE_MDDLOG) include(cmake/MddlogPreProject.cmake) endif() -set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/WebFront.hpp") +set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/webfront/WebFront.hpp") set(VERSION_STRING_REGEX "inline constexpr std::string_view version = \"([0-9]+\\.[0-9]+\\.[0-9]+)\"") -file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/include/WebFront.hpp" VERSION_STRING REGEX ${VERSION_STRING_REGEX}) +file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/include/webfront/WebFront.hpp" VERSION_STRING REGEX ${VERSION_STRING_REGEX}) string(REGEX MATCH "([0-9]+\\.[0-9]+\\.[0-9]+)" VERSION_STRING "${VERSION_STRING}") project(WebFront LANGUAGES CXX VERSION ${VERSION_STRING}) @@ -43,7 +43,7 @@ if(MSVC AND NOT WEBFRONT_USE_MDDLOG AND WEBFRONT_IS_TOP_LEVEL) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake ${CMAKE_CURRENT_LIST_DIR}/js/core ${CMAKE_CURRENT_LIST_DIR}/docs ${CMAKE_CURRENT_LIST_DIR}/test/cmake) if(WEBFRONT_IS_TOP_LEVEL) include(StandardProjectSettings) include(PreventInSourceBuilds) @@ -54,7 +54,7 @@ target_compile_features(WebFront_options INTERFACE cxx_std_23) # actually providing , a command-line -D applies from the start of every translation # unit, so other standard headers (e.g. ) that gate their own integration on # this macro see it "on" before has been included and fail to compile. Let each -# toolchain's own / define it accurately; include/details/C++20Support.hpp +# toolchain's own / define it accurately; include/webfront/details/C++20Support.hpp # already falls back to a minimal std::format polyfill when a toolchain leaves it undefined. add_library(WebFront_warnings INTERFACE) @@ -71,7 +71,7 @@ include(Sanitizers) enable_sanitizers(WebFront_options) if(WEBFRONT_IS_TOP_LEVEL) - configure_file(Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile) + configure_file(docs/Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile) include(Doxygen) enable_doxygen() @@ -109,13 +109,13 @@ if(ENABLE_TESTING OR ENABLE_FUZZING) endif() if(ENABLE_FUZZING) - add_subdirectory(fuzz) + add_subdirectory(test/fuzz) endif() if(ENABLE_TESTING) enable_testing() - add_subdirectory(test) - add_subdirectory(webtest) + add_subdirectory(test/unit) + add_subdirectory(test/web) endif() if(WEBFRONT_BUILD_EXAMPLES) diff --git a/CTestConfig.cmake b/CTestConfig.cmake deleted file mode 100644 index e69de29b..00000000 diff --git a/README.md b/README.md index df9e6d26..495ee15d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Register your simulation, bootstrap the tools, then build the interface in the a ```cpp -#include +#include #include using namespace std; @@ -220,4 +220,4 @@ CI runs one combined C++ / native-browser job per desktop platform on each code - Development project access is explicit and intended for trusted local code. Downloaded tools run with the application's bridge authority. Package scripts, native Node add-ons and Node APIs are unsupported. TypeScript is transformed without type checking. - Packaging, accessibility and native-engine deployment still need application-specific work. General DOM abstractions remain future work. See [project status](docs/PROJECT_STATUS.md) for known limitations. -[Developer environment reference](docs/DEVELOPER_ENVIRONMENT.md) · [UI components](docs/UI_COMPONENTS.md) · [architecture decisions](docs/adr/README.md) · [contributing](CONTRIBUTING.md) +[Developer environment reference](docs/DEVELOPER_ENVIRONMENT.md) · [UI components](docs/UI_COMPONENTS.md) · [architecture decisions](docs/adr/README.md) · [contributing](.github/CONTRIBUTING.md) diff --git a/assets/developer/bundles.json b/assets/developer/bundles.json deleted file mode 100644 index ca39e451..00000000 --- a/assets/developer/bundles.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "assets/developer/bootstrap.mjs": "534af4b3d07891338c3390e1d5e06c2fb6dd8df11ca6547735565b17f1b9cd70", - "assets/developer/bootstrap-entry.mjs": "ff8084f23f5acc721f97eb1ed0a454e7bfee1894de17d54f0100fa11f7ef8b77", - "assets/developer/packages.mjs": "faed29500a34c6ce24756d07bd4b47b9168ccec4bd49d12f00096a869637d74d", - "assets/developer/starter.mjs": "f8cdef1218ae14f8bbe49eae495d931cc29e33f74444f0e37d61aea416b9d750", - "assets/developer/paths.mjs": "6ebb626610756143c58762c87af18980802809d7f0f53d3b588e4b20e8db0161", - "assets/developer/runtime.mjs": "36847f4413928908ebc8a1909e608c783701b13274a289d81e43df0e5125a0e8", - "assets/developer/compiler.mjs": "3f7e187ca9a4c2645ef3823127457cad655919cbea3c7c0f22fb7ae2cc87e0e5", - "assets/developer/bundler.mjs": "b0ff79a1b0caa012c25ec7b7f121d7d50af1aa1651231d3dcf2f39470c4ea25c", - "assets/developer/entry.mjs": "b2b942443e3c74ae2c008392ba244d9b7e91db70ba1b4ebbe1357c455ebf51bb", - "assets/developer/conditions.mjs": "7f0ecba239480831e38985ccffd4c82309949924f4eb9d938e4ad1b09f5f36ed", - "assets/developer/io.mjs": "a155719c612e065c30272c0dfdc456df28b5efa90ca26f8cfcb55c9cb46de690", - "assets/developer/recipe.mjs": "809f2091c50ebd13d23f92de9876b584658dc687324f73d48ee9f1271319f1ed", - "assets/developer/registry.mjs": "f566f07ea066155ab7209d925cee2cf12a664ac51b07bc0ca3e3fd8fde49a9c8", - "assets/developer/archive.mjs": "1fb8b9c3c27219858597801104639bba1104c7a7d33973609cd556b5e5f81d2d", - "assets/developer/lock.mjs": "60d0ea14d24793cd5e85bbd4bb4bfe90d2c7d76c0d20ffc99f462595a6e57291", - "assets/developer/pins.mjs": "ddb2214a2e906cb117dc1bac0b5b056decd4f6c6e3d4713615176c1876db3534", - "assets/developer/peers.mjs": "e1d999892138682fc0134ef1f4d4b19b9a9ad8d7fb16e37fc9c6c684bd853896", - "assets/developer/resolve.mjs": "8b96b850af215be51f5cb85cc9c69e057afa04dfb8a57e572620c07059c17fa3", - "assets/developer/embed.mjs": "c8fb80998abecdd5fdeba77aa549ff638d849dc9fd7f34c896fb6c0c0bf15f34", - "tools/developer/starters/pi/main.tsx": "d3161b35db204ba54f782f711183e8d96aeff7c92d885c33a6ec168cf461e453", - "tools/developer/starters/pi/style.css": "360e2c7ae6d3699b00e18cbf67efbae7a8d8863d88926b31139e102cf38e5abd", - "examples/life/ui/main.tsx": "ed11a82aad1639eb6997af8b0fca4d5c5ed4c36422c22a74ac49ae73078d0a91", - "examples/life/ui/style.css": "9bb55eb0f0a3287e5b7dc78af9d69608b87ff42c4d9c8a653bc83a52fe293c44", - "assets/components/tools/wf.mjs": "6ee86d85ec96bf548ca25ea3ea3554b7dacbed7d047d6a9cfdc1e0f3f42de05e", - "tools/developer/distribution.json": "f17197a710d994a83dd35fbb983ae672ae00144bc81eb3f22a78bbaf5f26f658", - "tools/developer/build.mjs": "c486ac6816e7c18c51d4b75dd3b032616ee081a4461a4125a5c1753f00d36c8d", - "tools/developer/site.mjs": "d4b7112f0aa5f277f291505a3dce84e676fee9d4da386973af7c6df9885d4dd4", - "tools/developer/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b", - "tools/assets/package-lock.json": "eb545112b672f9dbf520125df1f44a878d62cc8e611f0e33baee36470ded4dec", - "assets/developer/bootstrap.bundle.mjs": "792fe7cf564bd12ac47fef419d8c71e2070925764a17706552e7d3f5d6ba2181", - "assets/developer/packages.bundle.mjs": "994c13a8b30a40ecea98414caa72a17927dcea81a1f62d47744b4f55d87005be", - "include/system/DeveloperReleaseData.hpp": "89dd809cf07eb5f3c11c772f385941b81cf78b94ad3719ab1c40e844c246bc76" -} diff --git a/cmake/MddlogIntegration.cmake b/cmake/MddlogIntegration.cmake index 84dca7b3..a4bfb708 100644 --- a/cmake/MddlogIntegration.cmake +++ b/cmake/MddlogIntegration.cmake @@ -101,7 +101,7 @@ function(webfront_add_mddlog) find_package(mddlog CONFIG REQUIRED) endif() - add_library(WebFront_mddlog STATIC "${PROJECT_SOURCE_DIR}/logging/Logger.cpp") + add_library(WebFront_mddlog STATIC "${PROJECT_SOURCE_DIR}/cmake/mddlog/Logger.cpp") add_library(WebFront::mddlog ALIAS WebFront_mddlog) target_compile_features(WebFront_mddlog PUBLIC cxx_std_23) set_target_properties(WebFront_mddlog PROPERTIES CXX_SCAN_FOR_MODULES ON) diff --git a/cmake/WKWebViewSupport.cmake b/cmake/WKWebViewSupport.cmake index 9f847074..4918e4a6 100644 --- a/cmake/WKWebViewSupport.cmake +++ b/cmake/WKWebViewSupport.cmake @@ -14,7 +14,7 @@ target_compile_options(WebFront INTERFACE "$<$:-fblocks>") target_link_libraries(WebFront INTERFACE "${WEBFRONT_COCOA_FRAMEWORK}" "${WEBFRONT_WEBKIT_FRAMEWORK}") function(webfront_add_wkwebview_tests) - get_filename_component(webtest_source_dir "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../webtest" ABSOLUTE) + get_filename_component(webtest_source_dir "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../test/web" ABSOLUTE) add_executable(wkwebview_lifecycle "${webtest_source_dir}/WKWebViewLifecycle.cpp" "${webtest_source_dir}/WKWebViewHeaderConsumer.cpp") target_link_libraries(wkwebview_lifecycle PRIVATE WebFront WebFront_warnings WebFront_options) diff --git a/cmake/WebKitGTKSupport.cmake b/cmake/WebKitGTKSupport.cmake index 61bbed7e..e5493b27 100644 --- a/cmake/WebKitGTKSupport.cmake +++ b/cmake/WebKitGTKSupport.cmake @@ -14,13 +14,13 @@ endif() target_compile_definitions(WebFront INTERFACE WEBFRONT_EMBED_WEBKITGTK) target_link_libraries(WebFront INTERFACE ${CMAKE_DL_LIBS}) -include("${CMAKE_CURRENT_LIST_DIR}/WebKitGTKTestEnvironment.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/../test/cmake/WebKitGTKTestEnvironment.cmake") function(webfront_add_webkitgtk_tests) foreach(name IN LISTS ARGN) webfront_configure_webkitgtk_test("${name}") endforeach() - set(source "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../webtest") + set(source "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../test/web") add_executable(webkitgtk_lifecycle "${source}/WebKitGTKLifecycle.cpp") target_link_libraries(webkitgtk_lifecycle PRIVATE WebFront_test_hardening WebFront WebFront_warnings WebFront_options) add_dependencies(webtest webkitgtk_lifecycle) diff --git a/cmake/WebView2Support.cmake b/cmake/WebView2Support.cmake index ace600ab..0b5ac033 100644 --- a/cmake/WebView2Support.cmake +++ b/cmake/WebView2Support.cmake @@ -59,7 +59,7 @@ target_link_libraries(WebFront INTERFACE # Register lifecycle coverage once, alongside the shared Jasmine runner; paths are module-relative. function(webfront_add_webview2_tests) - get_filename_component(webtest_source_dir "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../webtest" ABSOLUTE) + get_filename_component(webtest_source_dir "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../test/web" ABSOLUTE) add_executable(webview2_lifecycle "${webtest_source_dir}/WebView2Lifecycle.cpp" "${webtest_source_dir}/WebView2HeaderConsumer.cpp") diff --git a/logging/Logger.cpp b/cmake/mddlog/Logger.cpp similarity index 99% rename from logging/Logger.cpp rename to cmake/mddlog/Logger.cpp index 068d7847..96123a70 100644 --- a/logging/Logger.cpp +++ b/cmake/mddlog/Logger.cpp @@ -7,7 +7,7 @@ import mddlog.core.ring; import mddlog.adapter.logrecord; import mddlog.adapter.transportconsumer; -#include "tooling/LoggerApi.hpp" +#include namespace webfront::log { struct SinkHandle::Registration { diff --git a/CHANGELOG.md b/docs/CHANGELOG.md similarity index 81% rename from CHANGELOG.md rename to docs/CHANGELOG.md index b73fd4ca..1a8ddb91 100644 --- a/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,6 +2,20 @@ ## Unreleased +### Changed + +- **Breaking:** library headers moved to `include/webfront/`; include them as ``, + ``, `` and so on. The former spellings (``, + ``, ``) are removed with no redirect headers, so these generic names no longer + risk colliding with other libraries; point consumers at `include/` and update their includes. + `include/WebFront220128.hpp.gz` and the historical `webfront/` prototype are removed. +- Repository root reduced to `.github`, `cmake`, `docs`, `examples`, `include`, `js`, `test` (and `third_party` + until #319). `assets/` and `tools/` become `js/core` and `js/developer`; `webtest/` becomes `test/web`, + `fuzz/` becomes `test/fuzz`, unit tests move to `test/unit`; `CHANGELOG.md`, `Doxyfile.in` move to `docs/`, + `CONTRIBUTING.md` and `codecov.yml` to `.github/`, `Dockerfile` to `.devcontainer/`. Moves keep Git history. +- Developer distribution 0.4.1 (pending `developer-v0.4.1` publication): generated providers include + ``. Published 0.4.0 remains immutable. + ## 0.4.0 - 2026-10-21 ### Changed diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 0f935183..08152ec6 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -12,7 +12,7 @@ Do not ship developer mode as the distribution configuration. The 0.4 presentation update prepares developer distribution **0.4.0** with the revised Life text. It is not published as part of the repository cleanup. Before releasing this branch, publish the -prepared archives using [the package release procedure](../tools/developer/PUBLISHING.md). +prepared archives using [the package release procedure](../js/developer/tools/PUBLISHING.md). For local review, provision the generated archive as described below and pass its URL/integrity to `WebFrontLifeDeveloper`. Existing published versions remain unchanged. @@ -23,7 +23,7 @@ Enable the platform's native frontend in CMake: `WEBFRONT_EMBED_WKWEBVIEW=ON` on The default `webfront::WebFront` still opens the system browser. ```cpp -#include +#include #include std::bitset<1024> nextLife(const std::bitset<1024>& cells); // Existing C++ simulation. @@ -46,8 +46,8 @@ header generation. Both resulting headers were compiled and the applications pas native tests from empty working directories, with developer callbacks absent. Pages returned HTTP 200, CORS `*` and the pinned archive bytes. These checks supplement offline CTest fixtures. -The default configuration is generated in `include/system/DeveloperReleaseData.hpp` and targets -`https://ambroise-leclerc.github.io/WebFront/developer/0.4.0/environment.tgz`. This version is prepared but not yet published; use local provisioning for now. The configuration pins one version and +The default configuration is generated in `include/webfront/system/DeveloperReleaseData.hpp` and targets +`https://ambroise-leclerc.github.io/WebFront/developer/0.4.1/environment.tgz`. This version (generated providers now include ``) is prepared but not yet published until its `developer-v0.4.1` tag is pushed; use local provisioning for now. Published 0.4.0 stays immutable but targets the former include layout. The configuration pins one version and its SHA-512 rather than resolving a mutable `latest` channel. An explicit `DeveloperBootstrapOptions{.environment = url, .integrity = trustedHash}` still selects a different HTTPS/CORS repository or a same-origin test fixture. Users install neither npm nor Node.js. @@ -56,7 +56,7 @@ The environment archive contains pinned Life and PI starter descriptors. `wf cre verifies that separate archive, creates a new `ui` directory and prints the install/preview/embed commands. Existing directories are never replaced. The trusted environment hash protects both its own code and the starter descriptor; `provision.json` on the server is not a new trust anchor. -See [publication instructions](../tools/developer/PUBLISHING.md) for deployment and release checks. +See [publication instructions](../js/developer/tools/PUBLISHING.md) for deployment and release checks. The bootstrap verifies SHA-512 before unpacking or executing the archive, validates its manifest and paths, then publishes it under the application's local origin. The cached **archive** is @@ -119,7 +119,7 @@ determines the C++ provider name. The header is replaced only after all chunks a The distribution form has no project root or developer callbacks: ```cpp -#include +#include #include "Life.hpp" #include "generated/LifeUI.hpp" @@ -136,7 +136,7 @@ Reconfigure the native build with project sources, downloaded cache nor network. The PI starter remains available through `wf create pi` for existing projects and regression -coverage. Its sources are maintained under `tools/developer/starters/pi/`; the public C++ +coverage. Its sources are maintained under `js/developer/tools/starters/pi/`; the public C++ examples are limited to Hello World and Life. Existing embedded React/Babel providers remain supported. ## Dependencies, storage and limitations @@ -174,15 +174,15 @@ These commands require Node/npm **only for environment maintainers**. They prepa application developers can download. No command publishes anything to a registry automatically. ```sh -npm ci --prefix tools/assets --ignore-scripts -node tools/developer/build.mjs build-developer-environment --refresh-bootstrap -node tools/developer/fixtures.mjs build-developer-environment +npm ci --prefix js/developer/vendor --ignore-scripts +node js/developer/tools/build.mjs build-developer-environment --refresh-bootstrap +node js/developer/tools/fixtures.mjs build-developer-environment ``` `build.mjs` bundles the environment and compiler, includes esbuild.wasm, xterm styles and licenses, and writes deterministic `environment.tgz`, `life-starter.tgz`, `pi-starter.tgz`, `provision.json` and -`DeveloperReleaseData.hpp`. The version and public base URL are in `tools/developer/distribution.json`. Dependencies are -pinned in `tools/assets/package-lock.json`. `--refresh-bootstrap` additionally refreshes the two +`DeveloperReleaseData.hpp`. The version and public base URL are in `js/developer/tools/distribution.json`. Dependencies are +pinned in `js/developer/vendor/package-lock.json`. `--refresh-bootstrap` additionally refreshes the two checked-in JS bundles, their input checksums and the embedded bootstrap headers. Without that flag, it writes only to the output directory. The archives have the package identifiers `@webfront/developer-environment`, `@webfront/life-starter` and `@webfront/pi-starter`. They are distributed as static GitHub Pages downloads; no npm publication or diff --git a/Doxyfile.in b/docs/Doxyfile.in similarity index 100% rename from Doxyfile.in rename to docs/Doxyfile.in diff --git a/cmake/Doxygen.cmake b/docs/Doxygen.cmake similarity index 100% rename from cmake/Doxygen.cmake rename to docs/Doxygen.cmake diff --git a/docs/EMBEDDED_ASSETS.md b/docs/EMBEDDED_ASSETS.md index 23f64bf5..e8f49e18 100644 --- a/docs/EMBEDDED_ASSETS.md +++ b/docs/EMBEDDED_ASSETS.md @@ -15,9 +15,9 @@ Normal C++ consumer builds use checked-in headers and need neither Node.js nor n React 19 removed UMD builds and requires the automatic JSX transform ([upstream upgrade guide](https://react.dev/blog/2024/04/25/react-19-upgrade-guide)). -`tools/assets/update.mjs` bundles React, React DOM and `react/jsx-runtime` together as +`js/developer/vendor/update.mjs` bundles React, React DOM and `react/jsx-runtime` together as `/react@19.3.1/runtime.mjs`. This keeps hooks, DOM rendering and JSX on one React instance. -The import map in `webtest/fixtures/react.html` maps `react`, `react-dom/client` and `react/jsx-runtime` +The import map in `test/web/fixtures/react.html` maps `react`, `react-dom/client` and `react/jsx-runtime` to that runtime. Babel's custom `webfront-react` preset uses `runtime: "automatic"` and emits a native module. The JSX remains editable in the HTML file, without a consumer build step. Babel is served at `/babel-standalone@8.0.7/babel.min.js`. @@ -35,8 +35,8 @@ Run from the repository root: ```sh # Online, maintenance only: exact versions and transitive integrity hashes are in package-lock.json. -npm ci --prefix tools/assets --ignore-scripts -node tools/assets/update.mjs +npm ci --prefix js/developer/vendor --ignore-scripts +node js/developer/vendor/update.mjs # Refresh xterm only through its dedicated script, retaining readable upstream files and licenses. cmake -DXTERM_VERSION=6.0.0 -DFIT_VERSION=0.11.0 -P cmake/UpdateXterm.cmake @@ -45,12 +45,12 @@ cmake --build build --target webfront-embedded-assets ctest --test-dir build -R 'Asset.*Fresh|EmbeddedGzipContents' --output-on-failure ``` -`tools/assets/package.json` pins all six library versions and the maintenance tools; +`js/developer/vendor/package.json` pins all six library versions and the maintenance tools; `package-lock.json` pins the npm tarball URLs, integrity hashes, scheduler 0.28.0 and esbuild 0.28.2. When upgrading, recheck the registry's stable tags, update exact versions and the lockfile, then review sources, routes, tests, version inventory and size measurements together. `cmake/UpdateXterm.cmake` takes exact versions explicitly and records them in -`third_party/xterm/VERSION`. `tools/assets/update.mjs` records the other versions alongside +`third_party/xterm/VERSION`. `js/developer/vendor/update.mjs` records the other versions alongside their distribution files in `third_party/`. Compression uses the vendored **fflate 0.8.3** pure JavaScript `gzipSync` implementation @@ -60,9 +60,9 @@ its license are checked in, so the streams are identical across platforms withou The small bridge, fallback page and component modules remain identity encoded. `.gitattributes` keeps text sources and headers at LF; PNG files retain their binary bytes. -`cmake/EmbedTextAsset.cmake` packs the compressed bytes into big-endian words, with +`js/core/EmbedTextAsset.cmake` packs the compressed bytes into big-endian words, with `encoding = "gzip"` and `dataSize` excluding trailing word padding. CTest regenerates and compares -headers offline. `tools/assets/check.mjs` independently decodes the arrays using Node's zlib, +headers offline. `js/developer/vendor/check.mjs` independently decodes the arrays using Node's zlib, checks every decoded byte against the distribution file, validates gzip headers/padding, and checks React's named ESM exports. Catch2 exercises provider routes, reads across word boundaries, EOF, encoding metadata and HTTP Content-Encoding/Content-Length/MIME/body agreement. @@ -122,7 +122,7 @@ switch to a raw PNG favicon. The final total is 8,352 bytes above the xterm-only and **250,432 bytes below the original**. Major upgrades therefore do not uniformly shrink resources: React's combined DOM/JSX runtime and Jasmine grow while Babel shrinks. -Exact served lengths (without padding) are printed by `node tools/assets/check.mjs`: +Exact served lengths (without padding) are printed by `node js/developer/vendor/check.mjs`: xterm module 91,908; CSS 2,547; Fit 807; React runtime 72,925; Babel 563,586; Jasmine JS 75,638; HTML reporter 9,547; CSS 7,568; boot 1,073; PNG 1,486 bytes. diff --git a/docs/FRONTENDS.md b/docs/FRONTENDS.md index a609bd3e..31c546b6 100644 --- a/docs/FRONTENDS.md +++ b/docs/FRONTENDS.md @@ -2,7 +2,7 @@ [Back to the README](../README.md#use-webfront-in-your-project) -A frontend decides how the interface is displayed: the system browser (`DefaultBrowserFrontend`, the default), an embedded Chromium window (`CEFFrontend`) or an embedded native web view (`WebView2Frontend` on Windows, `WKWebViewFrontend` on macOS, `WebKitGTKFrontend` on Linux). The application code and interface assets do not change when the frontend does. Platform-specific notes live next to each frontend, for example [WebView2](WEBVIEW2.md) and [WKWebView](WKWEBVIEW.md). This page states the rules they all follow; the C++ concept is `frontend::FrontendType` in `include/frontend/Frontend.hpp`. +A frontend decides how the interface is displayed: the system browser (`DefaultBrowserFrontend`, the default), an embedded Chromium window (`CEFFrontend`) or an embedded native web view (`WebView2Frontend` on Windows, `WKWebViewFrontend` on macOS, `WebKitGTKFrontend` on Linux). The application code and interface assets do not change when the frontend does. Platform-specific notes live next to each frontend, for example [WebView2](WEBVIEW2.md) and [WKWebView](WKWEBVIEW.md). This page states the rules they all follow; the C++ concept is `frontend::FrontendType` in `include/webfront/frontend/Frontend.hpp`. ## The contract @@ -28,17 +28,17 @@ The [shared content policy](CONTENT_POLICY.md) defines bridge-origin authorizati ## Contract tests -`test/FrontendContractTests.cpp` uses a synchronized mock window and a server loop that stays active +`test/unit/FrontendContractTests.cpp` uses a synchronized mock window and a server loop that stays active until stopped. It verifies blocking until closure, execution on the calling thread, server-loop completion before `show()` returns or propagates an exception, and continued service after a `keepServerRunning` frontend returns. Standard and non-standard exceptions are covered, including startup failures before any window is created. Coordination waits have a 30-second upper bound. -`test/WebFrontTests.cpp` also checks initialization once per frontend type, retry after failed +`test/unit/WebFrontTests.cpp` also checks initialization once per frontend type, retry after failed initialization, frontend selection and unavailable-engine diagnostics. These tests need no GUI. ## Adding a frontend -1. Implement the type in `include/frontend/` following the contract above and include it from `Frontend.hpp`. Keep platform headers behind the option's macro. +1. Implement the type in `include/webfront/frontend/` following the contract above and include it from `Frontend.hpp`. Keep platform headers behind the option's macro. 2. Add its support module and one `webfront_register_frontend(...)` entry in `cmake/Frontends.cmake`, using the fields below. 3. Extend `FrontendSelection` coverage and run the shared Jasmine and lifecycle suites. Enabling the engine on a `TEST_PLATFORMS` platform automatically registers the seven shared lifecycle cases; `WEBFRONT_TEST_FRONTEND` selects its C++ type in both runners. @@ -62,7 +62,7 @@ Registry order determines the initial cache default: the first enabled embedded ## Lifecycle tests -`webtest/FrontendLifecycle.cpp` runs the same seven cases under the selected embedded engine: +`test/web/FrontendLifecycle.cpp` runs the same seven cases under the selected embedded engine: - `no-bridge`: close a page that never connects to the bridge and return from `show()`. - `early-close`: close immediately from the page's first script, before any bridge connection. diff --git a/docs/HTTP_ASSETS.md b/docs/HTTP_ASSETS.md index 6c7f7eb5..6dc822aa 100644 --- a/docs/HTTP_ASSETS.md +++ b/docs/HTTP_ASSETS.md @@ -46,7 +46,7 @@ All bundled assets fit under the 4 MiB default; custom applications can override their existing buffer policy: ```cpp -#include +#include #include struct AppBuffers : webfront::http::DefaultBuffersPolicy { diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index ea9bdf27..00b743db 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -1,16 +1,27 @@ # WebFront project status +## Repository layout (#320, epic #303) + +The root now holds only `.github`, `cmake`, `docs`, `examples`, `include`, `js`, `test` and `third_party` +(removed by #319), plus tool configuration files. Headers moved to `include/webfront/` and are included +as ``; the former ``, `` or `` spellings are +removed without redirect headers (see `docs/CHANGELOG.md`). Browser sources live in `js/core/` +(bridge, fallback, bootstrap loader and embedding modules) and `js/developer/` (environment, terminal +components, build tools, vendoring tools); tests live in `test/{unit,web,fuzz,fixtures,cmake}`. The CTest +case `RepositoryLayout` enforces the root. The generated-provider include changed, so the developer +distribution is bumped to 0.4.1 and awaits its `developer-v0.4.1` publication. + ## Release 0.4.0 (#200, 2026-10-21) `webfront::version` and the CMake project version are 0.4.0. The release presents the repository (examples, README, assets layout) and streamlines CI; it adds no library functionality, see -`CHANGELOG.md`. The developer distribution 0.4.0 is published and archived as `developer-v0.4.0`; +`docs/CHANGELOG.md`. The developer distribution 0.4.0 is published and archived as `developer-v0.4.0`; published 0.1.0 to 0.4.0 remain immutable. APIs and packaging remain experimental. ## Repository presentation for 0.4 (2026-10-21) - Public examples now live in `examples/`: Hello World and the three stages of Game of Life. - Browser bridge/component/bootstrap sources live in `assets/`; the library remains header-only. + Browser bridge/component/bootstrap sources live in `js/`; the library remains header-only. PI and Signal Studio resources required by regression tests remain fixtures, without public demo targets. - The README starts with Hello World and a linked Life thumbnail, then walks through the native bootstrap, dependency installation, preview and offline embedding. No library feature is added. @@ -115,7 +126,7 @@ Status snapshot: 2026-07-19. Optional mddlog integration note: 2026-10-02. Newco `webfront::version` and the CMake project version are 0.3.0. The release adds packed `std::bitset` bridge values (#289) and the opt-in developer environment with its packed Life demonstration (#288); -see `CHANGELOG.md`. The developer distribution 0.3.1 is published and archived as `developer-v0.3.1`; +see `docs/CHANGELOG.md`. The developer distribution 0.3.1 is published and archived as `developer-v0.3.1`; published 0.1.0 to 0.3.1 remain immutable. APIs and packaging remain experimental. ## Release 0.2.0 and native frontend epic (#253, 2026-10-19) @@ -125,7 +136,7 @@ Compile-time alias checks, CMake selector fixtures and the Windows WebView2, macOS WKWebView and Linux WebKitGTK browser/lifecycle CI lanes cover the delivered scope. Existing runtime and packaging limitations remain documented below. -`webfront::version` in `include/WebFront.hpp` is the version source for CMake. +`webfront::version` in `include/webfront/WebFront.hpp` is the version source for CMake. The C++ version scenario compares the compiled constant with `PROJECT_VERSION`; `ReleaseVersionConsistency` also checks version tags at HEAD without network access. The release-version workflow checks the actual tag on tag pushes and published @@ -215,7 +226,7 @@ See [WebKitGTK notes](WEBKITGTK.md). stalled on that existing regression. Each C++ scenario has a 60-second timeout. UBSan diagnostics fail the process. The ASan lane also runs each of three libFuzzer targets for 30 seconds. - `ENABLE_FUZZING=ON` builds bridge-message, HTTP-request and WebSocket-frame fuzzers - with ASan+UBSan. Seed corpora derive from existing unit examples and live in `fuzz/`; + with ASan+UBSan. Seed corpora derive from existing unit examples and live in `test/fuzz/`; writable copies stay in the build tree and CI uploads reproducer artifacts on failure. HTTP and WebSocket harnesses exercise partial receives; WebSocket decoding rejects oversized advertised lengths before allocating their payloads. @@ -277,12 +288,12 @@ See [WebKitGTK notes](WEBKITGTK.md). ## UI components: the terminal and the tool manager -- First opt-in UI component (#230), designed in [UI_COMPONENTS.md](UI_COMPONENTS.md): `webfront::Terminal` (`include/components/Terminal.hpp`) registers C++ commands behind an embedded xterm.js 6.0.0 terminal (`fs::TerminalFS`, served under `webfront/components/terminal/`; composed with `fs::DefaultFSWith<>`). The standalone terminal target was removed in 0.4; see the component API example in [UI_COMPONENTS.md](UI_COMPONENTS.md). The bridge protocol is unchanged. +- First opt-in UI component (#230), designed in [UI_COMPONENTS.md](UI_COMPONENTS.md): `webfront::Terminal` (`include/webfront/components/Terminal.hpp`) registers C++ commands behind an embedded xterm.js 6.0.0 terminal (`fs::TerminalFS`, served under `webfront/components/terminal/`; composed with `fs::DefaultFSWith<>`). The standalone terminal target was removed in 0.4; see the component API example in [UI_COMPONENTS.md](UI_COMPONENTS.md). The bridge protocol is unchanged. - Line editing, history and Tab completion run in the browser; C++ receives whole lines and returns the output as the Promise result. A command exception rejects the Promise and is printed as an error. Output is capped at 60000 bytes because bridge strings carry a 16-bit length. -- Covered by Catch2 (`TerminalTests.cpp`, `TerminalFSTests.cpp`), five asset freshness CTest cases and Jasmine specs (`webtest/js/terminal-specs.mjs`) in the browser integration test. +- Covered by Catch2 (`TerminalTests.cpp`, `TerminalFSTests.cpp`), five asset freshness CTest cases and Jasmine specs (`test/web/js/terminal-specs.mjs`) in the browser integration test. - Verified 2026-10-14 on Linux (GCC 16.1, Unix Makefiles generator): CEF-off build with all 100 CTest cases passing; the example driven in headless Chromium (commands, errors, quoting, completion, history, `help`, `clear`); and the Jasmine suite, terminal specs included, run in headless Chromium through a scratch copy of the runner that replaces `CEFFrontend`. A deliberately broken terminal spec made that run fail. **Not verified:** the CEF/Xvfb CTest itself, Windows, macOS and Clang. - Limitations: no output streaming, no cancellation, no per-browser sessions, and single-row line redraw (see the design note). -- The `wf` tool manager (#234, npm-hosted web tools installed during debugging): `webfront::ToolManager` (`include/components/ToolManager.hpp`) stores tools with `fs::ToolStore` under `.webfront/tools/`, records them in `webfront-tools.lock.json`, serves them with `fs::PackageFS` under `webfront/tools/` and runs `wf list`, `wf remove` and `wf help` in C++. `wf search`, `wf install` and `wf open` run in the page, in `wf.mjs` (`assets/components/tools/`, served by `fs::ToolManagerFS`), a terminal extension module loaded through the new `Terminal::extension()`: it fetches the packument and tarball, checks the SHA-512 `dist.integrity` with `crypto.subtle`, gunzips with `DecompressionStream`, reads the ustar archive (pax and prefixed paths included) and sends the files in 256 KiB chunks through `webfront.pkg.*`, after refusing archives unpacking to more than 256 MiB. Ctrl+C interrupts it through the `signal` the terminal passes to browser commands. The registry is set by `ToolManagerOptions::registry`. The standalone tools target was removed in 0.4; the component remains documented in [UI_COMPONENTS.md](UI_COMPONENTS.md). Covered by `ToolStoreTests.cpp`, `ToolManagerTests.cpp`, `TerminalTests.cpp` and the Jasmine specs `webtest/js/tools-specs.mjs`, which install a fixture package from a fake registry served by the test (`webtest/registry/`, regenerated by `make_fixture.py`) into a temporary directory. +- The `wf` tool manager (#234, npm-hosted web tools installed during debugging): `webfront::ToolManager` (`include/webfront/components/ToolManager.hpp`) stores tools with `fs::ToolStore` under `.webfront/tools/`, records them in `webfront-tools.lock.json`, serves them with `fs::PackageFS` under `webfront/tools/` and runs `wf list`, `wf remove` and `wf help` in C++. `wf search`, `wf install` and `wf open` run in the page, in `wf.mjs` (`js/developer/components/tools/`, served by `fs::ToolManagerFS`), a terminal extension module loaded through the new `Terminal::extension()`: it fetches the packument and tarball, checks the SHA-512 `dist.integrity` with `crypto.subtle`, gunzips with `DecompressionStream`, reads the ustar archive (pax and prefixed paths included) and sends the files in 256 KiB chunks through `webfront.pkg.*`, after refusing archives unpacking to more than 256 MiB. Ctrl+C interrupts it through the `signal` the terminal passes to browser commands. The registry is set by `ToolManagerOptions::registry`. The standalone tools target was removed in 0.4; the component remains documented in [UI_COMPONENTS.md](UI_COMPONENTS.md). Covered by `ToolStoreTests.cpp`, `ToolManagerTests.cpp`, `TerminalTests.cpp` and the Jasmine specs `test/web/js/tools-specs.mjs`, which install a fixture package from a fake registry served by the test (`test/web/registry/`, regenerated by `make_fixture.py`) into a temporary directory. - Verified 2026-10-15 on macOS (Apple clang, CEF off): all CTest cases pass except `AddSubdirectoryConsumer`, which fails locally because of the outdated libc++ headers of the Command Line Tools; the Jasmine suite, tools specs included, run in Chromium through a scratch copy of the runner that replaces `CEFFrontend` (one terminal spec, "reports an application without terminal functions", fails there as it does on develop, because that browser gave its unsized terminal a two-column width); `WebFrontTools` driven against registry.npmjs.org (`wf help`, `wf search`, `wf list`, `wf install left-pad` downloaded, verified and refused as not a tool). **Not verified locally:** the CEF/Xvfb CTest (Linux only; the macOS CEF build of `webtest` fails inside stdexec), Windows. - Limitations of the tool manager: no semver ranges (an exact version or a dist-tag), no dependencies (a tool must bundle what it uses), no progress bar beyond step messages, sequential chunk uploads, and the trust model of `npm install`. - Found while building it: the C++ encoder wrapped the 16-bit length of strings over 65535 bytes (#231, fixed: such strings now fail explicitly, see "Implemented baseline"); `MimeType::toString()` mapped `csv` to `text/css` (#232, fixed: a `static_assert` now ties the name table to the enum); with GCC 16.1 and the Ninja generator, CMake's module dependency scanning (`-fmodules-ts`) crashes the compiler inside stdexec, while Unix Makefiles builds work. @@ -314,7 +325,7 @@ The minimum demonstration milestone is deliberately narrower than the long-term - The browser integration is a timeout-bounded CTest test for CEF-enabled Linux builds and runs under Xvfb in a focused CI job, built with GCC and with Clang. CEF's `NO_UNIQUE_ADDRESS`, `ALWAYS_INLINE` and `NOINLINE` macros break stdexec headers included after CEF's headers, which only Clang 19+ (and, by stdexec's configuration, MSVC) reveals (#243): `frontend/CEF.hpp` includes `networking/SenderHeaders.hpp`, which lists every stdnet and stdexec header WebFront uses, first, and the Catch2 case `CEFMacrosTests.cpp` compiles `WebFront.hpp` after those macros. Verified 2026-10-16 on Linux with Clang 22: the CEF build of `webtest` failed before the fix and `WebFrontBrowserIntegration` passes after it. Not verified: CEF with MSVC or Apple clang. - `WEBFRONT_EMBED_CEF=ON` uses CEF 154.0.34 (Chromium 154.0.8037.98, package `ambroise-leclerc/CEF@154.0.34`). An existing CEF 137 build directory must be reconfigured from scratch. On Windows, `libEGL.dll`, `libGLESv2.dll`, `dxcompiler.dll`, `dxil.dll` and `vk_swiftshader_icd.json` are copied only when the distribution ships them (CEF 154 has no ANGLE DLLs, #249). Verified 2026-10-16 on Linux (GCC 16.1, Unix Makefiles): the CEF build with all 138 CTest cases passing, `WebFrontBrowserIntegration` included, and the CEF-off build with all 137; with Clang 22, the CEF build of `webtest` and `WebFrontBrowserIntegration`. **Not verified:** CEF 154 on Windows and macOS (the macOS ARM64 framework requires macOS 13.0+). The earlier multi-example build intermittently raced while copying CEF `locales/` to its shared output directory. The retained examples now use `/examples`. - The bridge carries all JavaScript numeric typed-array variants in both directions. C++ `std::vector`, `std::array`, and `std::span` values use the matching typed-array encoding, while decoded parameters own their storage. -- `assets/WebFront.js` is the readable browser bridge source. CMake deterministically regenerates the embedded `include/system/WebFrontJsData.hpp` asset and CTest rejects a stale generated copy. +- `js/core/WebFront.js` is the readable browser bridge source. CMake deterministically regenerates the embedded `include/webfront/system/WebFrontJsData.hpp` asset and CTest rejects a stale generated copy. - Encoded HTTP assets (#274): accepted gzip is served unchanged; otherwise the server decodes gzip to identity with the decoded length, no `Content-Encoding` and `Vary: Accept-Encoding`. The default decoded-byte budget is 4 MiB and applications can override it through their buffer @@ -324,7 +335,7 @@ The minimum demonstration milestone is deliberately narrower than the long-term Regression tests and gzip/HTTP fuzzers cover decoding and encoding preferences. Verified 2026-10-19 on Linux for #274: the CEF-off build/CTest suite, CEF/Xvfb integration and WebKitGTK integration passed. The macOS results above describe earlier platform validation. -- First-party bridge/component text assets are embedded **verbatim rather than compressed**, so `HTTPServer` serves them without a `Content-Encoding` header. Deflate streams are not reproducible across the zlib builds on our macOS, Linux, and Windows runners, so a pre-compressed blob could not be verified by the staleness check. Restoring compression — either a reproducible build-time gzip or on-the-fly compression keyed on `Accept-Encoding` — is tracked as a follow-up. The fallback HTML and module have readable sources under `assets/fallback/`; `favicon.ico` uses gzip. Legacy third-party Jasmine/React/Babel assets now use gzip for WKWebView local-HTTP compatibility (#258); their decoded payloads are unchanged. Regenerate the text headers with `cmake --build build --target webfront-embedded-assets`. Sources and generated headers use LF on every platform so the CTest freshness checks compare identical bytes. +- First-party bridge/component text assets are embedded **verbatim rather than compressed**, so `HTTPServer` serves them without a `Content-Encoding` header. Deflate streams are not reproducible across the zlib builds on our macOS, Linux, and Windows runners, so a pre-compressed blob could not be verified by the staleness check. Restoring compression — either a reproducible build-time gzip or on-the-fly compression keyed on `Accept-Encoding` — is tracked as a follow-up. The fallback HTML and module have readable sources under `js/core/fallback/`; `favicon.ico` uses gzip. Legacy third-party Jasmine/React/Babel assets now use gzip for WKWebView local-HTTP compatibility (#258); their decoded payloads are unchanged. Regenerate the text headers with `cmake --build build --target webfront-embedded-assets`. Sources and generated headers use LF on every platform so the CTest freshness checks compare identical bytes. - The fallback page awaits `webFront.ready` to display the initial bridge connection result. This promise resolves after the handshake acknowledgement and rejects if the initial connection fails or closes; it does not track later disconnects. Jasmine exercises failure against a test-owned HTTP server on an OS-assigned loopback port that rejects WebSocket upgrades, including the case where the application never consumes `ready`. - WebSocket writes own their payload buffers until asynchronous completion and are serialized per connection. - The HTTP server looks files up by the request path without its query string (`/app.js?v=2` serves `app.js`); the path is cut at the first `?` before percent-decoding, so an encoded `%3F` stays part of the file name, and the `..` check applies to the decoded path only. The query is not passed to filesystems. @@ -359,7 +370,7 @@ The minimum demonstration milestone is deliberately narrower than the long-term The Windows CI matrix runs the shared Jasmine bridge suite and timed lifecycle tests under WebView2; CEF/Xvfb remains the Linux lane. The WebView2 browser label runs separately with `--no-tests=error`. CI's Evergreen bootstrapper URL is mutable; a downloaded installer must carry a valid Microsoft signature, and installed executable versions are logged. -- Embedded frontend lifecycle coverage is shared through `webtest/FrontendLifecycle.cpp` (#256), +- Embedded frontend lifecycle coverage is shared through `test/web/FrontendLifecycle.cpp` (#256), selected with `WEBFRONT_TEST_FRONTEND` alongside Jasmine. Each registered test platform inherits seven timeout-bounded `web-integration` cases: no bridge, immediate page closure, rejected ready, failed initial navigation, encoded paths, blocked navigation/popups and an explicit navigation diff --git a/docs/UI_COMPONENTS.md b/docs/UI_COMPONENTS.md index 05a73d08..50980a5c 100644 --- a/docs/UI_COMPONENTS.md +++ b/docs/UI_COMPONENTS.md @@ -14,9 +14,9 @@ A component has four parts. | Part | Rule | Terminal | | --- | --- | --- | -| Assets | An embedded `fs::Provider` serving under the reserved prefix `webfront/components//`, so it never collides with a development document root or the application's own pages. Readable sources live in `assets/components//`, third-party code in `third_party/`, and generated headers are checked in and kept fresh by CTest, like `WebFront.js`. | `fs::TerminalFS` (`include/system/TerminalFS.hpp`) | -| Browser module | A native ES module exporting `mount(element, options)`. It depends only on the global `webFront` bridge and its own assets (relative imports), and waits for `webFront.ready`. | `assets/components/terminal/terminal.mjs` | -| C++ façade | A header under `include/components/` that registers its bridge functions under `webfront..`. `BasicWF::cppFunction` ignores a second registration of the same name, so the prefix is what keeps components and applications apart. | `webfront::Terminal` (`include/components/Terminal.hpp`) | +| Assets | An embedded `fs::Provider` serving under the reserved prefix `webfront/components//`, so it never collides with a development document root or the application's own pages. Readable sources live in `js/developer/components//`, third-party code in `third_party/`, and generated headers are checked in and kept fresh by CTest, like `WebFront.js`. | `fs::TerminalFS` (`include/webfront/system/TerminalFS.hpp`) | +| Browser module | A native ES module exporting `mount(element, options)`. It depends only on the global `webFront` bridge and its own assets (relative imports), and waits for `webFront.ready`. | `js/developer/components/terminal/terminal.mjs` | +| C++ façade | A header under `include/webfront/components/` that registers its bridge functions under `webfront..`. `BasicWF::cppFunction` ignores a second registration of the same name, so the prefix is what keeps components and applications apart. | `webfront::Terminal` (`include/webfront/components/Terminal.hpp`) | | Wire format | Only the existing bridge types: scalars, strings (at most 65535 bytes), tuples and numeric typed arrays. Lists of words cross as `"\n"`-separated strings. A component never changes `Messages.hpp` or `WebFront.js`. | `run(line) -> output`, `complete(line) -> candidates` | Assets are added to an application through its filesystem type. `fs::DefaultFSWith` is @@ -28,13 +28,13 @@ using TerminalApp = webfront::BasicWF` alone does not pull them in. +grow, and `#include ` alone does not pull them in. ## The terminal component ```cpp -#include -#include +#include +#include int main() { webfront::TerminalApp app; @@ -177,7 +177,7 @@ header-only C++ library. ### Browser side (implemented) -`assets/components/tools/wf.mjs` is served by `fs::ToolManagerFS` at +`js/developer/components/tools/wf.mjs` is served by `fs::ToolManagerFS` at `webfront/components/tools/wf.mjs` and added to the terminal by `ToolManager`. Besides the `commands` it exports `search`, `install`, `installed`, `open`, `readTar`, `gunzip`, `verifyIntegrity` and `parseSpec`, so other pages can use them. @@ -201,21 +201,21 @@ header-only C++ library. browser blocks the window, it prints the URL instead. The browser integration test serves a fake registry: packuments and a fixture tarball in -`webtest/registry/` (regenerated by `make_fixture.py`, which also writes a packument with a wrong +`test/web/registry/` (regenerated by `make_fixture.py`, which also writes a packument with a wrong integrity), and a search endpoint answered by the test. Tools are installed into a temporary directory, never into the source tree. ### C++ side (implemented) ```cpp -#include +#include webfront::ToolsApp app; // DefaultFSWith webfront::Terminal terminal{app}; webfront::ToolManager tools{app, terminal}; // adds 'wf' and the webfront.pkg.* functions ``` -- `fs::ToolStore` (`include/system/ToolStore.hpp`, with the small JSON reader of `include/utils/Json.hpp`) validates npm names (`@scope/` allowed), +- `fs::ToolStore` (`include/webfront/system/ToolStore.hpp`, with the small JSON reader of `include/webfront/utils/Json.hpp`) validates npm names (`@scope/` allowed), versions and paths, stages and commits installations, and reads and writes the lock file through a temporary file renamed over it. The lock file is read strictly, and a record whose name, version or entry could leave the tools directory is rejected. Names, versions and paths may not @@ -225,7 +225,7 @@ webfront::ToolManager tools{app, terminal}; // adds 'wf' and the webfront.pkg.* set of pending installations within the process; versions differing only by case, which name the same directory on a case-insensitive volume, replace each other without losing files. Once the lock file is written, a directory that cannot be deleted is left behind instead of failing the operation. -- `fs::BasicPackageFS` (`include/system/PackageFS.hpp`) takes the project directory from +- `fs::BasicPackageFS` (`include/webfront/system/PackageFS.hpp`) takes the project directory from `Location::get()`; `fs::PackageFS` uses the working directory at startup (`fs::CurrentDirectory`). `ToolManager` must use the same `Location`. - `webfront.pkg.list(first)` returns the `name\tversion\tentry URL\ttitle` lines of the tools from @@ -263,7 +263,7 @@ production plugin system. - Core gaps 1 and 2 above, for progress and output streaming initiated by C++ (done in #233). - A filesystem provider writing outside the build tree, with tests using temporary directories. - Browser tests that use a local fake registry: tests must not need the public network (done: - `webtest/js/tools-specs.mjs`). + `test/web/js/tools-specs.mjs`). ## Browser-powered developer environment diff --git a/docs/WEBKITGTK.md b/docs/WEBKITGTK.md index d320b34c..34ae02e1 100644 --- a/docs/WEBKITGTK.md +++ b/docs/WEBKITGTK.md @@ -4,7 +4,7 @@ WebKitGTKFrontend is an optional GTK 4 embedded window using the distribution's WebKitGTK 6.0 runtime. It never changes the system-browser default. ```cpp -#include +#include using App = webfront::WebFrontWithFrontend; int main() { App app; diff --git a/docs/WKWEBVIEW.md b/docs/WKWEBVIEW.md index 33e620f3..af0efe3e 100644 --- a/docs/WKWEBVIEW.md +++ b/docs/WKWEBVIEW.md @@ -19,7 +19,7 @@ integrity=$(node -p "require('./build-developer-environment/provision.json').int For HelloWorld or your application, select the adapter in C++: ```cpp -#include +#include using App = webfront::WebFrontWithFrontend; int main() { @@ -34,7 +34,7 @@ There is no engine download, SDK package or separate runtime installation. ## Implementation and lifetime -The adapter stays header-only under `include/frontend/WKWebView.hpp`. It sends public Cocoa/WebKit +The adapter stays header-only under `include/webfront/frontend/WKWebView.hpp`. It sends public Cocoa/WebKit messages through the Objective-C runtime and registers delegate/view classes once. It compiles as C++23, without an Objective-C++ `.mm` source or ARC. Clang's Blocks extension (`-fblocks`, inherited through `WebFront::WebFront`) supplies WebKit's decision-handler calling convention. CMake links diff --git a/docs/adr/ADR-001-coeur-cpp23-header-only.md b/docs/adr/ADR-001-coeur-cpp23-header-only.md index 459e9158..056182cb 100644 --- a/docs/adr/ADR-001-coeur-cpp23-header-only.md +++ b/docs/adr/ADR-001-coeur-cpp23-header-only.md @@ -68,14 +68,14 @@ est une exception optionnelle documentée par l’ADR-011. de `src/` servent aux exemples. Aucune bibliothèque compilée ne saurait devenir obligatoire. - Préférer la façade simple dans un nouvel exemple ; n’exposer `BasicWF` que si une variation réelle de provider, filesystem, politique ou frontend le justifie. -- Respecter C++23, les concepts et conventions de `CONTRIBUTING.md`. Ne pas confondre le +- Respecter C++23, les concepts et conventions de `.github/CONTRIBUTING.md`. Ne pas confondre le vocabulaire sender fourni par stdnet avec une bibliothèque réseau standard déjà disponible. - Ne pas imposer avertissements, sanitizers, couverture ou choix de linker au projet parent. ## Sources et vérification -- [API et composition](../../include/WebFront.hpp), [CMake](../../CMakeLists.txt), - [conventions](../../CONTRIBUTING.md), [état du projet](../PROJECT_STATUS.md). +- [API et composition](../../include/webfront/WebFront.hpp), [CMake](../../CMakeLists.txt), + [conventions](../../.github/CONTRIBUTING.md), [état du projet](../PROJECT_STATUS.md). - Vérifier `WebFrontTests.cpp`, `DefaultFSTests.cpp`, `AddSubdirectoryConsumer` et `NewcomerDocsMatchExamples` dans CTest. - Voir [ADR-002](ADR-002-systemes-de-fichiers-composables.md), diff --git a/docs/adr/ADR-002-systemes-de-fichiers-composables.md b/docs/adr/ADR-002-systemes-de-fichiers-composables.md index db237e00..7a817ce2 100644 --- a/docs/adr/ADR-002-systemes-de-fichiers-composables.md +++ b/docs/adr/ADR-002-systemes-de-fichiers-composables.md @@ -121,8 +121,8 @@ un store restent optionnels et demandent un emplacement adapté à la cible. ## Sources et vérification -- [DefaultFS](../../include/system/DefaultFS.hpp), [FileSystem](../../include/system/FileSystem.hpp), - [NativeFS](../../include/system/NativeFS.hpp). -- Tests : [FileSystemTests](../../test/FileSystemTests.cpp), [DefaultFSTests](../../test/DefaultFSTests.cpp), - [ModuleHTTPServerTests](../../test/ModuleHTTPServerTests.cpp). +- [DefaultFS](../../include/webfront/system/DefaultFS.hpp), [FileSystem](../../include/webfront/system/FileSystem.hpp), + [NativeFS](../../include/webfront/system/NativeFS.hpp). +- Tests : [FileSystemTests](../../test/unit/FileSystemTests.cpp), [DefaultFSTests](../../test/unit/DefaultFSTests.cpp), + [ModuleHTTPServerTests](../../test/unit/ModuleHTTPServerTests.cpp). - Voir [ADR-009](ADR-009-modules-et-assets-reproductibles.md) et [ADR-010](ADR-010-composants-et-outils-optionnels.md). diff --git a/docs/adr/ADR-003-protocole-binaire-et-bornes.md b/docs/adr/ADR-003-protocole-binaire-et-bornes.md index e058cbdd..71fa8897 100644 --- a/docs/adr/ADR-003-protocole-binaire-et-bornes.md +++ b/docs/adr/ADR-003-protocole-binaire-et-bornes.md @@ -32,7 +32,7 @@ arguments et corrompu les messages. Que soit préservé le protocole binaire de `weblink/Messages.hpp` et de la source `src/WebFront.js`. -Note de renommage (0.4) : la source JavaScript est désormais `assets/WebFront.js` ; ce déplacement ne modifie pas le protocole décrit ici. +Note de renommage (0.4) : la source JavaScript est désormais `js/core/WebFront.js` ; ce déplacement ne modifie pas le protocole décrit ici. Les messages d’appel et de retour portent des identifiants de corrélation sur 16 bits. Les types pris en charge sont les scalaires, chaînes, tuples, tableaux numériques typés et `std::bitset` ; les objets JavaScript arbitraires et objets DOM ne traversent pas automatiquement le pont. @@ -90,8 +90,8 @@ refusé dès l’en-tête, fragments compris. Les trames de contrôle ont leur p ## Sources et vérification -- [Codec C++](../../include/weblink/Messages.hpp), [codec JS](../../assets/WebFront.js), - [politique de buffers](../../include/http/BuffersPolicy.hpp). -- Tests : [MessagesTests](../../test/MessagesTests.cpp), [WebSocketTests](../../test/WebSocketTests.cpp), - [spécifications navigateur](../../webtest/js/webfront-specs.mjs). +- [Codec C++](../../include/webfront/weblink/Messages.hpp), [codec JS](../../js/core/WebFront.js), + [politique de buffers](../../include/webfront/http/BuffersPolicy.hpp). +- Tests : [MessagesTests](../../test/unit/MessagesTests.cpp), [WebSocketTests](../../test/unit/WebSocketTests.cpp), + [spécifications navigateur](../../test/web/js/webfront-specs.mjs). - Voir [ADR-004](ADR-004-appels-asynchrones-et-erreurs.md) et [ADR-012](ADR-012-preuves-et-tests.md). diff --git a/docs/adr/ADR-004-appels-asynchrones-et-erreurs.md b/docs/adr/ADR-004-appels-asynchrones-et-erreurs.md index 089d1162..5e4038b6 100644 --- a/docs/adr/ADR-004-appels-asynchrones-et-erreurs.md +++ b/docs/adr/ADR-004-appels-asynchrones-et-erreurs.md @@ -70,8 +70,8 @@ ordinaires sont déduites ; les lambdas génériques et opérateurs surchargés ## Sources et vérification -- [API C++](../../include/WebFront.hpp), [fonctions JS](../../include/JsFunction.hpp), +- [API C++](../../include/webfront/WebFront.hpp), [fonctions JS](../../include/webfront/JsFunction.hpp), [exécution asynchrone](../ASYNC_EXECUTION.md). -- Tests : [JSFunctionTests](../../test/JSFunctionTests.cpp), [WebLinkTests](../../test/WebLinkTests.cpp), - [webfront-specs](../../webtest/js/webfront-specs.mjs). +- Tests : [JSFunctionTests](../../test/unit/JSFunctionTests.cpp), [WebLinkTests](../../test/unit/WebLinkTests.cpp), + [webfront-specs](../../test/web/js/webfront-specs.mjs). - Voir [ADR-003](ADR-003-protocole-binaire-et-bornes.md) et [ADR-006](ADR-006-taches-structurees-et-arret.md). diff --git a/docs/adr/ADR-005-evolution-reseau-asio-stdnet.md b/docs/adr/ADR-005-evolution-reseau-asio-stdnet.md index 10243434..cbe58cee 100644 --- a/docs/adr/ADR-005-evolution-reseau-asio-stdnet.md +++ b/docs/adr/ADR-005-evolution-reseau-asio-stdnet.md @@ -103,8 +103,8 @@ d’un autre thread, mais les opérations réseau se dénouent sur le thread du - [P4100R1 (WG21, 2026)](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p4100r1.pdf) : document d’information sur une démarche de réseau pour C++29 ; il éclaire l’horizon des travaux sans présumer d’une adoption. -- [Provider stdnet](../../include/networking/TCPNetworkingStdnet.hpp), - [tâches](../../include/networking/Tasks.hpp), [en-têtes sender](../../include/networking/SenderHeaders.hpp). -- Tests : [StdnetShutdownTests](../../test/StdnetShutdownTests.cpp), - [HTTPServerTests](../../test/HTTPServerTests.cpp), [CEFMacrosTests](../../test/CEFMacrosTests.cpp). +- [Provider stdnet](../../include/webfront/networking/TCPNetworkingStdnet.hpp), + [tâches](../../include/webfront/networking/Tasks.hpp), [en-têtes sender](../../include/webfront/networking/SenderHeaders.hpp). +- Tests : [StdnetShutdownTests](../../test/unit/StdnetShutdownTests.cpp), + [HTTPServerTests](../../test/unit/HTTPServerTests.cpp), [CEFMacrosTests](../../test/unit/CEFMacrosTests.cpp). - Voir [ADR-006](ADR-006-taches-structurees-et-arret.md). diff --git a/docs/adr/ADR-006-taches-structurees-et-arret.md b/docs/adr/ADR-006-taches-structurees-et-arret.md index 62b94bc1..d2310246 100644 --- a/docs/adr/ADR-006-taches-structurees-et-arret.md +++ b/docs/adr/ADR-006-taches-structurees-et-arret.md @@ -73,7 +73,7 @@ prévaut entre résultat, arrêt et déconnexion. ## Sources et vérification -- [Contrat détaillé](../ASYNC_EXECUTION.md), [TaskScope](../../include/networking/Tasks.hpp). -- Tests : [StructuredShutdownTests](../../test/StructuredShutdownTests.cpp), - [ApplicationTaskTests](../../test/ApplicationTaskTests.cpp), [JsFunctionSenderTests](../../test/JsFunctionSenderTests.cpp). +- [Contrat détaillé](../ASYNC_EXECUTION.md), [TaskScope](../../include/webfront/networking/Tasks.hpp). +- Tests : [StructuredShutdownTests](../../test/unit/StructuredShutdownTests.cpp), + [ApplicationTaskTests](../../test/unit/ApplicationTaskTests.cpp), [JsFunctionSenderTests](../../test/unit/JsFunctionSenderTests.cpp). - Exemple compilé : [AwaitBrowser.cpp (historique 0.3)](https://github.com/ambroise-leclerc/WebFront/blob/30665cab6e1d68636ef160d8c2f34bd29bff601f/src/AwaitBrowser.cpp). diff --git a/docs/adr/ADR-007-frontends-explicites.md b/docs/adr/ADR-007-frontends-explicites.md index e38bef76..58a3a354 100644 --- a/docs/adr/ADR-007-frontends-explicites.md +++ b/docs/adr/ADR-007-frontends-explicites.md @@ -85,8 +85,8 @@ Un frontend indisponible reste déclaré et échoue avec un diagnostic indiquant ## Sources et vérification -- [Contrat](../FRONTENDS.md), [concept](../../include/frontend/Frontend.hpp), +- [Contrat](../FRONTENDS.md), [concept](../../include/webfront/frontend/Frontend.hpp), [configuration](../../cmake/Frontends.cmake). -- Tests : [FrontendContractTests](../../test/FrontendContractTests.cpp), - [frontend scenarios](../../test/frontends/CMakeLists.txt), [webtest](../../webtest/CMakeLists.txt). +- Tests : [FrontendContractTests](../../test/unit/FrontendContractTests.cpp), + [frontend scenarios](../../test/cmake/frontends/CMakeLists.txt), [webtest](../../test/web/CMakeLists.txt). - Voir [ADR-008](ADR-008-contenu-de-confiance-et-origines.md). diff --git a/docs/adr/ADR-008-contenu-de-confiance-et-origines.md b/docs/adr/ADR-008-contenu-de-confiance-et-origines.md index d6f1b3a1..a8e33696 100644 --- a/docs/adr/ADR-008-contenu-de-confiance-et-origines.md +++ b/docs/adr/ADR-008-contenu-de-confiance-et-origines.md @@ -64,7 +64,7 @@ WebFront cible du contenu de confiance, sans TLS ni authentification intégrés. ## Sources et vérification - [Politique et capacités détaillées](../CONTENT_POLICY.md), - [ContentPolicy](../../include/ContentPolicy.hpp). -- Tests : [ContentPolicyTests](../../test/ContentPolicyTests.cpp), - [content-policy-specs](../../webtest/js/content-policy-specs.mjs). + [ContentPolicy](../../include/webfront/ContentPolicy.hpp). +- Tests : [ContentPolicyTests](../../test/unit/ContentPolicyTests.cpp), + [content-policy-specs](../../test/web/js/content-policy-specs.mjs). - Voir [ADR-007](ADR-007-frontends-explicites.md) et [ADR-010](ADR-010-composants-et-outils-optionnels.md). diff --git a/docs/adr/ADR-009-modules-et-assets-reproductibles.md b/docs/adr/ADR-009-modules-et-assets-reproductibles.md index 53491ef4..117c4ddc 100644 --- a/docs/adr/ADR-009-modules-et-assets-reproductibles.md +++ b/docs/adr/ADR-009-modules-et-assets-reproductibles.md @@ -32,7 +32,7 @@ locaux servent les ressources. React, Babel, Jasmine et xterm sont distribués a et licences traçables ; React partage un environnement ESM local pour DOM, hooks et JSX. Les sources lisibles résident dans `src/` et `third_party/` ; les en-têtes générés sont versionnés. -La maintenance utilise `tools/assets/`, les versions exactes et le lockfile. Les distributions +La maintenance utilise `js/developer/vendor/`, les versions exactes et le lockfile. Les distributions JS/CSS volumineuses sont compressées avec le fflate vendored, paramètres fixes dont `mtime=0`. Les petits scripts du bridge et des composants restent en identity. Les contrôles CTest régénèrent et comparent hors ligne après configuration des dépendances. @@ -71,7 +71,7 @@ un échec de décodage ou dépassement du budget donne 500. ## Sources et vérification - [Maintenance des assets](../EMBEDDED_ASSETS.md), [contrat HTTP](../HTTP_ASSETS.md), - [génération](../../cmake/WebFrontAssets.cmake). -- Tests : `Asset.*Fresh`, `EmbeddedGzipContents`, [HTTPEncodingTests](../../test/HTTPEncodingTests.cpp), - [React dans le navigateur](../../webtest/js/react-demo-specs.mjs). + [génération](../../js/core/WebFrontAssets.cmake). +- Tests : `Asset.*Fresh`, `EmbeddedGzipContents`, [HTTPEncodingTests](../../test/unit/HTTPEncodingTests.cpp), + [React dans le navigateur](../../test/web/js/react-demo-specs.mjs). - Voir [ADR-002](ADR-002-systemes-de-fichiers-composables.md). diff --git a/docs/adr/ADR-010-composants-et-outils-optionnels.md b/docs/adr/ADR-010-composants-et-outils-optionnels.md index c1ef71fb..bdbe6adf 100644 --- a/docs/adr/ADR-010-composants-et-outils-optionnels.md +++ b/docs/adr/ADR-010-composants-et-outils-optionnels.md @@ -26,7 +26,7 @@ outils web distribués par npm. ## Décision -Que chaque composant réunisse une façade C++ sous `include/components/`, un fournisseur de +Que chaque composant réunisse une façade C++ sous `include/webfront/components/`, un fournisseur de ressources embarquées, un module ES exportant `mount(element, options)` et les types du pont. Les noms de callbacks utilisent `webfront..`. Les assets sont optionnels, absents de `WebFront` tant que les providers correspondants ne sont pas sélectionnés. @@ -79,7 +79,7 @@ l’autorité du bridge de l’application ; c’est une fonction de développem ## Sources et vérification - [Architecture des composants et limites](../UI_COMPONENTS.md), - [Terminal](../../include/components/Terminal.hpp), [ToolManager](../../include/components/ToolManager.hpp). -- Tests : [UISubscribersTests](../../test/UISubscribersTests.cpp), - [ToolStoreTests](../../test/ToolStoreTests.cpp), [tools-specs](../../webtest/js/tools-specs.mjs). + [Terminal](../../include/webfront/components/Terminal.hpp), [ToolManager](../../include/webfront/components/ToolManager.hpp). +- Tests : [UISubscribersTests](../../test/unit/UISubscribersTests.cpp), + [ToolStoreTests](../../test/unit/ToolStoreTests.cpp), [tools-specs](../../test/web/js/tools-specs.mjs). - Voir [ADR-002](ADR-002-systemes-de-fichiers-composables.md) et [ADR-008](ADR-008-contenu-de-confiance-et-origines.md). diff --git a/docs/adr/ADR-011-diagnostics-optionnels.md b/docs/adr/ADR-011-diagnostics-optionnels.md index 62a88f42..582aebd5 100644 --- a/docs/adr/ADR-011-diagnostics-optionnels.md +++ b/docs/adr/ADR-011-diagnostics-optionnels.md @@ -25,7 +25,7 @@ sans que ses contraintes de modules C++ gagnent les applications clientes. Que `WEBFRONT_USE_MDDLOG=OFF` demeure le réglage par défaut. `tooling/Logger.hpp` est l’entrée commune ; l’option activée sélectionne la façade et lie l’adaptateur statique `WebFront_mddlog` (`WebFront::mddlog`). -`logging/Logger.cpp` est la seule unité consommatrice des modules. Les consommateurs incluent +`cmake/mddlog/Logger.cpp` est la seule unité consommatrice des modules. Les consommateurs incluent des en-têtes et n’importent pas les modules mddlog. L’option et les contraintes de toolchain sont cohérentes dans toutes les unités de traduction. @@ -67,7 +67,7 @@ sans promesse de persistance d’audit ou de livraison garantie. ## Sources et vérification - [Contrat et matrice mddlog](../mddlog-integration.md), - [façade](../../include/tooling/Logger.hpp), [adaptateur](../../logging/Logger.cpp). -- Tests : [LoggerTests](../../test/LoggerTests.cpp), [MddlogLoggerTests](../../test/MddlogLoggerTests.cpp), - [MddlogTransportTests](../../test/MddlogTransportTests.cpp). + [façade](../../include/webfront/tooling/Logger.hpp), [adaptateur](../../cmake/mddlog/Logger.cpp). +- Tests : [LoggerTests](../../test/unit/LoggerTests.cpp), [MddlogLoggerTests](../../test/unit/MddlogLoggerTests.cpp), + [MddlogTransportTests](../../test/unit/MddlogTransportTests.cpp). - Voir [ADR-001](ADR-001-coeur-cpp23-header-only.md) et [ADR-006](ADR-006-taches-structurees-et-arret.md). diff --git a/docs/adr/ADR-012-preuves-et-tests.md b/docs/adr/ADR-012-preuves-et-tests.md index ec66e3b8..4f2c894b 100644 --- a/docs/adr/ADR-012-preuves-et-tests.md +++ b/docs/adr/ADR-012-preuves-et-tests.md @@ -27,7 +27,7 @@ comme sous-projet constituent elles aussi des contrats observables. ## Décision Que Catch2, sous `test/`, vérifie unités, états et erreurs à l’aide de simulacres déterministes. -Jasmine sous `webtest/` exécute les modules dans un vrai moteur, attend le reporting vers +Jasmine sous `test/web/` exécute les modules dans un vrai moteur, attend le reporting vers C++, se ferme et fournit un statut de processus significatif. CTest borne les tests par des timeouts. La CI Linux utilise CEF/Xvfb ; les moteurs natifs ont leurs suites de cycle de vie lorsque configurés. @@ -71,7 +71,7 @@ préexistant, ni d’une intervention humaine, ni du réseau public après confi ## Sources et vérification - [Guide contributeur](../../AGENTS.md), [CI](../../.github/workflows/BuildAndTest.yml), - [CMake des tests](../../test/CMakeLists.txt), [runner navigateur](../../webtest/CMakeLists.txt). + [CMake des tests](../../test/unit/CMakeLists.txt), [runner navigateur](../../test/web/CMakeLists.txt). - Commandes de référence : [README](../../README.md) et [frontends](../FRONTENDS.md). - Toute nouvelle architecture doit préciser ses preuves attendues, ses échecs observables et les limites encore ouvertes dans [PROJECT_STATUS](../PROJECT_STATUS.md). diff --git a/docs/adr/README.md b/docs/adr/README.md index 17978706..581d622e 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -109,6 +109,6 @@ Keep previous rows and update the current version in the index. ## Chemins depuis la version 0.4 -Les exemples publics résident dans `examples/` et les ressources web lisibles dans `assets/`. +Les exemples publics résident dans `examples/` et les ressources web lisibles dans `js/`. Les mentions de `src/` dans les décisions précédentes décrivent l’ancienne organisation ; elles ne changent pas les contrats. Les démonstrations supprimées restent consultables dans l’historique Git. diff --git a/docs/mddlog-integration.md b/docs/mddlog-integration.md index b6816293..728379fc 100644 --- a/docs/mddlog-integration.md +++ b/docs/mddlog-integration.md @@ -4,8 +4,8 @@ header-only and builds with CMake 3.31, its usual compilers and generators. It neither searches for mddlog nor selects CMake's experimental `import std` gate. -With `ON`, WebFront owns `include/tooling/MddlogLogger.hpp`, the shared declarations -in `include/tooling/LoggerApi.hpp`, and `logging/Logger.cpp`. `tooling/Logger.hpp` +With `ON`, WebFront owns `include/webfront/tooling/MddlogLogger.hpp`, the shared declarations +in `include/webfront/tooling/LoggerApi.hpp`, and `cmake/mddlog/Logger.cpp`. `tooling/Logger.hpp` selects the facade through the `WEBFRONT_USE_MDDLOG=1` definition supplied by the `WebFront` target. The `WebFront_mddlog` static library (`WebFront::mddlog`) compiles the sole module-consuming translation unit. Linking `WebFront` supplies the definition diff --git a/tools/docs/render-life-bootstrap.py b/docs/tools/render-life-bootstrap.py similarity index 100% rename from tools/docs/render-life-bootstrap.py rename to docs/tools/render-life-bootstrap.py diff --git a/examples/hello-world/HelloWorld.cpp b/examples/hello-world/HelloWorld.cpp index 0a90ed71..aaa55a73 100644 --- a/examples/hello-world/HelloWorld.cpp +++ b/examples/hello-world/HelloWorld.cpp @@ -1,4 +1,4 @@ -#include +#include // Switching to an embedded Chromium window only changes this alias (CEF must be enabled at // configure time with -DWEBFRONT_EMBED_CEF=ON): diff --git a/examples/life/LifeDeveloper.cpp b/examples/life/LifeDeveloper.cpp index 7bc2c8d6..2def185f 100644 --- a/examples/life/LifeDeveloper.cpp +++ b/examples/life/LifeDeveloper.cpp @@ -1,5 +1,5 @@ #include "Life.hpp" -#include +#include #include diff --git a/examples/life/LifeEmbedded.cpp b/examples/life/LifeEmbedded.cpp index fb5f4b80..66c65cee 100644 --- a/examples/life/LifeEmbedded.cpp +++ b/examples/life/LifeEmbedded.cpp @@ -1,4 +1,4 @@ -#include +#include #include WEBFRONT_LIFE_ASSETS_HEADER #include "Life.hpp" diff --git a/include/WebFront220128.hpp.gz b/include/WebFront220128.hpp.gz deleted file mode 100644 index 621b1ca9508a1c40a59041464947b975749f7785..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12745 zcmV;)F*eR0iwFptZ|h?K16O5YMsja%bTTq9F)}zVXmD@<+&%kq+eVMScc%Zte!2M^ zDwZFT9XFL_^%TcxJ@q4FDb3yVavDlp+5Ae8I+C)JbNs&_fPHXxNy@V0Hl0&vVsal? z0E@)}SS-7>wZ;BD@N>@EFSoW^TkY+3o3-{j+uNO&FTek83#m~nQ( zClOC4vUZ$?e98vNjI)^MH%a@=DDVS<98!#L+@>_;q|%_BbJaqj0~5`X{Qzs*zsa^|xnp78I# zgZFS605+o!$7efjdX4d&UPmWK{j*X3?9J#D9-tCx!kE`o@;C^m1%$Kn)8n(#{(ltR zj1t{8oB4G7smXSfY+R0fM|J95>ms4_SM()82%aXAOiL zW!!||r*nS`M$a9{lPnLQk6V@k|Ex0T8H}C2+2?F418hq`u_FIG=b2N!h(j1o6c%hE zzK{Cv-kltcMo_|-?tnl>dFqFG27O|G#q%9_SIF9&enkF-Lzye;Bb%#B+w#LG2WH-I;0$hXzFnjwo1MA24 zfU7a&HBSW;5ZeO@TbB{!_cUtC|7Q`VJoEe@7^T;KwBVzZPkG7#)F?;XytTaHH5%*| zH~@k?8BP2w@4oMOIh5|RI}0^hNo-hC}a99MxE8)`8-6f&AD|C#|?}a8z{m&&G2ujFSVRJvW3(7k28Zb`M-aWvt z(j-pq1C=jed$LOSr#VkU+OeW7(7yIC(PfgtM9=J@1Y1Tf(K>>h$E z8m&fg1v{sUc!C?RA6dmSkipdMojIhI@CvK2FJmzd^ZS{z$}Eeb(RIjgR=}frVk*E+ z!-&H^3G2fyt^iuYyeOIYj?h%_GnrR(P5CANw4CiLiF+jvT+Z7JG`H~^K88gc=eU;_ zrG^D(?D2;3G`82b+|L)Fq>LR6JE00I+IKqr3ARqs{c_b&9Ly6i6Dz8YlS4p`f2yjx z;8_yECQwl|Ad{$~;t=)O>&0|h+3j?ZqxRDELVp%)8B>KOPpDI?ld768#!)!wh!^}> zt-J<{6aIWdz0r{HcVD zO%33poe95y2&jp@NrSnCX@v=n6*SmZijKy}%X{L$R!@thHI{&?^+7z=4?GDoHb}WG z`Wd4p(Vn7C8p{3Enz-M7y7)z}Y?*AbPJx`HP+>>lm|7_ z@~bd2s_syVNGj6s8rD(AWxV37!B=BiZCZp(7UE|}bgl3iZ5}LoW?wPCPcMGuF&ya_ zHw;54uWKNJTXZW34KnsIfYCtQEZ) z6)VDeDheu$G!1&tyPv;9=B)*d-v=M7m6OD0nAoNW$itwa*6f23sb$fs$e0_)*P&9$ z6Jj~}H5f`5^wwDLFz)Edds-$Lcu9V(hMmPOja#5L&lOPA&;1B|pH*2X+!hMpQMbqQ z@u_gFmApsdyE13%@IAcpQxoSQMO+`t@G)*!BjNRRC1?flaZ|7sY?7b&7m&4lZk~cP zbGDw8u+>(sNdo!gHXXe`U)mnIHB|3aB?M(Rg&=NJ>;-jArrz+Y@VkG<`1Uxix|Mu; zOdqnf{4KFH^uo8}?UU_^e;1@5ygB}5h<}4!@+oK|*ni{g@^3)nQ|+985-E0MqdFj7 zD|480%~*%Uizu4ssk2`0?zMsInQGe*Qqw;o~iJVIBhry$I#IX4LJ!d##D@xBw}G4=Aj<}-=M2kEv_F1{Wtw#pWS5sD6oTP zA<%^&Mszq0+=RA++)wkx+&k_6di3G^;*HmCvNj0!n(E)!FU_b4MD#pHL!*IrvMJ^`pXn1^j^yd6MsIm{q zA_`tdm`Ek6KAgWldGq=NP&I=8rXWqCB;$e)p1~kNYE@K;I*4jdwfe__$s0GAu=uKlG5p%|isgT^aNjmfMQ=Vo1CHLN*U!3-b zqtl}SFzIO2KY@Ad506H#-@ko(biuwbr@`Bc^V8AbKL^93({knU&u8Zs@aJrBbb;A+ zS^-N+wwrdmzV4TDO3DM8b8%2`@@_a7Ui7>*MO_1dDfp(+2&c>wq&D2M3t|HS800CP z2A4)Tq*3%B&hdgdSt-vJQSK>l%>wYcWVPG-1kd8%rkvNpN8BBGAt}R=Hp4jMY3^;y zKx>{zGs7d^;*rU-&a;Mf%ws4~0mMENahe#^c_lN+)KmP^JQd8$6R9Lji%w*-U?_N! z!ZL=MAY-JztCqTX926z-WzVCgo0DXLF%P!ITHD*(f-cl9GHcOQG4*?u8VJ{myZV-G z8ZPPoFLVUW8dm`5G%lrADMh8TFH6{qjz1YdI_%jqcLhGB6jw>`%5qsRk&6MJRNFK; z^aUZLzW@V4{f07mYszZCClMO5o@@=YT#o>Dqvs)HM}FbAXsn|A?j2%LF~&cOF^Ub? zV4X|I{RXgQ2NkA{YXsqj9PxPcP*Z55wVL@u?N%{+etAC}U6^JM7JRsHY#!0-!^LV= z&r$#9{_&Y(?|ikfqcsAECAM7AzCqs9nK!U>;)FV=Y)0j!$b8DfcLI?N)~Yc6UC*Z5 zt2r|!PpB#_$*Okqk`x9H_mQ@WD+7DQm4Q}g=T&EW`>_s`W`lVbpq>|`GtAt|P6r^u zd?6D?V|iF#*J>tsA=}mQRb`uz3a$ne&SAk%;2+=4OcMZ9PTDE}xShWy0O-uMWe^ff zur<=#L|2vAw#wM4odjp9msPrFW}@8Ji6p6ZHwK|E0F=Fne)c(@knZrX#o8LS_2H?3 zY0O$V*OB03_t6dYr#9fB-}q_JrQtjR1P~ilL5#13d2f(w3E7XQ_-ScR$g-P5WCn;=xOGJ?jlTIg5Jx0FhVkQDTQrUftHY@ZMU1|Eu6#J8` zqOBJ=i7&QDuE+>4$we`_U$vEB3N;(RoRV*lZeGpj@@kpbWZGYIFRjlq4S6Hr#S2B_ z^lXBKdF98KJYxweO&@E7UMt@*s}_a|29&A%g@1apn9T)=t8SHxJd83i#PTd^oen0_ ze8jyBym0a5i**e|FY#QS`|hh(ari4=hnvjgX_;uv|)x1X!YR`Dl8fbdp@o&MSL zO7R#sJyfE)DM0Bg+tp%9^5?*i$+P-+K=YXlCZ5Whg%$kobYznr>=EMLC<$}Jq8h;> z&BQv-8dSBrxx&@!DYkZHp0c441%H9DH{PoTKB~6snjA-ZioU3cJVGUm1DK%$)p=hQ zn9y2#`)qxk%1hBRbn8Wrf3jB;iEl{6p0no_fh+}`s3}j8?y5;^6KU&$N550|j}F`- z_EQG+44$6Z0WOz=&+Ha|0&6NJPyJ}1iJ$6h-f9vHY&~q;Wjk&56MMe-9Q2Mk1{7j_ z2dmsT;@xsC{8wypL6dlZG+HNiqCM1dFnqFUhUJdDPE#_6n+PeUFB>w4%bcjCF9`ZLDNnxfEL6-?c7 zQpxK${Xv+`@%$_RHee$>Gb>!8t6^L~UL6hAy={aGI`u z2-s?;Syup^T|fjXllkXSth=bhIU9s}SNmTrfVKmmT@65^)G|{>EN zR|pTaittdo-D&^O*=;Ykd25WRnA5#UX(s9`OR_jCc~3@NkuI-F)*AG&fQaWR#%fk- z3+>>6Jv~u5^+f<&)RWspt6G?Q*_EI2U^LIuu0s||wS2dBrlL4gae1TVepSPbo*1#@ zdrNGR`BNYRT*~-LxFqu>sPw@KwZpvKURdiXAqcx;qO(f&il(EG9)(yJQsL-e5P;d6^D{M zqravt7D8`(+=5@D;h=ZgAN*Q_Udv*Xgw5vu=P2=m6CS@stFsExB}lcZkRrUS zf%bMs7|6*vnBWyd8Rj&3eXult$4iJG)s@PysqxLO!f7tdyW-e#DY7`Yz&89yP7;CG z*T-055m5IsGr&`8wfDeX$S~Oo{Kqfww1aD%3SREX5}0~fxeJfm;_+n@{15TC*JSNo z@%RHM5ZUdO2Ki$XC@O_y1@%{?UXYCtx>r(C(Uv`EhcSLp?OOpKwe{$ z>1T9Ko%go$zVq?UB}oglWM19mh@=@h?Jcpnj3GAcN_oTQPQ{w3#pIIbZ@~xPHY$!} z50n{gvTNVj{m~VuBBnmJMY-O zT!~eq6!idq`_nTcVrghwV$>h7Q#Gn9T6Goex{4i90S?kK9)Re-E96^oz!v!>-HWxL zx?0M_?x~lG>04u_5bCRGn8K2Ij(Yn!Lp7I)RTSn6aJuM&a&vT2tJDLp`^4T}B9x0kjXSb)qHXd833fl-Xf6 zY14c;Fpy{=vwtupupF~gw$MQ(@^%PLp(YG0Pnu--kA0R}3v!#X=SnTV*dJohy?P$O zu13NTQG1RZOj>13M1GQm2`$|zT1smOrOD7>Vh^{Ngk8jH2@><(6Hpqq)nv#b+6(1* zYAs_G5${a333Bh{%bmSaFxUjE#Rdjn8~6&MJkuv9Dz z#8R;^7E8s#a4Z!IBeGQds*>m*D~PU4U!&zq&VmvnG=U0H8i)D4{sF>}<~G?{mX@If zj!=q}RPA|_t9f+IW3BIS*w&s1?dA&|JF`+N{Va+19Y|yc6^Ht^OHY-a0fcTEk=tzv zo78BO1iEh(TiOI@$DVczbE#vs6RpG_Mh^#bKQ@o_>dx>q|6cS2IQ@m33g9a9t>W`G z)z)CKrrpu(&*~H^V+AZx8QE5*X=avViD&e6G(EjCLTpxB*%m#p6~t3kWvQ+RLk8ZB zS&=21^F?+w8vBz!yxQ(4;yOfZ5!!epKqV5zm2Xv$l>ryuCo)K|T`uF4xKO(qs9rQ8 zK1Ivo4M&kqOJQ5Ff;t_!fljgQP^2C>Eln^K5|g5)uK9^`VgauqGn;vC-6^TXT!N|z zQP2XiM%$c>`DGYWj(8#PrW|6zgrDNakTd*9au|bwhH8aw!1-|ihF!?%YsdkS#KL@2 z_jHXvJVhbSfH9{ny{53uus+OL%z2QpS(0*j(4v*@9MSNW5HC*zO3tM~Oe!2Q2R<$X z!((h7Q0kCW5zek>p6j9qsyf)LE#w(m{Wtj!zvDm0sPos?*+1FtM|UH#mCtMQG~e8x zTq8$ND3!P%P@*?q>g2+^S4|OO*@2gX7n*Wbywn3 zn_N&#pdt+n6SIKUf4aVoCh!ZvrQ&2yz}zo`L^IU_Yxr+v=tcZWhnyUk)z^+J5^eSy zd)-Z#Pp%jyPvy2V0b;-z>0*$d0al~Qp8F)oJ~!Ry86?}8IhB)Ou41q9 z2-d~N(rkK&#h4U*vA)btXIWWE8_aBEigJTOoMwr2&8dtI@fHNcVP+s-C63GIw93Q4 zU&Y!nj(=CgWRA1yM*_rhJjP%%|FOSZN-S`l%A0^F9E%wblVu&%J!t z&5VZGQ7UO{n$&Bf#mLCSUs)8L29Bv|oo6qZSfzmLPri*qW2>+De-cnc-M))ZdZn*glYb^5S{G@I+>!!FZw*ro8C0ulvy67(x%ekjPV1S^&$+P;Y59t=@h}~Ylms4tr zs!}RWO)oS4DH31EXG0fm-;Rz_st5|W_@AAKyM3jDsU%kS?#0Cx`PKF=R+b_+o6?-`wE}9 zcck(9v9pPZ9KI;Iq$3+~kttY+G)KC`3f}BwlP*qBPMA0+D@w{oMEEOK(5A@H0@~~2 zsihRAlCpc%`mx=kRbZ)CEB+$3tR^JXiDIInFVs!rJ#)) zxmaC@gi;XK_Yl|!qct9hkBY@M@ibV@f&{WycpDF!+msiHK5 z3TZ1OPMiJDwR|vsj4Iws4BnSwaEMmNwD^wqu6F| zhx4m8vmsFB-s&>^gJv4Lifo!$a6sQYu}@R=@nU#+D-3Hz#1VW2%=*kaH#_Enhkt|sIA{EoKv4rw~S zPjz*BU)4IvZ7N$|$eQrA1t()xp~}6LVhsRX4w&RjJ8)*~JJW=>n}|hlYK(Yi8t_hr z!n#44xAU`Qaq{7d%TOj{TBJ@&G_5ke|cojh)@jUUy$j z7fi(-1|TmksFztWr*-7Knj-zeUY8p3lhB_(wTu(YSre=q4Og_ zl7t|iRF3fX>&w5D1AFsY6*b!2VxP%2mAs0-9gjar*O4cu z6{NtZPp2(veSR zF+Q*!19p)Ctd|c=7HI^MLz0K24H_hX#fm|#=}6KdMnmZ4nlLL4E}LmZg|Y zl_{`sUtTD;c@5E;*vqLUGM3TM;H zG5AjmK45T!!7&COG5Az2Xggp2J7)hc4E`H~|G}V#!8rzf3qHv!QdYlObS;i#q3iIZZWvS;2wi-7(8I`e;70{XkyU9U>SoI3|28% z!{8+b>lkccuzO7Ac-)kNdgoI z8WoBCrq7@XBGMHcSh4a}*`KlS7m`|je!tDxcY)b8vpuXw1m!=|q#q{(mF0Uwo6- zyQ=+0WLEr5B3+UlOijsWmK>mdr7;UfH-wWzTs8OXgHmYxYHTEDt#WI zs~&QtLZ76!Ekj`V?oCJ%p|o`%%IOBXS3r{FXv>ZL$-@n_k;F$+dv>y-MoKMOMI(h? z(_aGG2+Ar83(`16JBi1}x3!lmtF7fmvj#JHcfYf@v%8K4n%_3ocX#$W`(1o)HkMnf zD=*jZxwE|2>NfWqYWbjt?>Ra?Jy}~hebi~{+yPT|0dsW34as63zJpF_O=jxgM7Wtm zbvmtx|KR9)i4WO8g;E=4WlU&cL4U?!-4(ku7PTXOi`G`E(sz-=XQiFv#q`5isy&>X zvPleyU5oSNcb7R}6)vlhUCNaIRZ+lvE6Xj?x4{I*`ouzX?@{#MN#hhTsot9S)>m&W zd>g2@Wqga(+X}wjpR6}rW^bt>%Jn`PysW|Bg@tM)&1VGmKm>RZt$-NNI3@lsL<>8q zNlC&4*hy+p(t03e+0&+V>qQlUimf;7ikV)iR3HklxqJ#J7LV)ZvAM#Y*G^$hYlc6` z_dpCj@UsgG!{CmD?xhQ&^RI@!`AU+eB|ba!`Lh0h}2Un`6Vfd_o*&&J65esg!X zv)7rUMn8;&&dyq^)7)Dt_D$i19K;Eme0%7P0mi}w{KtjkSNM-a9sr6nP^d<@n(PPS z`}UX4YteFW`{*3qoCV_XJQOROzk{QvC|r`dVDyZIiRa=ClD_E zoJ`M%?+9>?^FJr&Cb?y>bDG8p*3yn1)s`XNjy})xIW2%!+!&b9otSkVQGJqC5_dVc zQj+MV97zyGn2Q+7=&RrvR0KF) znLLrLMSHO@VEP>uv#=et=zyF6rnTs>H|<}+pK%IlhqzaJJOMP-qK}E(Gti=%1bj_@ z0`iYF<2=3VcL_S)_y4U@5@p(K@C1-7@P-l=irnWg+I^98hb@r)(l zqY59)GDJ4*GM`iq3$ZvT$QpOO7*n=-Gv zJ9{O&1R^4@Nax`F`)&t5Ws1mt&nvapecL_mmiUJRk>nLRI6QuH@cxK@N|I4tsl%P) z&g+uZCZf6AG6zS;4jzy|bBlbG=w?N3b4wh5*y(ibiV^7-+IMg3GJ2f2)TO)yh>V%a znsPkBd=sKRp|oj$N*5C!Z!RZ5@NyFHVWT~!%?xhGr+A_ zG$|GGif|P>zF;*G^^S(7;#Jn$PCw+J&tgZpla)MKmWG&42Qd^m8w(;Os8}hz{PiaN zs|v?wrOJ$V-2~bUm$vUFmv|Lv`GZj(hoj3vkvEBs@b;uP#UG`523pa`nF=N5 zChh``aTVKYG-}a#Z=hr-5M?nY8Bh0N%`>3)6?%Vz=4|NFoK7!S8%-??u}`P^v5+96 zb4am?Zk9=mLsLl?y1_6y#m7`kg?-!efTN2|#6wZ`Vv^m??t ziEY^4oDQd>c)J8k_UTx1DN&0B$hag@HG;`+{X+4Oe7N1>*M3YrDnYu1-jf2W}xGp#Lp93JJ)y6!R-o6 z9jZ3+y+t<2Z0Lgddo?)T0v=afvmcMXH8JMR!Ad*O zOCT}NXHIQZqtcN|i*%yp=nl(|znc69e|X7;ubFJSy@A>=@bW9JXL7$EPa}#7Fl-yO)R0rq~CyB=!FWr1q%U2Os;;K1~Yw08Q|+Lti+d$0ymee#Fv}+ zk`=kR43>f3Fqv+Wa3<(2lL=n@MHltAFEIxOVirSVdur*)>7!u21lDH7>IG2<&%GNo z?E?syzX7bON0gehON~v*s6dlVo?Jmv{RSx^Gz(|h*g#dkB-HG zoh%hE?MUDB*Gc#6fAh-AQK{^oo$m{yi{U6vA7DLmjjkuASJ7lVp5izgjQh7ZIedWk ziik90P0Ospz(Vb6DDiwE{`z)@GU4L{PcLsLL+Kp>bv`Jejw<600h%(3hbWa55sPO! zumUVEmF@WY#Sj)irFy+2t|&Dm)@~;^V|Oz`_PuIZyX{NyCe2LQo_(&Yz#-yt%fezL zwZ2@GvldqClXyg0A!n50aZ?7pe$`9Q5EgA<)82^r@)C?$QZcU6kYQkoEj$!MRQ)2h zynNQE7+0I^mj?aY2r%A0SVxH{t`3ktYyjoWRalZkP=^j)(7qW$z0r$lnRfMya^+wKU&#W%4H!i_jB9 zK$}XO9g&$=6FWzngTrE>wYuKj+22`R>~1ty7FS;G?JRDrc6Js!t2?`mz0UgTZnIg+ zwhEoAfvOu3a}c|aXHaL2dNT)oq4gjCImge=>&eMQZ!|)avD?e5Q+|pb9#u&1p5qu{ zk8~mLx51g9!lnSZJRXiy2$JYe_9_fnL(YMoA(ZNTbD~0Fnjnp|Ojoj4xeM z!r2yIR=_=C4EhQ(aoRRyUVJmjJ=;0itO;%W^;IDAzsuH(661kgT5>#RfU%CP)@4PY ztBsslc+bXOL^Agbo^-_dxqHC7tA&Ct>Gz5|dbm5BplxuVSf))dE(>utM)5++{MV8} zrQf6s5mcng&!EfhTFfLOb{7zjQh6X$`O+fe)g8x8&q|8GZoS< z-#pW2R`R>s(u1c}Afi3*nhgc@Y^??;B^Jz!LL#OI&Zwl1G$pjWp!^F9H3tFae9Ddw zkzw8$6;ln6-lt4)hQgW~%OXIIW^Z@m=>D}Ib=(ZZwfwk4Kk5i7c;!cv>VR86o)(Bk zm4d7yn8u=$_#X9hc(uiR@)lxU7&7HP_2TI8jnOG8n(W3G<4Md!ORtn0D=X9Tqn2go zva^TS@(ZSxN&!ky#DEGlKn2O=BGl`;H^u88MPYI7^8^E7 zd08p9fRc2U3~G{s6W3i84IVkk zV`4z2#PZ5LLXg*GN-%-lTzy@ozf|>|u5L-nc9u^09=)*ho;E}LW942M=;VyY_ zjkHr0gU(f=6jmB;3JNtMrC^23ciLv6q6y!fgm{7MIt8O&M9l_y-p2NlgNga-=MJ_y z47Tu4GZJ6^$gqcq7<0VU)gNu&9ABSrco)T+MnoP*%I#=`5UN22%>|8txuo!U z;?sf><$pE_{BT1vzy5PcK(*hWXFexpqH$I?1?DiPM6fG79;ntW1$khwW1bPp&F&7J z)quch@n4c0Ol79!YM?fH;r2t-`5qDGyP3FG1;Nl2It)`+_6llpmKi9mN=hOD2_T3c zT*MX;4m38~b5KHSF4UXBncLO5&I>aD{v;vG>X{%qX>}j$6grmpF1gHflsgRDA>4=e zA?6zd|62MFkbXX8&&FXGDgLY(xs&E6VeVCM!jw>d*%0|*#zxz4ABUlG!>S<{Y-5FMLzLIK#L0>`ex#@?j!;brF{4 zsfuKkle^AJO@w_f(;cSmBHujQKJuleNzKtbp>{sk{yR-a1U%|v1X|=Vs1^SUkYQpg zw;1Q3d_Rf1lzkuHGpK=EW`EduzSWBX7pEcYqSw?!p5DLmj|S$uA;Bdrt8;?-MY3yb zWWHi85Z*g*e^I$pKj*I0?bD|Tf73a_S|{w#LmkHhUh%N2Mxnq7UBF>(n@}5=x`Z-x z0`gXI?KT#F<(y^xa<}N`{{oljawpW-l7&vyaW1xTli>z?I(f)ameClSXoC!^uchnr zbH~{^e}z?;*Vr6x$8-rYRe01-QI@HdB;>lSuBLPoq}ItSW-G36n3YRZG;s9J&)$6n zqG~qjYRb>~a*hDvU*qiKE60U=2IPKEDoi6|3GmwIxxK`C=tmUp++ThVWwgZC%TPbZ zo4R5gjKdGpC>clS11%=+l<30*wG~;@>+m*Sxv(!ktWB zECuIIGs-fDS&(vrqf;}YKsRbG?z`{)PLKF{>X+Ony}F$a#`j5u$pWZLCt}ae$J47U zMaTlgGn-bNs{2m!vjk=3ZVqo;LS;Zw$=#1(=tJZt7p9NUBebu@!Y%>O4%ew%?mbWf zn4Gf2i!VRRcu#iD%CDtn3Ei_Z=nV$Ysx)Bzc>{>9W$PJ{%J5cHLjC1-)FU0tF|6jt zq$%}n>dU;ckVU_?zz7rScyvdSnRsB}US$>PCWD(XdVz@5!&dY{0jSG|if$)1tLiw6 z#h+?H9lg|76s)=$SoVCOGpF(NOep*~;_{BnfivrE8lTDUi%Y|Upw3YrTzxl~V>E;= z2-Vv6L?Oh;+k~Wljl?>|*lPrcI!Iza-`O}}ONAUM|BWhT%D)QbQy9_hDX=0awjl7= z1FU@tLl$#T7!?w-%p$c4LUVc1dl&RPsJ}2w&xoM3@|80~NjHA?jB5w3TyXIcx^sb{ z${l*{v}k>Aaa;2Oqgs*KV5AdvTZ4N+g}XBL{qkuxVNc+=jJ2xe*4d$SqV_P^OQ#b> z_6ex_ink}8%Dd`=7gFG9PJz29lm_>#t0*!U6tMTZAzFYdCbZj2hy9OlY%ia>1&338 zuSM6xZ)7bm6Bj7u$!DMv5dr5V^KdfLu1cveQ`B0z}TOb2xC-WrQa>_B7KmOkhRsd{99X1?0^| zG_@DFyJ&G+h~cGUXfrM(t{=4g>{%*2`Re%Lb_prlYhCc#aJushR{f*h`BIp=1s6vnBf=Pl{Q#CND`MN7JV{@haGSEE8!5buzHf+{xPi`V_3 zeq)i(<7k@m+fXELookcTAxvSoK^@_I&>s!aRRc{$ - -namespace webfront::developer::release { -inline constexpr std::string_view version{"0.4.0"}; -inline constexpr std::string_view environment{"https://ambroise-leclerc.github.io/WebFront/developer/0.4.0/environment.tgz"}; -inline constexpr std::string_view integrity{"sha512-CElEaA68ASX+2Wsq6Z8Ax0jxMFEHLqsAJ1xQk4URRClXWLVywsQ5EBW4dFCJXdkGQVeZWzJvHE5uhhHBHbxEfw=="}; -} // namespace webfront::developer::release diff --git a/include/system/TerminalModuleData.hpp b/include/system/TerminalModuleData.hpp deleted file mode 100644 index a6741acc..00000000 --- a/include/system/TerminalModuleData.hpp +++ /dev/null @@ -1,343 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace webfront::fs::generated { - -struct TerminalModuleData { - static constexpr std::string_view encoding{}; - static constexpr std::size_t dataSize{13028}; - static constexpr std::array data{ - 0x2f2f2f2040627269, 0x6566205765624672, 0x6f6e74207465726d, 0x696e616c20636f6d, 0x706f6e656e743a20, - 0x616e20787465726d, 0x2e6a73207465726d, 0x696e616c2077686f, 0x7365206c696e6520, 0x656469746f722073, - 0x656e647320656163, 0x682076616c696461, 0x7465640a2f2f2f20, 0x6c696e6520746f20, 0x74686520432b2b20, - 0x636f6d6d616e6473, 0x2072656769737465, 0x726564207468726f, 0x7567682077656266, 0x726f6e743a3a5465, - 0x726d696e616c2028, 0x696e636c7564652f, 0x636f6d706f6e656e, 0x74732f5465726d69, 0x6e616c2e68707029, - 0x2c0a2f2f2f20756e, 0x6c65737320612062, 0x726f777365722063, 0x6f6d6d616e64206f, 0x6620616e20657874, - 0x656e73696f6e206d, 0x6f64756c65202854, 0x65726d696e616c3a, 0x3a657874656e7369, 0x6f6e292068616e64, - 0x6c65732069742066, 0x697273742e0a0a69, 0x6d706f7274207b54, 0x65726d696e616c7d, 0x2066726f6d20222e, - 0x2f787465726d2e6d, 0x6a73223b0a696d70, 0x6f7274207b466974, 0x4164646f6e7d2066, 0x726f6d20222e2f61, - 0x64646f6e2d666974, 0x2e6d6a73223b0a0a, 0x636f6e737420616e, 0x7369203d207b0a20, 0x2020207265643a20, - 0x287465787429203d, 0x3e20605c7831625b, 0x33316d247b746578, 0x747d5c7831625b30, 0x6d602c0a20202020, - 0x636c656172546f45, 0x6e643a20225c7831, 0x625b4b222c0a2020, 0x2020636c65617253, 0x637265656e3a2022, - 0x5c7831625b324a5c, 0x7831625b334a5c78, 0x31625b48222c0a20, 0x2020206c6566743a, 0x2028636f756e7429, - 0x203d3e2028636f75, 0x6e74203e2030203f, 0x20605c7831625b24, 0x7b636f756e747d44, 0x60203a202222292c, - 0x0a7d3b0a0a66756e, 0x6374696f6e20636f, 0x6d6d6f6e50726566, 0x697828776f726473, 0x29207b0a20202020, - 0x72657475726e2077, 0x6f7264732e726564, 0x7563652828707265, 0x6669782c20776f72, 0x6429203d3e207b0a, - 0x2020202020202020, 0x636f6e7374206c69, 0x6d6974203d204d61, 0x74682e6d696e2870, 0x72656669782e6c65, - 0x6e6774682c20776f, 0x72642e6c656e6774, 0x68293b0a20202020, 0x202020206c657420, 0x6c656e677468203d, - 0x20303b0a20202020, 0x202020207768696c, 0x6520286c656e6774, 0x68203c206c696d69, 0x7420262620707265, - 0x6669785b6c656e67, 0x74685d203d3d3d20, 0x776f72645b6c656e, 0x6774685d290a2020, 0x2020202020202020, - 0x20202b2b6c656e67, 0x74683b0a20202020, 0x2020202072657475, 0x726e207072656669, 0x782e736c69636528, - 0x302c206c656e6774, 0x68293b0a20202020, 0x7d293b0a7d0a0a2f, 0x2f20526561647320, 0x61206c696e652066, - 0x6f7220746f6b656e, 0x697a6528292c206f, 0x6e6520776f726420, 0x7061727420617420, 0x612074696d652e0a, - 0x636c617373205363, 0x616e6e6572207b0a, 0x20202020636f6e73, 0x74727563746f7228, 0x6c696e6529207b0a, - 0x2020202020202020, 0x746869732e6c696e, 0x65203d206c696e65, 0x3b0a202020202020, 0x2020746869732e69, - 0x6e646578203d2030, 0x3b0a202020207d0a, 0x0a20202020676574, 0x20646f6e65282920, 0x7b0a202020202020, - 0x202072657475726e, 0x20746869732e696e, 0x646578203d3d3d20, 0x746869732e6c696e, 0x652e6c656e677468, - 0x3b0a202020207d0a, 0x0a202020206e6578, 0x742870726f626c65, 0x6d29207b0a202020, 0x2020202020696620, - 0x28746869732e646f, 0x6e65290a20202020, 0x2020202020202020, 0x7468726f77206e65, 0x772053796e746178, - 0x4572726f72287072, 0x6f626c656d293b0a, 0x2020202020202020, 0x72657475726e2074, 0x6869732e6c696e65, - 0x5b746869732e696e, 0x6465782b2b5d3b0a, 0x202020207d0a0a20, 0x2020202f2f205468, 0x6520636f6e74656e, - 0x74206f6620612071, 0x756f746564207374, 0x72696e672077686f, 0x7365206f70656e69, 0x6e672071756f7465, - 0x2077617320726561, 0x642e20496e736964, 0x6520646f75626c65, 0x2071756f74657320, 0x61206261636b736c, - 0x6173680a20202020, 0x2f2f206573636170, 0x657320746865206e, 0x6578742063686172, 0x61637465723b206f, - 0x6e6520656e64696e, 0x6720746865206c69, 0x6e65207374617973, 0x206c69746572616c, 0x2c20616e64207468, - 0x65206d697373696e, 0x6720636c6f73696e, 0x672071756f74650a, 0x202020202f2f2069, 0x73207265706f7274, - 0x6564206e6578742e, 0x0a2020202071756f, 0x7465642871756f74, 0x6529207b0a202020, 0x20202020206c6574, - 0x20636f6e74656e74, 0x203d2022223b0a20, 0x2020202020202066, 0x6f7220286c657420, 0x63686172203d2074, - 0x6869732e6e657874, 0x2822556e7465726d, 0x696e617465642071, 0x756f746522293b20, 0x6368617220213d3d, - 0x2071756f74653b20, 0x63686172203d2074, 0x6869732e6e657874, 0x2822556e7465726d, 0x696e617465642071, - 0x756f74652229290a, 0x2020202020202020, 0x20202020636f6e74, 0x656e74202b3d2071, 0x756f7465203d3d3d, - 0x2027222720262620, 0x63686172203d3d3d, 0x20225c5c22202626, 0x2021746869732e64, 0x6f6e65203f207468, - 0x69732e6e65787428, 0x29203a2063686172, 0x3b0a202020202020, 0x202072657475726e, 0x20636f6e74656e74, - 0x3b0a202020207d0a, 0x0a202020202f2f20, 0x5768617420606368, 0x6172602c20726561, 0x64206f7574736964, - 0x652071756f746573, 0x2c20616464732074, 0x6f20746865206375, 0x7272656e7420776f, 0x72642e0a20202020, - 0x7061727428636861, 0x7229207b0a202020, 0x2020202020696620, 0x2863686172203d3d, 0x3d20225c5c22290a, - 0x2020202020202020, 0x2020202072657475, 0x726e20746869732e, 0x6e65787428225472, 0x61696c696e672062, - 0x61636b736c617368, 0x22293b0a20202020, 0x2020202069662028, 0x63686172203d3d3d, 0x20222722207c7c20, - 0x63686172203d3d3d, 0x20272227290a2020, 0x2020202020202020, 0x202072657475726e, 0x20746869732e7175, - 0x6f74656428636861, 0x72293b0a20202020, 0x2020202072657475, 0x726e20636861723b, 0x0a202020207d0a7d, - 0x0a0a2f2f2f205370, 0x6c6974732061206c, 0x696e6520696e746f, 0x20776f726473206c, 0x696b65207465726d, - 0x696e616c3a3a746f, 0x6b656e697a652069, 0x6e20432b2b3a2077, 0x6869746573706163, 0x6520736570617261, - 0x74657320776f7264, 0x732c2073696e676c, 0x652071756f746573, 0x0a2f2f2f206b6565, 0x7020746865697220, - 0x636f6e74656e7420, 0x766572626174696d, 0x2c20646f75626c65, 0x2071756f74657320, 0x6b65657020697420, - 0x62757420686f6e6f, 0x72206261636b736c, 0x6173682065736361, 0x7065732c20616e64, 0x20616e20756e7175, - 0x6f7465640a2f2f2f, 0x206261636b736c61, 0x7368206573636170, 0x657320746865206e, 0x6578742063686172, - 0x61637465722e2054, 0x68726f7773206120, 0x53796e7461784572, 0x726f72206f6e2061, 0x6e20756e7465726d, - 0x696e617465642071, 0x756f7465206f7220, 0x6120747261696c69, 0x6e670a2f2f2f2062, 0x61636b736c617368, - 0x2e0a6578706f7274, 0x2066756e6374696f, 0x6e20746f6b656e69, 0x7a65286c696e6529, 0x207b0a2020202063, - 0x6f6e737420776f72, 0x6473203d205b5d3b, 0x0a20202020636f6e, 0x7374207363616e6e, 0x6572203d206e6577, - 0x205363616e6e6572, 0x286c696e65293b0a, 0x202020206c657420, 0x776f7264203d206e, 0x756c6c3b20202f2f, - 0x206e756c6c206265, 0x747765656e20776f, 0x7264730a20202020, 0x7768696c65202821, 0x7363616e6e65722e, - 0x646f6e6529207b0a, 0x2020202020202020, 0x636f6e7374206368, 0x6172203d20736361, 0x6e6e65722e6e6578, - 0x7428293b0a202020, 0x2020202020636f6e, 0x7374207365706172, 0x61746f72203d2063, 0x686172203d3d3d20, - 0x222022207c7c2063, 0x686172203d3d3d20, 0x225c74223b0a2020, 0x2020202020206966, 0x2028736570617261, - 0x746f722026262077, 0x6f726420213d3d20, 0x6e756c6c290a2020, 0x2020202020202020, 0x2020776f7264732e, - 0x7075736828776f72, 0x64293b0a20202020, 0x20202020776f7264, 0x203d207365706172, 0x61746f72203f206e, - 0x756c6c203a202877, 0x6f7264203f3f2022, 0x2229202b20736361, 0x6e6e65722e706172, 0x742863686172293b, - 0x0a202020207d0a20, 0x2020206966202877, 0x6f726420213d3d20, 0x6e756c6c290a2020, 0x202020202020776f, - 0x7264732e70757368, 0x28776f7264293b0a, 0x2020202072657475, 0x726e20776f726473, 0x3b0a7d0a0a2f2f20, - 0x42726f7773657220, 0x636f6d6d616e6420, 0x6f75747075742075, 0x73657320225c6e22, 0x206c696e6520656e, - 0x64696e67732c2063, 0x6f6e766572746564, 0x206c696b6520432b, 0x2b206f7574707574, 0x2e0a636f6e737420, - 0x746f5465726d696e, 0x616c54657874203d, 0x2028746578742920, 0x3d3e20746578742e, 0x7265706c61636528, - 0x2f283f3c215c7229, 0x5c6e2f672c20225c, 0x725c6e22293b0a0a, 0x2f2f2f2052756e73, 0x2061206c696e653a, - 0x20612062726f7773, 0x657220636f6d6d61, 0x6e64206f66206063, 0x6f6d6d616e647360, 0x202861204d617020, - 0x66726f6d20636f6d, 0x6d616e64206e616d, 0x6520746f2068616e, 0x646c657229207768, 0x656e206f6e652069, - 0x730a2f2f2f207265, 0x6769737465726564, 0x20666f7220697473, 0x2066697273742077, 0x6f726420616e6420, - 0x646f6573206e6f74, 0x2072657475726e20, 0x756e646566696e65, 0x642c20656c736520, 0x6072756e496e4370, - 0x70286c696e652960, 0x2e2041206c696e65, 0x20746861740a2f2f, 0x2f2063616e6e6f74, 0x2062652073706c69, - 0x7420676f65732074, 0x6f20432b2b2c2077, 0x6869636820726570, 0x6f72747320746865, 0x206572726f722e20, - 0x42726f7773657220, 0x636f6d6d616e6473, 0x2067657420607369, 0x676e616c602c2077, 0x6869636820437472, - 0x6c2b430a2f2f2f20, 0x61626f7274732077, 0x6974682074686520, 0x726561736f6e2045, 0x72726f722822496e, - 0x7465727275707465, 0x6422293b20612043, 0x2b2b20636f6d6d61, 0x6e642063616e6e6f, 0x7420626520696e74, - 0x6572727570746564, 0x2e0a6578706f7274, 0x206173796e632066, 0x756e6374696f6e20, 0x72756e4c696e6528, - 0x6c696e652c207b63, 0x6f6d6d616e64732c, 0x2072756e496e4370, 0x702c207772697465, 0x2c20627269646765, - 0x2c207369676e616c, 0x203d206e65772041, 0x626f7274436f6e74, 0x726f6c6c65722829, 0x2e7369676e616c7d, - 0x29207b0a20202020, 0x6c657420776f7264, 0x733b0a2020202074, 0x7279207b0a202020, 0x2020202020776f72, - 0x6473203d20746f6b, 0x656e697a65286c69, 0x6e65293b0a202020, 0x207d206361746368, 0x20286572726f7229, - 0x207b0a2020202020, 0x2020207265747572, 0x6e2072756e496e43, 0x7070286c696e6529, 0x3b0a202020207d0a, - 0x20202020636f6e73, 0x742068616e646c65, 0x72203d20776f7264, 0x732e6c656e677468, 0x203e2030203f2063, - 0x6f6d6d616e64732e, 0x67657428776f7264, 0x735b305d29203a20, 0x756e646566696e65, 0x643b0a2020202069, - 0x6620282168616e64, 0x6c6572290a202020, 0x2020202020726574, 0x75726e2072756e49, 0x6e437070286c696e, - 0x65293b0a20202020, 0x636f6e7374206f75, 0x74707574203d2061, 0x776169742068616e, 0x646c657228776f72, - 0x64732e736c696365, 0x2831292c207b0a20, 0x202020202020206c, 0x696e652c0a202020, 0x2020202020627269, - 0x6467652c0a202020, 0x2020202020736967, 0x6e616c2c0a202020, 0x2020202020777269, 0x74653a2028746578, - 0x7429203d3e207772, 0x69746528746f5465, 0x726d696e616c5465, 0x787428537472696e, 0x6728746578742929, - 0x292c0a2020202020, 0x20202072756e496e, 0x4370703a20282920, 0x3d3e2072756e496e, 0x437070286c696e65, - 0x292c0a202020207d, 0x293b0a2020202072, 0x657475726e206f75, 0x74707574203d3d3d, 0x20756e646566696e, - 0x6564203f2072756e, 0x496e437070286c69, 0x6e6529203a20746f, 0x5465726d696e616c, 0x5465787428537472, - 0x696e67286f757470, 0x757429293b0a7d0a, 0x0a2f2f2f20496d70, 0x6f72747320746865, 0x20657874656e7369, - 0x6f6e206d6f64756c, 0x6573206c69737465, 0x6420627920432b2b, 0x2028225c6e222d73, 0x6570617261746564, - 0x2055524c73292061, 0x6e6420636f6c6c65, 0x6374732074686569, 0x722062726f777365, 0x720a2f2f2f20636f, - 0x6d6d616e64732e20, 0x41206d6f64756c65, 0x2074686174206661, 0x696c7320746f206c, 0x6f61642069732072, - 0x65706f7274656420, 0x616e6420736b6970, 0x7065642e0a617379, 0x6e632066756e6374, 0x696f6e206c6f6164, - 0x457874656e73696f, 0x6e732875726c732c, 0x2077726974652920, 0x7b0a20202020636f, 0x6e737420636f6d6d, - 0x616e6473203d206e, 0x6577204d61702829, 0x3b0a20202020666f, 0x722028636f6e7374, 0x2075726c206f6620, - 0x75726c732e73706c, 0x697428225c6e2229, 0x2e66696c74657228, 0x28656e7472792920, 0x3d3e20656e747279, - 0x20213d3d20222229, 0x29207b0a20202020, 0x2020202074727920, 0x7b0a202020202020, 0x202020202020636f, - 0x6e7374206d6f6475, 0x6c65203d20617761, 0x697420696d706f72, 0x742875726c293b0a, 0x2020202020202020, - 0x20202020666f7220, 0x28636f6e7374205b, 0x6e616d652c206861, 0x6e646c65725d206f, 0x66204f626a656374, - 0x2e656e7472696573, 0x286d6f64756c652e, 0x636f6d6d616e6473, 0x203f3f207b7d2929, 0x0a20202020202020, - 0x2020202020202020, 0x20636f6d6d616e64, 0x732e736574286e61, 0x6d652c2068616e64, 0x6c6572293b0a2020, - 0x2020202020207d20, 0x6361746368202865, 0x72726f7229207b0a, 0x2020202020202020, 0x2020202077726974, - 0x6528616e73692e72, 0x656428605465726d, 0x696e616c20657874, 0x656e73696f6e2024, 0x7b75726c7d206661, - 0x696c656420746f20, 0x6c6f61643a20247b, 0x6572726f723f2e6d, 0x657373616765203f, 0x3f206572726f727d, - 0x6029202b20225c72, 0x5c6e22293b0a2020, 0x2020202020207d0a, 0x202020207d0a2020, 0x202072657475726e, - 0x20636f6d6d616e64, 0x733b0a7d0a0a2f2f, 0x2045646974696e67, 0x206b6579732c2061, 0x7320787465726d2e, - 0x6a73207265706f72, 0x7473207468656d20, 0x696e206f6e446174, 0x612c206d61707065, 0x6420746f204c696e, - 0x65456469746f7220, 0x616374696f6e732e, 0x0a636f6e7374206b, 0x6579416374696f6e, 0x73203d206e657720, - 0x4d6170285b0a2020, 0x20205b225c72222c, 0x2028656469746f72, 0x29203d3e20656469, 0x746f722e7375626d, - 0x697428295d2c0a20, 0x2020205b225c7837, 0x66222c2028656469, 0x746f7229203d3e20, 0x656469746f722e65, - 0x72617365282d3129, 0x5d2c0a202020205b, 0x225c62222c202865, 0x6469746f7229203d, 0x3e20656469746f72, - 0x2e6572617365282d, 0x31295d2c0a202020, 0x205b225c7831625b, 0x337e222c20286564, 0x69746f7229203d3e, - 0x20656469746f722e, 0x6572617365283029, 0x5d2c0a202020205b, 0x225c7831625b4422, 0x2c2028656469746f, - 0x7229203d3e206564, 0x69746f722e6d6f76, 0x65546f2865646974, 0x6f722e637572736f, 0x72202d2031295d2c, - 0x0a202020205b225c, 0x7831625b43222c20, 0x28656469746f7229, 0x203d3e2065646974, 0x6f722e6d6f766554, - 0x6f28656469746f72, 0x2e637572736f7220, 0x2b2031295d2c0a20, 0x2020205b225c7831, 0x625b48222c202865, - 0x6469746f7229203d, 0x3e20656469746f72, 0x2e6d6f7665546f28, 0x30295d2c0a202020, 0x205b225c7831624f, - 0x48222c2028656469, 0x746f7229203d3e20, 0x656469746f722e6d, 0x6f7665546f283029, 0x5d2c0a202020205b, - 0x225c783031222c20, 0x28656469746f7229, 0x203d3e2065646974, 0x6f722e6d6f766554, 0x6f2830295d2c0a20, - 0x2020205b225c7831, 0x625b46222c202865, 0x6469746f7229203d, 0x3e20656469746f72, 0x2e6d6f7665546f28, - 0x656469746f722e63, 0x686172732e6c656e, 0x677468295d2c0a20, 0x2020205b225c7831, 0x624f46222c202865, - 0x6469746f7229203d, 0x3e20656469746f72, 0x2e6d6f7665546f28, 0x656469746f722e63, 0x686172732e6c656e, - 0x677468295d2c0a20, 0x2020205b225c7830, 0x35222c2028656469, 0x746f7229203d3e20, 0x656469746f722e6d, - 0x6f7665546f286564, 0x69746f722e636861, 0x72732e6c656e6774, 0x68295d2c0a202020, 0x205b225c7831625b, - 0x41222c2028656469, 0x746f7229203d3e20, 0x656469746f722e72, 0x6563616c6c282d31, 0x295d2c0a20202020, - 0x5b225c7831625b42, 0x222c202865646974, 0x6f7229203d3e2065, 0x6469746f722e7265, 0x63616c6c2831295d, - 0x2c0a202020205b22, 0x5c74222c20286564, 0x69746f7229203d3e, 0x20656469746f722e, 0x747261636b286564, - 0x69746f722e636f6d, 0x706c6574654c696e, 0x652829295d2c0a20, 0x2020205b225c7830, 0x33222c2028656469, - 0x746f7229203d3e20, 0x656469746f722e63, 0x616e63656c4c696e, 0x6528295d2c0a2020, 0x20205b225c783063, - 0x222c202865646974, 0x6f7229203d3e2065, 0x6469746f722e7265, 0x6472617728616e73, 0x692e636c65617253, - 0x637265656e295d2c, 0x0a202020205b225c, 0x783135222c202865, 0x6469746f7229203d, 0x3e20656469746f72, - 0x2e6b696c6c426566, 0x6f7265437572736f, 0x7228295d2c0a5d29, 0x3b0a0a2f2f2f204c, 0x696e652065646974, - 0x6f72206472697665, 0x6e20627920746865, 0x207465726d696e61, 0x6c277320696e7075, 0x7420646174612e20, - 0x6077726974652874, 0x6578742960206469, 0x73706c6179732074, 0x6578743b20607275, 0x6e286c696e652960, - 0x20616e640a2f2f2f, 0x2060636f6d706c65, 0x7465286c696e6529, 0x602072657475726e, 0x2050726f6d697365, - 0x73206f6620746865, 0x20432b2b206f7574, 0x70757420616e6420, 0x6f6620225c6e222d, 0x7365706172617465, - 0x6420636f6d706c65, 0x74696f6e2063616e, 0x646964617465732e, 0x0a6578706f727420, 0x636c617373204c69, - 0x6e65456469746f72, 0x207b0a2020202063, 0x6f6e737472756374, 0x6f72287b77726974, 0x652c2072756e2c20, - 0x636f6d706c657465, 0x2c2070726f6d7074, 0x7d29207b0a202020, 0x2020202020746869, 0x732e777269746520, - 0x3d2077726974653b, 0x0a20202020202020, 0x20746869732e7275, 0x6e203d2072756e3b, 0x0a20202020202020, - 0x20746869732e636f, 0x6d706c657465203d, 0x20636f6d706c6574, 0x653b0a2020202020, 0x202020746869732e, - 0x61626f7274203d20, 0x6e756c6c3b0a2020, 0x2020202020207468, 0x69732e70726f6d70, 0x74203d2070726f6d, - 0x70743b0a20202020, 0x2020202074686973, 0x2e6368617273203d, 0x205b5d3b0a202020, 0x2020202020746869, - 0x732e637572736f72, 0x203d20303b0a2020, 0x2020202020207468, 0x69732e686973746f, 0x7279203d205b5d3b, - 0x0a20202020202020, 0x20746869732e6869, 0x73746f7279496e64, 0x6578203d20303b0a, 0x2020202020202020, - 0x746869732e627573, 0x79203d206e756c6c, 0x3b0a202020207d0a, 0x0a20202020676574, 0x206c696e65282920, - 0x7b0a202020202020, 0x202072657475726e, 0x20746869732e6368, 0x6172732e6a6f696e, 0x282222293b0a2020, - 0x20207d0a0a202020, 0x202f2f2f20526573, 0x6f6c766573206f6e, 0x6365206e6f20636f, 0x6d6d616e64206f72, - 0x20636f6d706c6574, 0x696f6e2069732070, 0x656e64696e672e0a, 0x202020206173796e, 0x63207768656e4964, - 0x6c652829207b0a20, 0x2020202020202077, 0x68696c6520287468, 0x69732e6275737929, 0x0a20202020202020, - 0x2020202020617761, 0x697420746869732e, 0x627573793b0a2020, 0x20207d0a0a202020, 0x2073686f7750726f, - 0x6d70742829207b0a, 0x2020202020202020, 0x746869732e777269, 0x746528746869732e, 0x70726f6d7074293b, - 0x0a202020207d0a0a, 0x2020202068616e64, 0x6c65286461746129, 0x207b0a2020202020, 0x2020206966202874, - 0x6869732e62757379, 0x290a202020202020, 0x2020202020207265, 0x7475726e20746869, 0x732e696e74657272, - 0x7570742864617461, 0x293b0a2020202020, 0x202020636f6e7374, 0x20616374696f6e20, 0x3d206b6579416374, - 0x696f6e732e676574, 0x2864617461293b0a, 0x2020202020202020, 0x6966202861637469, 0x6f6e290a20202020, - 0x2020202020202020, 0x72657475726e2061, 0x6374696f6e287468, 0x6973293b0a202020, 0x2020202020696620, - 0x2821646174612e73, 0x7461727473576974, 0x6828225c78316222, 0x29290a2020202020, 0x2020202020202072, - 0x657475726e207468, 0x69732e696e736572, 0x7454657874286461, 0x7461293b0a202020, 0x207d0a0a20202020, - 0x2f2f205768696c65, 0x206120636f6d6d61, 0x6e642072756e732c, 0x204374726c2b4320, 0x61626f7274732069, - 0x7473207369676e61, 0x6c206f6e63652061, 0x6e6420746865206f, 0x74686572206b6579, 0x7320617265206967, - 0x6e6f7265642e0a20, 0x202020696e746572, 0x7275707428646174, 0x6129207b0a202020, 0x2020202020636f6e, - 0x73742072756e6e69, 0x6e67203d20746869, 0x732e61626f72743f, 0x2e7369676e616c2e, 0x61626f7274656420, - 0x3d3d3d2066616c73, 0x653b0a2020202020, 0x2020206966202864, 0x61746120213d3d20, 0x225c78303322207c, - 0x7c202172756e6e69, 0x6e67290a20202020, 0x2020202020202020, 0x72657475726e3b0a, 0x2020202020202020, - 0x746869732e777269, 0x746528225e435c72, 0x5c6e22293b0a2020, 0x2020202020207468, 0x69732e61626f7274, - 0x2e61626f7274286e, 0x6577204572726f72, 0x2822496e74657272, 0x7570746564222929, 0x3b0a202020207d0a, - 0x0a202020202f2f20, 0x5479706564206f72, 0x2070617374656420, 0x746578743a207072, 0x696e7461626c6520, - 0x6368617261637465, 0x7273206172652069, 0x6e7365727465642c, 0x2061206361727269, 0x6167652072657475, - 0x726e207375626d69, 0x747320746865206c, 0x696e650a20202020, 0x2f2f20616e642074, 0x6865207265737420, - 0x6f662061206d756c, 0x74692d6c696e6520, 0x7061737465206973, 0x2064726f70706564, 0x2c2073696e636520, - 0x636f6d6d616e6473, 0x2072756e206f6e65, 0x2061742061207469, 0x6d652e0a20202020, 0x696e736572745465, - 0x7874286461746129, 0x207b0a2020202020, 0x202020636f6e7374, 0x205b746578742c20, 0x2e2e2e726573745d, - 0x203d20646174612e, 0x73706c697428225c, 0x7222293b0a202020, 0x2020202020746869, 0x732e696e73657274, - 0x2841727261792e66, 0x726f6d2874657874, 0x292e66696c746572, 0x2828636861722920, 0x3d3e206368617220, - 0x3e3d202220222026, 0x2620636861722021, 0x3d3d20225c783766, 0x2229293b0a202020, 0x2020202020696620, - 0x28726573742e6c65, 0x6e677468203e2030, 0x290a202020202020, 0x2020202020207265, 0x7475726e20746869, - 0x732e7375626d6974, 0x28293b0a20202020, 0x7d0a0a2020202069, 0x6e73657274286368, 0x61727329207b0a20, - 0x2020202020202069, 0x6620286368617273, 0x2e6c656e67746820, 0x3d3d3d2030290a20, 0x2020202020202020, - 0x2020207265747572, 0x6e3b0a2020202020, 0x202020746869732e, 0x63686172732e7370, 0x6c69636528746869, - 0x732e637572736f72, 0x2c20302c202e2e2e, 0x6368617273293b0a, 0x2020202020202020, 0x746869732e637572, - 0x736f72202b3d2063, 0x686172732e6c656e, 0x6774683b0a202020, 0x2020202020746869, 0x732e726564726177, - 0x28293b0a20202020, 0x7d0a0a2020202065, 0x72617365286f6666, 0x73657429207b0a20, 0x2020202020202063, - 0x6f6e737420696e64, 0x6578203d20746869, 0x732e637572736f72, 0x202b206f66667365, 0x743b0a2020202020, - 0x2020206966202869, 0x6e646578203c2030, 0x207c7c20696e6465, 0x78203e3d20746869, 0x732e63686172732e, - 0x6c656e677468290a, 0x2020202020202020, 0x2020202072657475, 0x726e3b0a20202020, 0x2020202074686973, - 0x2e63686172732e73, 0x706c69636528696e, 0x6465782c2031293b, 0x0a20202020202020, 0x20746869732e6375, - 0x72736f72203d2069, 0x6e6465783b0a2020, 0x2020202020207468, 0x69732e7265647261, 0x7728293b0a202020, - 0x207d0a0a20202020, 0x6b696c6c4265666f, 0x7265437572736f72, 0x2829207b0a202020, 0x2020202020746869, - 0x732e63686172732e, 0x73706c6963652830, 0x2c20746869732e63, 0x7572736f72293b0a, 0x2020202020202020, - 0x746869732e637572, 0x736f72203d20303b, 0x0a20202020202020, 0x20746869732e7265, 0x6472617728293b0a, - 0x202020207d0a0a20, 0x2020206d6f766554, 0x6f28706f73697469, 0x6f6e29207b0a2020, 0x202020202020636f, - 0x6e73742063757273, 0x6f72203d204d6174, 0x682e6d617828302c, 0x204d6174682e6d69, 0x6e28746869732e63, - 0x686172732e6c656e, 0x6774682c20706f73, 0x6974696f6e29293b, 0x0a20202020202020, 0x2069662028637572, - 0x736f72203d3d3d20, 0x746869732e637572, 0x736f72290a202020, 0x2020202020202020, 0x2072657475726e3b, - 0x0a20202020202020, 0x20746869732e6375, 0x72736f72203d2063, 0x7572736f723b0a20, 0x2020202020202074, - 0x6869732e72656472, 0x617728293b0a2020, 0x20207d0a0a202020, 0x20726563616c6c28, 0x646972656374696f, - 0x6e29207b0a202020, 0x2020202020636f6e, 0x737420696e646578, 0x203d20746869732e, 0x686973746f727949, - 0x6e646578202b2064, 0x6972656374696f6e, 0x3b0a202020202020, 0x202069662028696e, 0x646578203c203020, - 0x7c7c20696e646578, 0x203e20746869732e, 0x686973746f72792e, 0x6c656e677468290a, 0x2020202020202020, - 0x2020202072657475, 0x726e3b0a20202020, 0x2020202074686973, 0x2e686973746f7279, 0x496e646578203d20, - 0x696e6465783b0a20, 0x2020202020202074, 0x6869732e63686172, 0x73203d2041727261, 0x792e66726f6d2869, - 0x6e646578203d3d3d, 0x20746869732e6869, 0x73746f72792e6c65, 0x6e677468203f2022, 0x22203a2074686973, - 0x2e686973746f7279, 0x5b696e6465785d29, 0x3b0a202020202020, 0x2020746869732e63, 0x7572736f72203d20, - 0x746869732e636861, 0x72732e6c656e6774, 0x683b0a2020202020, 0x202020746869732e, 0x7265647261772829, - 0x3b0a202020207d0a, 0x0a2020202063616e, 0x63656c4c696e6528, 0x29207b0a20202020, 0x2020202074686973, - 0x2e77726974652822, 0x5e435c725c6e2229, 0x3b0a202020202020, 0x2020746869732e63, 0x68617273203d205b, - 0x5d3b0a2020202020, 0x202020746869732e, 0x637572736f72203d, 0x20303b0a20202020, 0x2020202074686973, - 0x2e686973746f7279, 0x496e646578203d20, 0x746869732e686973, 0x746f72792e6c656e, 0x6774683b0a202020, - 0x2020202020746869, 0x732e73686f775072, 0x6f6d707428293b0a, 0x202020207d0a0a20, 0x2020202f2f205265, - 0x7772697465732074, 0x68652070726f6d70, 0x7420616e64207468, 0x65206c696e652069, 0x6e20706c6163652c, - 0x207468656e206d6f, 0x7665732074686520, 0x637572736f722062, 0x61636b20746f2069, 0x747320706f736974, - 0x696f6e2e0a202020, 0x2072656472617728, 0x707265666978203d, 0x20225c722229207b, 0x0a20202020202020, - 0x20746869732e7772, 0x6974652870726566, 0x6978202b20746869, 0x732e70726f6d7074, 0x202b20746869732e, - 0x6c696e65202b2061, 0x6e73692e636c6561, 0x72546f456e64202b, 0x20616e73692e6c65, 0x667428746869732e, - 0x63686172732e6c65, 0x6e677468202d2074, 0x6869732e63757273, 0x6f7229293b0a2020, 0x20207d0a0a202020, - 0x20747261636b2870, 0x726f6d6973652920, 0x7b0a202020202020, 0x2020746869732e62, 0x757379203d207072, - 0x6f6d6973652e6669, 0x6e616c6c79282829, 0x203d3e207b0a2020, 0x2020202020202020, 0x2020746869732e62, - 0x757379203d206e75, 0x6c6c3b0a20202020, 0x202020207d293b0a, 0x2020202020202020, 0x72657475726e2074, - 0x6869732e62757379, 0x3b0a202020207d0a, 0x0a20202020737562, 0x6d69742829207b0a, 0x2020202020202020, - 0x636f6e7374206c69, 0x6e65203d20746869, 0x732e6c696e653b0a, 0x2020202020202020, 0x746869732e777269, - 0x746528225c725c6e, 0x22293b0a20202020, 0x2020202074686973, 0x2e6368617273203d, 0x205b5d3b0a202020, - 0x2020202020746869, 0x732e637572736f72, 0x203d20303b0a2020, 0x2020202020206966, 0x20286c696e652e74, - 0x72696d282920213d, 0x3d20222220262620, 0x746869732e686973, 0x746f72792e617428, 0x2d312920213d3d20, - 0x6c696e65290a2020, 0x2020202020202020, 0x2020746869732e68, 0x6973746f72792e70, 0x757368286c696e65, - 0x293b0a2020202020, 0x202020746869732e, 0x686973746f727949, 0x6e646578203d2074, 0x6869732e68697374, - 0x6f72792e6c656e67, 0x74683b0a20202020, 0x2020202072657475, 0x726e20746869732e, 0x747261636b287468, - 0x69732e6578656375, 0x7465286c696e6529, 0x293b0a202020207d, 0x0a0a202020206173, 0x796e632065786563, - 0x757465286c696e65, 0x29207b0a20202020, 0x2020202074686973, 0x2e61626f7274203d, 0x206e65772041626f, - 0x7274436f6e74726f, 0x6c6c657228293b0a, 0x2020202020202020, 0x747279207b0a2020, 0x2020202020202020, - 0x2020636f6e737420, 0x6f7574707574203d, 0x2061776169742074, 0x6869732e72756e28, 0x6c696e652c207468, - 0x69732e61626f7274, 0x2e7369676e616c29, 0x3b0a202020202020, 0x2020202020202f2f, 0x205468652070726f, - 0x6d70742073746172, 0x7473206f6e206120, 0x6e6577206c696e65, 0x2c20756e6c657373, 0x20746865206f7574, - 0x70757420616c7265, 0x61647920656e6473, 0x206f6e65206f7220, 0x6c65617665732074, 0x68650a2020202020, - 0x202020202020202f, 0x2f20637572736f72, 0x20617420686f6d65, 0x2028737563682061, 0x7320746865202763, - 0x6c6561722720636f, 0x6d6d616e64292e0a, 0x2020202020202020, 0x2020202069662028, 0x6f7574707574290a, - 0x2020202020202020, 0x2020202020202020, 0x746869732e777269, 0x7465286f75747075, 0x742e656e64735769, - 0x746828225c6e2229, 0x207c7c206f757470, 0x75742e656e647357, 0x69746828225c7831, 0x625b482229203f20, - 0x6f7574707574203a, 0x206f757470757420, 0x2b20225c725c6e22, 0x293b0a2020202020, 0x2020207d20636174, - 0x636820286572726f, 0x7229207b0a202020, 0x2020202020202020, 0x20746869732e7772, 0x69746528616e7369, - 0x2e72656428604572, 0x726f723a20247b65, 0x72726f723f2e6d65, 0x7373616765203f3f, 0x206572726f727d60, - 0x29202b20225c725c, 0x6e22293b0a202020, 0x20202020207d0a20, 0x2020202020202074, 0x6869732e73686f77, - 0x50726f6d70742829, 0x3b0a202020207d0a, 0x0a20202020617379, 0x6e6320636f6d706c, 0x6574654c696e6528, - 0x29207b0a20202020, 0x202020202f2f204f, 0x6e6c792074686520, 0x636f6d6d616e6420, 0x6e616d6520697320, - 0x636f6d706c657465, 0x642c20616e64206f, 0x6e6c792077697468, 0x2074686520637572, 0x736f722061742074, - 0x686520656e64206f, 0x6620746865206c69, 0x6e652e0a20202020, 0x2020202069662028, 0x746869732e637572, - 0x736f7220213d3d20, 0x746869732e636861, 0x72732e6c656e6774, 0x68290a2020202020, 0x2020202020202072, - 0x657475726e3b0a20, 0x2020202020202063, 0x6f6e7374206c696e, 0x65203d2074686973, 0x2e6c696e653b0a20, - 0x202020202020206c, 0x65742063616e6469, 0x64617465733b0a20, 0x2020202020202074, 0x7279207b0a202020, - 0x2020202020202020, 0x2063616e64696461, 0x746573203d202861, 0x7761697420746869, 0x732e636f6d706c65, - 0x7465286c696e6529, 0x292e73706c697428, 0x225c6e22292e6669, 0x6c7465722828776f, 0x726429203d3e2077, - 0x6f726420213d3d20, 0x2222293b0a202020, 0x20202020207d2063, 0x6174636820286572, 0x726f7229207b0a20, - 0x2020202020202020, 0x2020207265747572, 0x6e3b0a2020202020, 0x2020207d0a202020, 0x2020202020696620, - 0x2863616e64696461, 0x7465732e6c656e67, 0x7468203d3d3d2030, 0x290a202020202020, 0x2020202020207265, - 0x7475726e3b0a2020, 0x202020202020636f, 0x6e737420636f6d70, 0x6c6574696f6e203d, 0x2063616e64696461, - 0x7465732e6c656e67, 0x7468203d3d3d2031, 0x203f2063616e6469, 0x64617465735b305d, 0x202b20222022203a, - 0x20636f6d6d6f6e50, 0x7265666978286361, 0x6e64696461746573, 0x293b0a2020202020, 0x2020206966202863, - 0x6f6d706c6574696f, 0x6e2e6c656e677468, 0x203e206c696e652e, 0x6c656e677468290a, 0x2020202020202020, - 0x2020202072657475, 0x726e20746869732e, 0x696e736572742841, 0x727261792e66726f, 0x6d28636f6d706c65, - 0x74696f6e2e736c69, 0x6365286c696e652e, 0x6c656e6774682929, 0x293b0a2020202020, 0x202020746869732e, - 0x777269746528225c, 0x725c6e22202b2063, 0x616e646964617465, 0x732e6a6f696e2822, 0x20202229202b2022, - 0x5c725c6e22293b0a, 0x2020202020202020, 0x746869732e726564, 0x72617728293b0a20, 0x2020207d0a7d0a0a, - 0x2f2f2f204d6f756e, 0x7473206120746572, 0x6d696e616c20696e, 0x2060656c656d656e, 0x7460206f6e636520, - 0x7468652057656246, 0x726f6e7420627269, 0x6467652069732072, 0x656164792e205265, 0x7475726e73207468, - 0x6520787465726d20, 0x5465726d696e616c, 0x2c0a2f2f2f206974, 0x73206c696e652065, 0x6469746f7220616e, - 0x6420612060666c75, 0x7368282960207265, 0x736f6c76696e6720, 0x7768656e20657665, 0x7279207772697465, - 0x2068617320626565, 0x6e2072656e646572, 0x65642e0a6578706f, 0x7274206173796e63, 0x2066756e6374696f, - 0x6e206d6f756e7428, 0x656c656d656e742c, 0x207b627269646765, 0x203d20676c6f6261, 0x6c546869732e7765, - 0x6246726f6e742c20, 0x7465726d696e616c, 0x4f7074696f6e7320, 0x3d207b7d7d203d20, 0x7b7d29207b0a2020, - 0x2020636f6e737420, 0x7465726d696e616c, 0x203d206e65772054, 0x65726d696e616c28, 0x7b0a202020202020, - 0x2020637572736f72, 0x426c696e6b3a2074, 0x7275652c0a202020, 0x2020202020636f6e, 0x76657274456f6c3a, - 0x2066616c73652c0a, 0x2020202020202020, 0x666f6e7446616d69, 0x6c793a202775692d, 0x6d6f6e6f73706163, - 0x652c202243617363, 0x6164696120436f64, 0x65222c2022536f75, 0x72636520436f6465, 0x2050726f222c204d, - 0x656e6c6f2c20436f, 0x6e736f6c61732c20, 0x6d6f6e6f73706163, 0x65272c0a20202020, 0x202020207468656d, - 0x653a207b6261636b, 0x67726f756e643a20, 0x2223306431313137, 0x222c20666f726567, 0x726f756e643a2022, - 0x2365366564663322, 0x7d2c0a2020202020, 0x2020202e2e2e7465, 0x726d696e616c4f70, 0x74696f6e732c0a20, - 0x2020207d293b0a20, 0x202020636f6e7374, 0x20666974203d206e, 0x6577204669744164, 0x646f6e28293b0a20, - 0x2020207465726d69, 0x6e616c2e6c6f6164, 0x4164646f6e286669, 0x74293b0a20202020, 0x7465726d696e616c, - 0x2e6f70656e28656c, 0x656d656e74293b0a, 0x202020206669742e, 0x66697428293b0a20, 0x2020206e65772052, - 0x6573697a654f6273, 0x6572766572282829, 0x203d3e206669742e, 0x6669742829292e6f, 0x6273657276652865, - 0x6c656d656e74293b, 0x0a0a202020206c65, 0x74206c6173745772, 0x697465203d205072, 0x6f6d6973652e7265, - 0x736f6c766528293b, 0x0a20202020636f6e, 0x7374207772697465, 0x203d202874657874, 0x29203d3e207b0a20, - 0x202020202020206c, 0x6173745772697465, 0x203d206e65772050, 0x726f6d6973652828, 0x7265736f6c766529, - 0x203d3e207465726d, 0x696e616c2e777269, 0x746528746578742c, 0x207265736f6c7665, 0x29293b0a20202020, - 0x7d3b0a2020202063, 0x6f6e737420666c75, 0x7368203d20282920, 0x3d3e206c61737457, 0x726974653b0a0a20, - 0x202020747279207b, 0x0a20202020202020, 0x2061776169742062, 0x72696467652e7265, 0x6164793b0a202020, - 0x207d206361746368, 0x20286572726f7229, 0x207b0a2020202020, 0x2020207772697465, 0x28616e73692e7265, - 0x642860436f6e6e65, 0x6374696f6e20746f, 0x2074686520617070, 0x6c69636174696f6e, 0x206661696c65643a, - 0x20247b6572726f72, 0x3f2e6d6573736167, 0x65203f3f20657272, 0x6f727d6029202b20, 0x225c725c6e22293b, - 0x0a20202020202020, 0x2072657475726e20, 0x7b7465726d696e61, 0x6c2c20656469746f, 0x723a206e756c6c2c, - 0x20666c7573687d3b, 0x0a202020207d0a0a, 0x20202020636f6e73, 0x742063616c6c203d, 0x20286e616d652920, - 0x3d3e206272696467, 0x652e63707046756e, 0x6374696f6e286077, 0x656266726f6e742e, 0x7465726d696e616c, - 0x2e247b6e616d657d, 0x60293b0a20202020, 0x6c65742070726f6d, 0x70742c2062616e6e, 0x65722c2065787465, - 0x6e73696f6e733b0a, 0x2020202074727920, 0x7b0a202020202020, 0x20205b70726f6d70, 0x742c2062616e6e65, - 0x722c20657874656e, 0x73696f6e735d203d, 0x2061776169742050, 0x726f6d6973652e61, 0x6c6c285b63616c6c, - 0x282270726f6d7074, 0x222928292c206361, 0x6c6c282262616e6e, 0x6572222928292c20, 0x63616c6c28226578, - 0x74656e73696f6e73, 0x222928295d293b0a, 0x202020207d206361, 0x7463682028657272, 0x6f7229207b0a2020, - 0x2020202020202f2f, 0x20466f7220657861, 0x6d706c6520612070, 0x6167652073657276, 0x656420627920616e, - 0x206170706c696361, 0x74696f6e20776974, 0x686f757420776562, 0x66726f6e743a3a54, 0x65726d696e616c2e, - 0x0a20202020202020, 0x2077726974652861, 0x6e73692e72656428, 0x605465726d696e61, 0x6c20756e61766169, - 0x6c61626c653a2024, 0x7b6572726f723f2e, 0x6d65737361676520, 0x3f3f206572726f72, 0x7d6029202b20225c, - 0x725c6e22293b0a20, 0x2020202020202072, 0x657475726e207b74, 0x65726d696e616c2c, 0x20656469746f723a, - 0x206e756c6c2c2066, 0x6c7573687d3b0a20, 0x2020207d0a202020, 0x20636f6e73742063, 0x6f6d6d616e647320, - 0x3d20617761697420, 0x6c6f616445787465, 0x6e73696f6e732865, 0x7874656e73696f6e, 0x732c207772697465, - 0x293b0a2020202063, 0x6f6e73742072756e, 0x496e437070203d20, 0x63616c6c28227275, 0x6e22293b0a202020, - 0x20636f6e73742072, 0x756e203d20286c69, 0x6e652c207369676e, 0x616c29203d3e2072, 0x756e4c696e65286c, - 0x696e652c207b636f, 0x6d6d616e64732c20, 0x72756e496e437070, 0x2c2077726974652c, 0x206272696467652c, - 0x207369676e616c7d, 0x293b0a2020202063, 0x6f6e737420656469, 0x746f72203d206e65, 0x77204c696e654564, - 0x69746f72287b7772, 0x6974652c2072756e, 0x2c20636f6d706c65, 0x74653a2063616c6c, 0x2822636f6d706c65, - 0x746522292c207072, 0x6f6d70747d293b0a, 0x2020202069662028, 0x62616e6e6572290a, 0x2020202020202020, - 0x7772697465286261, 0x6e6e65722e726570, 0x6c616365416c6c28, 0x225c6e222c20225c, 0x725c6e2229202b20, - 0x225c725c6e22293b, 0x0a20202020656469, 0x746f722e73686f77, 0x50726f6d70742829, 0x3b0a202020207465, - 0x726d696e616c2e6f, 0x6e44617461282864, 0x61746129203d3e20, 0x656469746f722e68, 0x616e646c65286461, - 0x746129293b0a2020, 0x20207465726d696e, 0x616c2e666f637573, 0x28293b0a20202020, 0x72657475726e207b, - 0x7465726d696e616c, 0x2c20656469746f72, 0x2c20666c7573687d, 0x3b0a7d0a00000000 - }; -}; - -} // namespace webfront::fs::generated diff --git a/include/system/ToolManagerModuleData.hpp b/include/system/ToolManagerModuleData.hpp deleted file mode 100644 index 7b3efb04..00000000 --- a/include/system/ToolManagerModuleData.hpp +++ /dev/null @@ -1,392 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace webfront::fs::generated { - -struct ToolManagerModuleData { - static constexpr std::string_view encoding{}; - static constexpr std::size_t dataSize{14997}; - static constexpr std::array data{ - 0x2f2f2f2040627269, 0x65662042726f7773, 0x6572207369646520, 0x6f66207468652077, 0x6620746f6f6c206d, - 0x616e616765722028, 0x23323334292c2061, 0x207465726d696e61, 0x6c20657874656e73, 0x696f6e2061646465, - 0x642062790a2f2f2f, 0x2077656266726f6e, 0x743a3a546f6f6c4d, 0x616e616765722028, 0x696e636c7564652f, - 0x636f6d706f6e656e, 0x74732f546f6f6c4d, 0x616e616765722e68, 0x7070292e20277766, 0x2073656172636827, - 0x2c2027776620696e, 0x7374616c6c272061, 0x6e640a2f2f2f2027, 0x7766206f70656e27, 0x2072756e20686572, - 0x652c206265636175, 0x7365207468652064, 0x6f776e6c6f616420, 0x737065616b732048, 0x545450533b202777, - 0x66206c697374272c, 0x202777662072656d, 0x6f76652720616e64, 0x202777662068656c, 0x70272072756e0a2f, - 0x2f2f20696e20432b, 0x2b2e20416e20696e, 0x7374616c6c617469, 0x6f6e206665746368, 0x6573207468652070, - 0x61636b756d656e74, 0x20616e6420746865, 0x2074617262616c6c, 0x2066726f6d207468, 0x65206e706d207265, - 0x6769737472792c20, 0x636865636b732074, 0x68650a2f2f2f2074, 0x617262616c6c2773, 0x205348412d353132, - 0x20696e7465677269, 0x74792c20756e7061, 0x636b732069742061, 0x6e642073656e6473, 0x206974732066696c, - 0x6573207468726f75, 0x6768207765626672, 0x6f6e742e706b672e, 0x626567696e2c0a2f, 0x2f2f202e77726974, - 0x6546696c6520616e, 0x64202e636f6d6d69, 0x742e0a0a636f6e73, 0x7420626c6f636b53, 0x697a65203d203531, - 0x323b0a2f2f2f2046, 0x696c65732063726f, 0x7373207468652062, 0x726964676520696e, 0x206368756e6b7320, - 0x6f66207468697320, 0x6d616e7920627974, 0x65733b2074686520, 0x62726f7773657220, 0x73656e6473206120, - 0x6c61726765206f6e, 0x6520696e20736576, 0x6572616c0a2f2f2f, 0x20576562536f636b, 0x6574206672616d65, - 0x732c207768696368, 0x2074686520736572, 0x7665722072656173, 0x73656d626c65732e, 0x0a6578706f727420, - 0x636f6e7374206368, 0x756e6b53697a6520, 0x3d20323536202a20, 0x313032343b0a2f2f, 0x2f204c6172676573, - 0x7420756e7061636b, 0x6564207461726261, 0x6c6c206163636570, 0x7465642c20616761, 0x696e737420646563, - 0x6f6d707265737369, 0x6f6e20626f6d6273, 0x2e0a6578706f7274, 0x20636f6e7374206d, 0x6178556e7061636b, - 0x6564427974657320, 0x3d20323536202a20, 0x31303234202a2031, 0x3032343b0a636f6e, 0x7374207574663820, - 0x3d206e6577205465, 0x78744465636f6465, 0x7228293b0a0a2f2f, 0x2f2053706c697473, 0x20226e616d655b40, - 0x76657273696f6e5d, 0x222c207768657265, 0x20746865206e616d, 0x65206d6179206265, 0x2073636f70656420, - 0x28224073636f7065, 0x2f6e616d6540312e, 0x302e3022292e2054, 0x6865207665727369, 0x6f6e206973202222, - 0x0a2f2f2f20776865, 0x6e20616273656e74, 0x2e0a6578706f7274, 0x2066756e6374696f, 0x6e20706172736553, - 0x7065632873706563, 0x29207b0a20202020, 0x636f6e7374206174, 0x203d20737065632e, 0x696e6465784f6628, - 0x2240222c20737065, 0x632e737461727473, 0x5769746828224022, 0x29203f2031203a20, 0x30293b0a20202020, - 0x72657475726e2061, 0x74203c2030203f20, 0x7b6e616d653a2073, 0x7065632c20766572, 0x73696f6e3a202222, - 0x7d203a207b6e616d, 0x653a20737065632e, 0x736c69636528302c, 0x206174292c207665, 0x7273696f6e3a2073, - 0x7065632e736c6963, 0x65286174202b2031, 0x297d3b0a7d0a0a66, 0x756e6374696f6e20, 0x7265676973747279, - 0x4261736528726567, 0x697374727929207b, 0x0a20202020636f6e, 0x7374206261736520, 0x3d206e6577205552, - 0x4c28726567697374, 0x72792c20676c6f62, 0x616c546869732e6c, 0x6f636174696f6e3f, 0x2e68726566293b0a, - 0x2020202069662028, 0x21626173652e7061, 0x74686e616d652e65, 0x6e64735769746828, 0x222f2229290a2020, - 0x2020202020206261, 0x73652e706174686e, 0x616d65202b3d2022, 0x2f223b0a20202020, 0x72657475726e2062, - 0x6173653b0a7d0a0a, 0x2f2f205468652072, 0x6567697374727920, 0x656e636f64657320, 0x74686520736c6173, - 0x68206f6620612073, 0x636f706564206e61, 0x6d652e0a636f6e73, 0x74207061636b756d, 0x656e7455726c203d, - 0x2028626173652c20, 0x6e616d6529203d3e, 0x206e65772055524c, 0x286e616d652e7265, 0x706c61636528222f, - 0x222c202225326622, 0x292c206261736529, 0x3b0a0a6173796e63, 0x2066756e6374696f, 0x6e2066657463684f, - 0x6b2875726c2c2066, 0x65746368496d706c, 0x2c207369676e616c, 0x29207b0a20202020, 0x636f6e7374207265, - 0x73706f6e7365203d, 0x2061776169742066, 0x65746368496d706c, 0x2875726c2c207b73, 0x69676e616c7d293b, - 0x0a20202020696620, 0x2821726573706f6e, 0x73652e6f6b290a20, 0x2020202020202074, 0x68726f77206e6577, - 0x204572726f722860, 0x247b75726c7d3a20, 0x4854545020247b72, 0x6573706f6e73652e, 0x7374617475737d60, - 0x293b0a2020202072, 0x657475726e207265, 0x73706f6e73653b0a, 0x7d0a0a6173796e63, 0x2066756e6374696f, - 0x6e2066657463684a, 0x736f6e2875726c2c, 0x206665746368496d, 0x706c2c207369676e, 0x616c29207b0a2020, - 0x202072657475726e, 0x2028617761697420, 0x66657463684f6b28, 0x75726c2c20666574, 0x6368496d706c2c20, - 0x7369676e616c2929, 0x2e6a736f6e28293b, 0x0a7d0a0a66756e63, 0x74696f6e20726573, 0x6f6c76654d616e69, - 0x6665737428706163, 0x6b756d656e742c20, 0x6e616d652c207265, 0x7175657374656429, 0x207b0a2020202063, - 0x6f6e737420746167, 0x203d207265717565, 0x73746564207c7c20, 0x226c617465737422, 0x3b0a20202020636f, - 0x6e73742076657273, 0x696f6e203d207061, 0x636b756d656e745b, 0x22646973742d7461, 0x6773225d3f2e5b74, - 0x61675d203f3f2072, 0x6571756573746564, 0x3b0a20202020636f, 0x6e7374206d616e69, 0x66657374203d2070, - 0x61636b756d656e74, 0x2e76657273696f6e, 0x733f2e5b76657273, 0x696f6e5d3b0a2020, 0x202069662028216d, - 0x616e696665737429, 0x0a20202020202020, 0x207468726f77206e, 0x6577204572726f72, 0x2860247b6e616d65, - 0x7d20686173206e6f, 0x2076657273696f6e, 0x2027247b7461677d, 0x2760293b0a202020, 0x2072657475726e20, - 0x6d616e6966657374, 0x3b0a7d0a0a2f2f2f, 0x20436865636b7320, 0x6279746573206167, 0x61696e737420616e, - 0x2053524920696e74, 0x6567726974792073, 0x7472696e67202822, 0x7368613531322d3c, 0x6261736536343e22, - 0x2c20706f73736962, 0x6c79207365766572, 0x616c206861736865, 0x730a2f2f2f207365, 0x7061726174656420, - 0x6279207370616365, 0x732920616e642072, 0x657475726e732074, 0x6865206d61746368, 0x696e672022736861, - 0x3531322de280a622, 0x20686173682e204f, 0x6e6c79205348412d, 0x3531322069732061, 0x636365707465642e, - 0x0a6578706f727420, 0x6173796e63206675, 0x6e6374696f6e2076, 0x6572696679496e74, 0x6567726974792862, - 0x797465732c20696e, 0x7465677269747929, 0x207b0a2020202063, 0x6f6e737420657870, 0x6563746564203d20, - 0x537472696e672869, 0x6e74656772697479, 0x203f3f202222290a, 0x2020202020202020, 0x2e73706c6974282f, - 0x5c732b2f290a2020, 0x2020202020202e66, 0x696c746572282868, 0x61736829203d3e20, 0x686173682e737461, - 0x7274735769746828, 0x227368613531322d, 0x2229290a20202020, 0x202020202e6d6170, 0x2828686173682920, - 0x3d3e20686173682e, 0x73706c697428223f, 0x22295b305d293b0a, 0x2020202069662028, 0x6578706563746564, - 0x2e6c656e67746820, 0x3d3d3d2030290a20, 0x2020202020202074, 0x68726f77206e6577, 0x204572726f722822, - 0x546865207061636b, 0x6167652068617320, 0x6e6f205348412d35, 0x313220696e746567, 0x7269747922293b0a, - 0x2020202069662028, 0x21676c6f62616c54, 0x6869732e63727970, 0x746f3f2e73756274, 0x6c65290a20202020, - 0x202020207468726f, 0x77206e6577204572, 0x726f722822496e74, 0x6567726974792063, 0x6865636b73206e65, - 0x6564206120736563, 0x75726520636f6e74, 0x6578742028687474, 0x7073206f72206c6f, 0x63616c686f737429, - 0x22293b0a20202020, 0x636f6e7374206469, 0x67657374203d206e, 0x65772055696e7438, 0x4172726179286177, - 0x6169742063727970, 0x746f2e737562746c, 0x652e646967657374, 0x28225348412d3531, 0x32222c2062797465, - 0x7329293b0a202020, 0x20636f6e73742061, 0x637475616c203d20, 0x227368613531322d, 0x22202b2062746f61, - 0x2841727261792e66, 0x726f6d2864696765, 0x73742c2028627974, 0x6529203d3e205374, 0x72696e672e66726f, - 0x6d43686172436f64, 0x6528627974652929, 0x2e6a6f696e282222, 0x29293b0a20202020, 0x6966202821657870, - 0x65637465642e696e, 0x636c756465732861, 0x637475616c29290a, 0x2020202020202020, 0x7468726f77206e65, - 0x77204572726f7228, 0x60496e7465677269, 0x747920636865636b, 0x206661696c65643a, 0x2065787065637465, - 0x6420247b65787065, 0x637465645b305d7d, 0x2c20676f7420247b, 0x61637475616c7d60, 0x293b0a2020202072, - 0x657475726e206163, 0x7475616c3b0a7d0a, 0x0a2f2f2f2047756e, 0x7a69707320627974, 0x65732c206661696c, - 0x696e67206f6e6365, 0x206d6f7265207468, 0x616e20606c696d69, 0x7460206279746573, 0x20636f6d65206f75, - 0x742e0a6578706f72, 0x74206173796e6320, 0x66756e6374696f6e, 0x2067756e7a697028, 0x62797465732c206c, - 0x696d6974203d206d, 0x6178556e7061636b, 0x6564427974657329, 0x207b0a2020202063, 0x6f6e737420726561, - 0x646572203d206e65, 0x7720426c6f62285b, 0x62797465735d292e, 0x73747265616d2829, 0x2e70697065546872, - 0x6f756768286e6577, 0x204465636f6d7072, 0x657373696f6e5374, 0x7265616d2822677a, 0x69702229292e6765, - 0x7452656164657228, 0x293b0a2020202063, 0x6f6e737420636875, 0x6e6b73203d205b5d, 0x3b0a202020206c65, - 0x7420746f74616c20, 0x3d20303b0a202020, 0x20666f7220286c65, 0x742072656164203d, 0x2061776169742072, - 0x65616465722e7265, 0x616428293b202172, 0x6561642e646f6e65, 0x3b2072656164203d, 0x2061776169742072, - 0x65616465722e7265, 0x6164282929207b0a, 0x2020202020202020, 0x746f74616c202b3d, 0x20726561642e7661, - 0x6c75652e6c656e67, 0x74683b0a20202020, 0x2020202069662028, 0x746f74616c203e20, 0x6c696d697429207b, - 0x0a20202020202020, 0x2020202020617761, 0x6974207265616465, 0x722e63616e63656c, 0x28293b0a20202020, - 0x2020202020202020, 0x7468726f77206e65, 0x77204572726f7228, 0x6054686520746172, 0x62616c6c20756e70, - 0x61636b7320746f20, 0x6d6f726520746861, 0x6e20247b6c696d69, 0x747d206279746573, 0x60293b0a20202020, - 0x202020207d0a2020, 0x2020202020206368, 0x756e6b732e707573, 0x6828726561642e76, 0x616c7565293b0a20, - 0x2020207d0a202020, 0x2072657475726e20, 0x6e65772055696e74, 0x3841727261792861, 0x77616974206e6577, - 0x20426c6f62286368, 0x756e6b73292e6172, 0x7261794275666665, 0x722829293b0a7d0a, 0x0a2f2f2041204e55, - 0x4c2d7465726d696e, 0x6174656420686561, 0x646572206669656c, 0x642e0a66756e6374, 0x696f6e2074657874, - 0x28626c6f636b2c20, 0x6f66667365742c20, 0x6c656e6774682920, 0x7b0a20202020636f, 0x6e7374206669656c, - 0x64203d20626c6f63, 0x6b2e737562617272, 0x6179286f66667365, 0x742c206f66667365, 0x74202b206c656e67, - 0x7468293b0a202020, 0x20636f6e73742065, 0x6e64203d20666965, 0x6c642e696e646578, 0x4f662830293b0a20, - 0x2020207265747572, 0x6e20757466382e64, 0x65636f646528656e, 0x64203c2030203f20, 0x6669656c64203a20, - 0x6669656c642e7375, 0x6261727261792830, 0x2c20656e6429293b, 0x0a7d0a0a2f2f2041, 0x6e206f6374616c20, - 0x6e756d6265722c20, 0x6f72206120626173, 0x652d323536206f6e, 0x65207768656e2074, 0x6865206669727374, - 0x2062797465206861, 0x7320697473206869, 0x6768206269742073, 0x65742028474e5520, 0x616e642073746172, - 0x292e0a66756e6374, 0x696f6e206e756d62, 0x657228626c6f636b, 0x2c206f6666736574, 0x2c206c656e677468, - 0x29207b0a20202020, 0x69662028626c6f63, 0x6b5b6f6666736574, 0x5d20262030783830, 0x290a202020202020, - 0x202072657475726e, 0x20626c6f636b2e73, 0x7562617272617928, 0x6f6666736574202b, 0x20312c206f666673, - 0x6574202b206c656e, 0x677468292e726564, 0x756365282876616c, 0x75652c2062797465, 0x29203d3e2076616c, - 0x7565202a20323536, 0x202b20627974652c, 0x20626c6f636b5b6f, 0x66667365745d2026, 0x2030783766293b0a, - 0x20202020636f6e73, 0x7420646967697473, 0x203d207465787428, 0x626c6f636b2c206f, 0x66667365742c206c, - 0x656e677468292e74, 0x72696d28293b0a20, 0x2020206966202821, 0x2f5e5b302d375d2a, 0x242f2e7465737428, - 0x6469676974732929, 0x0a20202020202020, 0x207468726f77206e, 0x6577204572726f72, 0x2822436f72727570, - 0x7420746172206865, 0x6164657222293b0a, 0x2020202072657475, 0x726e206469676974, 0x73203d3d3d202222, - 0x203f2030203a2070, 0x61727365496e7428, 0x6469676974732c20, 0x38293b0a7d0a0a66, 0x756e6374696f6e20, - 0x7665726966794368, 0x65636b73756d2868, 0x656164657229207b, 0x0a202020206c6574, 0x2073756d203d2030, - 0x3b0a20202020666f, 0x7220286c65742069, 0x6e646578203d2030, 0x3b20696e64657820, 0x3c20626c6f636b53, - 0x697a653b202b2b69, 0x6e646578290a2020, 0x2020202020207375, 0x6d202b3d20696e64, 0x6578203e3d203134, - 0x3820262620696e64, 0x6578203c20313536, 0x203f203078323020, 0x3a20686561646572, 0x5b696e6465785d3b, - 0x0a20202020696620, 0x286e756d62657228, 0x6865616465722c20, 0x3134382c20382920, 0x213d3d2073756d29, - 0x0a20202020202020, 0x207468726f77206e, 0x6577204572726f72, 0x2822436f72727570, 0x7420746172206865, - 0x6164657220636865, 0x636b73756d22293b, 0x0a7d0a0a2f2f2022, 0x3c6c656e6774683e, 0x203c6b65793e3d3c, - 0x76616c75653e5c6e, 0x22207265636f7264, 0x73206f6620612070, 0x617820657874656e, 0x6465642068656164, - 0x65723b206c656e67, 0x74687320636f756e, 0x742062797465732e, 0x0a66756e6374696f, 0x6e20706178526563, - 0x6f72647328646174, 0x6129207b0a202020, 0x20636f6e73742072, 0x65636f726473203d, 0x207b7d3b0a202020, - 0x206c6574206f6666, 0x736574203d20303b, 0x0a20202020776869, 0x6c6520286f666673, 0x6574203c20646174, - 0x612e6c656e677468, 0x29207b0a20202020, 0x20202020636f6e73, 0x7420737061636520, 0x3d20646174612e69, - 0x6e6465784f662830, 0x7832302c206f6666, 0x736574293b0a2020, 0x202020202020636f, 0x6e7374206c656e67, - 0x7468203d20737061, 0x6365203c2030203f, 0x204e614e203a204e, 0x756d626572287574, 0x66382e6465636f64, - 0x6528646174612e73, 0x7562617272617928, 0x6f66667365742c20, 0x7370616365292929, 0x3b0a202020202020, - 0x2020696620282128, 0x6c656e677468203e, 0x203029207c7c206f, 0x6666736574202b20, 0x6c656e677468203e, - 0x20646174612e6c65, 0x6e677468290a2020, 0x2020202020202020, 0x20207468726f7720, 0x6e6577204572726f, - 0x722822436f727275, 0x7074207061782068, 0x656164657222293b, 0x0a20202020202020, 0x20636f6e73742072, - 0x65636f7264203d20, 0x757466382e646563, 0x6f64652864617461, 0x2e73756261727261, 0x7928737061636520, - 0x2b20312c206f6666, 0x736574202b206c65, 0x6e677468202d2031, 0x29293b0a20202020, 0x20202020636f6e73, - 0x7420657175616c73, 0x203d207265636f72, 0x642e696e6465784f, 0x6628223d22293b0a, 0x2020202020202020, - 0x7265636f7264735b, 0x7265636f72642e73, 0x6c69636528302c20, 0x657175616c73295d, 0x203d207265636f72, - 0x642e736c69636528, 0x657175616c73202b, 0x2031293b0a202020, 0x20202020206f6666, 0x736574202b3d206c, - 0x656e6774683b0a20, 0x2020207d0a202020, 0x2072657475726e20, 0x7265636f7264733b, 0x0a7d0a0a2f2f2054, - 0x686520656e747279, 0x2077686f73652068, 0x6561646572207374, 0x6172747320617420, 0x606f666673657460, - 0x3a20697473206865, 0x616465722c207479, 0x706520666c61672c, 0x206461746120616e, 0x6420746865206f66, - 0x66736574206f6620, 0x746865206e657874, 0x0a2f2f20656e7472, 0x792e0a66756e6374, 0x696f6e2072656164, - 0x456e747279286172, 0x63686976652c206f, 0x666673657429207b, 0x0a20202020636f6e, 0x7374206865616465, - 0x72203d2061726368, 0x6976652e73756261, 0x72726179286f6666, 0x7365742c206f6666, 0x736574202b20626c, - 0x6f636b53697a6529, 0x3b0a202020207665, 0x7269667943686563, 0x6b73756d28686561, 0x646572293b0a2020, - 0x2020636f6e737420, 0x73697a65203d206e, 0x756d626572286865, 0x616465722c203132, 0x342c203132293b0a, - 0x20202020636f6e73, 0x7420737461727420, 0x3d206f6666736574, 0x202b20626c6f636b, 0x53697a653b0a2020, - 0x2020696620287374, 0x617274202b207369, 0x7a65203e20617263, 0x686976652e6c656e, 0x677468290a202020, - 0x2020202020746872, 0x6f77206e65772045, 0x72726f7228225472, 0x756e636174656420, 0x7461722061726368, - 0x69766522293b0a20, 0x2020207265747572, 0x6e207b0a20202020, 0x2020202068656164, 0x65722c0a20202020, - 0x2020202074797065, 0x3a20686561646572, 0x5b3135365d203d3d, 0x3d2030203f202230, 0x22203a2053747269, - 0x6e672e66726f6d43, 0x686172436f646528, 0x6865616465725b31, 0x35365d292c0a2020, 0x2020202020206461, - 0x74613a2061726368, 0x6976652e73756261, 0x7272617928737461, 0x72742c2073746172, 0x74202b2073697a65, - 0x292c0a2020202020, 0x2020206e6578743a, 0x207374617274202b, 0x204d6174682e6365, 0x696c2873697a6520, - 0x2f20626c6f636b53, 0x697a6529202a2062, 0x6c6f636b53697a65, 0x2c0a202020207d3b, 0x0a7d0a0a2f2f2041, - 0x6e20617263686976, 0x6520656e64732061, 0x742074776f207a65, 0x726f20626c6f636b, 0x733b206f6e652069, - 0x7320656e6f756768, 0x20746f2073746f70, 0x2e0a66756e637469, 0x6f6e206973456e64, 0x2861726368697665, - 0x2c206f6666736574, 0x29207b0a20202020, 0x72657475726e206f, 0x6666736574202b20, 0x626c6f636b53697a, - 0x65203e2061726368, 0x6976652e6c656e67, 0x7468207c7c206172, 0x63686976652e7375, 0x626172726179286f, - 0x66667365742c206f, 0x6666736574202b20, 0x626c6f636b53697a, 0x65292e6576657279, 0x2828627974652920, - 0x3d3e206279746520, 0x3d3d3d2030293b0a, 0x7d0a0a2f2f205468, 0x65206e616d652066, 0x69656c64206f6620, - 0x6120757374617220, 0x6865616465722c20, 0x6166746572206974, 0x7320707265666978, 0x206669656c642e0a, - 0x66756e6374696f6e, 0x2068656164657250, 0x6174682868656164, 0x657229207b0a2020, 0x2020636f6e737420, - 0x6e616d65203d2074, 0x6578742868656164, 0x65722c20302c2031, 0x3030293b0a202020, 0x20636f6e73742070, - 0x7265666978203d20, 0x7465787428686561, 0x6465722c20323537, 0x2c203529203d3d3d, 0x2022757374617222, - 0x203f207465787428, 0x6865616465722c20, 0x3334352c20313535, 0x29203a2022223b0a, 0x2020202072657475, - 0x726e207072656669, 0x78203f2060247b70, 0x72656669787d2f24, 0x7b6e616d657d6020, 0x3a206e616d653b0a, - 0x7d0a0a2f2f20456e, 0x7472696573206e61, 0x6d696e6720746865, 0x206e657874206f6e, 0x653a206120706178, - 0x20657874656e6465, 0x6420686561646572, 0x20616e6420612047, 0x4e55206c6f6e6720, 0x6e616d652e204120, - 0x70617820676c6f62, 0x616c206865616465, 0x72206e616d65730a, 0x2f2f206e6f746869, 0x6e67205765624672, - 0x6f6e742075736573, 0x2e0a636f6e737420, 0x6e616d65456e7472, 0x696573203d207b0a, 0x20202020783a2028, - 0x6e616d65732c2064, 0x61746129203d3e20, 0x287b2e2e2e6e616d, 0x65732c207061783a, 0x207061785265636f, - 0x7264732864617461, 0x292e706174687d29, 0x2c0a202020204c3a, 0x20286e616d65732c, 0x206461746129203d, - 0x3e20287b2e2e2e6e, 0x616d65732c206c6f, 0x6e673a2074657874, 0x28646174612c2030, 0x2c20646174612e6c, - 0x656e677468297d29, 0x2c0a20202020673a, 0x20286e616d657329, 0x203d3e206e616d65, 0x732c0a7d3b0a0a2f, - 0x2f2f205265616473, 0x2061207461722061, 0x7263686976652028, 0x75737461722c2077, 0x6974682070617820, - 0x616e6420474e5520, 0x6c6f6e67206e616d, 0x65732920616e6420, 0x72657475726e7320, 0x6974732072656775, - 0x6c61722066696c65, 0x732061730a2f2f2f, 0x207b706174682c20, 0x62797465737d2c20, 0x696e206172636869, - 0x7665206f72646572, 0x2e20446972656374, 0x6f726965732c206c, 0x696e6b7320616e64, 0x206f746865722065, - 0x6e74726965732061, 0x726520736b697070, 0x65642e0a6578706f, 0x72742066756e6374, 0x696f6e2072656164, - 0x5461722861726368, 0x69766529207b0a20, 0x202020636f6e7374, 0x2066696c6573203d, 0x205b5d3b0a202020, - 0x206c6574206e616d, 0x6573203d207b7d3b, 0x0a20202020666f72, 0x20286c6574206f66, 0x66736574203d2030, - 0x3b20216973456e64, 0x2861726368697665, 0x2c206f6666736574, 0x293b29207b0a2020, 0x202020202020636f, - 0x6e7374207b686561, 0x6465722c20747970, 0x652c20646174612c, 0x206e6578747d203d, 0x2072656164456e74, - 0x7279286172636869, 0x76652c206f666673, 0x6574293b0a202020, 0x20202020206f6666, 0x736574203d206e65, - 0x78743b0a20202020, 0x2020202069662028, 0x4f626a6563742e68, 0x61734f776e286e61, 0x6d65456e74726965, - 0x732c207479706529, 0x29207b0a20202020, 0x2020202020202020, 0x6e616d6573203d20, 0x6e616d65456e7472, - 0x6965735b74797065, 0x5d286e616d65732c, 0x2064617461293b0a, 0x2020202020202020, 0x20202020636f6e74, - 0x696e75653b0a2020, 0x2020202020207d0a, 0x2020202020202020, 0x6966202874797065, 0x203d3d3d20223022, - 0x207c7c2074797065, 0x203d3d3d20223722, 0x290a202020202020, 0x2020202020206669, 0x6c65732e70757368, - 0x287b706174683a20, 0x6e616d65732e7061, 0x78203f3f206e616d, 0x65732e6c6f6e6720, 0x3f3f206865616465, - 0x7250617468286865, 0x61646572292c2062, 0x797465733a206461, 0x74617d293b0a2020, 0x2020202020206e61, - 0x6d6573203d207b7d, 0x3b0a202020207d0a, 0x2020202072657475, 0x726e2066696c6573, 0x3b0a7d0a0a2f2f2f, - 0x205468652066696c, 0x6573206f6620616e, 0x206e706d20746172, 0x62616c6c20627920, 0x706174682072656c, - 0x617469766520746f, 0x2074686520706163, 0x6b61676520726f6f, 0x743a207468652066, 0x6972737420706174, - 0x6820636f6d706f6e, 0x656e740a2f2f2f20, 0x286e6f726d616c6c, 0x7920227061636b61, 0x67652f2229206973, - 0x2072656d6f766564, 0x2c206173206e706d, 0x20646f65732e2041, 0x206c617465722065, 0x6e74727920726570, - 0x6c6163657320616e, 0x206561726c696572, 0x206f6e652e0a6675, 0x6e6374696f6e2070, 0x61636b6167654669, - 0x6c657328656e7472, 0x69657329207b0a20, 0x202020636f6e7374, 0x2066696c6573203d, 0x206e6577204d6170, - 0x28293b0a20202020, 0x666f722028636f6e, 0x7374207b70617468, 0x2c2062797465737d, 0x206f6620656e7472, - 0x69657329207b0a20, 0x2020202020202063, 0x6f6e73742072656c, 0x6174697665203d20, 0x706174682e726570, - 0x6c616365282f5e28, 0x5c2e3f5c2f292b2f, 0x2c202222292e7370, 0x6c697428222f2229, 0x2e736c6963652831, - 0x292e6a6f696e2822, 0x2f22293b0a202020, 0x2020202020696620, 0x2872656c61746976, 0x6520213d3d202222, - 0x290a202020202020, 0x2020202020206669, 0x6c65732e73657428, 0x72656c6174697665, 0x2c20627974657329, - 0x3b0a202020207d0a, 0x2020202072657475, 0x726e2066696c6573, 0x3b0a7d0a0a66756e, 0x6374696f6e207061, - 0x636b6167654a736f, 0x6e2866696c65732c, 0x206e616d652c2076, 0x657273696f6e2920, 0x7b0a20202020636f, - 0x6e7374206d616e69, 0x66657374203d2066, 0x696c65732e676574, 0x28227061636b6167, 0x652e6a736f6e2229, - 0x3b0a202020206966, 0x2028216d616e6966, 0x657374290a202020, 0x2020202020746872, 0x6f77206e65772045, - 0x72726f722860247b, 0x6e616d657d40247b, 0x76657273696f6e7d, 0x20686173206e6f20, 0x7061636b6167652e, - 0x6a736f6e60293b0a, 0x20202020636f6e73, 0x7420706b67203d20, 0x4a534f4e2e706172, 0x736528757466382e, - 0x6465636f6465286d, 0x616e696665737429, 0x293b0a2020202069, 0x662028706b672e6e, 0x616d6520213d3d20, - 0x6e616d65207c7c20, 0x706b672e76657273, 0x696f6e20213d3d20, 0x76657273696f6e29, 0x0a20202020202020, - 0x207468726f77206e, 0x6577204572726f72, 0x2860546865206172, 0x636869766520636f, 0x6e7461696e732024, - 0x7b706b672e6e616d, 0x657d40247b706b67, 0x2e76657273696f6e, 0x7d2c206e6f742024, 0x7b6e616d657d4024, - 0x7b76657273696f6e, 0x7d60293b0a202020, 0x2072657475726e20, 0x706b673b0a7d0a0a, 0x636f6e7374206973, - 0x546f6f6c203d2028, 0x6669656c6429203d, 0x3e206669656c643f, 0x2e6b696e64203d3d, 0x3d2022746f6f6c22, - 0x2026262074797065, 0x6f66206669656c64, 0x2e656e747279203d, 0x3d3d202273747269, 0x6e67223b0a0a6675, - 0x6e6374696f6e2074, 0x6f6f6c4f66286669, 0x6c65732c206e616d, 0x652c207665727369, 0x6f6e29207b0a2020, - 0x2020636f6e737420, 0x746f6f6c203d2070, 0x61636b6167654a73, 0x6f6e2866696c6573, 0x2c206e616d652c20, - 0x76657273696f6e29, 0x2e77656266726f6e, 0x743b0a2020202069, 0x662028216973546f, 0x6f6c28746f6f6c29, - 0x290a202020202020, 0x20207468726f7720, 0x6e6577204572726f, 0x722860247b6e616d, 0x657d206973206e6f, - 0x7420612057656246, 0x726f6e7420746f6f, 0x6c3a206974732070, 0x61636b6167652e6a, 0x736f6e2068617320, - 0x6e6f207765626672, 0x6f6e74206669656c, 0x642077697468206b, 0x696e642022746f6f, 0x6c2220616e642061, - 0x6e20656e74727960, 0x293b0a2020202072, 0x657475726e207b65, 0x6e7472793a20746f, 0x6f6c2e656e747279, - 0x2e7265706c616365, 0x282f5e285c2e5c2f, 0x292b2f2c20222229, 0x2c207469746c653a, 0x20747970656f6620, - 0x746f6f6c2e746974, 0x6c65203d3d3d2022, 0x737472696e672220, 0x3f20746f6f6c2e74, 0x69746c65203a206e, - 0x616d657d3b0a7d0a, 0x0a636f6e73742070, 0x6b6746756e637469, 0x6f6e203d20286272, 0x696467652c206e61, - 0x6d6529203d3e2062, 0x72696467652e6370, 0x7046756e6374696f, 0x6e28607765626672, 0x6f6e742e706b672e, - 0x247b6e616d657d60, 0x293b0a0a2f2f2f20, 0x4f7074696f6e7320, 0x7368617265642062, 0x7920736561726368, - 0x282920616e642069, 0x6e7374616c6c2829, 0x3a0a2f2f2f202020, 0x6272696467652020, 0x2020746865205765, - 0x6246726f6e742062, 0x7269646765202867, 0x6c6f62616c546869, 0x732e77656246726f, 0x6e74290a2f2f2f20, - 0x2020726567697374, 0x7279202074686520, 0x6e706d2072656769, 0x737472792055524c, 0x202864656661756c, - 0x743a207765626672, 0x6f6e742e706b672e, 0x7265676973747279, 0x28292c2073657420, 0x696e20546f6f6c4d, - 0x616e616765724f70, 0x74696f6e73290a2f, 0x2f2f202020666574, 0x6368202020202074, 0x6865206665746368, - 0x2066756e6374696f, 0x6e0a2f2f2f202020, 0x7369676e616c2020, 0x2020616e2041626f, 0x72745369676e616c, - 0x2073746f7070696e, 0x672074686520646f, 0x776e6c6f61647320, 0x616e642074686520, 0x75706c6f61640a61, - 0x73796e632066756e, 0x6374696f6e207365, 0x7474696e6773287b, 0x627269646765203d, 0x20676c6f62616c54, - 0x6869732e77656246, 0x726f6e742c207265, 0x6769737472792c20, 0x66657463683a2066, 0x65746368496d706c, - 0x203d20282e2e2e61, 0x72677329203d3e20, 0x676c6f62616c5468, 0x69732e6665746368, 0x282e2e2e61726773, - 0x292c207369676e61, 0x6c7d203d207b7d29, 0x207b0a2020202072, 0x657475726e207b62, 0x72696467652c2066, - 0x65746368496d706c, 0x2c207369676e616c, 0x2c20626173653a20, 0x7265676973747279, 0x4261736528726567, - 0x6973747279203f3f, 0x2028617761697420, 0x706b6746756e6374, 0x696f6e2862726964, 0x67652c2022726567, - 0x6973747279222928, 0x2929297d3b0a7d0a, 0x0a2f2f2f20536561, 0x7263686573207468, 0x6520726567697374, - 0x727920666f722070, 0x61636b6167657320, 0x7769746820746865, 0x2077656266726f6e, 0x742d746f6f6c206b, - 0x6579776f72642e20, 0x52657475726e7320, 0x7b6e616d652c2076, 0x657273696f6e2c0a, 0x2f2f2f2064657363, - 0x72697074696f6e7d, 0x206f626a65637473, 0x2e0a6578706f7274, 0x206173796e632066, 0x756e6374696f6e20, - 0x7365617263682874, 0x65726d2c206f7074, 0x696f6e7329207b0a, 0x20202020636f6e73, 0x74207b6665746368, - 0x496d706c2c207369, 0x676e616c2c206261, 0x73657d203d206177, 0x6169742073657474, 0x696e6773286f7074, - 0x696f6e73293b0a20, 0x202020636f6e7374, 0x2075726c203d206e, 0x65772055524c2822, 0x2d2f76312f736561, - 0x726368222c206261, 0x7365293b0a202020, 0x2075726c2e736561, 0x726368506172616d, 0x732e736574282274, - 0x657874222c20606b, 0x6579776f7264733a, 0x77656266726f6e74, 0x2d746f6f6c20247b, 0x7465726d7d602e74, - 0x72696d2829293b0a, 0x2020202075726c2e, 0x7365617263685061, 0x72616d732e736574, 0x282273697a65222c, - 0x2022323022293b0a, 0x20202020636f6e73, 0x7420726573756c74, 0x203d206177616974, 0x2066657463684a73, - 0x6f6e2875726c2c20, 0x6665746368496d70, 0x6c2c207369676e61, 0x6c293b0a20202020, 0x72657475726e2028, - 0x726573756c742e6f, 0x626a65637473203f, 0x3f205b5d292e6d61, 0x7028287b7061636b, 0x6167653a20666f75, - 0x6e647d29203d3e20, 0x287b0a2020202020, 0x2020206e616d653a, 0x20666f756e642e6e, 0x616d652c0a202020, - 0x2020202020766572, 0x73696f6e3a20666f, 0x756e642e76657273, 0x696f6e2c0a202020, 0x2020202020646573, - 0x6372697074696f6e, 0x3a20666f756e642e, 0x6465736372697074, 0x696f6e203f3f2022, 0x222c0a202020207d, - 0x29293b0a7d0a0a2f, 0x2f20446f776e6c6f, 0x6164732074686520, 0x74617262616c6c20, 0x6f662061206d616e, - 0x696665737420616e, 0x642072657475726e, 0x7320697473206669, 0x6c65732077697468, 0x2074686520766572, - 0x696669656420696e, 0x746567726974792e, 0x0a6173796e632066, 0x756e6374696f6e20, 0x646f776e6c6f6164, - 0x286d616e69666573, 0x742c207061636b75, 0x6d656e744c6f6361, 0x74696f6e2c206665, 0x746368496d706c2c, - 0x207369676e616c29, 0x207b0a2020202063, 0x6f6e737420746172, 0x62616c6c55726c20, 0x3d206e6577205552, - 0x4c286d616e696665, 0x73742e646973743f, 0x2e74617262616c6c, 0x203f3f2022222c20, 0x7061636b756d656e, - 0x744c6f636174696f, 0x6e293b0a20202020, 0x636f6e7374207461, 0x7262616c6c203d20, 0x6e65772055696e74, - 0x3841727261792861, 0x7761697420286177, 0x6169742066657463, 0x684f6b2874617262, 0x616c6c55726c2c20, - 0x6665746368496d70, 0x6c2c207369676e61, 0x6c29292e61727261, 0x7942756666657228, 0x29293b0a20202020, - 0x636f6e737420696e, 0x7465677269747920, 0x3d20617761697420, 0x766572696679496e, 0x7465677269747928, - 0x74617262616c6c2c, 0x206d616e69666573, 0x742e646973743f2e, 0x696e746567726974, 0x79293b0a20202020, - 0x72657475726e207b, 0x696e746567726974, 0x792c2066696c6573, 0x3a207061636b6167, 0x6546696c65732872, - 0x6561645461722861, 0x776169742067756e, 0x7a69702874617262, 0x616c6c2929297d3b, 0x0a7d0a0a2f2f2053, - 0x656e647320746865, 0x2066696c65732074, 0x6f2077656266726f, 0x6e742e706b672e77, 0x7269746546696c65, - 0x20696e206368756e, 0x6b733b20616e2065, 0x6d7074792066696c, 0x652069732073656e, 0x74206173206f6e65, - 0x20656d7074792063, 0x68756e6b2e0a6173, 0x796e632066756e63, 0x74696f6e2075706c, 0x6f61642866696c65, - 0x732c207b62726964, 0x67652c206e616d65, 0x2c2076657273696f, 0x6e2c207369676e61, 0x6c7d29207b0a2020, - 0x2020636f6e737420, 0x777269746546696c, 0x65203d20706b6746, 0x756e6374696f6e28, 0x6272696467652c20, - 0x2277726974654669, 0x6c6522293b0a2020, 0x2020666f72202863, 0x6f6e7374205b7061, 0x74682c2062797465, - 0x735d206f66206669, 0x6c657329207b0a20, 0x202020202020206c, 0x6574206f66667365, 0x74203d20303b0a20, - 0x2020202020202064, 0x6f207b0a20202020, 0x2020202020202020, 0x7369676e616c3f2e, 0x7468726f77496641, - 0x626f727465642829, 0x3b0a202020202020, 0x202020202020636f, 0x6e7374206368756e, 0x6b203d2062797465, - 0x732e737562617272, 0x6179286f66667365, 0x742c206f66667365, 0x74202b206368756e, 0x6b53697a65293b0a, - 0x2020202020202020, 0x2020202061776169, 0x7420777269746546, 0x696c65286e616d65, 0x2c2076657273696f, - 0x6e2c20706174682c, 0x206f66667365742c, 0x206368756e6b293b, 0x0a20202020202020, 0x20202020206f6666, - 0x736574202b3d2063, 0x68756e6b2e6c656e, 0x6774683b0a202020, 0x20202020207d2077, 0x68696c6520286f66, - 0x66736574203c2062, 0x797465732e6c656e, 0x677468293b0a2020, 0x20207d0a7d0a0a2f, 0x2f2f20446f776e6c, - 0x6f6164732c207665, 0x7269666965732061, 0x6e642073746f7265, 0x7320226e616d655b, 0x4076657273696f6e, - 0x206f722064697374, 0x2d7461675d222028, 0x6c61746573742062, 0x792064656661756c, 0x74292e206070726f, - 0x6772657373287465, 0x787429600a2f2f2f, 0x207265706f727473, 0x2074686520737465, 0x70732e205265736f, - 0x6c76657320746f20, 0x7b6e616d652c2076, 0x657273696f6e2c20, 0x7469746c652c2065, 0x6e7472792c206669, - 0x6c65737d3b207265, 0x6a65637473207769, 0x74686f7574206368, 0x616e67696e672074, 0x68650a2f2f2f2069, - 0x6e7374616c6c6564, 0x2076657273696f6e, 0x207768656e20616e, 0x797468696e672066, 0x61696c73206f7220, - 0x607369676e616c60, 0x2069732061626f72, 0x7465642e0a657870, 0x6f7274206173796e, 0x632066756e637469, - 0x6f6e20696e737461, 0x6c6c28737065632c, 0x207b70726f677265, 0x7373203d20282920, 0x3d3e207b7d2c202e, - 0x2e2e6f7074696f6e, 0x737d203d207b7d29, 0x207b0a2020202063, 0x6f6e7374207b6e61, 0x6d652c2076657273, - 0x696f6e3a20726571, 0x7565737465647d20, 0x3d20706172736553, 0x7065632873706563, 0x293b0a2020202063, - 0x6f6e7374207b6272, 0x696467652c206665, 0x746368496d706c2c, 0x207369676e616c2c, 0x20626173657d203d, - 0x2061776169742073, 0x657474696e677328, 0x6f7074696f6e7329, 0x3b0a20202020636f, 0x6e7374207061636b, - 0x756d656e744c6f63, 0x6174696f6e203d20, 0x7061636b756d656e, 0x7455726c28626173, 0x652c206e616d6529, - 0x3b0a20202020636f, 0x6e7374206d616e69, 0x66657374203d2072, 0x65736f6c76654d61, 0x6e69666573742861, - 0x7761697420666574, 0x63684a736f6e2870, 0x61636b756d656e74, 0x4c6f636174696f6e, 0x2c20666574636849, - 0x6d706c2c20736967, 0x6e616c292c206e61, 0x6d652c2072657175, 0x6573746564293b0a, 0x20202020636f6e73, - 0x74207b7665727369, 0x6f6e7d203d206d61, 0x6e69666573743b0a, 0x2020202070726f67, 0x726573732860446f, - 0x776e6c6f6164696e, 0x6720247b6e616d65, 0x7d40247b76657273, 0x696f6e7de280a660, 0x293b0a2020202063, - 0x6f6e7374207b696e, 0x746567726974792c, 0x2066696c65737d20, 0x3d20617761697420, 0x646f776e6c6f6164, - 0x286d616e69666573, 0x742c207061636b75, 0x6d656e744c6f6361, 0x74696f6e2c206665, 0x746368496d706c2c, - 0x207369676e616c29, 0x3b0a20202020636f, 0x6e7374207b656e74, 0x72792c207469746c, 0x657d203d20746f6f, - 0x6c4f662866696c65, 0x732c206e616d652c, 0x2076657273696f6e, 0x293b0a2020202069, 0x6620282166696c65, - 0x732e68617328656e, 0x74727929290a2020, 0x2020202020207468, 0x726f77206e657720, 0x4572726f72286054, - 0x686520656e747279, 0x207061676520247b, 0x656e7472797d206f, 0x6620247b6e616d65, 0x7d206973206e6f74, - 0x20696e2074686520, 0x7061636b61676560, 0x293b0a0a20202020, 0x70726f6772657373, 0x2860496e7374616c, - 0x6c696e6720247b66, 0x696c65732e73697a, 0x657d2066696c6573, 0xe280a660293b0a20, 0x2020206177616974, - 0x20706b6746756e63, 0x74696f6e28627269, 0x6467652c20226265, 0x67696e2229286e61, 0x6d652c2076657273, - 0x696f6e293b0a2020, 0x2020617761697420, 0x75706c6f61642866, 0x696c65732c207b62, 0x72696467652c206e, - 0x616d652c20766572, 0x73696f6e2c207369, 0x676e616c7d293b0a, 0x202020207369676e, 0x616c3f2e7468726f, - 0x77496641626f7274, 0x656428293b0a2020, 0x2020617761697420, 0x706b6746756e6374, 0x696f6e2862726964, - 0x67652c2022636f6d, 0x6d69742229286e61, 0x6d652c2076657273, 0x696f6e2c20696e74, 0x6567726974792c20, - 0x656e7472792c2074, 0x69746c65293b0a20, 0x2020207265747572, 0x6e207b6e616d652c, 0x2076657273696f6e, - 0x2c207469746c652c, 0x20656e7472792c20, 0x66696c65733a2066, 0x696c65732e73697a, 0x657d3b0a7d0a0a2f, - 0x2f2f205468652069, 0x6e7374616c6c6564, 0x20746f6f6c732c20, 0x66726f6d20746865, 0x207061676573206f, - 0x662077656266726f, 0x6e742e706b672e6c, 0x69737428293a207b, 0x6e616d652c207665, 0x7273696f6e2c2075, - 0x726c2c207469746c, 0x657d206f626a6563, 0x74732e0a6578706f, 0x7274206173796e63, 0x2066756e6374696f, - 0x6e20696e7374616c, 0x6c65642862726964, 0x6765203d20676c6f, 0x62616c546869732e, 0x77656246726f6e74, - 0x29207b0a20202020, 0x636f6e7374206c69, 0x7374203d20706b67, 0x46756e6374696f6e, 0x286272696467652c, - 0x20226c6973742229, 0x3b0a20202020636f, 0x6e737420746f6f6c, 0x73203d205b5d3b0a, 0x20202020666f7220, - 0x283b3b29207b0a20, 0x2020202020202063, 0x6f6e7374206c696e, 0x6573203d20286177, 0x616974206c697374, - 0x28746f6f6c732e6c, 0x656e67746829292e, 0x73706c697428225c, 0x6e22292e66696c74, 0x657228286c696e65, - 0x29203d3e206c696e, 0x6520213d3d202222, 0x293b0a2020202020, 0x202020696620286c, 0x696e65732e6c656e, - 0x677468203d3d3d20, 0x30290a2020202020, 0x2020202020202072, 0x657475726e20746f, 0x6f6c733b0a202020, - 0x2020202020666f72, 0x2028636f6e737420, 0x6c696e65206f6620, 0x6c696e657329207b, 0x0a20202020202020, - 0x2020202020636f6e, 0x7374205b6e616d65, 0x2c2076657273696f, 0x6e2c2075726c2c20, 0x7469746c655d203d, - 0x206c696e652e7370, 0x6c697428225c7422, 0x293b0a2020202020, 0x2020202020202074, 0x6f6f6c732e707573, - 0x68287b6e616d652c, 0x2076657273696f6e, 0x2c2075726c2c2074, 0x69746c657d293b0a, 0x2020202020202020, - 0x7d0a202020207d0a, 0x7d0a0a2f2f2f204f, 0x70656e7320746865, 0x20656e7472792070, 0x616765206f662061, - 0x6e20696e7374616c, 0x6c656420746f6f6c, 0x20696e2061206e65, 0x7720746162206f72, 0x2077696e646f772c, - 0x20616e6420726573, 0x6f6c76657320746f, 0x206974732055524c, 0x2e0a6578706f7274, 0x206173796e632066, - 0x756e6374696f6e20, 0x6f70656e286e616d, 0x652c206272696467, 0x65203d20676c6f62, 0x616c546869732e77, - 0x656246726f6e7429, 0x207b0a2020202063, 0x6f6e737420746f6f, 0x6c203d2028617761, 0x697420696e737461, - 0x6c6c656428627269, 0x64676529292e6669, 0x6e64282863616e64, 0x696461746529203d, 0x3e2063616e646964, - 0x6174652e6e616d65, 0x203d3d3d206e616d, 0x65293b0a20202020, 0x6966202821746f6f, 0x6c290a2020202020, - 0x2020207468726f77, 0x206e657720457272, 0x6f722860247b6e61, 0x6d657d206973206e, 0x6f7420696e737461, - 0x6c6c656460293b0a, 0x2020202072657475, 0x726e207b2e2e2e74, 0x6f6f6c2c206f7065, 0x6e65643a20676c6f, - 0x62616c546869732e, 0x6f70656e28746f6f, 0x6c2e75726c2c2022, 0x5f626c616e6b2229, 0x20213d3d206e756c, - 0x6c7d3b0a7d0a0a66, 0x756e6374696f6e20, 0x726571756972654f, 0x6e65286172677329, 0x207b0a2020202069, - 0x662028617267732e, 0x6c656e6774682021, 0x3d3d2031290a2020, 0x2020202020207468, 0x726f77206e657720, - 0x4572726f72282257, 0x726f6e67206e756d, 0x626572206f662061, 0x7267756d656e7473, 0x2e20547970652027, - 0x77662068656c7027, 0x2e22293b0a202020, 0x2072657475726e20, 0x617267735b305d3b, 0x0a7d0a0a66756e63, - 0x74696f6e20666f72, 0x6d6174466f756e64, 0x28666f756e642920, 0x7b0a202020206966, 0x2028666f756e642e, - 0x6c656e677468203d, 0x3d3d2030290a2020, 0x2020202020207265, 0x7475726e20224e6f, 0x20746f6f6c20666f, - 0x756e642e223b0a20, 0x202020636f6e7374, 0x207769647468203d, 0x204d6174682e6d61, 0x78282e2e2e666f75, - 0x6e642e6d61702828, 0x7b6e616d652c2076, 0x657273696f6e7d29, 0x203d3e206e616d65, 0x2e6c656e67746820, - 0x2b2076657273696f, 0x6e2e6c656e677468, 0x202b203129293b0a, 0x2020202072657475, 0x726e20666f756e64, - 0x2e6d617028287b6e, 0x616d652c20766572, 0x73696f6e2c206465, 0x736372697074696f, 0x6e7d29203d3e2060, - 0x247b6e616d657d40, 0x247b76657273696f, 0x6e7d602e70616445, 0x6e64287769647468, 0x202b203229202b20, - 0x6465736372697074, 0x696f6e292e6a6f69, 0x6e28225c6e22293b, 0x0a7d0a0a2f2f2054, 0x6865207766207375, - 0x62636f6d6d616e64, 0x732072756e6e696e, 0x6720696e20746865, 0x2062726f77736572, 0x3b20277766206c69, - 0x7374272c20277766, 0x2072656d6f766527, 0x20616e6420277766, 0x2068656c70272072, 0x756e20696e20432b, - 0x2b2e0a636f6e7374, 0x20737562636f6d6d, 0x616e6473203d207b, 0x0a20202020736561, 0x7263683a20617379, - 0x6e63202861726773, 0x2c207b6272696467, 0x652c207369676e61, 0x6c7d29203d3e2066, 0x6f726d6174466f75, - 0x6e64286177616974, 0x2073656172636828, 0x617267732e6a6f69, 0x6e28222022292c20, 0x7b6272696467652c, - 0x207369676e616c7d, 0x29292c0a20202020, 0x696e7374616c6c3a, 0x206173796e632028, 0x617267732c207b62, - 0x72696467652c2073, 0x69676e616c2c2077, 0x726974657d29203d, 0x3e207b0a20202020, 0x20202020636f6e73, - 0x7420746f6f6c203d, 0x2061776169742069, 0x6e7374616c6c2872, 0x6571756972654f6e, 0x652861726773292c, - 0x207b627269646765, 0x2c207369676e616c, 0x2c2070726f677265, 0x73733a2028737465, 0x7029203d3e207772, - 0x6974652873746570, 0x202b20225c6e2229, 0x7d293b0a20202020, 0x2020202072657475, 0x726e2060496e7374, - 0x616c6c656420247b, 0x746f6f6c2e6e616d, 0x657d40247b746f6f, 0x6c2e76657273696f, 0x6e7d3a20247b746f, - 0x6f6c2e7469746c65, 0x7d2e205479706520, 0x277766206f70656e, 0x20247b746f6f6c2e, 0x6e616d657d272e60, - 0x3b0a202020207d2c, 0x0a202020206f7065, 0x6e3a206173796e63, 0x2028617267732c20, 0x7b6272696467657d, - 0x29203d3e207b0a20, 0x2020202020202063, 0x6f6e737420746f6f, 0x6c203d2061776169, 0x74206f70656e2872, - 0x6571756972654f6e, 0x652861726773292c, 0x2062726964676529, 0x3b0a202020202020, 0x202072657475726e, - 0x20746f6f6c2e6f70, 0x656e6564203f2060, 0x4f70656e65642024, 0x7b746f6f6c2e7469, 0x746c657d3a20247b, - 0x746f6f6c2e75726c, 0x7d60203a20605468, 0x652062726f777365, 0x7220626c6f636b65, 0x6420746865206e65, - 0x772077696e646f77, 0x2e204f70656e2024, 0x7b746f6f6c2e7572, 0x6c7d603b0a202020, 0x207d2c0a7d3b0a0a, - 0x6173796e63206675, 0x6e6374696f6e2077, 0x66285b636f6d6d61, 0x6e642c202e2e2e61, 0x7267735d2c20636f, - 0x6e7465787429207b, 0x0a20202020726574, 0x75726e204f626a65, 0x63742e6861734f77, 0x6e28737562636f6d, - 0x6d616e64732c2063, 0x6f6d6d616e642920, 0x3f20737562636f6d, 0x6d616e64735b636f, 0x6d6d616e645d2861, - 0x7267732c20636f6e, 0x7465787429203a20, 0x756e646566696e65, 0x643b0a7d0a0a2f2f, 0x2f205465726d696e, - 0x616c2062726f7773, 0x657220636f6d6d61, 0x6e64732028736565, 0x205465726d696e61, 0x6c3a3a657874656e, - 0x73696f6e292e0a65, 0x78706f727420636f, 0x6e737420636f6d6d, 0x616e6473203d207b, 0x77667d3b0a000000 - }; -}; - -} // namespace webfront::fs::generated diff --git a/include/ApplicationOrigin.hpp b/include/webfront/ApplicationOrigin.hpp similarity index 100% rename from include/ApplicationOrigin.hpp rename to include/webfront/ApplicationOrigin.hpp diff --git a/include/ContentPolicy.hpp b/include/webfront/ContentPolicy.hpp similarity index 100% rename from include/ContentPolicy.hpp rename to include/webfront/ContentPolicy.hpp diff --git a/include/DeveloperApp.hpp b/include/webfront/DeveloperApp.hpp similarity index 100% rename from include/DeveloperApp.hpp rename to include/webfront/DeveloperApp.hpp diff --git a/include/JsFunction.hpp b/include/webfront/JsFunction.hpp similarity index 100% rename from include/JsFunction.hpp rename to include/webfront/JsFunction.hpp diff --git a/include/JsFunctionSender.hpp b/include/webfront/JsFunctionSender.hpp similarity index 100% rename from include/JsFunctionSender.hpp rename to include/webfront/JsFunctionSender.hpp diff --git a/include/Task.hpp b/include/webfront/Task.hpp similarity index 100% rename from include/Task.hpp rename to include/webfront/Task.hpp diff --git a/include/UISubscribers.hpp b/include/webfront/UISubscribers.hpp similarity index 100% rename from include/UISubscribers.hpp rename to include/webfront/UISubscribers.hpp diff --git a/include/WebFront.hpp b/include/webfront/WebFront.hpp similarity index 100% rename from include/WebFront.hpp rename to include/webfront/WebFront.hpp diff --git a/include/components/Terminal.hpp b/include/webfront/components/Terminal.hpp similarity index 100% rename from include/components/Terminal.hpp rename to include/webfront/components/Terminal.hpp diff --git a/include/components/ToolManager.hpp b/include/webfront/components/ToolManager.hpp similarity index 100% rename from include/components/ToolManager.hpp rename to include/webfront/components/ToolManager.hpp diff --git a/include/details/C++20Support.hpp b/include/webfront/details/C++20Support.hpp similarity index 100% rename from include/details/C++20Support.hpp rename to include/webfront/details/C++20Support.hpp diff --git a/include/details/C++23Support.hpp b/include/webfront/details/C++23Support.hpp similarity index 100% rename from include/details/C++23Support.hpp rename to include/webfront/details/C++23Support.hpp diff --git a/include/frontend/Action.hpp b/include/webfront/frontend/Action.hpp similarity index 100% rename from include/frontend/Action.hpp rename to include/webfront/frontend/Action.hpp diff --git a/include/frontend/CEF.hpp b/include/webfront/frontend/CEF.hpp similarity index 100% rename from include/frontend/CEF.hpp rename to include/webfront/frontend/CEF.hpp diff --git a/include/frontend/CEFPaths.hpp b/include/webfront/frontend/CEFPaths.hpp similarity index 100% rename from include/frontend/CEFPaths.hpp rename to include/webfront/frontend/CEFPaths.hpp diff --git a/include/frontend/DefaultBrowser.hpp b/include/webfront/frontend/DefaultBrowser.hpp similarity index 100% rename from include/frontend/DefaultBrowser.hpp rename to include/webfront/frontend/DefaultBrowser.hpp diff --git a/include/frontend/Frontend.hpp b/include/webfront/frontend/Frontend.hpp similarity index 100% rename from include/frontend/Frontend.hpp rename to include/webfront/frontend/Frontend.hpp diff --git a/include/frontend/NativeWebView.hpp b/include/webfront/frontend/NativeWebView.hpp similarity index 100% rename from include/frontend/NativeWebView.hpp rename to include/webfront/frontend/NativeWebView.hpp diff --git a/include/frontend/Url.hpp b/include/webfront/frontend/Url.hpp similarity index 100% rename from include/frontend/Url.hpp rename to include/webfront/frontend/Url.hpp diff --git a/include/frontend/WKWebView.hpp b/include/webfront/frontend/WKWebView.hpp similarity index 100% rename from include/frontend/WKWebView.hpp rename to include/webfront/frontend/WKWebView.hpp diff --git a/include/frontend/WebKitGTK.hpp b/include/webfront/frontend/WebKitGTK.hpp similarity index 100% rename from include/frontend/WebKitGTK.hpp rename to include/webfront/frontend/WebKitGTK.hpp diff --git a/include/frontend/WebKitGTKPolicy.hpp b/include/webfront/frontend/WebKitGTKPolicy.hpp similarity index 100% rename from include/frontend/WebKitGTKPolicy.hpp rename to include/webfront/frontend/WebKitGTKPolicy.hpp diff --git a/include/frontend/WebView2.hpp b/include/webfront/frontend/WebView2.hpp similarity index 100% rename from include/frontend/WebView2.hpp rename to include/webfront/frontend/WebView2.hpp diff --git a/include/http/AcceptEncoding.hpp b/include/webfront/http/AcceptEncoding.hpp similarity index 100% rename from include/http/AcceptEncoding.hpp rename to include/webfront/http/AcceptEncoding.hpp diff --git a/include/http/BuffersPolicy.hpp b/include/webfront/http/BuffersPolicy.hpp similarity index 100% rename from include/http/BuffersPolicy.hpp rename to include/webfront/http/BuffersPolicy.hpp diff --git a/include/http/Encodings.hpp b/include/webfront/http/Encodings.hpp similarity index 100% rename from include/http/Encodings.hpp rename to include/webfront/http/Encodings.hpp diff --git a/include/http/Gzip.hpp b/include/webfront/http/Gzip.hpp similarity index 100% rename from include/http/Gzip.hpp rename to include/webfront/http/Gzip.hpp diff --git a/include/http/HTTPServer.hpp b/include/webfront/http/HTTPServer.hpp similarity index 100% rename from include/http/HTTPServer.hpp rename to include/webfront/http/HTTPServer.hpp diff --git a/include/http/MimeType.hpp b/include/webfront/http/MimeType.hpp similarity index 100% rename from include/http/MimeType.hpp rename to include/webfront/http/MimeType.hpp diff --git a/include/http/WebSocket.hpp b/include/webfront/http/WebSocket.hpp similarity index 100% rename from include/http/WebSocket.hpp rename to include/webfront/http/WebSocket.hpp diff --git a/include/networking/BasicNetworking.hpp b/include/webfront/networking/BasicNetworking.hpp similarity index 100% rename from include/networking/BasicNetworking.hpp rename to include/webfront/networking/BasicNetworking.hpp diff --git a/include/networking/NetworkingMock.hpp b/include/webfront/networking/NetworkingMock.hpp similarity index 100% rename from include/networking/NetworkingMock.hpp rename to include/webfront/networking/NetworkingMock.hpp diff --git a/include/networking/SenderHeaders.hpp b/include/webfront/networking/SenderHeaders.hpp similarity index 100% rename from include/networking/SenderHeaders.hpp rename to include/webfront/networking/SenderHeaders.hpp diff --git a/include/networking/TCPNetworkingStdnet.hpp b/include/webfront/networking/TCPNetworkingStdnet.hpp similarity index 100% rename from include/networking/TCPNetworkingStdnet.hpp rename to include/webfront/networking/TCPNetworkingStdnet.hpp diff --git a/include/networking/TCPSockets.hpp b/include/webfront/networking/TCPSockets.hpp similarity index 100% rename from include/networking/TCPSockets.hpp rename to include/webfront/networking/TCPSockets.hpp diff --git a/include/networking/Tasks.hpp b/include/webfront/networking/Tasks.hpp similarity index 100% rename from include/networking/Tasks.hpp rename to include/webfront/networking/Tasks.hpp diff --git a/include/system/BabelData.hpp b/include/webfront/system/BabelData.hpp similarity index 100% rename from include/system/BabelData.hpp rename to include/webfront/system/BabelData.hpp diff --git a/include/system/BabelFS.hpp b/include/webfront/system/BabelFS.hpp similarity index 100% rename from include/system/BabelFS.hpp rename to include/webfront/system/BabelFS.hpp diff --git a/include/system/DefaultFS.hpp b/include/webfront/system/DefaultFS.hpp similarity index 100% rename from include/system/DefaultFS.hpp rename to include/webfront/system/DefaultFS.hpp diff --git a/include/system/DeveloperBootstrapData.hpp b/include/webfront/system/DeveloperBootstrapData.hpp similarity index 100% rename from include/system/DeveloperBootstrapData.hpp rename to include/webfront/system/DeveloperBootstrapData.hpp diff --git a/include/system/DeveloperFS.hpp b/include/webfront/system/DeveloperFS.hpp similarity index 100% rename from include/system/DeveloperFS.hpp rename to include/webfront/system/DeveloperFS.hpp diff --git a/include/system/DeveloperFiles.hpp b/include/webfront/system/DeveloperFiles.hpp similarity index 100% rename from include/system/DeveloperFiles.hpp rename to include/webfront/system/DeveloperFiles.hpp diff --git a/include/system/DeveloperIndexHtmlData.hpp b/include/webfront/system/DeveloperIndexHtmlData.hpp similarity index 100% rename from include/system/DeveloperIndexHtmlData.hpp rename to include/webfront/system/DeveloperIndexHtmlData.hpp diff --git a/include/system/DeveloperPaths.hpp b/include/webfront/system/DeveloperPaths.hpp similarity index 100% rename from include/system/DeveloperPaths.hpp rename to include/webfront/system/DeveloperPaths.hpp diff --git a/include/webfront/system/DeveloperReleaseData.hpp b/include/webfront/system/DeveloperReleaseData.hpp new file mode 100644 index 00000000..eed7156a --- /dev/null +++ b/include/webfront/system/DeveloperReleaseData.hpp @@ -0,0 +1,10 @@ +#pragma once + +// Pinned developer distribution. Regenerate with js/developer/tools/build.mjs --refresh-bootstrap. +#include + +namespace webfront::developer::release { +inline constexpr std::string_view version{"0.4.1"}; +inline constexpr std::string_view environment{"https://ambroise-leclerc.github.io/WebFront/developer/0.4.1/environment.tgz"}; +inline constexpr std::string_view integrity{"sha512-GFvk1FWIVWBWAXLzJUEmaKo1CIMS82FZdhZyd/q8qE3/FA8CcxFN7G/u4gpQJNMJ9R1PKKLV0UXd2uuk08y0AA=="}; +} // namespace webfront::developer::release diff --git a/include/system/DeveloperStore.hpp b/include/webfront/system/DeveloperStore.hpp similarity index 100% rename from include/system/DeveloperStore.hpp rename to include/webfront/system/DeveloperStore.hpp diff --git a/include/system/FallbackIndexHtmlData.hpp b/include/webfront/system/FallbackIndexHtmlData.hpp similarity index 100% rename from include/system/FallbackIndexHtmlData.hpp rename to include/webfront/system/FallbackIndexHtmlData.hpp diff --git a/include/system/FallbackModuleData.hpp b/include/webfront/system/FallbackModuleData.hpp similarity index 100% rename from include/system/FallbackModuleData.hpp rename to include/webfront/system/FallbackModuleData.hpp diff --git a/include/system/FileSystem.hpp b/include/webfront/system/FileSystem.hpp similarity index 99% rename from include/system/FileSystem.hpp rename to include/webfront/system/FileSystem.hpp index e447d01d..a484b212 100644 --- a/include/system/FileSystem.hpp +++ b/include/webfront/system/FileSystem.hpp @@ -4,7 +4,7 @@ #pragma once #include "../details/C++23Support.hpp" -#include "tooling/Logger.hpp" +#include #include #include diff --git a/include/system/IndexFS.hpp b/include/webfront/system/IndexFS.hpp similarity index 100% rename from include/system/IndexFS.hpp rename to include/webfront/system/IndexFS.hpp diff --git a/include/system/JasmineBootData.hpp b/include/webfront/system/JasmineBootData.hpp similarity index 100% rename from include/system/JasmineBootData.hpp rename to include/webfront/system/JasmineBootData.hpp diff --git a/include/system/JasmineCssData.hpp b/include/webfront/system/JasmineCssData.hpp similarity index 100% rename from include/system/JasmineCssData.hpp rename to include/webfront/system/JasmineCssData.hpp diff --git a/include/system/JasmineFS.hpp b/include/webfront/system/JasmineFS.hpp similarity index 100% rename from include/system/JasmineFS.hpp rename to include/webfront/system/JasmineFS.hpp diff --git a/include/system/JasmineFaviconData.hpp b/include/webfront/system/JasmineFaviconData.hpp similarity index 100% rename from include/system/JasmineFaviconData.hpp rename to include/webfront/system/JasmineFaviconData.hpp diff --git a/include/system/JasmineHtmlData.hpp b/include/webfront/system/JasmineHtmlData.hpp similarity index 100% rename from include/system/JasmineHtmlData.hpp rename to include/webfront/system/JasmineHtmlData.hpp diff --git a/include/system/JasmineJsData.hpp b/include/webfront/system/JasmineJsData.hpp similarity index 100% rename from include/system/JasmineJsData.hpp rename to include/webfront/system/JasmineJsData.hpp diff --git a/include/system/NativeFS.hpp b/include/webfront/system/NativeFS.hpp similarity index 100% rename from include/system/NativeFS.hpp rename to include/webfront/system/NativeFS.hpp diff --git a/include/system/PackageFS.hpp b/include/webfront/system/PackageFS.hpp similarity index 100% rename from include/system/PackageFS.hpp rename to include/webfront/system/PackageFS.hpp diff --git a/include/system/ReactFS.hpp b/include/webfront/system/ReactFS.hpp similarity index 100% rename from include/system/ReactFS.hpp rename to include/webfront/system/ReactFS.hpp diff --git a/include/system/ReactRuntimeData.hpp b/include/webfront/system/ReactRuntimeData.hpp similarity index 100% rename from include/system/ReactRuntimeData.hpp rename to include/webfront/system/ReactRuntimeData.hpp diff --git a/include/system/TerminalFS.hpp b/include/webfront/system/TerminalFS.hpp similarity index 100% rename from include/system/TerminalFS.hpp rename to include/webfront/system/TerminalFS.hpp diff --git a/include/system/TerminalIndexHtmlData.hpp b/include/webfront/system/TerminalIndexHtmlData.hpp similarity index 100% rename from include/system/TerminalIndexHtmlData.hpp rename to include/webfront/system/TerminalIndexHtmlData.hpp diff --git a/include/webfront/system/TerminalModuleData.hpp b/include/webfront/system/TerminalModuleData.hpp new file mode 100644 index 00000000..70bd555a --- /dev/null +++ b/include/webfront/system/TerminalModuleData.hpp @@ -0,0 +1,343 @@ +#pragma once + +#include +#include +#include +#include + +namespace webfront::fs::generated { + +struct TerminalModuleData { + static constexpr std::string_view encoding{}; + static constexpr std::size_t dataSize{13037}; + static constexpr std::array data{ + 0x2f2f2f2040627269, 0x6566205765624672, 0x6f6e74207465726d, 0x696e616c20636f6d, 0x706f6e656e743a20, + 0x616e20787465726d, 0x2e6a73207465726d, 0x696e616c2077686f, 0x7365206c696e6520, 0x656469746f722073, + 0x656e647320656163, 0x682076616c696461, 0x7465640a2f2f2f20, 0x6c696e6520746f20, 0x74686520432b2b20, + 0x636f6d6d616e6473, 0x2072656769737465, 0x726564207468726f, 0x7567682077656266, 0x726f6e743a3a5465, + 0x726d696e616c2028, 0x696e636c7564652f, 0x77656266726f6e74, 0x2f636f6d706f6e65, 0x6e74732f5465726d, + 0x696e616c2e687070, 0x292c0a2f2f2f2075, 0x6e6c657373206120, 0x62726f7773657220, 0x636f6d6d616e6420, + 0x6f6620616e206578, 0x74656e73696f6e20, 0x6d6f64756c652028, 0x5465726d696e616c, 0x3a3a657874656e73, + 0x696f6e292068616e, 0x646c657320697420, 0x66697273742e0a0a, 0x696d706f7274207b, 0x5465726d696e616c, + 0x7d2066726f6d2022, 0x2e2f787465726d2e, 0x6d6a73223b0a696d, 0x706f7274207b4669, 0x744164646f6e7d20, + 0x66726f6d20222e2f, 0x6164646f6e2d6669, 0x742e6d6a73223b0a, 0x0a636f6e73742061, 0x6e7369203d207b0a, + 0x202020207265643a, 0x2028746578742920, 0x3d3e20605c783162, 0x5b33316d247b7465, 0x78747d5c7831625b, + 0x306d602c0a202020, 0x20636c656172546f, 0x456e643a20225c78, 0x31625b4b222c0a20, 0x202020636c656172, + 0x53637265656e3a20, 0x225c7831625b324a, 0x5c7831625b334a5c, 0x7831625b48222c0a, 0x202020206c656674, + 0x3a2028636f756e74, 0x29203d3e2028636f, 0x756e74203e203020, 0x3f20605c7831625b, 0x247b636f756e747d, + 0x4460203a20222229, 0x2c0a7d3b0a0a6675, 0x6e6374696f6e2063, 0x6f6d6d6f6e507265, 0x66697828776f7264, + 0x7329207b0a202020, 0x2072657475726e20, 0x776f7264732e7265, 0x6475636528287072, 0x656669782c20776f, + 0x726429203d3e207b, 0x0a20202020202020, 0x20636f6e7374206c, 0x696d6974203d204d, 0x6174682e6d696e28, + 0x7072656669782e6c, 0x656e6774682c2077, 0x6f72642e6c656e67, 0x7468293b0a202020, 0x20202020206c6574, + 0x206c656e67746820, 0x3d20303b0a202020, 0x2020202020776869, 0x6c6520286c656e67, 0x7468203c206c696d, + 0x6974202626207072, 0x656669785b6c656e, 0x6774685d203d3d3d, 0x20776f72645b6c65, 0x6e6774685d290a20, + 0x2020202020202020, 0x2020202b2b6c656e, 0x6774683b0a202020, 0x2020202020726574, 0x75726e2070726566, + 0x69782e736c696365, 0x28302c206c656e67, 0x7468293b0a202020, 0x207d293b0a7d0a0a, 0x2f2f205265616473, + 0x2061206c696e6520, 0x666f7220746f6b65, 0x6e697a6528292c20, 0x6f6e6520776f7264, 0x2070617274206174, + 0x20612074696d652e, 0x0a636c6173732053, 0x63616e6e6572207b, 0x0a20202020636f6e, 0x7374727563746f72, + 0x286c696e6529207b, 0x0a20202020202020, 0x20746869732e6c69, 0x6e65203d206c696e, 0x653b0a2020202020, + 0x202020746869732e, 0x696e646578203d20, 0x303b0a202020207d, 0x0a0a202020206765, 0x7420646f6e652829, + 0x207b0a2020202020, 0x2020207265747572, 0x6e20746869732e69, 0x6e646578203d3d3d, 0x20746869732e6c69, + 0x6e652e6c656e6774, 0x683b0a202020207d, 0x0a0a202020206e65, 0x78742870726f626c, 0x656d29207b0a2020, + 0x2020202020206966, 0x2028746869732e64, 0x6f6e65290a202020, 0x2020202020202020, 0x207468726f77206e, + 0x65772053796e7461, 0x784572726f722870, 0x726f626c656d293b, 0x0a20202020202020, 0x2072657475726e20, + 0x746869732e6c696e, 0x655b746869732e69, 0x6e6465782b2b5d3b, 0x0a202020207d0a0a, 0x202020202f2f2054, + 0x686520636f6e7465, 0x6e74206f66206120, 0x71756f7465642073, 0x7472696e67207768, 0x6f7365206f70656e, + 0x696e672071756f74, 0x6520776173207265, 0x61642e20496e7369, 0x646520646f75626c, 0x652071756f746573, + 0x2061206261636b73, 0x6c6173680a202020, 0x202f2f2065736361, 0x7065732074686520, 0x6e65787420636861, + 0x7261637465723b20, 0x6f6e6520656e6469, 0x6e6720746865206c, 0x696e652073746179, 0x73206c6974657261, + 0x6c2c20616e642074, 0x6865206d69737369, 0x6e6720636c6f7369, 0x6e672071756f7465, 0x0a202020202f2f20, + 0x6973207265706f72, 0x746564206e657874, 0x2e0a202020207175, 0x6f7465642871756f, 0x746529207b0a2020, + 0x2020202020206c65, 0x7420636f6e74656e, 0x74203d2022223b0a, 0x2020202020202020, 0x666f7220286c6574, + 0x2063686172203d20, 0x746869732e6e6578, 0x742822556e746572, 0x6d696e6174656420, 0x71756f746522293b, + 0x206368617220213d, 0x3d2071756f74653b, 0x2063686172203d20, 0x746869732e6e6578, 0x742822556e746572, + 0x6d696e6174656420, 0x71756f7465222929, 0x0a20202020202020, 0x2020202020636f6e, 0x74656e74202b3d20, + 0x71756f7465203d3d, 0x3d20272227202626, 0x2063686172203d3d, 0x3d20225c5c222026, 0x262021746869732e, + 0x646f6e65203f2074, 0x6869732e6e657874, 0x2829203a20636861, 0x723b0a2020202020, 0x2020207265747572, + 0x6e20636f6e74656e, 0x743b0a202020207d, 0x0a0a202020202f2f, 0x2057686174206063, 0x686172602c207265, + 0x6164206f75747369, 0x64652071756f7465, 0x732c206164647320, 0x746f207468652063, 0x757272656e742077, + 0x6f72642e0a202020, 0x2070617274286368, 0x617229207b0a2020, 0x2020202020206966, 0x202863686172203d, + 0x3d3d20225c5c2229, 0x0a20202020202020, 0x2020202020726574, 0x75726e2074686973, 0x2e6e657874282254, + 0x7261696c696e6720, 0x6261636b736c6173, 0x6822293b0a202020, 0x2020202020696620, 0x2863686172203d3d, + 0x3d20222722207c7c, 0x2063686172203d3d, 0x3d20272227290a20, 0x2020202020202020, 0x2020207265747572, + 0x6e20746869732e71, 0x756f746564286368, 0x6172293b0a202020, 0x2020202020726574, 0x75726e2063686172, + 0x3b0a202020207d0a, 0x7d0a0a2f2f2f2053, 0x706c697473206120, 0x6c696e6520696e74, 0x6f20776f72647320, + 0x6c696b6520746572, 0x6d696e616c3a3a74, 0x6f6b656e697a6520, 0x696e20432b2b3a20, 0x7768697465737061, + 0x6365207365706172, 0x6174657320776f72, 0x64732c2073696e67, 0x6c652071756f7465, 0x730a2f2f2f206b65, + 0x6570207468656972, 0x20636f6e74656e74, 0x2076657262617469, 0x6d2c20646f75626c, 0x652071756f746573, + 0x206b656570206974, 0x2062757420686f6e, 0x6f72206261636b73, 0x6c61736820657363, 0x617065732c20616e, + 0x6420616e20756e71, 0x756f7465640a2f2f, 0x2f206261636b736c, 0x6173682065736361, 0x7065732074686520, + 0x6e65787420636861, 0x7261637465722e20, 0x5468726f77732061, 0x2053796e74617845, 0x72726f72206f6e20, + 0x616e20756e746572, 0x6d696e6174656420, 0x71756f7465206f72, 0x206120747261696c, 0x696e670a2f2f2f20, + 0x6261636b736c6173, 0x682e0a6578706f72, 0x742066756e637469, 0x6f6e20746f6b656e, 0x697a65286c696e65, + 0x29207b0a20202020, 0x636f6e737420776f, 0x726473203d205b5d, 0x3b0a20202020636f, 0x6e7374207363616e, + 0x6e6572203d206e65, 0x77205363616e6e65, 0x72286c696e65293b, 0x0a202020206c6574, 0x20776f7264203d20, + 0x6e756c6c3b20202f, 0x2f206e756c6c2062, 0x65747765656e2077, 0x6f7264730a202020, 0x207768696c652028, + 0x217363616e6e6572, 0x2e646f6e6529207b, 0x0a20202020202020, 0x20636f6e73742063, 0x686172203d207363, + 0x616e6e65722e6e65, 0x787428293b0a2020, 0x202020202020636f, 0x6e73742073657061, 0x7261746f72203d20, + 0x63686172203d3d3d, 0x20222022207c7c20, 0x63686172203d3d3d, 0x20225c74223b0a20, 0x2020202020202069, + 0x6620287365706172, 0x61746f7220262620, 0x776f726420213d3d, 0x206e756c6c290a20, 0x2020202020202020, + 0x202020776f726473, 0x2e7075736828776f, 0x7264293b0a202020, 0x2020202020776f72, 0x64203d2073657061, + 0x7261746f72203f20, 0x6e756c6c203a2028, 0x776f7264203f3f20, 0x222229202b207363, 0x616e6e65722e7061, + 0x7274286368617229, 0x3b0a202020207d0a, 0x2020202069662028, 0x776f726420213d3d, 0x206e756c6c290a20, + 0x2020202020202077, 0x6f7264732e707573, 0x6828776f7264293b, 0x0a20202020726574, 0x75726e20776f7264, + 0x733b0a7d0a0a2f2f, 0x2042726f77736572, 0x20636f6d6d616e64, 0x206f757470757420, 0x7573657320225c6e, + 0x22206c696e652065, 0x6e64696e67732c20, 0x636f6e7665727465, 0x64206c696b652043, 0x2b2b206f75747075, + 0x742e0a636f6e7374, 0x20746f5465726d69, 0x6e616c5465787420, 0x3d20287465787429, 0x203d3e2074657874, + 0x2e7265706c616365, 0x282f283f3c215c72, 0x295c6e2f672c2022, 0x5c725c6e22293b0a, 0x0a2f2f2f2052756e, + 0x732061206c696e65, 0x3a20612062726f77, 0x73657220636f6d6d, 0x616e64206f662060, 0x636f6d6d616e6473, + 0x60202861204d6170, 0x2066726f6d20636f, 0x6d6d616e64206e61, 0x6d6520746f206861, 0x6e646c6572292077, + 0x68656e206f6e6520, 0x69730a2f2f2f2072, 0x6567697374657265, 0x6420666f72206974, 0x7320666972737420, + 0x776f726420616e64, 0x20646f6573206e6f, 0x742072657475726e, 0x20756e646566696e, 0x65642c20656c7365, + 0x206072756e496e43, 0x7070286c696e6529, 0x602e2041206c696e, 0x6520746861740a2f, 0x2f2f2063616e6e6f, + 0x742062652073706c, 0x697420676f657320, 0x746f20432b2b2c20, 0x7768696368207265, 0x706f727473207468, + 0x65206572726f722e, 0x2042726f77736572, 0x20636f6d6d616e64, 0x7320676574206073, 0x69676e616c602c20, + 0x7768696368204374, 0x726c2b430a2f2f2f, 0x2061626f72747320, 0x7769746820746865, 0x20726561736f6e20, + 0x4572726f72282249, 0x6e74657272757074, 0x656422293b206120, 0x432b2b20636f6d6d, 0x616e642063616e6e, + 0x6f7420626520696e, 0x7465727275707465, 0x642e0a6578706f72, 0x74206173796e6320, 0x66756e6374696f6e, + 0x2072756e4c696e65, 0x286c696e652c207b, 0x636f6d6d616e6473, 0x2c2072756e496e43, 0x70702c2077726974, + 0x652c206272696467, 0x652c207369676e61, 0x6c203d206e657720, 0x41626f7274436f6e, 0x74726f6c6c657228, + 0x292e7369676e616c, 0x7d29207b0a202020, 0x206c657420776f72, 0x64733b0a20202020, 0x747279207b0a2020, + 0x202020202020776f, 0x726473203d20746f, 0x6b656e697a65286c, 0x696e65293b0a2020, 0x20207d2063617463, + 0x6820286572726f72, 0x29207b0a20202020, 0x2020202072657475, 0x726e2072756e496e, 0x437070286c696e65, + 0x293b0a202020207d, 0x0a20202020636f6e, 0x73742068616e646c, 0x6572203d20776f72, 0x64732e6c656e6774, + 0x68203e2030203f20, 0x636f6d6d616e6473, 0x2e67657428776f72, 0x64735b305d29203a, 0x20756e646566696e, + 0x65643b0a20202020, 0x696620282168616e, 0x646c6572290a2020, 0x2020202020207265, 0x7475726e2072756e, + 0x496e437070286c69, 0x6e65293b0a202020, 0x20636f6e7374206f, 0x7574707574203d20, 0x6177616974206861, + 0x6e646c657228776f, 0x7264732e736c6963, 0x652831292c207b0a, 0x2020202020202020, 0x6c696e652c0a2020, + 0x2020202020206272, 0x696467652c0a2020, 0x2020202020207369, 0x676e616c2c0a2020, 0x2020202020207772, + 0x6974653a20287465, 0x787429203d3e2077, 0x7269746528746f54, 0x65726d696e616c54, 0x6578742853747269, + 0x6e67287465787429, 0x29292c0a20202020, 0x2020202072756e49, 0x6e4370703a202829, 0x203d3e2072756e49, + 0x6e437070286c696e, 0x65292c0a20202020, 0x7d293b0a20202020, 0x72657475726e206f, 0x7574707574203d3d, + 0x3d20756e64656669, 0x6e6564203f207275, 0x6e496e437070286c, 0x696e6529203a2074, 0x6f5465726d696e61, + 0x6c54657874285374, 0x72696e67286f7574, 0x70757429293b0a7d, 0x0a0a2f2f2f20496d, 0x706f727473207468, + 0x6520657874656e73, 0x696f6e206d6f6475, 0x6c6573206c697374, 0x656420627920432b, 0x2b2028225c6e222d, + 0x7365706172617465, 0x642055524c732920, 0x616e6420636f6c6c, 0x6563747320746865, 0x69722062726f7773, + 0x65720a2f2f2f2063, 0x6f6d6d616e64732e, 0x2041206d6f64756c, 0x6520746861742066, 0x61696c7320746f20, + 0x6c6f616420697320, 0x7265706f72746564, 0x20616e6420736b69, 0x707065642e0a6173, 0x796e632066756e63, + 0x74696f6e206c6f61, 0x64457874656e7369, 0x6f6e732875726c73, 0x2c20777269746529, 0x207b0a2020202063, + 0x6f6e737420636f6d, 0x6d616e6473203d20, 0x6e6577204d617028, 0x293b0a2020202066, 0x6f722028636f6e73, + 0x742075726c206f66, 0x2075726c732e7370, 0x6c697428225c6e22, 0x292e66696c746572, 0x2828656e74727929, + 0x203d3e20656e7472, 0x7920213d3d202222, 0x2929207b0a202020, 0x2020202020747279, 0x207b0a2020202020, + 0x2020202020202063, 0x6f6e7374206d6f64, 0x756c65203d206177, 0x61697420696d706f, 0x72742875726c293b, + 0x0a20202020202020, 0x2020202020666f72, 0x2028636f6e737420, 0x5b6e616d652c2068, 0x616e646c65725d20, + 0x6f66204f626a6563, 0x742e656e74726965, 0x73286d6f64756c65, 0x2e636f6d6d616e64, 0x73203f3f207b7d29, + 0x290a202020202020, 0x2020202020202020, 0x2020636f6d6d616e, 0x64732e736574286e, 0x616d652c2068616e, + 0x646c6572293b0a20, 0x202020202020207d, 0x2063617463682028, 0x6572726f7229207b, 0x0a20202020202020, + 0x2020202020777269, 0x746528616e73692e, 0x7265642860546572, 0x6d696e616c206578, 0x74656e73696f6e20, + 0x247b75726c7d2066, 0x61696c656420746f, 0x206c6f61643a2024, 0x7b6572726f723f2e, 0x6d65737361676520, + 0x3f3f206572726f72, 0x7d6029202b20225c, 0x725c6e22293b0a20, 0x202020202020207d, 0x0a202020207d0a20, + 0x2020207265747572, 0x6e20636f6d6d616e, 0x64733b0a7d0a0a2f, 0x2f2045646974696e, 0x67206b6579732c20, + 0x617320787465726d, 0x2e6a73207265706f, 0x727473207468656d, 0x20696e206f6e4461, 0x74612c206d617070, + 0x656420746f204c69, 0x6e65456469746f72, 0x20616374696f6e73, 0x2e0a636f6e737420, 0x6b6579416374696f, + 0x6e73203d206e6577, 0x204d6170285b0a20, 0x2020205b225c7222, 0x2c2028656469746f, 0x7229203d3e206564, + 0x69746f722e737562, 0x6d697428295d2c0a, 0x202020205b225c78, 0x3766222c20286564, 0x69746f7229203d3e, + 0x20656469746f722e, 0x6572617365282d31, 0x295d2c0a20202020, 0x5b225c62222c2028, 0x656469746f722920, + 0x3d3e20656469746f, 0x722e657261736528, 0x2d31295d2c0a2020, 0x20205b225c783162, 0x5b337e222c202865, + 0x6469746f7229203d, 0x3e20656469746f72, 0x2e65726173652830, 0x295d2c0a20202020, 0x5b225c7831625b44, + 0x222c202865646974, 0x6f7229203d3e2065, 0x6469746f722e6d6f, 0x7665546f28656469, 0x746f722e63757273, + 0x6f72202d2031295d, 0x2c0a202020205b22, 0x5c7831625b43222c, 0x2028656469746f72, 0x29203d3e20656469, + 0x746f722e6d6f7665, 0x546f28656469746f, 0x722e637572736f72, 0x202b2031295d2c0a, 0x202020205b225c78, + 0x31625b48222c2028, 0x656469746f722920, 0x3d3e20656469746f, 0x722e6d6f7665546f, 0x2830295d2c0a2020, + 0x20205b225c783162, 0x4f48222c20286564, 0x69746f7229203d3e, 0x20656469746f722e, 0x6d6f7665546f2830, + 0x295d2c0a20202020, 0x5b225c783031222c, 0x2028656469746f72, 0x29203d3e20656469, 0x746f722e6d6f7665, + 0x546f2830295d2c0a, 0x202020205b225c78, 0x31625b46222c2028, 0x656469746f722920, 0x3d3e20656469746f, + 0x722e6d6f7665546f, 0x28656469746f722e, 0x63686172732e6c65, 0x6e677468295d2c0a, 0x202020205b225c78, + 0x31624f46222c2028, 0x656469746f722920, 0x3d3e20656469746f, 0x722e6d6f7665546f, 0x28656469746f722e, + 0x63686172732e6c65, 0x6e677468295d2c0a, 0x202020205b225c78, 0x3035222c20286564, 0x69746f7229203d3e, + 0x20656469746f722e, 0x6d6f7665546f2865, 0x6469746f722e6368, 0x6172732e6c656e67, 0x7468295d2c0a2020, + 0x20205b225c783162, 0x5b41222c20286564, 0x69746f7229203d3e, 0x20656469746f722e, 0x726563616c6c282d, + 0x31295d2c0a202020, 0x205b225c7831625b, 0x42222c2028656469, 0x746f7229203d3e20, 0x656469746f722e72, + 0x6563616c6c283129, 0x5d2c0a202020205b, 0x225c74222c202865, 0x6469746f7229203d, 0x3e20656469746f72, + 0x2e747261636b2865, 0x6469746f722e636f, 0x6d706c6574654c69, 0x6e652829295d2c0a, 0x202020205b225c78, + 0x3033222c20286564, 0x69746f7229203d3e, 0x20656469746f722e, 0x63616e63656c4c69, 0x6e6528295d2c0a20, + 0x2020205b225c7830, 0x63222c2028656469, 0x746f7229203d3e20, 0x656469746f722e72, 0x656472617728616e, + 0x73692e636c656172, 0x53637265656e295d, 0x2c0a202020205b22, 0x5c783135222c2028, 0x656469746f722920, + 0x3d3e20656469746f, 0x722e6b696c6c4265, 0x666f726543757273, 0x6f7228295d2c0a5d, 0x293b0a0a2f2f2f20, + 0x4c696e6520656469, 0x746f722064726976, 0x656e206279207468, 0x65207465726d696e, 0x616c277320696e70, + 0x757420646174612e, 0x2060777269746528, 0x7465787429602064, 0x6973706c61797320, 0x746578743b206072, + 0x756e286c696e6529, 0x6020616e640a2f2f, 0x2f2060636f6d706c, 0x657465286c696e65, 0x2960207265747572, + 0x6e2050726f6d6973, 0x6573206f66207468, 0x6520432b2b206f75, 0x7470757420616e64, 0x206f6620225c6e22, + 0x2d73657061726174, 0x656420636f6d706c, 0x6574696f6e206361, 0x6e64696461746573, 0x2e0a6578706f7274, + 0x20636c617373204c, 0x696e65456469746f, 0x72207b0a20202020, 0x636f6e7374727563, 0x746f72287b777269, + 0x74652c2072756e2c, 0x20636f6d706c6574, 0x652c2070726f6d70, 0x747d29207b0a2020, 0x2020202020207468, + 0x69732e7772697465, 0x203d207772697465, 0x3b0a202020202020, 0x2020746869732e72, 0x756e203d2072756e, + 0x3b0a202020202020, 0x2020746869732e63, 0x6f6d706c65746520, 0x3d20636f6d706c65, 0x74653b0a20202020, + 0x2020202074686973, 0x2e61626f7274203d, 0x206e756c6c3b0a20, 0x2020202020202074, 0x6869732e70726f6d, + 0x7074203d2070726f, 0x6d70743b0a202020, 0x2020202020746869, 0x732e636861727320, 0x3d205b5d3b0a2020, + 0x2020202020207468, 0x69732e637572736f, 0x72203d20303b0a20, 0x2020202020202074, 0x6869732e68697374, + 0x6f7279203d205b5d, 0x3b0a202020202020, 0x2020746869732e68, 0x6973746f7279496e, 0x646578203d20303b, + 0x0a20202020202020, 0x20746869732e6275, 0x7379203d206e756c, 0x6c3b0a202020207d, 0x0a0a202020206765, + 0x74206c696e652829, 0x207b0a2020202020, 0x2020207265747572, 0x6e20746869732e63, 0x686172732e6a6f69, + 0x6e282222293b0a20, 0x2020207d0a0a2020, 0x20202f2f2f205265, 0x736f6c766573206f, 0x6e6365206e6f2063, + 0x6f6d6d616e64206f, 0x7220636f6d706c65, 0x74696f6e20697320, 0x70656e64696e672e, 0x0a20202020617379, + 0x6e63207768656e49, 0x646c652829207b0a, 0x2020202020202020, 0x7768696c65202874, 0x6869732e62757379, + 0x290a202020202020, 0x2020202020206177, 0x6169742074686973, 0x2e627573793b0a20, 0x2020207d0a0a2020, + 0x202073686f775072, 0x6f6d70742829207b, 0x0a20202020202020, 0x20746869732e7772, 0x6974652874686973, + 0x2e70726f6d707429, 0x3b0a202020207d0a, 0x0a2020202068616e, 0x646c652864617461, 0x29207b0a20202020, + 0x2020202069662028, 0x746869732e627573, 0x79290a2020202020, 0x2020202020202072, 0x657475726e207468, + 0x69732e696e746572, 0x7275707428646174, 0x61293b0a20202020, 0x20202020636f6e73, 0x7420616374696f6e, + 0x203d206b65794163, 0x74696f6e732e6765, 0x742864617461293b, 0x0a20202020202020, 0x2069662028616374, + 0x696f6e290a202020, 0x2020202020202020, 0x2072657475726e20, 0x616374696f6e2874, 0x686973293b0a2020, + 0x2020202020206966, 0x202821646174612e, 0x7374617274735769, 0x746828225c783162, 0x2229290a20202020, + 0x2020202020202020, 0x72657475726e2074, 0x6869732e696e7365, 0x7274546578742864, 0x617461293b0a2020, + 0x20207d0a0a202020, 0x202f2f205768696c, 0x65206120636f6d6d, 0x616e642072756e73, 0x2c204374726c2b43, + 0x2061626f72747320, 0x697473207369676e, 0x616c206f6e636520, 0x616e642074686520, 0x6f74686572206b65, + 0x7973206172652069, 0x676e6f7265642e0a, 0x20202020696e7465, 0x7272757074286461, 0x746129207b0a2020, + 0x202020202020636f, 0x6e73742072756e6e, 0x696e67203d207468, 0x69732e61626f7274, 0x3f2e7369676e616c, + 0x2e61626f72746564, 0x203d3d3d2066616c, 0x73653b0a20202020, 0x2020202069662028, 0x6461746120213d3d, + 0x20225c7830332220, 0x7c7c202172756e6e, 0x696e67290a202020, 0x2020202020202020, 0x2072657475726e3b, + 0x0a20202020202020, 0x20746869732e7772, 0x69746528225e435c, 0x725c6e22293b0a20, 0x2020202020202074, + 0x6869732e61626f72, 0x742e61626f727428, 0x6e6577204572726f, 0x722822496e746572, 0x7275707465642229, + 0x293b0a202020207d, 0x0a0a202020202f2f, 0x205479706564206f, 0x7220706173746564, 0x20746578743a2070, + 0x72696e7461626c65, 0x2063686172616374, 0x6572732061726520, 0x696e736572746564, 0x2c20612063617272, + 0x6961676520726574, 0x75726e207375626d, 0x6974732074686520, 0x6c696e650a202020, 0x202f2f20616e6420, + 0x7468652072657374, 0x206f662061206d75, 0x6c74692d6c696e65, 0x2070617374652069, 0x732064726f707065, + 0x642c2073696e6365, 0x20636f6d6d616e64, 0x732072756e206f6e, 0x6520617420612074, 0x696d652e0a202020, + 0x20696e7365727454, 0x6578742864617461, 0x29207b0a20202020, 0x20202020636f6e73, 0x74205b746578742c, + 0x202e2e2e72657374, 0x5d203d2064617461, 0x2e73706c69742822, 0x5c7222293b0a2020, 0x2020202020207468, + 0x69732e696e736572, 0x742841727261792e, 0x66726f6d28746578, 0x74292e66696c7465, 0x7228286368617229, + 0x203d3e2063686172, 0x203e3d2022202220, 0x2626206368617220, 0x213d3d20225c7837, 0x662229293b0a2020, + 0x2020202020206966, 0x2028726573742e6c, 0x656e677468203e20, 0x30290a2020202020, 0x2020202020202072, + 0x657475726e207468, 0x69732e7375626d69, 0x7428293b0a202020, 0x207d0a0a20202020, 0x696e736572742863, + 0x6861727329207b0a, 0x2020202020202020, 0x6966202863686172, 0x732e6c656e677468, 0x203d3d3d2030290a, + 0x2020202020202020, 0x2020202072657475, 0x726e3b0a20202020, 0x2020202074686973, 0x2e63686172732e73, + 0x706c696365287468, 0x69732e637572736f, 0x722c20302c202e2e, 0x2e6368617273293b, 0x0a20202020202020, + 0x20746869732e6375, 0x72736f72202b3d20, 0x63686172732e6c65, 0x6e6774683b0a2020, 0x2020202020207468, + 0x69732e7265647261, 0x7728293b0a202020, 0x207d0a0a20202020, 0x6572617365286f66, 0x6673657429207b0a, + 0x2020202020202020, 0x636f6e737420696e, 0x646578203d207468, 0x69732e637572736f, 0x72202b206f666673, + 0x65743b0a20202020, 0x2020202069662028, 0x696e646578203c20, 0x30207c7c20696e64, 0x6578203e3d207468, + 0x69732e6368617273, 0x2e6c656e67746829, 0x0a20202020202020, 0x2020202020726574, 0x75726e3b0a202020, + 0x2020202020746869, 0x732e63686172732e, 0x73706c6963652869, 0x6e6465782c203129, 0x3b0a202020202020, + 0x2020746869732e63, 0x7572736f72203d20, 0x696e6465783b0a20, 0x2020202020202074, 0x6869732e72656472, + 0x617728293b0a2020, 0x20207d0a0a202020, 0x206b696c6c426566, 0x6f7265437572736f, 0x722829207b0a2020, + 0x2020202020207468, 0x69732e6368617273, 0x2e73706c69636528, 0x302c20746869732e, 0x637572736f72293b, + 0x0a20202020202020, 0x20746869732e6375, 0x72736f72203d2030, 0x3b0a202020202020, 0x2020746869732e72, + 0x656472617728293b, 0x0a202020207d0a0a, 0x202020206d6f7665, 0x546f28706f736974, 0x696f6e29207b0a20, + 0x2020202020202063, 0x6f6e737420637572, 0x736f72203d204d61, 0x74682e6d61782830, 0x2c204d6174682e6d, + 0x696e28746869732e, 0x63686172732e6c65, 0x6e6774682c20706f, 0x736974696f6e2929, 0x3b0a202020202020, + 0x2020696620286375, 0x72736f72203d3d3d, 0x20746869732e6375, 0x72736f72290a2020, 0x2020202020202020, + 0x202072657475726e, 0x3b0a202020202020, 0x2020746869732e63, 0x7572736f72203d20, 0x637572736f723b0a, + 0x2020202020202020, 0x746869732e726564, 0x72617728293b0a20, 0x2020207d0a0a2020, 0x2020726563616c6c, + 0x2864697265637469, 0x6f6e29207b0a2020, 0x202020202020636f, 0x6e737420696e6465, 0x78203d2074686973, + 0x2e686973746f7279, 0x496e646578202b20, 0x646972656374696f, 0x6e3b0a2020202020, 0x2020206966202869, + 0x6e646578203c2030, 0x207c7c20696e6465, 0x78203e2074686973, 0x2e686973746f7279, 0x2e6c656e67746829, + 0x0a20202020202020, 0x2020202020726574, 0x75726e3b0a202020, 0x2020202020746869, 0x732e686973746f72, + 0x79496e646578203d, 0x20696e6465783b0a, 0x2020202020202020, 0x746869732e636861, 0x7273203d20417272, + 0x61792e66726f6d28, 0x696e646578203d3d, 0x3d20746869732e68, 0x6973746f72792e6c, 0x656e677468203f20, + 0x2222203a20746869, 0x732e686973746f72, 0x795b696e6465785d, 0x293b0a2020202020, 0x202020746869732e, + 0x637572736f72203d, 0x20746869732e6368, 0x6172732e6c656e67, 0x74683b0a20202020, 0x2020202074686973, + 0x2e72656472617728, 0x293b0a202020207d, 0x0a0a202020206361, 0x6e63656c4c696e65, 0x2829207b0a202020, + 0x2020202020746869, 0x732e777269746528, 0x225e435c725c6e22, 0x293b0a2020202020, 0x202020746869732e, + 0x6368617273203d20, 0x5b5d3b0a20202020, 0x2020202074686973, 0x2e637572736f7220, 0x3d20303b0a202020, + 0x2020202020746869, 0x732e686973746f72, 0x79496e646578203d, 0x20746869732e6869, 0x73746f72792e6c65, + 0x6e6774683b0a2020, 0x2020202020207468, 0x69732e73686f7750, 0x726f6d707428293b, 0x0a202020207d0a0a, + 0x202020202f2f2052, 0x6577726974657320, 0x7468652070726f6d, 0x707420616e642074, 0x6865206c696e6520, + 0x696e20706c616365, 0x2c207468656e206d, 0x6f76657320746865, 0x20637572736f7220, 0x6261636b20746f20, + 0x69747320706f7369, 0x74696f6e2e0a2020, 0x2020726564726177, 0x2870726566697820, 0x3d20225c72222920, + 0x7b0a202020202020, 0x2020746869732e77, 0x7269746528707265, 0x666978202b207468, 0x69732e70726f6d70, + 0x74202b2074686973, 0x2e6c696e65202b20, 0x616e73692e636c65, 0x6172546f456e6420, 0x2b20616e73692e6c, + 0x6566742874686973, 0x2e63686172732e6c, 0x656e677468202d20, 0x746869732e637572, 0x736f7229293b0a20, + 0x2020207d0a0a2020, 0x2020747261636b28, 0x70726f6d69736529, 0x207b0a2020202020, 0x202020746869732e, + 0x62757379203d2070, 0x726f6d6973652e66, 0x696e616c6c792828, 0x29203d3e207b0a20, 0x2020202020202020, + 0x202020746869732e, 0x62757379203d206e, 0x756c6c3b0a202020, 0x20202020207d293b, 0x0a20202020202020, + 0x2072657475726e20, 0x746869732e627573, 0x793b0a202020207d, 0x0a0a202020207375, 0x626d69742829207b, + 0x0a20202020202020, 0x20636f6e7374206c, 0x696e65203d207468, 0x69732e6c696e653b, 0x0a20202020202020, + 0x20746869732e7772, 0x69746528225c725c, 0x6e22293b0a202020, 0x2020202020746869, 0x732e636861727320, + 0x3d205b5d3b0a2020, 0x2020202020207468, 0x69732e637572736f, 0x72203d20303b0a20, 0x2020202020202069, + 0x6620286c696e652e, 0x7472696d28292021, 0x3d3d202222202626, 0x20746869732e6869, 0x73746f72792e6174, + 0x282d312920213d3d, 0x206c696e65290a20, 0x2020202020202020, 0x202020746869732e, 0x686973746f72792e, + 0x70757368286c696e, 0x65293b0a20202020, 0x2020202074686973, 0x2e686973746f7279, 0x496e646578203d20, + 0x746869732e686973, 0x746f72792e6c656e, 0x6774683b0a202020, 0x2020202020726574, 0x75726e2074686973, + 0x2e747261636b2874, 0x6869732e65786563, 0x757465286c696e65, 0x29293b0a20202020, 0x7d0a0a2020202061, + 0x73796e6320657865, 0x63757465286c696e, 0x6529207b0a202020, 0x2020202020746869, 0x732e61626f727420, + 0x3d206e6577204162, 0x6f7274436f6e7472, 0x6f6c6c657228293b, 0x0a20202020202020, 0x20747279207b0a20, + 0x2020202020202020, 0x202020636f6e7374, 0x206f757470757420, 0x3d20617761697420, 0x746869732e72756e, + 0x286c696e652c2074, 0x6869732e61626f72, 0x742e7369676e616c, 0x293b0a2020202020, 0x202020202020202f, + 0x2f20546865207072, 0x6f6d707420737461, 0x727473206f6e2061, 0x206e6577206c696e, 0x652c20756e6c6573, + 0x7320746865206f75, 0x7470757420616c72, 0x6561647920656e64, 0x73206f6e65206f72, 0x206c656176657320, + 0x7468650a20202020, 0x2020202020202020, 0x2f2f20637572736f, 0x7220617420686f6d, 0x6520287375636820, + 0x6173207468652027, 0x636c656172272063, 0x6f6d6d616e64292e, 0x0a20202020202020, 0x2020202020696620, + 0x286f757470757429, 0x0a20202020202020, 0x2020202020202020, 0x20746869732e7772, 0x697465286f757470, + 0x75742e656e647357, 0x69746828225c6e22, 0x29207c7c206f7574, 0x7075742e656e6473, 0x5769746828225c78, + 0x31625b482229203f, 0x206f757470757420, 0x3a206f7574707574, 0x202b20225c725c6e, 0x22293b0a20202020, + 0x202020207d206361, 0x7463682028657272, 0x6f7229207b0a2020, 0x2020202020202020, 0x2020746869732e77, + 0x7269746528616e73, 0x692e726564286045, 0x72726f723a20247b, 0x6572726f723f2e6d, 0x657373616765203f, + 0x3f206572726f727d, 0x6029202b20225c72, 0x5c6e22293b0a2020, 0x2020202020207d0a, 0x2020202020202020, + 0x746869732e73686f, 0x7750726f6d707428, 0x293b0a202020207d, 0x0a0a202020206173, 0x796e6320636f6d70, + 0x6c6574654c696e65, 0x2829207b0a202020, 0x20202020202f2f20, 0x4f6e6c7920746865, 0x20636f6d6d616e64, + 0x206e616d65206973, 0x20636f6d706c6574, 0x65642c20616e6420, 0x6f6e6c7920776974, 0x6820746865206375, + 0x72736f7220617420, 0x74686520656e6420, 0x6f6620746865206c, 0x696e652e0a202020, 0x2020202020696620, + 0x28746869732e6375, 0x72736f7220213d3d, 0x20746869732e6368, 0x6172732e6c656e67, 0x7468290a20202020, + 0x2020202020202020, 0x72657475726e3b0a, 0x2020202020202020, 0x636f6e7374206c69, 0x6e65203d20746869, + 0x732e6c696e653b0a, 0x2020202020202020, 0x6c65742063616e64, 0x6964617465733b0a, 0x2020202020202020, + 0x747279207b0a2020, 0x2020202020202020, 0x202063616e646964, 0x61746573203d2028, 0x6177616974207468, + 0x69732e636f6d706c, 0x657465286c696e65, 0x29292e73706c6974, 0x28225c6e22292e66, 0x696c746572282877, + 0x6f726429203d3e20, 0x776f726420213d3d, 0x202222293b0a2020, 0x2020202020207d20, 0x6361746368202865, + 0x72726f7229207b0a, 0x2020202020202020, 0x2020202072657475, 0x726e3b0a20202020, 0x202020207d0a2020, + 0x2020202020206966, 0x202863616e646964, 0x617465732e6c656e, 0x677468203d3d3d20, 0x30290a2020202020, + 0x2020202020202072, 0x657475726e3b0a20, 0x2020202020202063, 0x6f6e737420636f6d, 0x706c6574696f6e20, + 0x3d2063616e646964, 0x617465732e6c656e, 0x677468203d3d3d20, 0x31203f2063616e64, 0x6964617465735b30, + 0x5d202b2022202220, 0x3a20636f6d6d6f6e, 0x5072656669782863, 0x616e646964617465, 0x73293b0a20202020, + 0x2020202069662028, 0x636f6d706c657469, 0x6f6e2e6c656e6774, 0x68203e206c696e65, 0x2e6c656e67746829, + 0x0a20202020202020, 0x2020202020726574, 0x75726e2074686973, 0x2e696e7365727428, 0x41727261792e6672, + 0x6f6d28636f6d706c, 0x6574696f6e2e736c, 0x696365286c696e65, 0x2e6c656e67746829, 0x29293b0a20202020, + 0x2020202074686973, 0x2e77726974652822, 0x5c725c6e22202b20, 0x63616e6469646174, 0x65732e6a6f696e28, + 0x2220202229202b20, 0x225c725c6e22293b, 0x0a20202020202020, 0x20746869732e7265, 0x6472617728293b0a, + 0x202020207d0a7d0a, 0x0a2f2f2f204d6f75, 0x6e74732061207465, 0x726d696e616c2069, 0x6e2060656c656d65, + 0x6e7460206f6e6365, 0x2074686520576562, 0x46726f6e74206272, 0x6964676520697320, 0x72656164792e2052, + 0x657475726e732074, 0x686520787465726d, 0x205465726d696e61, 0x6c2c0a2f2f2f2069, 0x7473206c696e6520, + 0x656469746f722061, 0x6e6420612060666c, 0x7573682829602072, 0x65736f6c76696e67, 0x207768656e206576, + 0x6572792077726974, 0x6520686173206265, 0x656e2072656e6465, 0x7265642e0a657870, 0x6f7274206173796e, + 0x632066756e637469, 0x6f6e206d6f756e74, 0x28656c656d656e74, 0x2c207b6272696467, 0x65203d20676c6f62, + 0x616c546869732e77, 0x656246726f6e742c, 0x207465726d696e61, 0x6c4f7074696f6e73, 0x203d207b7d7d203d, + 0x207b7d29207b0a20, 0x202020636f6e7374, 0x207465726d696e61, 0x6c203d206e657720, 0x5465726d696e616c, + 0x287b0a2020202020, 0x202020637572736f, 0x72426c696e6b3a20, 0x747275652c0a2020, 0x202020202020636f, + 0x6e76657274456f6c, 0x3a2066616c73652c, 0x0a20202020202020, 0x20666f6e7446616d, 0x696c793a20277569, + 0x2d6d6f6e6f737061, 0x63652c2022436173, 0x636164696120436f, 0x6465222c2022536f, 0x7572636520436f64, + 0x652050726f222c20, 0x4d656e6c6f2c2043, 0x6f6e736f6c61732c, 0x206d6f6e6f737061, 0x6365272c0a202020, + 0x2020202020746865, 0x6d653a207b626163, 0x6b67726f756e643a, 0x2022233064313131, 0x37222c20666f7265, + 0x67726f756e643a20, 0x2223653665646633, 0x227d2c0a20202020, 0x202020202e2e2e74, 0x65726d696e616c4f, + 0x7074696f6e732c0a, 0x202020207d293b0a, 0x20202020636f6e73, 0x7420666974203d20, 0x6e65772046697441, + 0x64646f6e28293b0a, 0x202020207465726d, 0x696e616c2e6c6f61, 0x644164646f6e2866, 0x6974293b0a202020, + 0x207465726d696e61, 0x6c2e6f70656e2865, 0x6c656d656e74293b, 0x0a20202020666974, 0x2e66697428293b0a, + 0x202020206e657720, 0x526573697a654f62, 0x7365727665722828, 0x29203d3e20666974, 0x2e6669742829292e, + 0x6f62736572766528, 0x656c656d656e7429, 0x3b0a0a202020206c, 0x6574206c61737457, 0x72697465203d2050, + 0x726f6d6973652e72, 0x65736f6c76652829, 0x3b0a20202020636f, 0x6e73742077726974, 0x65203d2028746578, + 0x7429203d3e207b0a, 0x2020202020202020, 0x6c61737457726974, 0x65203d206e657720, 0x50726f6d69736528, + 0x287265736f6c7665, 0x29203d3e20746572, 0x6d696e616c2e7772, 0x6974652874657874, 0x2c207265736f6c76, + 0x6529293b0a202020, 0x207d3b0a20202020, 0x636f6e737420666c, 0x757368203d202829, 0x203d3e206c617374, + 0x57726974653b0a0a, 0x2020202074727920, 0x7b0a202020202020, 0x2020617761697420, 0x6272696467652e72, + 0x656164793b0a2020, 0x20207d2063617463, 0x6820286572726f72, 0x29207b0a20202020, 0x2020202077726974, + 0x6528616e73692e72, 0x65642860436f6e6e, 0x656374696f6e2074, 0x6f20746865206170, 0x706c69636174696f, + 0x6e206661696c6564, 0x3a20247b6572726f, 0x723f2e6d65737361, 0x6765203f3f206572, 0x726f727d6029202b, + 0x20225c725c6e2229, 0x3b0a202020202020, 0x202072657475726e, 0x207b7465726d696e, 0x616c2c2065646974, + 0x6f723a206e756c6c, 0x2c20666c7573687d, 0x3b0a202020207d0a, 0x0a20202020636f6e, 0x73742063616c6c20, + 0x3d20286e616d6529, 0x203d3e2062726964, 0x67652e6370704675, 0x6e6374696f6e2860, 0x77656266726f6e74, + 0x2e7465726d696e61, 0x6c2e247b6e616d65, 0x7d60293b0a202020, 0x206c65742070726f, 0x6d70742c2062616e, + 0x6e65722c20657874, 0x656e73696f6e733b, 0x0a20202020747279, 0x207b0a2020202020, 0x2020205b70726f6d, + 0x70742c2062616e6e, 0x65722c2065787465, 0x6e73696f6e735d20, 0x3d20617761697420, 0x50726f6d6973652e, + 0x616c6c285b63616c, 0x6c282270726f6d70, 0x74222928292c2063, 0x616c6c282262616e, 0x6e6572222928292c, + 0x2063616c6c282265, 0x7874656e73696f6e, 0x73222928295d293b, 0x0a202020207d2063, 0x6174636820286572, + 0x726f7229207b0a20, 0x202020202020202f, 0x2f20466f72206578, 0x616d706c65206120, 0x7061676520736572, + 0x7665642062792061, 0x6e206170706c6963, 0x6174696f6e207769, 0x74686f7574207765, 0x6266726f6e743a3a, + 0x5465726d696e616c, 0x2e0a202020202020, 0x2020777269746528, 0x616e73692e726564, 0x28605465726d696e, + 0x616c20756e617661, 0x696c61626c653a20, 0x247b6572726f723f, 0x2e6d657373616765, 0x203f3f206572726f, + 0x727d6029202b2022, 0x5c725c6e22293b0a, 0x2020202020202020, 0x72657475726e207b, 0x7465726d696e616c, + 0x2c20656469746f72, 0x3a206e756c6c2c20, 0x666c7573687d3b0a, 0x202020207d0a2020, 0x2020636f6e737420, + 0x636f6d6d616e6473, 0x203d206177616974, 0x206c6f6164457874, 0x656e73696f6e7328, 0x657874656e73696f, + 0x6e732c2077726974, 0x65293b0a20202020, 0x636f6e7374207275, 0x6e496e437070203d, 0x2063616c6c282272, + 0x756e22293b0a2020, 0x2020636f6e737420, 0x72756e203d20286c, 0x696e652c20736967, 0x6e616c29203d3e20, + 0x72756e4c696e6528, 0x6c696e652c207b63, 0x6f6d6d616e64732c, 0x2072756e496e4370, 0x702c207772697465, + 0x2c20627269646765, 0x2c207369676e616c, 0x7d293b0a20202020, 0x636f6e7374206564, 0x69746f72203d206e, + 0x6577204c696e6545, 0x6469746f72287b77, 0x726974652c207275, 0x6e2c20636f6d706c, 0x6574653a2063616c, + 0x6c2822636f6d706c, 0x65746522292c2070, 0x726f6d70747d293b, 0x0a20202020696620, 0x2862616e6e657229, + 0x0a20202020202020, 0x2077726974652862, 0x616e6e65722e7265, 0x706c616365416c6c, 0x28225c6e222c2022, + 0x5c725c6e2229202b, 0x20225c725c6e2229, 0x3b0a202020206564, 0x69746f722e73686f, 0x7750726f6d707428, + 0x293b0a2020202074, 0x65726d696e616c2e, 0x6f6e446174612828, 0x6461746129203d3e, 0x20656469746f722e, + 0x68616e646c652864, 0x61746129293b0a20, 0x2020207465726d69, 0x6e616c2e666f6375, 0x7328293b0a202020, + 0x2072657475726e20, 0x7b7465726d696e61, 0x6c2c20656469746f, 0x722c20666c757368, 0x7d3b0a7d0a000000 + }; +}; + +} // namespace webfront::fs::generated diff --git a/include/system/ToolManagerFS.hpp b/include/webfront/system/ToolManagerFS.hpp similarity index 100% rename from include/system/ToolManagerFS.hpp rename to include/webfront/system/ToolManagerFS.hpp diff --git a/include/webfront/system/ToolManagerModuleData.hpp b/include/webfront/system/ToolManagerModuleData.hpp new file mode 100644 index 00000000..a055a52f --- /dev/null +++ b/include/webfront/system/ToolManagerModuleData.hpp @@ -0,0 +1,393 @@ +#pragma once + +#include +#include +#include +#include + +namespace webfront::fs::generated { + +struct ToolManagerModuleData { + static constexpr std::string_view encoding{}; + static constexpr std::size_t dataSize{15006}; + static constexpr std::array data{ + 0x2f2f2f2040627269, 0x65662042726f7773, 0x6572207369646520, 0x6f66207468652077, 0x6620746f6f6c206d, + 0x616e616765722028, 0x23323334292c2061, 0x207465726d696e61, 0x6c20657874656e73, 0x696f6e2061646465, + 0x642062790a2f2f2f, 0x2077656266726f6e, 0x743a3a546f6f6c4d, 0x616e616765722028, 0x696e636c7564652f, + 0x77656266726f6e74, 0x2f636f6d706f6e65, 0x6e74732f546f6f6c, 0x4d616e616765722e, 0x687070292e202777, + 0x6620736561726368, 0x272c202777662069, 0x6e7374616c6c2720, 0x616e640a2f2f2f20, 0x277766206f70656e, + 0x272072756e206865, 0x72652c2062656361, 0x7573652074686520, 0x646f776e6c6f6164, 0x20737065616b7320, + 0x48545450533b2027, 0x7766206c69737427, 0x2c20277766207265, 0x6d6f76652720616e, 0x6420277766206865, + 0x6c70272072756e0a, 0x2f2f2f20696e2043, 0x2b2b2e20416e2069, 0x6e7374616c6c6174, 0x696f6e2066657463, + 0x6865732074686520, 0x7061636b756d656e, 0x7420616e64207468, 0x652074617262616c, 0x6c2066726f6d2074, + 0x6865206e706d2072, 0x656769737472792c, 0x20636865636b7320, 0x7468650a2f2f2f20, 0x74617262616c6c27, + 0x73205348412d3531, 0x3220696e74656772, 0x6974792c20756e70, 0x61636b7320697420, 0x616e642073656e64, + 0x7320697473206669, 0x6c6573207468726f, 0x7567682077656266, 0x726f6e742e706b67, 0x2e626567696e2c0a, + 0x2f2f2f202e777269, 0x746546696c652061, 0x6e64202e636f6d6d, 0x69742e0a0a636f6e, 0x737420626c6f636b, + 0x53697a65203d2035, 0x31323b0a2f2f2f20, 0x46696c6573206372, 0x6f73732074686520, 0x6272696467652069, + 0x6e206368756e6b73, 0x206f662074686973, 0x206d616e79206279, 0x7465733b20746865, 0x2062726f77736572, + 0x2073656e64732061, 0x206c61726765206f, 0x6e6520696e207365, 0x766572616c0a2f2f, 0x2f20576562536f63, + 0x6b6574206672616d, 0x65732c2077686963, 0x6820746865207365, 0x7276657220726561, 0x7373656d626c6573, + 0x2e0a6578706f7274, 0x20636f6e73742063, 0x68756e6b53697a65, 0x203d20323536202a, 0x20313032343b0a2f, + 0x2f2f204c61726765, 0x737420756e706163, 0x6b65642074617262, 0x616c6c2061636365, 0x707465642c206167, + 0x61696e7374206465, 0x636f6d7072657373, 0x696f6e20626f6d62, 0x732e0a6578706f72, 0x7420636f6e737420, + 0x6d6178556e706163, 0x6b65644279746573, 0x203d20323536202a, 0x2031303234202a20, 0x313032343b0a636f, + 0x6e73742075746638, 0x203d206e65772054, 0x6578744465636f64, 0x657228293b0a0a2f, 0x2f2f2053706c6974, + 0x7320226e616d655b, 0x4076657273696f6e, 0x5d222c2077686572, 0x6520746865206e61, 0x6d65206d61792062, + 0x652073636f706564, 0x2028224073636f70, 0x652f6e616d654031, 0x2e302e3022292e20, 0x5468652076657273, + 0x696f6e2069732022, 0x220a2f2f2f207768, 0x656e20616273656e, 0x742e0a6578706f72, 0x742066756e637469, + 0x6f6e207061727365, 0x5370656328737065, 0x6329207b0a202020, 0x20636f6e73742061, 0x74203d2073706563, + 0x2e696e6465784f66, 0x282240222c207370, 0x65632e7374617274, 0x7357697468282240, 0x2229203f2031203a, + 0x2030293b0a202020, 0x2072657475726e20, 0x6174203c2030203f, 0x207b6e616d653a20, 0x737065632c207665, + 0x7273696f6e3a2022, 0x227d203a207b6e61, 0x6d653a2073706563, 0x2e736c6963652830, 0x2c206174292c2076, + 0x657273696f6e3a20, 0x737065632e736c69, 0x6365286174202b20, 0x31297d3b0a7d0a0a, 0x66756e6374696f6e, + 0x2072656769737472, 0x7942617365287265, 0x6769737472792920, 0x7b0a20202020636f, 0x6e73742062617365, + 0x203d206e65772055, 0x524c287265676973, 0x7472792c20676c6f, 0x62616c546869732e, 0x6c6f636174696f6e, + 0x3f2e68726566293b, 0x0a20202020696620, 0x2821626173652e70, 0x6174686e616d652e, 0x656e647357697468, + 0x28222f2229290a20, 0x2020202020202062, 0x6173652e70617468, 0x6e616d65202b3d20, 0x222f223b0a202020, + 0x2072657475726e20, 0x626173653b0a7d0a, 0x0a2f2f2054686520, 0x7265676973747279, 0x20656e636f646573, + 0x2074686520736c61, 0x7368206f66206120, 0x73636f706564206e, 0x616d652e0a636f6e, 0x7374207061636b75, + 0x6d656e7455726c20, 0x3d2028626173652c, 0x206e616d6529203d, 0x3e206e6577205552, 0x4c286e616d652e72, + 0x65706c6163652822, 0x2f222c2022253266, 0x22292c2062617365, 0x293b0a0a6173796e, 0x632066756e637469, + 0x6f6e206665746368, 0x4f6b2875726c2c20, 0x6665746368496d70, 0x6c2c207369676e61, 0x6c29207b0a202020, + 0x20636f6e73742072, 0x6573706f6e736520, 0x3d20617761697420, 0x6665746368496d70, 0x6c2875726c2c207b, + 0x7369676e616c7d29, 0x3b0a202020206966, 0x202821726573706f, 0x6e73652e6f6b290a, 0x2020202020202020, + 0x7468726f77206e65, 0x77204572726f7228, 0x60247b75726c7d3a, 0x204854545020247b, 0x726573706f6e7365, + 0x2e7374617475737d, 0x60293b0a20202020, 0x72657475726e2072, 0x6573706f6e73653b, 0x0a7d0a0a6173796e, + 0x632066756e637469, 0x6f6e206665746368, 0x4a736f6e2875726c, 0x2c20666574636849, 0x6d706c2c20736967, + 0x6e616c29207b0a20, 0x2020207265747572, 0x6e20286177616974, 0x2066657463684f6b, 0x2875726c2c206665, + 0x746368496d706c2c, 0x207369676e616c29, 0x292e6a736f6e2829, 0x3b0a7d0a0a66756e, 0x6374696f6e207265, + 0x736f6c76654d616e, 0x6966657374287061, 0x636b756d656e742c, 0x206e616d652c2072, 0x6571756573746564, + 0x29207b0a20202020, 0x636f6e7374207461, 0x67203d2072657175, 0x6573746564207c7c, 0x20226c6174657374, + 0x223b0a2020202063, 0x6f6e737420766572, 0x73696f6e203d2070, 0x61636b756d656e74, 0x5b22646973742d74, + 0x616773225d3f2e5b, 0x7461675d203f3f20, 0x7265717565737465, 0x643b0a2020202063, 0x6f6e7374206d616e, + 0x6966657374203d20, 0x7061636b756d656e, 0x742e76657273696f, 0x6e733f2e5b766572, 0x73696f6e5d3b0a20, + 0x2020206966202821, 0x6d616e6966657374, 0x290a202020202020, 0x20207468726f7720, 0x6e6577204572726f, + 0x722860247b6e616d, 0x657d20686173206e, 0x6f2076657273696f, 0x6e2027247b746167, 0x7d2760293b0a2020, + 0x202072657475726e, 0x206d616e69666573, 0x743b0a7d0a0a2f2f, 0x2f20436865636b73, 0x2062797465732061, + 0x6761696e73742061, 0x6e2053524920696e, 0x7465677269747920, 0x737472696e672028, 0x227368613531322d, + 0x3c6261736536343e, 0x222c20706f737369, 0x626c792073657665, 0x72616c2068617368, 0x65730a2f2f2f2073, + 0x6570617261746564, 0x2062792073706163, 0x65732920616e6420, 0x72657475726e7320, 0x746865206d617463, + 0x68696e6720227368, 0x613531322de280a6, 0x2220686173682e20, 0x4f6e6c7920534841, 0x2d35313220697320, + 0x6163636570746564, 0x2e0a6578706f7274, 0x206173796e632066, 0x756e6374696f6e20, 0x766572696679496e, + 0x7465677269747928, 0x62797465732c2069, 0x6e74656772697479, 0x29207b0a20202020, 0x636f6e7374206578, + 0x706563746564203d, 0x20537472696e6728, 0x696e746567726974, 0x79203f3f20222229, 0x0a20202020202020, + 0x202e73706c697428, 0x2f5c732b2f290a20, 0x202020202020202e, 0x66696c7465722828, 0x6861736829203d3e, + 0x20686173682e7374, 0x6172747357697468, 0x2822736861353132, 0x2d2229290a202020, 0x20202020202e6d61, + 0x7028286861736829, 0x203d3e2068617368, 0x2e73706c69742822, 0x3f22295b305d293b, 0x0a20202020696620, + 0x2865787065637465, 0x642e6c656e677468, 0x203d3d3d2030290a, 0x2020202020202020, 0x7468726f77206e65, + 0x77204572726f7228, 0x2254686520706163, 0x6b61676520686173, 0x206e6f205348412d, 0x35313220696e7465, + 0x677269747922293b, 0x0a20202020696620, 0x2821676c6f62616c, 0x546869732e637279, 0x70746f3f2e737562, + 0x746c65290a202020, 0x2020202020746872, 0x6f77206e65772045, 0x72726f722822496e, 0x7465677269747920, + 0x636865636b73206e, 0x6565642061207365, 0x6375726520636f6e, 0x7465787420286874, 0x747073206f72206c, + 0x6f63616c686f7374, 0x2922293b0a202020, 0x20636f6e73742064, 0x6967657374203d20, 0x6e65772055696e74, + 0x3841727261792861, 0x7761697420637279, 0x70746f2e73756274, 0x6c652e6469676573, 0x7428225348412d35, + 0x3132222c20627974, 0x657329293b0a2020, 0x2020636f6e737420, 0x61637475616c203d, 0x2022736861353132, + 0x2d22202b2062746f, 0x612841727261792e, 0x66726f6d28646967, 0x6573742c20286279, 0x746529203d3e2053, + 0x7472696e672e6672, 0x6f6d43686172436f, 0x6465286279746529, 0x292e6a6f696e2822, 0x2229293b0a202020, + 0x2069662028216578, 0x7065637465642e69, 0x6e636c7564657328, 0x61637475616c2929, 0x0a20202020202020, + 0x207468726f77206e, 0x6577204572726f72, 0x2860496e74656772, 0x6974792063686563, 0x6b206661696c6564, + 0x3a20657870656374, 0x656420247b657870, 0x65637465645b305d, 0x7d2c20676f742024, 0x7b61637475616c7d, + 0x60293b0a20202020, 0x72657475726e2061, 0x637475616c3b0a7d, 0x0a0a2f2f2f204775, 0x6e7a697073206279, + 0x7465732c20666169, 0x6c696e67206f6e63, 0x65206d6f72652074, 0x68616e20606c696d, 0x6974602062797465, + 0x7320636f6d65206f, 0x75742e0a6578706f, 0x7274206173796e63, 0x2066756e6374696f, 0x6e2067756e7a6970, + 0x2862797465732c20, 0x6c696d6974203d20, 0x6d6178556e706163, 0x6b65644279746573, 0x29207b0a20202020, + 0x636f6e7374207265, 0x61646572203d206e, 0x657720426c6f6228, 0x5b62797465735d29, 0x2e73747265616d28, + 0x292e706970655468, 0x726f756768286e65, 0x77204465636f6d70, 0x72657373696f6e53, 0x747265616d282267, + 0x7a69702229292e67, 0x6574526561646572, 0x28293b0a20202020, 0x636f6e7374206368, 0x756e6b73203d205b, + 0x5d3b0a202020206c, 0x657420746f74616c, 0x203d20303b0a2020, 0x2020666f7220286c, 0x6574207265616420, + 0x3d20617761697420, 0x7265616465722e72, 0x65616428293b2021, 0x726561642e646f6e, 0x653b207265616420, + 0x3d20617761697420, 0x7265616465722e72, 0x656164282929207b, 0x0a20202020202020, 0x20746f74616c202b, + 0x3d20726561642e76, 0x616c75652e6c656e, 0x6774683b0a202020, 0x2020202020696620, 0x28746f74616c203e, + 0x206c696d69742920, 0x7b0a202020202020, 0x2020202020206177, 0x6169742072656164, 0x65722e63616e6365, + 0x6c28293b0a202020, 0x2020202020202020, 0x207468726f77206e, 0x6577204572726f72, 0x2860546865207461, + 0x7262616c6c20756e, 0x7061636b7320746f, 0x206d6f7265207468, 0x616e20247b6c696d, 0x69747d2062797465, + 0x7360293b0a202020, 0x20202020207d0a20, 0x2020202020202063, 0x68756e6b732e7075, 0x736828726561642e, + 0x76616c7565293b0a, 0x202020207d0a2020, 0x202072657475726e, 0x206e65772055696e, 0x7438417272617928, + 0x6177616974206e65, 0x7720426c6f622863, 0x68756e6b73292e61, 0x7272617942756666, 0x65722829293b0a7d, + 0x0a0a2f2f2041204e, 0x554c2d7465726d69, 0x6e61746564206865, 0x6164657220666965, 0x6c642e0a66756e63, + 0x74696f6e20746578, 0x7428626c6f636b2c, 0x206f66667365742c, 0x206c656e67746829, 0x207b0a2020202063, + 0x6f6e737420666965, 0x6c64203d20626c6f, 0x636b2e7375626172, 0x726179286f666673, 0x65742c206f666673, + 0x6574202b206c656e, 0x677468293b0a2020, 0x2020636f6e737420, 0x656e64203d206669, 0x656c642e696e6465, + 0x784f662830293b0a, 0x2020202072657475, 0x726e20757466382e, 0x6465636f64652865, 0x6e64203c2030203f, + 0x206669656c64203a, 0x206669656c642e73, 0x7562617272617928, 0x302c20656e642929, 0x3b0a7d0a0a2f2f20, + 0x416e206f6374616c, 0x206e756d6265722c, 0x206f722061206261, 0x73652d323536206f, 0x6e65207768656e20, + 0x7468652066697273, 0x7420627974652068, 0x6173206974732068, 0x6967682062697420, 0x7365742028474e55, + 0x20616e6420737461, 0x72292e0a66756e63, 0x74696f6e206e756d, 0x62657228626c6f63, 0x6b2c206f66667365, + 0x742c206c656e6774, 0x6829207b0a202020, 0x2069662028626c6f, 0x636b5b6f66667365, 0x745d202620307838, + 0x30290a2020202020, 0x2020207265747572, 0x6e20626c6f636b2e, 0x7375626172726179, 0x286f666673657420, + 0x2b20312c206f6666, 0x736574202b206c65, 0x6e677468292e7265, 0x6475636528287661, 0x6c75652c20627974, + 0x6529203d3e207661, 0x6c7565202a203235, 0x36202b2062797465, 0x2c20626c6f636b5b, 0x6f66667365745d20, + 0x262030783766293b, 0x0a20202020636f6e, 0x7374206469676974, 0x73203d2074657874, 0x28626c6f636b2c20, + 0x6f66667365742c20, 0x6c656e677468292e, 0x7472696d28293b0a, 0x2020202069662028, 0x212f5e5b302d375d, + 0x2a242f2e74657374, 0x2864696769747329, 0x290a202020202020, 0x20207468726f7720, 0x6e6577204572726f, + 0x722822436f727275, 0x7074207461722068, 0x656164657222293b, 0x0a20202020726574, 0x75726e2064696769, + 0x7473203d3d3d2022, 0x22203f2030203a20, 0x7061727365496e74, 0x286469676974732c, 0x2038293b0a7d0a0a, + 0x66756e6374696f6e, 0x2076657269667943, 0x6865636b73756d28, 0x6865616465722920, 0x7b0a202020206c65, + 0x742073756d203d20, 0x303b0a2020202066, 0x6f7220286c657420, 0x696e646578203d20, 0x303b20696e646578, + 0x203c20626c6f636b, 0x53697a653b202b2b, 0x696e646578290a20, 0x2020202020202073, 0x756d202b3d20696e, + 0x646578203e3d2031, 0x343820262620696e, 0x646578203c203135, 0x36203f2030783230, 0x203a206865616465, + 0x725b696e6465785d, 0x3b0a202020206966, 0x20286e756d626572, 0x286865616465722c, 0x203134382c203829, + 0x20213d3d2073756d, 0x290a202020202020, 0x20207468726f7720, 0x6e6577204572726f, 0x722822436f727275, + 0x7074207461722068, 0x6561646572206368, 0x65636b73756d2229, 0x3b0a7d0a0a2f2f20, 0x223c6c656e677468, + 0x3e203c6b65793e3d, 0x3c76616c75653e5c, 0x6e22207265636f72, 0x6473206f66206120, 0x7061782065787465, + 0x6e64656420686561, 0x6465723b206c656e, 0x6774687320636f75, 0x6e74206279746573, 0x2e0a66756e637469, + 0x6f6e207061785265, 0x636f726473286461, 0x746129207b0a2020, 0x2020636f6e737420, 0x7265636f72647320, + 0x3d207b7d3b0a2020, 0x20206c6574206f66, 0x66736574203d2030, 0x3b0a202020207768, 0x696c6520286f6666, + 0x736574203c206461, 0x74612e6c656e6774, 0x6829207b0a202020, 0x2020202020636f6e, 0x7374207370616365, + 0x203d20646174612e, 0x696e6465784f6628, 0x307832302c206f66, 0x66736574293b0a20, 0x2020202020202063, + 0x6f6e7374206c656e, 0x677468203d207370, 0x616365203c203020, 0x3f204e614e203a20, 0x4e756d6265722875, + 0x7466382e6465636f, 0x646528646174612e, 0x7375626172726179, 0x286f66667365742c, 0x2073706163652929, + 0x293b0a2020202020, 0x2020206966202821, 0x286c656e67746820, 0x3e203029207c7c20, 0x6f6666736574202b, + 0x206c656e67746820, 0x3e20646174612e6c, 0x656e677468290a20, 0x2020202020202020, 0x2020207468726f77, + 0x206e657720457272, 0x6f722822436f7272, 0x7570742070617820, 0x6865616465722229, 0x3b0a202020202020, + 0x2020636f6e737420, 0x7265636f7264203d, 0x20757466382e6465, 0x636f646528646174, 0x612e737562617272, + 0x6179287370616365, 0x202b20312c206f66, 0x66736574202b206c, 0x656e677468202d20, 0x3129293b0a202020, + 0x2020202020636f6e, 0x737420657175616c, 0x73203d207265636f, 0x72642e696e646578, 0x4f6628223d22293b, + 0x0a20202020202020, 0x207265636f726473, 0x5b7265636f72642e, 0x736c69636528302c, 0x20657175616c7329, + 0x5d203d207265636f, 0x72642e736c696365, 0x28657175616c7320, 0x2b2031293b0a2020, 0x2020202020206f66, + 0x66736574202b3d20, 0x6c656e6774683b0a, 0x202020207d0a2020, 0x202072657475726e, 0x207265636f726473, + 0x3b0a7d0a0a2f2f20, 0x54686520656e7472, 0x792077686f736520, 0x6865616465722073, 0x7461727473206174, + 0x20606f6666736574, 0x603a206974732068, 0x65616465722c2074, 0x79706520666c6167, 0x2c20646174612061, + 0x6e6420746865206f, 0x6666736574206f66, 0x20746865206e6578, 0x740a2f2f20656e74, 0x72792e0a66756e63, + 0x74696f6e20726561, 0x64456e7472792861, 0x7263686976652c20, 0x6f66667365742920, 0x7b0a20202020636f, + 0x6e73742068656164, 0x6572203d20617263, 0x686976652e737562, 0x6172726179286f66, 0x667365742c206f66, + 0x66736574202b2062, 0x6c6f636b53697a65, 0x293b0a2020202076, 0x6572696679436865, 0x636b73756d286865, + 0x61646572293b0a20, 0x202020636f6e7374, 0x2073697a65203d20, 0x6e756d6265722868, 0x65616465722c2031, + 0x32342c203132293b, 0x0a20202020636f6e, 0x7374207374617274, 0x203d206f66667365, 0x74202b20626c6f63, + 0x6b53697a653b0a20, 0x2020206966202873, 0x74617274202b2073, 0x697a65203e206172, 0x63686976652e6c65, + 0x6e677468290a2020, 0x2020202020207468, 0x726f77206e657720, 0x4572726f72282254, 0x72756e6361746564, + 0x2074617220617263, 0x6869766522293b0a, 0x2020202072657475, 0x726e207b0a202020, 0x2020202020686561, + 0x6465722c0a202020, 0x2020202020747970, 0x653a206865616465, 0x725b3135365d203d, 0x3d3d2030203f2022, + 0x3022203a20537472, 0x696e672e66726f6d, 0x43686172436f6465, 0x286865616465725b, 0x3135365d292c0a20, + 0x2020202020202064, 0x6174613a20617263, 0x686976652e737562, 0x6172726179287374, 0x6172742c20737461, + 0x7274202b2073697a, 0x65292c0a20202020, 0x202020206e657874, 0x3a20737461727420, 0x2b204d6174682e63, + 0x65696c2873697a65, 0x202f20626c6f636b, 0x53697a6529202a20, 0x626c6f636b53697a, 0x652c0a202020207d, + 0x3b0a7d0a0a2f2f20, 0x416e206172636869, 0x766520656e647320, 0x61742074776f207a, 0x65726f20626c6f63, + 0x6b733b206f6e6520, 0x697320656e6f7567, 0x6820746f2073746f, 0x702e0a66756e6374, 0x696f6e206973456e, + 0x6428617263686976, 0x652c206f66667365, 0x7429207b0a202020, 0x2072657475726e20, 0x6f6666736574202b, + 0x20626c6f636b5369, 0x7a65203e20617263, 0x686976652e6c656e, 0x677468207c7c2061, 0x7263686976652e73, + 0x7562617272617928, 0x6f66667365742c20, 0x6f6666736574202b, 0x20626c6f636b5369, 0x7a65292e65766572, + 0x7928286279746529, 0x203d3e2062797465, 0x203d3d3d2030293b, 0x0a7d0a0a2f2f2054, 0x6865206e616d6520, + 0x6669656c64206f66, 0x2061207573746172, 0x206865616465722c, 0x2061667465722069, 0x7473207072656669, + 0x78206669656c642e, 0x0a66756e6374696f, 0x6e20686561646572, 0x5061746828686561, 0x64657229207b0a20, + 0x202020636f6e7374, 0x206e616d65203d20, 0x7465787428686561, 0x6465722c20302c20, 0x313030293b0a2020, + 0x2020636f6e737420, 0x707265666978203d, 0x2074657874286865, 0x616465722c203235, 0x372c203529203d3d, + 0x3d20227573746172, 0x22203f2074657874, 0x286865616465722c, 0x203334352c203135, 0x3529203a2022223b, + 0x0a20202020726574, 0x75726e2070726566, 0x6978203f2060247b, 0x7072656669787d2f, 0x247b6e616d657d60, + 0x203a206e616d653b, 0x0a7d0a0a2f2f2045, 0x6e7472696573206e, 0x616d696e67207468, 0x65206e657874206f, + 0x6e653a2061207061, 0x7820657874656e64, 0x6564206865616465, 0x7220616e64206120, 0x474e55206c6f6e67, + 0x206e616d652e2041, 0x2070617820676c6f, 0x62616c2068656164, 0x6572206e616d6573, 0x0a2f2f206e6f7468, + 0x696e672057656246, 0x726f6e7420757365, 0x732e0a636f6e7374, 0x206e616d65456e74, 0x72696573203d207b, + 0x0a20202020783a20, 0x286e616d65732c20, 0x6461746129203d3e, 0x20287b2e2e2e6e61, 0x6d65732c20706178, + 0x3a20706178526563, 0x6f72647328646174, 0x61292e706174687d, 0x292c0a202020204c, 0x3a20286e616d6573, + 0x2c20646174612920, 0x3d3e20287b2e2e2e, 0x6e616d65732c206c, 0x6f6e673a20746578, 0x7428646174612c20, + 0x302c20646174612e, 0x6c656e677468297d, 0x292c0a2020202067, 0x3a20286e616d6573, 0x29203d3e206e616d, + 0x65732c0a7d3b0a0a, 0x2f2f2f2052656164, 0x7320612074617220, 0x6172636869766520, 0x2875737461722c20, + 0x7769746820706178, 0x20616e6420474e55, 0x206c6f6e67206e61, 0x6d65732920616e64, 0x2072657475726e73, + 0x2069747320726567, 0x756c61722066696c, 0x65732061730a2f2f, 0x2f207b706174682c, 0x2062797465737d2c, + 0x20696e2061726368, 0x697665206f726465, 0x722e204469726563, 0x746f726965732c20, 0x6c696e6b7320616e, + 0x64206f7468657220, 0x656e747269657320, 0x61726520736b6970, 0x7065642e0a657870, 0x6f72742066756e63, + 0x74696f6e20726561, 0x6454617228617263, 0x6869766529207b0a, 0x20202020636f6e73, 0x742066696c657320, + 0x3d205b5d3b0a2020, 0x20206c6574206e61, 0x6d6573203d207b7d, 0x3b0a20202020666f, 0x7220286c6574206f, + 0x6666736574203d20, 0x303b20216973456e, 0x6428617263686976, 0x652c206f66667365, 0x74293b29207b0a20, + 0x2020202020202063, 0x6f6e7374207b6865, 0x616465722c207479, 0x70652c2064617461, 0x2c206e6578747d20, + 0x3d2072656164456e, 0x7472792861726368, 0x6976652c206f6666, 0x736574293b0a2020, 0x2020202020206f66, + 0x66736574203d206e, 0x6578743b0a202020, 0x2020202020696620, 0x284f626a6563742e, 0x6861734f776e286e, + 0x616d65456e747269, 0x65732c2074797065, 0x2929207b0a202020, 0x2020202020202020, 0x206e616d6573203d, + 0x206e616d65456e74, 0x726965735b747970, 0x655d286e616d6573, 0x2c2064617461293b, 0x0a20202020202020, + 0x2020202020636f6e, 0x74696e75653b0a20, 0x202020202020207d, 0x0a20202020202020, 0x2069662028747970, + 0x65203d3d3d202230, 0x22207c7c20747970, 0x65203d3d3d202237, 0x22290a2020202020, 0x2020202020202066, + 0x696c65732e707573, 0x68287b706174683a, 0x206e616d65732e70, 0x6178203f3f206e61, 0x6d65732e6c6f6e67, + 0x203f3f2068656164, 0x6572506174682868, 0x6561646572292c20, 0x62797465733a2064, 0x6174617d293b0a20, + 0x202020202020206e, 0x616d6573203d207b, 0x7d3b0a202020207d, 0x0a20202020726574, 0x75726e2066696c65, + 0x733b0a7d0a0a2f2f, 0x2f20546865206669, 0x6c6573206f662061, 0x6e206e706d207461, 0x7262616c6c206279, + 0x2070617468207265, 0x6c61746976652074, 0x6f20746865207061, 0x636b61676520726f, 0x6f743a2074686520, + 0x6669727374207061, 0x746820636f6d706f, 0x6e656e740a2f2f2f, 0x20286e6f726d616c, 0x6c7920227061636b, + 0x6167652f22292069, 0x732072656d6f7665, 0x642c206173206e70, 0x6d20646f65732e20, 0x41206c6174657220, + 0x656e747279207265, 0x706c616365732061, 0x6e206561726c6965, 0x72206f6e652e0a66, 0x756e6374696f6e20, + 0x7061636b61676546, 0x696c657328656e74, 0x7269657329207b0a, 0x20202020636f6e73, 0x742066696c657320, + 0x3d206e6577204d61, 0x7028293b0a202020, 0x20666f722028636f, 0x6e7374207b706174, 0x682c206279746573, + 0x7d206f6620656e74, 0x7269657329207b0a, 0x2020202020202020, 0x636f6e7374207265, 0x6c6174697665203d, + 0x20706174682e7265, 0x706c616365282f5e, 0x285c2e3f5c2f292b, 0x2f2c202222292e73, 0x706c697428222f22, + 0x292e736c69636528, 0x31292e6a6f696e28, 0x222f22293b0a2020, 0x2020202020206966, 0x202872656c617469, + 0x766520213d3d2022, 0x22290a2020202020, 0x2020202020202066, 0x696c65732e736574, 0x2872656c61746976, + 0x652c206279746573, 0x293b0a202020207d, 0x0a20202020726574, 0x75726e2066696c65, 0x733b0a7d0a0a6675, + 0x6e6374696f6e2070, 0x61636b6167654a73, 0x6f6e2866696c6573, 0x2c206e616d652c20, 0x76657273696f6e29, + 0x207b0a2020202063, 0x6f6e7374206d616e, 0x6966657374203d20, 0x66696c65732e6765, 0x7428227061636b61, + 0x67652e6a736f6e22, 0x293b0a2020202069, 0x662028216d616e69, 0x66657374290a2020, 0x2020202020207468, + 0x726f77206e657720, 0x4572726f72286024, 0x7b6e616d657d4024, 0x7b76657273696f6e, 0x7d20686173206e6f, + 0x207061636b616765, 0x2e6a736f6e60293b, 0x0a20202020636f6e, 0x737420706b67203d, 0x204a534f4e2e7061, + 0x7273652875746638, 0x2e6465636f646528, 0x6d616e6966657374, 0x29293b0a20202020, 0x69662028706b672e, + 0x6e616d6520213d3d, 0x206e616d65207c7c, 0x20706b672e766572, 0x73696f6e20213d3d, 0x2076657273696f6e, + 0x290a202020202020, 0x20207468726f7720, 0x6e6577204572726f, 0x7228605468652061, 0x7263686976652063, + 0x6f6e7461696e7320, 0x247b706b672e6e61, 0x6d657d40247b706b, 0x672e76657273696f, 0x6e7d2c206e6f7420, + 0x247b6e616d657d40, 0x247b76657273696f, 0x6e7d60293b0a2020, 0x202072657475726e, 0x20706b673b0a7d0a, + 0x0a636f6e73742069, 0x73546f6f6c203d20, 0x286669656c642920, 0x3d3e206669656c64, 0x3f2e6b696e64203d, + 0x3d3d2022746f6f6c, 0x2220262620747970, 0x656f66206669656c, 0x642e656e74727920, 0x3d3d3d2022737472, + 0x696e67223b0a0a66, 0x756e6374696f6e20, 0x746f6f6c4f662866, 0x696c65732c206e61, 0x6d652c2076657273, + 0x696f6e29207b0a20, 0x202020636f6e7374, 0x20746f6f6c203d20, 0x7061636b6167654a, 0x736f6e2866696c65, + 0x732c206e616d652c, 0x2076657273696f6e, 0x292e77656266726f, 0x6e743b0a20202020, 0x6966202821697354, + 0x6f6f6c28746f6f6c, 0x29290a2020202020, 0x2020207468726f77, 0x206e657720457272, 0x6f722860247b6e61, + 0x6d657d206973206e, 0x6f74206120576562, 0x46726f6e7420746f, 0x6f6c3a2069747320, 0x7061636b6167652e, + 0x6a736f6e20686173, 0x206e6f2077656266, 0x726f6e7420666965, 0x6c64207769746820, 0x6b696e642022746f, + 0x6f6c2220616e6420, 0x616e20656e747279, 0x60293b0a20202020, 0x72657475726e207b, 0x656e7472793a2074, + 0x6f6f6c2e656e7472, 0x792e7265706c6163, 0x65282f5e285c2e5c, 0x2f292b2f2c202222, 0x292c207469746c65, + 0x3a20747970656f66, 0x20746f6f6c2e7469, 0x746c65203d3d3d20, 0x22737472696e6722, 0x203f20746f6f6c2e, + 0x7469746c65203a20, 0x6e616d657d3b0a7d, 0x0a0a636f6e737420, 0x706b6746756e6374, 0x696f6e203d202862, + 0x72696467652c206e, 0x616d6529203d3e20, 0x6272696467652e63, 0x707046756e637469, 0x6f6e286077656266, + 0x726f6e742e706b67, 0x2e247b6e616d657d, 0x60293b0a0a2f2f2f, 0x204f7074696f6e73, 0x2073686172656420, + 0x6279207365617263, 0x68282920616e6420, 0x696e7374616c6c28, 0x293a0a2f2f2f2020, 0x2062726964676520, + 0x2020207468652057, 0x656246726f6e7420, 0x6272696467652028, 0x676c6f62616c5468, 0x69732e7765624672, + 0x6f6e74290a2f2f2f, 0x2020207265676973, 0x7472792020746865, 0x206e706d20726567, 0x6973747279205552, + 0x4c20286465666175, 0x6c743a2077656266, 0x726f6e742e706b67, 0x2e72656769737472, 0x7928292c20736574, + 0x20696e20546f6f6c, 0x4d616e616765724f, 0x7074696f6e73290a, 0x2f2f2f2020206665, 0x7463682020202020, + 0x7468652066657463, 0x682066756e637469, 0x6f6e0a2f2f2f2020, 0x207369676e616c20, 0x202020616e204162, + 0x6f72745369676e61, 0x6c2073746f707069, 0x6e67207468652064, 0x6f776e6c6f616473, 0x20616e6420746865, + 0x2075706c6f61640a, 0x6173796e63206675, 0x6e6374696f6e2073, 0x657474696e677328, 0x7b62726964676520, + 0x3d20676c6f62616c, 0x546869732e776562, 0x46726f6e742c2072, 0x656769737472792c, 0x2066657463683a20, + 0x6665746368496d70, 0x6c203d20282e2e2e, 0x6172677329203d3e, 0x20676c6f62616c54, 0x6869732e66657463, + 0x68282e2e2e617267, 0x73292c207369676e, 0x616c7d203d207b7d, 0x29207b0a20202020, 0x72657475726e207b, + 0x6272696467652c20, 0x6665746368496d70, 0x6c2c207369676e61, 0x6c2c20626173653a, 0x2072656769737472, + 0x7942617365287265, 0x676973747279203f, 0x3f20286177616974, 0x20706b6746756e63, 0x74696f6e28627269, + 0x6467652c20227265, 0x6769737472792229, 0x282929297d3b0a7d, 0x0a0a2f2f2f205365, 0x6172636865732074, + 0x6865207265676973, 0x74727920666f7220, 0x7061636b61676573, 0x2077697468207468, 0x652077656266726f, + 0x6e742d746f6f6c20, 0x6b6579776f72642e, 0x2052657475726e73, 0x207b6e616d652c20, 0x76657273696f6e2c, + 0x0a2f2f2f20646573, 0x6372697074696f6e, 0x7d206f626a656374, 0x732e0a6578706f72, 0x74206173796e6320, + 0x66756e6374696f6e, 0x2073656172636828, 0x7465726d2c206f70, 0x74696f6e7329207b, 0x0a20202020636f6e, + 0x7374207b66657463, 0x68496d706c2c2073, 0x69676e616c2c2062, 0x6173657d203d2061, 0x7761697420736574, + 0x74696e6773286f70, 0x74696f6e73293b0a, 0x20202020636f6e73, 0x742075726c203d20, 0x6e65772055524c28, + 0x222d2f76312f7365, 0x61726368222c2062, 0x617365293b0a2020, 0x202075726c2e7365, 0x6172636850617261, + 0x6d732e7365742822, 0x74657874222c2060, 0x6b6579776f726473, 0x3a77656266726f6e, 0x742d746f6f6c2024, + 0x7b7465726d7d602e, 0x7472696d2829293b, 0x0a2020202075726c, 0x2e73656172636850, 0x6172616d732e7365, + 0x74282273697a6522, 0x2c2022323022293b, 0x0a20202020636f6e, 0x737420726573756c, 0x74203d2061776169, + 0x742066657463684a, 0x736f6e2875726c2c, 0x206665746368496d, 0x706c2c207369676e, 0x616c293b0a202020, + 0x2072657475726e20, 0x28726573756c742e, 0x6f626a6563747320, 0x3f3f205b5d292e6d, 0x617028287b706163, + 0x6b6167653a20666f, 0x756e647d29203d3e, 0x20287b0a20202020, 0x202020206e616d65, 0x3a20666f756e642e, + 0x6e616d652c0a2020, 0x2020202020207665, 0x7273696f6e3a2066, 0x6f756e642e766572, 0x73696f6e2c0a2020, + 0x2020202020206465, 0x736372697074696f, 0x6e3a20666f756e64, 0x2e64657363726970, 0x74696f6e203f3f20, + 0x22222c0a20202020, 0x7d29293b0a7d0a0a, 0x2f2f20446f776e6c, 0x6f61647320746865, 0x2074617262616c6c, + 0x206f662061206d61, 0x6e69666573742061, 0x6e64207265747572, 0x6e73206974732066, 0x696c657320776974, + 0x6820746865207665, 0x7269666965642069, 0x6e74656772697479, 0x2e0a6173796e6320, 0x66756e6374696f6e, + 0x20646f776e6c6f61, 0x64286d616e696665, 0x73742c207061636b, 0x756d656e744c6f63, 0x6174696f6e2c2066, + 0x65746368496d706c, 0x2c207369676e616c, 0x29207b0a20202020, 0x636f6e7374207461, 0x7262616c6c55726c, + 0x203d206e65772055, 0x524c286d616e6966, 0x6573742e64697374, 0x3f2e74617262616c, 0x6c203f3f2022222c, + 0x207061636b756d65, 0x6e744c6f63617469, 0x6f6e293b0a202020, 0x20636f6e73742074, 0x617262616c6c203d, + 0x206e65772055696e, 0x7438417272617928, 0x6177616974202861, 0x7761697420666574, 0x63684f6b28746172, + 0x62616c6c55726c2c, 0x206665746368496d, 0x706c2c207369676e, 0x616c29292e617272, 0x6179427566666572, + 0x2829293b0a202020, 0x20636f6e73742069, 0x6e74656772697479, 0x203d206177616974, 0x2076657269667949, + 0x6e74656772697479, 0x2874617262616c6c, 0x2c206d616e696665, 0x73742e646973743f, 0x2e696e7465677269, + 0x7479293b0a202020, 0x2072657475726e20, 0x7b696e7465677269, 0x74792c2066696c65, 0x733a207061636b61, + 0x676546696c657328, 0x7265616454617228, 0x6177616974206775, 0x6e7a697028746172, 0x62616c6c2929297d, + 0x3b0a7d0a0a2f2f20, 0x53656e6473207468, 0x652066696c657320, 0x746f207765626672, 0x6f6e742e706b672e, + 0x777269746546696c, 0x6520696e20636875, 0x6e6b733b20616e20, 0x656d707479206669, 0x6c65206973207365, + 0x6e74206173206f6e, 0x6520656d70747920, 0x6368756e6b2e0a61, 0x73796e632066756e, 0x6374696f6e207570, + 0x6c6f61642866696c, 0x65732c207b627269, 0x6467652c206e616d, 0x652c207665727369, 0x6f6e2c207369676e, + 0x616c7d29207b0a20, 0x202020636f6e7374, 0x2077726974654669, 0x6c65203d20706b67, 0x46756e6374696f6e, + 0x286272696467652c, 0x2022777269746546, 0x696c6522293b0a20, 0x202020666f722028, 0x636f6e7374205b70, + 0x6174682c20627974, 0x65735d206f662066, 0x696c657329207b0a, 0x2020202020202020, 0x6c6574206f666673, + 0x6574203d20303b0a, 0x2020202020202020, 0x646f207b0a202020, 0x2020202020202020, 0x207369676e616c3f, + 0x2e7468726f774966, 0x41626f7274656428, 0x293b0a2020202020, 0x2020202020202063, 0x6f6e737420636875, + 0x6e6b203d20627974, 0x65732e7375626172, 0x726179286f666673, 0x65742c206f666673, 0x6574202b20636875, + 0x6e6b53697a65293b, 0x0a20202020202020, 0x2020202020617761, 0x6974207772697465, 0x46696c65286e616d, + 0x652c207665727369, 0x6f6e2c2070617468, 0x2c206f6666736574, 0x2c206368756e6b29, 0x3b0a202020202020, + 0x2020202020206f66, 0x66736574202b3d20, 0x6368756e6b2e6c65, 0x6e6774683b0a2020, 0x2020202020207d20, + 0x7768696c6520286f, 0x6666736574203c20, 0x62797465732e6c65, 0x6e677468293b0a20, 0x2020207d0a7d0a0a, + 0x2f2f2f20446f776e, 0x6c6f6164732c2076, 0x6572696669657320, 0x616e642073746f72, 0x657320226e616d65, + 0x5b4076657273696f, 0x6e206f7220646973, 0x742d7461675d2220, 0x286c617465737420, 0x6279206465666175, + 0x6c74292e20607072, 0x6f67726573732874, 0x65787429600a2f2f, 0x2f207265706f7274, 0x7320746865207374, + 0x6570732e20526573, 0x6f6c76657320746f, 0x207b6e616d652c20, 0x76657273696f6e2c, 0x207469746c652c20, + 0x656e7472792c2066, 0x696c65737d3b2072, 0x656a656374732077, 0x6974686f75742063, 0x68616e67696e6720, + 0x7468650a2f2f2f20, 0x696e7374616c6c65, 0x642076657273696f, 0x6e207768656e2061, 0x6e797468696e6720, + 0x6661696c73206f72, 0x20607369676e616c, 0x602069732061626f, 0x727465642e0a6578, 0x706f727420617379, + 0x6e632066756e6374, 0x696f6e20696e7374, 0x616c6c2873706563, 0x2c207b70726f6772, 0x657373203d202829, + 0x203d3e207b7d2c20, 0x2e2e2e6f7074696f, 0x6e737d203d207b7d, 0x29207b0a20202020, 0x636f6e7374207b6e, + 0x616d652c20766572, 0x73696f6e3a207265, 0x717565737465647d, 0x203d207061727365, 0x5370656328737065, + 0x63293b0a20202020, 0x636f6e7374207b62, 0x72696467652c2066, 0x65746368496d706c, 0x2c207369676e616c, + 0x2c20626173657d20, 0x3d20617761697420, 0x73657474696e6773, 0x286f7074696f6e73, 0x293b0a2020202063, + 0x6f6e737420706163, 0x6b756d656e744c6f, 0x636174696f6e203d, 0x207061636b756d65, 0x6e7455726c286261, + 0x73652c206e616d65, 0x293b0a2020202063, 0x6f6e7374206d616e, 0x6966657374203d20, 0x7265736f6c76654d, + 0x616e696665737428, 0x6177616974206665, 0x7463684a736f6e28, 0x7061636b756d656e, 0x744c6f636174696f, + 0x6e2c206665746368, 0x496d706c2c207369, 0x676e616c292c206e, 0x616d652c20726571, 0x756573746564293b, + 0x0a20202020636f6e, 0x7374207b76657273, 0x696f6e7d203d206d, 0x616e69666573743b, 0x0a2020202070726f, + 0x6772657373286044, 0x6f776e6c6f616469, 0x6e6720247b6e616d, 0x657d40247b766572, 0x73696f6e7de280a6, + 0x60293b0a20202020, 0x636f6e7374207b69, 0x6e74656772697479, 0x2c2066696c65737d, 0x203d206177616974, + 0x20646f776e6c6f61, 0x64286d616e696665, 0x73742c207061636b, 0x756d656e744c6f63, 0x6174696f6e2c2066, + 0x65746368496d706c, 0x2c207369676e616c, 0x293b0a2020202063, 0x6f6e7374207b656e, 0x7472792c20746974, + 0x6c657d203d20746f, 0x6f6c4f662866696c, 0x65732c206e616d65, 0x2c2076657273696f, 0x6e293b0a20202020, + 0x696620282166696c, 0x65732e6861732865, 0x6e74727929290a20, 0x2020202020202074, 0x68726f77206e6577, + 0x204572726f722860, 0x54686520656e7472, 0x7920706167652024, 0x7b656e7472797d20, 0x6f6620247b6e616d, + 0x657d206973206e6f, 0x7420696e20746865, 0x207061636b616765, 0x60293b0a0a202020, 0x2070726f67726573, + 0x732860496e737461, 0x6c6c696e6720247b, 0x66696c65732e7369, 0x7a657d2066696c65, 0x73e280a660293b0a, + 0x2020202061776169, 0x7420706b6746756e, 0x6374696f6e286272, 0x696467652c202262, 0x6567696e2229286e, + 0x616d652c20766572, 0x73696f6e293b0a20, 0x2020206177616974, 0x2075706c6f616428, 0x66696c65732c207b, + 0x6272696467652c20, 0x6e616d652c207665, 0x7273696f6e2c2073, 0x69676e616c7d293b, 0x0a20202020736967, + 0x6e616c3f2e746872, 0x6f77496641626f72, 0x74656428293b0a20, 0x2020206177616974, 0x20706b6746756e63, + 0x74696f6e28627269, 0x6467652c2022636f, 0x6d6d69742229286e, 0x616d652c20766572, 0x73696f6e2c20696e, + 0x746567726974792c, 0x20656e7472792c20, 0x7469746c65293b0a, 0x2020202072657475, 0x726e207b6e616d65, + 0x2c2076657273696f, 0x6e2c207469746c65, 0x2c20656e7472792c, 0x2066696c65733a20, 0x66696c65732e7369, + 0x7a657d3b0a7d0a0a, 0x2f2f2f2054686520, 0x696e7374616c6c65, 0x6420746f6f6c732c, 0x2066726f6d207468, + 0x6520706167657320, 0x6f66207765626672, 0x6f6e742e706b672e, 0x6c69737428293a20, 0x7b6e616d652c2076, + 0x657273696f6e2c20, 0x75726c2c20746974, 0x6c657d206f626a65, 0x6374732e0a657870, 0x6f7274206173796e, + 0x632066756e637469, 0x6f6e20696e737461, 0x6c6c656428627269, 0x646765203d20676c, 0x6f62616c54686973, + 0x2e77656246726f6e, 0x7429207b0a202020, 0x20636f6e7374206c, 0x697374203d20706b, 0x6746756e6374696f, + 0x6e28627269646765, 0x2c20226c69737422, 0x293b0a2020202063, 0x6f6e737420746f6f, 0x6c73203d205b5d3b, + 0x0a20202020666f72, 0x20283b3b29207b0a, 0x2020202020202020, 0x636f6e7374206c69, 0x6e6573203d202861, + 0x77616974206c6973, 0x7428746f6f6c732e, 0x6c656e6774682929, 0x2e73706c69742822, 0x5c6e22292e66696c, + 0x74657228286c696e, 0x6529203d3e206c69, 0x6e6520213d3d2022, 0x22293b0a20202020, 0x2020202069662028, + 0x6c696e65732e6c65, 0x6e677468203d3d3d, 0x2030290a20202020, 0x2020202020202020, 0x72657475726e2074, + 0x6f6f6c733b0a2020, 0x202020202020666f, 0x722028636f6e7374, 0x206c696e65206f66, 0x206c696e65732920, + 0x7b0a202020202020, 0x202020202020636f, 0x6e7374205b6e616d, 0x652c207665727369, 0x6f6e2c2075726c2c, + 0x207469746c655d20, 0x3d206c696e652e73, 0x706c697428225c74, 0x22293b0a20202020, 0x2020202020202020, + 0x746f6f6c732e7075, 0x7368287b6e616d65, 0x2c2076657273696f, 0x6e2c2075726c2c20, 0x7469746c657d293b, + 0x0a20202020202020, 0x207d0a202020207d, 0x0a7d0a0a2f2f2f20, 0x4f70656e73207468, 0x6520656e74727920, + 0x70616765206f6620, 0x616e20696e737461, 0x6c6c656420746f6f, 0x6c20696e2061206e, 0x657720746162206f, + 0x722077696e646f77, 0x2c20616e64207265, 0x736f6c7665732074, 0x6f20697473205552, 0x4c2e0a6578706f72, + 0x74206173796e6320, 0x66756e6374696f6e, 0x206f70656e286e61, 0x6d652c2062726964, 0x6765203d20676c6f, + 0x62616c546869732e, 0x77656246726f6e74, 0x29207b0a20202020, 0x636f6e737420746f, 0x6f6c203d20286177, + 0x61697420696e7374, 0x616c6c6564286272, 0x6964676529292e66, 0x696e64282863616e, 0x6469646174652920, + 0x3d3e2063616e6469, 0x646174652e6e616d, 0x65203d3d3d206e61, 0x6d65293b0a202020, 0x206966202821746f, + 0x6f6c290a20202020, 0x202020207468726f, 0x77206e6577204572, 0x726f722860247b6e, 0x616d657d20697320, + 0x6e6f7420696e7374, 0x616c6c656460293b, 0x0a20202020726574, 0x75726e207b2e2e2e, 0x746f6f6c2c206f70, + 0x656e65643a20676c, 0x6f62616c54686973, 0x2e6f70656e28746f, 0x6f6c2e75726c2c20, 0x225f626c616e6b22, + 0x2920213d3d206e75, 0x6c6c7d3b0a7d0a0a, 0x66756e6374696f6e, 0x2072657175697265, 0x4f6e652861726773, + 0x29207b0a20202020, 0x6966202861726773, 0x2e6c656e67746820, 0x213d3d2031290a20, 0x2020202020202074, + 0x68726f77206e6577, 0x204572726f722822, 0x57726f6e67206e75, 0x6d626572206f6620, 0x617267756d656e74, + 0x732e205479706520, 0x2777662068656c70, 0x272e22293b0a2020, 0x202072657475726e, 0x20617267735b305d, + 0x3b0a7d0a0a66756e, 0x6374696f6e20666f, 0x726d6174466f756e, 0x6428666f756e6429, 0x207b0a2020202069, + 0x662028666f756e64, 0x2e6c656e67746820, 0x3d3d3d2030290a20, 0x2020202020202072, 0x657475726e20224e, + 0x6f20746f6f6c2066, 0x6f756e642e223b0a, 0x20202020636f6e73, 0x7420776964746820, 0x3d204d6174682e6d, + 0x6178282e2e2e666f, 0x756e642e6d617028, 0x287b6e616d652c20, 0x76657273696f6e7d, 0x29203d3e206e616d, + 0x652e6c656e677468, 0x202b207665727369, 0x6f6e2e6c656e6774, 0x68202b203129293b, 0x0a20202020726574, + 0x75726e20666f756e, 0x642e6d617028287b, 0x6e616d652c207665, 0x7273696f6e2c2064, 0x6573637269707469, + 0x6f6e7d29203d3e20, 0x60247b6e616d657d, 0x40247b7665727369, 0x6f6e7d602e706164, 0x456e642877696474, + 0x68202b203229202b, 0x2064657363726970, 0x74696f6e292e6a6f, 0x696e28225c6e2229, 0x3b0a7d0a0a2f2f20, + 0x5468652077662073, 0x7562636f6d6d616e, 0x64732072756e6e69, 0x6e6720696e207468, 0x652062726f777365, + 0x723b20277766206c, 0x697374272c202777, 0x662072656d6f7665, 0x2720616e64202777, 0x662068656c702720, + 0x72756e20696e2043, 0x2b2b2e0a636f6e73, 0x7420737562636f6d, 0x6d616e6473203d20, 0x7b0a202020207365, + 0x617263683a206173, 0x796e632028617267, 0x732c207b62726964, 0x67652c207369676e, 0x616c7d29203d3e20, + 0x666f726d6174466f, 0x756e642861776169, 0x7420736561726368, 0x28617267732e6a6f, 0x696e28222022292c, + 0x207b627269646765, 0x2c207369676e616c, 0x7d29292c0a202020, 0x20696e7374616c6c, 0x3a206173796e6320, + 0x28617267732c207b, 0x6272696467652c20, 0x7369676e616c2c20, 0x77726974657d2920, 0x3d3e207b0a202020, + 0x2020202020636f6e, 0x737420746f6f6c20, 0x3d20617761697420, 0x696e7374616c6c28, 0x726571756972654f, + 0x6e65286172677329, 0x2c207b6272696467, 0x652c207369676e61, 0x6c2c2070726f6772, 0x6573733a20287374, + 0x657029203d3e2077, 0x7269746528737465, 0x70202b20225c6e22, 0x297d293b0a202020, 0x2020202020726574, + 0x75726e2060496e73, 0x74616c6c65642024, 0x7b746f6f6c2e6e61, 0x6d657d40247b746f, 0x6f6c2e7665727369, + 0x6f6e7d3a20247b74, 0x6f6f6c2e7469746c, 0x657d2e2054797065, 0x20277766206f7065, 0x6e20247b746f6f6c, + 0x2e6e616d657d272e, 0x603b0a202020207d, 0x2c0a202020206f70, 0x656e3a206173796e, 0x632028617267732c, + 0x207b627269646765, 0x7d29203d3e207b0a, 0x2020202020202020, 0x636f6e737420746f, 0x6f6c203d20617761, + 0x6974206f70656e28, 0x726571756972654f, 0x6e65286172677329, 0x2c20627269646765, 0x293b0a2020202020, + 0x2020207265747572, 0x6e20746f6f6c2e6f, 0x70656e6564203f20, 0x604f70656e656420, 0x247b746f6f6c2e74, + 0x69746c657d3a2024, 0x7b746f6f6c2e7572, 0x6c7d60203a206054, 0x68652062726f7773, 0x657220626c6f636b, + 0x656420746865206e, 0x65772077696e646f, 0x772e204f70656e20, 0x247b746f6f6c2e75, 0x726c7d603b0a2020, + 0x20207d2c0a7d3b0a, 0x0a6173796e632066, 0x756e6374696f6e20, 0x7766285b636f6d6d, 0x616e642c202e2e2e, + 0x617267735d2c2063, 0x6f6e746578742920, 0x7b0a202020207265, 0x7475726e204f626a, 0x6563742e6861734f, + 0x776e28737562636f, 0x6d6d616e64732c20, 0x636f6d6d616e6429, 0x203f20737562636f, 0x6d6d616e64735b63, + 0x6f6d6d616e645d28, 0x617267732c20636f, 0x6e7465787429203a, 0x20756e646566696e, 0x65643b0a7d0a0a2f, + 0x2f2f205465726d69, 0x6e616c2062726f77, 0x73657220636f6d6d, 0x616e647320287365, 0x65205465726d696e, + 0x616c3a3a65787465, 0x6e73696f6e292e0a, 0x6578706f72742063, 0x6f6e737420636f6d, 0x6d616e6473203d20, + 0x7b77667d3b0a0000 + }; +}; + +} // namespace webfront::fs::generated diff --git a/include/system/ToolStore.hpp b/include/webfront/system/ToolStore.hpp similarity index 100% rename from include/system/ToolStore.hpp rename to include/webfront/system/ToolStore.hpp diff --git a/include/system/WebFrontJsData.hpp b/include/webfront/system/WebFrontJsData.hpp similarity index 100% rename from include/system/WebFrontJsData.hpp rename to include/webfront/system/WebFrontJsData.hpp diff --git a/include/system/WindowsCompat.hpp b/include/webfront/system/WindowsCompat.hpp similarity index 100% rename from include/system/WindowsCompat.hpp rename to include/webfront/system/WindowsCompat.hpp diff --git a/include/system/XtermCssData.hpp b/include/webfront/system/XtermCssData.hpp similarity index 100% rename from include/system/XtermCssData.hpp rename to include/webfront/system/XtermCssData.hpp diff --git a/include/system/XtermFitAddonData.hpp b/include/webfront/system/XtermFitAddonData.hpp similarity index 100% rename from include/system/XtermFitAddonData.hpp rename to include/webfront/system/XtermFitAddonData.hpp diff --git a/include/system/XtermModuleData.hpp b/include/webfront/system/XtermModuleData.hpp similarity index 100% rename from include/system/XtermModuleData.hpp rename to include/webfront/system/XtermModuleData.hpp diff --git a/include/tooling/HexDump.hpp b/include/webfront/tooling/HexDump.hpp similarity index 100% rename from include/tooling/HexDump.hpp rename to include/webfront/tooling/HexDump.hpp diff --git a/include/tooling/Logger.hpp b/include/webfront/tooling/Logger.hpp similarity index 100% rename from include/tooling/Logger.hpp rename to include/webfront/tooling/Logger.hpp diff --git a/include/tooling/LoggerApi.hpp b/include/webfront/tooling/LoggerApi.hpp similarity index 100% rename from include/tooling/LoggerApi.hpp rename to include/webfront/tooling/LoggerApi.hpp diff --git a/include/tooling/MddlogLogger.hpp b/include/webfront/tooling/MddlogLogger.hpp similarity index 100% rename from include/tooling/MddlogLogger.hpp rename to include/webfront/tooling/MddlogLogger.hpp diff --git a/include/tooling/PathUtils.hpp b/include/webfront/tooling/PathUtils.hpp similarity index 98% rename from include/tooling/PathUtils.hpp rename to include/webfront/tooling/PathUtils.hpp index b4e0ffcf..7f910fd2 100644 --- a/include/tooling/PathUtils.hpp +++ b/include/webfront/tooling/PathUtils.hpp @@ -9,7 +9,7 @@ #pragma once -#include +#include #include #include #include diff --git a/include/utils/Json.hpp b/include/webfront/utils/Json.hpp similarity index 100% rename from include/utils/Json.hpp rename to include/webfront/utils/Json.hpp diff --git a/include/utils/TypeErasedFunction.hpp b/include/webfront/utils/TypeErasedFunction.hpp similarity index 100% rename from include/utils/TypeErasedFunction.hpp rename to include/webfront/utils/TypeErasedFunction.hpp diff --git a/include/weblink/Messages.hpp b/include/webfront/weblink/Messages.hpp similarity index 100% rename from include/weblink/Messages.hpp rename to include/webfront/weblink/Messages.hpp diff --git a/include/weblink/PendingCalls.hpp b/include/webfront/weblink/PendingCalls.hpp similarity index 100% rename from include/weblink/PendingCalls.hpp rename to include/webfront/weblink/PendingCalls.hpp diff --git a/include/weblink/WebLink.hpp b/include/webfront/weblink/WebLink.hpp similarity index 100% rename from include/weblink/WebLink.hpp rename to include/webfront/weblink/WebLink.hpp diff --git a/cmake/EmbedTextAsset.cmake b/js/core/EmbedTextAsset.cmake similarity index 98% rename from cmake/EmbedTextAsset.cmake rename to js/core/EmbedTextAsset.cmake index aafecece..99c6acfc 100644 --- a/cmake/EmbedTextAsset.cmake +++ b/js/core/EmbedTextAsset.cmake @@ -16,7 +16,7 @@ set(encoding "") if(GZIP) find_program(NODE_EXECUTABLE NAMES node nodejs REQUIRED) set(compressed "${CMAKE_CURRENT_BINARY_DIR}/${STRUCT}.gz") - execute_process(COMMAND "${NODE_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../tools/assets/gzip.mjs" + execute_process(COMMAND "${NODE_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../developer/vendor/gzip.mjs" "${INPUT}" "${compressed}" RESULT_VARIABLE result) if(NOT result EQUAL 0) message(FATAL_ERROR "gzip generation failed for ${INPUT}") diff --git a/assets/WebFront.js b/js/core/WebFront.js similarity index 100% rename from assets/WebFront.js rename to js/core/WebFront.js diff --git a/cmake/WebFrontAssets.cmake b/js/core/WebFrontAssets.cmake similarity index 71% rename from cmake/WebFrontAssets.cmake rename to js/core/WebFrontAssets.cmake index 53623f0b..37cbf40b 100644 --- a/cmake/WebFrontAssets.cmake +++ b/js/core/WebFrontAssets.cmake @@ -30,52 +30,52 @@ endfunction() function(webfront_add_embedded_assets) find_package(Git QUIET) - set(root "${_WEBFRONT_ASSETS_DIR}/..") + set(root "${_WEBFRONT_ASSETS_DIR}/../..") cmake_path(NORMAL_PATH root) add_custom_target(webfront-embedded-assets COMMENT "Regenerating embedded browser bridge and fallback-page assets") _webfront_add_embedded_text_asset( - "${root}/assets/WebFront.js" "${root}/include/system/WebFrontJsData.hpp" + "${root}/js/core/WebFront.js" "${root}/include/webfront/system/WebFrontJsData.hpp" WebFrontJsData WebFrontJsAssetsFresh) _webfront_add_embedded_text_asset( - "${root}/assets/fallback/index.html" "${root}/include/system/FallbackIndexHtmlData.hpp" + "${root}/js/core/fallback/index.html" "${root}/include/webfront/system/FallbackIndexHtmlData.hpp" FallbackIndexHtmlData FallbackIndexHtmlAssetFresh) _webfront_add_embedded_text_asset( - "${root}/assets/fallback/webfront-fallback.mjs" "${root}/include/system/FallbackModuleData.hpp" + "${root}/js/core/fallback/webfront-fallback.mjs" "${root}/include/webfront/system/FallbackModuleData.hpp" FallbackModuleData FallbackModuleAssetFresh) _webfront_add_embedded_text_asset( - "${root}/assets/developer/index.html" "${root}/include/system/DeveloperIndexHtmlData.hpp" + "${root}/js/core/bootstrap/index.html" "${root}/include/webfront/system/DeveloperIndexHtmlData.hpp" DeveloperIndexHtmlData DeveloperIndexHtmlAssetFresh) _webfront_add_embedded_text_asset( - "${root}/assets/developer/bootstrap.bundle.mjs" "${root}/include/system/DeveloperBootstrapData.hpp" + "${root}/js/core/bootstrap/bootstrap.bundle.mjs" "${root}/include/webfront/system/DeveloperBootstrapData.hpp" DeveloperBootstrapData DeveloperBootstrapAssetFresh) - # Terminal component (include/system/TerminalFS.hpp). xterm.js files are vendored verbatim in + # Terminal component (include/webfront/system/TerminalFS.hpp). xterm.js files are vendored verbatim in # third_party/xterm (see its VERSION file); refresh them with cmake/UpdateXterm.cmake. _webfront_add_embedded_text_asset( - "${root}/assets/components/terminal/index.html" "${root}/include/system/TerminalIndexHtmlData.hpp" + "${root}/js/developer/components/terminal/index.html" "${root}/include/webfront/system/TerminalIndexHtmlData.hpp" TerminalIndexHtmlData TerminalIndexHtmlAssetFresh) _webfront_add_embedded_text_asset( - "${root}/assets/components/terminal/terminal.mjs" "${root}/include/system/TerminalModuleData.hpp" + "${root}/js/developer/components/terminal/terminal.mjs" "${root}/include/webfront/system/TerminalModuleData.hpp" TerminalModuleData TerminalModuleAssetFresh) - # Browser side of the wf tool manager (include/system/ToolManagerFS.hpp). + # Browser side of the wf tool manager (include/webfront/system/ToolManagerFS.hpp). _webfront_add_embedded_text_asset( - "${root}/assets/components/tools/wf.mjs" "${root}/include/system/ToolManagerModuleData.hpp" + "${root}/js/developer/components/tools/wf.mjs" "${root}/include/webfront/system/ToolManagerModuleData.hpp" ToolManagerModuleData ToolManagerModuleAssetFresh) _webfront_add_embedded_text_asset( - "${root}/third_party/xterm/xterm.mjs" "${root}/include/system/XtermModuleData.hpp" + "${root}/third_party/xterm/xterm.mjs" "${root}/include/webfront/system/XtermModuleData.hpp" XtermModuleData XtermModuleAssetFresh ON) _webfront_add_embedded_text_asset( - "${root}/third_party/xterm/xterm.css" "${root}/include/system/XtermCssData.hpp" + "${root}/third_party/xterm/xterm.css" "${root}/include/webfront/system/XtermCssData.hpp" XtermCssData XtermCssAssetFresh ON) _webfront_add_embedded_text_asset( - "${root}/third_party/xterm/addon-fit.mjs" "${root}/include/system/XtermFitAddonData.hpp" + "${root}/third_party/xterm/addon-fit.mjs" "${root}/include/webfront/system/XtermFitAddonData.hpp" XtermFitAddonData XtermFitAddonAssetFresh ON) _webfront_add_embedded_text_asset( - "${root}/third_party/react/runtime.mjs" "${root}/include/system/ReactRuntimeData.hpp" + "${root}/third_party/react/runtime.mjs" "${root}/include/webfront/system/ReactRuntimeData.hpp" ReactRuntimeData ReactRuntimeAssetFresh ON) _webfront_add_embedded_text_asset( - "${root}/third_party/babel/babel.min.js" "${root}/include/system/BabelData.hpp" + "${root}/third_party/babel/babel.min.js" "${root}/include/webfront/system/BabelData.hpp" BabelData BabelAssetFresh ON) foreach(asset IN ITEMS jasmine.js jasmine-html.js jasmine.css boot.js jasmine_favicon.png) if(asset STREQUAL "jasmine.js") @@ -95,15 +95,15 @@ function(webfront_add_embedded_assets) set(compress ON) endif() _webfront_add_embedded_text_asset( - "${root}/third_party/jasmine/${asset}" "${root}/include/system/${struct}.hpp" + "${root}/third_party/jasmine/${asset}" "${root}/include/webfront/system/${struct}.hpp" ${struct} ${struct}AssetFresh ${compress}) endforeach() if(ENABLE_TESTING) find_program(WEBFRONT_NODE_EXECUTABLE NAMES node nodejs REQUIRED) add_test(NAME DeveloperJavaScript COMMAND "${WEBFRONT_NODE_EXECUTABLE}" - --test "${root}/tools/developer/check.mjs" "${root}/tools/developer/distribution-check.mjs") + --test "${root}/js/developer/tools/check.mjs" "${root}/js/developer/tools/distribution-check.mjs") set_tests_properties(DeveloperJavaScript PROPERTIES TIMEOUT 30) add_test(NAME EmbeddedGzipContents COMMAND "${WEBFRONT_NODE_EXECUTABLE}" - "${root}/tools/assets/check.mjs") + "${root}/js/developer/vendor/check.mjs") endif() endfunction() diff --git a/assets/developer/bootstrap.bundle.mjs b/js/core/bootstrap/bootstrap.bundle.mjs similarity index 100% rename from assets/developer/bootstrap.bundle.mjs rename to js/core/bootstrap/bootstrap.bundle.mjs diff --git a/assets/developer/index.html b/js/core/bootstrap/index.html similarity index 100% rename from assets/developer/index.html rename to js/core/bootstrap/index.html diff --git a/assets/fallback/index.html b/js/core/fallback/index.html similarity index 100% rename from assets/fallback/index.html rename to js/core/fallback/index.html diff --git a/assets/fallback/webfront-fallback.mjs b/js/core/fallback/webfront-fallback.mjs similarity index 100% rename from assets/fallback/webfront-fallback.mjs rename to js/core/fallback/webfront-fallback.mjs diff --git a/assets/components/terminal/index.html b/js/developer/components/terminal/index.html similarity index 100% rename from assets/components/terminal/index.html rename to js/developer/components/terminal/index.html diff --git a/assets/components/terminal/terminal.mjs b/js/developer/components/terminal/terminal.mjs similarity index 99% rename from assets/components/terminal/terminal.mjs rename to js/developer/components/terminal/terminal.mjs index 62acbf67..f910ffe2 100644 --- a/assets/components/terminal/terminal.mjs +++ b/js/developer/components/terminal/terminal.mjs @@ -1,5 +1,5 @@ /// @brief WebFront terminal component: an xterm.js terminal whose line editor sends each validated -/// line to the C++ commands registered through webfront::Terminal (include/components/Terminal.hpp), +/// line to the C++ commands registered through webfront::Terminal (include/webfront/components/Terminal.hpp), /// unless a browser command of an extension module (Terminal::extension) handles it first. import {Terminal} from "./xterm.mjs"; diff --git a/assets/components/tools/wf.mjs b/js/developer/components/tools/wf.mjs similarity index 99% rename from assets/components/tools/wf.mjs rename to js/developer/components/tools/wf.mjs index 82ffcc63..c8a477f9 100644 --- a/assets/components/tools/wf.mjs +++ b/js/developer/components/tools/wf.mjs @@ -1,5 +1,5 @@ /// @brief Browser side of the wf tool manager (#234), a terminal extension added by -/// webfront::ToolManager (include/components/ToolManager.hpp). 'wf search', 'wf install' and +/// webfront::ToolManager (include/webfront/components/ToolManager.hpp). 'wf search', 'wf install' and /// 'wf open' run here, because the download speaks HTTPS; 'wf list', 'wf remove' and 'wf help' run /// in C++. An installation fetches the packument and the tarball from the npm registry, checks the /// tarball's SHA-512 integrity, unpacks it and sends its files through webfront.pkg.begin, diff --git a/assets/developer/PACKAGES-LICENSE.txt b/js/developer/environment/PACKAGES-LICENSE.txt similarity index 100% rename from assets/developer/PACKAGES-LICENSE.txt rename to js/developer/environment/PACKAGES-LICENSE.txt diff --git a/assets/developer/archive.mjs b/js/developer/environment/archive.mjs similarity index 100% rename from assets/developer/archive.mjs rename to js/developer/environment/archive.mjs diff --git a/assets/developer/bootstrap-entry.mjs b/js/developer/environment/bootstrap-entry.mjs similarity index 100% rename from assets/developer/bootstrap-entry.mjs rename to js/developer/environment/bootstrap-entry.mjs diff --git a/assets/developer/bootstrap.mjs b/js/developer/environment/bootstrap.mjs similarity index 100% rename from assets/developer/bootstrap.mjs rename to js/developer/environment/bootstrap.mjs diff --git a/assets/developer/bundler.mjs b/js/developer/environment/bundler.mjs similarity index 100% rename from assets/developer/bundler.mjs rename to js/developer/environment/bundler.mjs diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json new file mode 100644 index 00000000..d20d873d --- /dev/null +++ b/js/developer/environment/bundles.json @@ -0,0 +1,34 @@ +{ + "js/developer/environment/bootstrap.mjs": "534af4b3d07891338c3390e1d5e06c2fb6dd8df11ca6547735565b17f1b9cd70", + "js/developer/environment/bootstrap-entry.mjs": "ff8084f23f5acc721f97eb1ed0a454e7bfee1894de17d54f0100fa11f7ef8b77", + "js/developer/environment/packages.mjs": "faed29500a34c6ce24756d07bd4b47b9168ccec4bd49d12f00096a869637d74d", + "js/developer/environment/starter.mjs": "f8cdef1218ae14f8bbe49eae495d931cc29e33f74444f0e37d61aea416b9d750", + "js/developer/environment/paths.mjs": "6ebb626610756143c58762c87af18980802809d7f0f53d3b588e4b20e8db0161", + "js/developer/environment/runtime.mjs": "640896773c533ecc091a44384f0cac5115de346073c5393994073d7ff9d64c1b", + "js/developer/environment/compiler.mjs": "3f7e187ca9a4c2645ef3823127457cad655919cbea3c7c0f22fb7ae2cc87e0e5", + "js/developer/environment/bundler.mjs": "b0ff79a1b0caa012c25ec7b7f121d7d50af1aa1651231d3dcf2f39470c4ea25c", + "js/developer/environment/entry.mjs": "b2b942443e3c74ae2c008392ba244d9b7e91db70ba1b4ebbe1357c455ebf51bb", + "js/developer/environment/conditions.mjs": "7f0ecba239480831e38985ccffd4c82309949924f4eb9d938e4ad1b09f5f36ed", + "js/developer/environment/io.mjs": "a155719c612e065c30272c0dfdc456df28b5efa90ca26f8cfcb55c9cb46de690", + "js/developer/environment/recipe.mjs": "809f2091c50ebd13d23f92de9876b584658dc687324f73d48ee9f1271319f1ed", + "js/developer/environment/registry.mjs": "f566f07ea066155ab7209d925cee2cf12a664ac51b07bc0ca3e3fd8fde49a9c8", + "js/developer/environment/archive.mjs": "1fb8b9c3c27219858597801104639bba1104c7a7d33973609cd556b5e5f81d2d", + "js/developer/environment/lock.mjs": "60d0ea14d24793cd5e85bbd4bb4bfe90d2c7d76c0d20ffc99f462595a6e57291", + "js/developer/environment/pins.mjs": "ddb2214a2e906cb117dc1bac0b5b056decd4f6c6e3d4713615176c1876db3534", + "js/developer/environment/peers.mjs": "e1d999892138682fc0134ef1f4d4b19b9a9ad8d7fb16e37fc9c6c684bd853896", + "js/developer/environment/resolve.mjs": "8b96b850af215be51f5cb85cc9c69e057afa04dfb8a57e572620c07059c17fa3", + "js/developer/environment/embed.mjs": "c370fd05b1629d630a3d504f65f6411df3a73c0f6deabf484654bddae52857a2", + "js/developer/tools/starters/pi/main.tsx": "d3161b35db204ba54f782f711183e8d96aeff7c92d885c33a6ec168cf461e453", + "js/developer/tools/starters/pi/style.css": "360e2c7ae6d3699b00e18cbf67efbae7a8d8863d88926b31139e102cf38e5abd", + "examples/life/ui/main.tsx": "ed11a82aad1639eb6997af8b0fca4d5c5ed4c36422c22a74ac49ae73078d0a91", + "examples/life/ui/style.css": "9bb55eb0f0a3287e5b7dc78af9d69608b87ff42c4d9c8a653bc83a52fe293c44", + "js/developer/components/tools/wf.mjs": "2a8b463b2da223deb8d54d9fdd6037fdd079afeb24e39337693df03cdbcbd0ec", + "js/developer/tools/distribution.json": "26bb7dba24546565e38071087ab088727ad2b51fbbdb37afe801a574aff53fb6", + "js/developer/tools/build.mjs": "30999e2a9209966deb2cd486c786ce27d464a93882cca5b272b530837d46b3dd", + "js/developer/tools/site.mjs": "1827d3fd7e1e470336aab25ea8686c912c2b674a10f7be496f2f0077fbc45292", + "js/developer/tools/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b", + "js/developer/vendor/package-lock.json": "eb545112b672f9dbf520125df1f44a878d62cc8e611f0e33baee36470ded4dec", + "js/core/bootstrap/bootstrap.bundle.mjs": "792fe7cf564bd12ac47fef419d8c71e2070925764a17706552e7d3f5d6ba2181", + "js/developer/environment/packages.bundle.mjs": "994c13a8b30a40ecea98414caa72a17927dcea81a1f62d47744b4f55d87005be", + "include/webfront/system/DeveloperReleaseData.hpp": "c97a8c3b21df3306c179f7b46d945159b5854f9d2810f135a4ab224c768c75d7" +} diff --git a/assets/developer/compiler.mjs b/js/developer/environment/compiler.mjs similarity index 100% rename from assets/developer/compiler.mjs rename to js/developer/environment/compiler.mjs diff --git a/assets/developer/conditions.mjs b/js/developer/environment/conditions.mjs similarity index 100% rename from assets/developer/conditions.mjs rename to js/developer/environment/conditions.mjs diff --git a/assets/developer/embed.mjs b/js/developer/environment/embed.mjs similarity index 96% rename from assets/developer/embed.mjs rename to js/developer/environment/embed.mjs index 7de4bc70..f9903620 100644 --- a/assets/developer/embed.mjs +++ b/js/developer/environment/embed.mjs @@ -1,4 +1,4 @@ -import {gzipSync} from '../../third_party/fflate/browser.mjs'; +import {gzipSync} from '../../../third_party/fflate/browser.mjs'; export function compress(bytes) { return gzipSync(bytes, {level: 9, mem: 8, mtime: 0}); @@ -43,7 +43,7 @@ export function generateProvider(files, className = 'ApplicationAssets', notices } return `#pragma once -#include +#include /* Dependency notices and build inputs\n${notices.replaceAll('*/', '* /')}\n*/ namespace webfront::fs { diff --git a/assets/developer/entry.mjs b/js/developer/environment/entry.mjs similarity index 100% rename from assets/developer/entry.mjs rename to js/developer/environment/entry.mjs diff --git a/assets/developer/io.mjs b/js/developer/environment/io.mjs similarity index 100% rename from assets/developer/io.mjs rename to js/developer/environment/io.mjs diff --git a/assets/developer/lock.mjs b/js/developer/environment/lock.mjs similarity index 100% rename from assets/developer/lock.mjs rename to js/developer/environment/lock.mjs diff --git a/assets/developer/packages.bundle.mjs b/js/developer/environment/packages.bundle.mjs similarity index 100% rename from assets/developer/packages.bundle.mjs rename to js/developer/environment/packages.bundle.mjs diff --git a/assets/developer/packages.mjs b/js/developer/environment/packages.mjs similarity index 100% rename from assets/developer/packages.mjs rename to js/developer/environment/packages.mjs diff --git a/assets/developer/paths.mjs b/js/developer/environment/paths.mjs similarity index 100% rename from assets/developer/paths.mjs rename to js/developer/environment/paths.mjs diff --git a/assets/developer/peers.mjs b/js/developer/environment/peers.mjs similarity index 100% rename from assets/developer/peers.mjs rename to js/developer/environment/peers.mjs diff --git a/assets/developer/pins.mjs b/js/developer/environment/pins.mjs similarity index 100% rename from assets/developer/pins.mjs rename to js/developer/environment/pins.mjs diff --git a/assets/developer/recipe.mjs b/js/developer/environment/recipe.mjs similarity index 100% rename from assets/developer/recipe.mjs rename to js/developer/environment/recipe.mjs diff --git a/assets/developer/registry.mjs b/js/developer/environment/registry.mjs similarity index 100% rename from assets/developer/registry.mjs rename to js/developer/environment/registry.mjs diff --git a/assets/developer/resolve.mjs b/js/developer/environment/resolve.mjs similarity index 100% rename from assets/developer/resolve.mjs rename to js/developer/environment/resolve.mjs diff --git a/assets/developer/runtime.mjs b/js/developer/environment/runtime.mjs similarity index 98% rename from assets/developer/runtime.mjs rename to js/developer/environment/runtime.mjs index 5b83914c..69228ad8 100644 --- a/assets/developer/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -1,5 +1,5 @@ -import {Terminal} from '../../third_party/xterm/xterm.mjs'; -import {FitAddon} from '../../third_party/xterm/addon-fit.mjs'; +import {Terminal} from '../../../third_party/xterm/xterm.mjs'; +import {FitAddon} from '../../../third_party/xterm/addon-fit.mjs'; import {LineEditor, tokenize} from '../components/terminal/terminal.mjs'; import {resolvePackages, validateLock, downloadPackage} from './packages.mjs'; import {readProject, publish} from './io.mjs'; diff --git a/assets/developer/starter.mjs b/js/developer/environment/starter.mjs similarity index 100% rename from assets/developer/starter.mjs rename to js/developer/environment/starter.mjs diff --git a/tools/developer/PUBLISHING.md b/js/developer/tools/PUBLISHING.md similarity index 87% rename from tools/developer/PUBLISHING.md rename to js/developer/tools/PUBLISHING.md index 4e577d60..b6c7cc42 100644 --- a/tools/developer/PUBLISHING.md +++ b/js/developer/tools/PUBLISHING.md @@ -8,15 +8,15 @@ The package names in their manifests are identifiers, not a requirement to own o ## Build and review ```sh -npm ci --prefix tools/assets --ignore-scripts -node tools/developer/build.mjs build-distribution --refresh-bootstrap -node tools/developer/fixtures.mjs build-distribution -node --test tools/developer/check.mjs tools/developer/distribution-check.mjs -node tools/developer/site.mjs build-distribution build-developer-site +npm ci --prefix js/developer/vendor --ignore-scripts +node js/developer/tools/build.mjs build-distribution --refresh-bootstrap +node js/developer/tools/fixtures.mjs build-distribution +node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs +node js/developer/tools/site.mjs build-distribution build-developer-site ``` Review and commit the updated checked-in bootstrap bundles, checksums and -`include/system/DeveloperReleaseData.hpp`. The header pins the exact environment archive and URL. +`include/webfront/system/DeveloperReleaseData.hpp`. The header pins the exact environment archive and URL. The environment pins the starter archive in turn. `provision.json` is informational; applications do not discover a replacement trust hash from that remote file or follow `latest` at startup. @@ -52,7 +52,7 @@ It publishes only on a `developer-v` tag or an explicit workflow dispat Use the dedicated tag `developer-v` matching `distribution.json`; the C++ library's `v*` releases remain separate. ```sh -version=$(node -p "require('./tools/developer/distribution.json').version") +version=$(node -p "require('./js/developer/tools/distribution.json').version") git tag "developer-v$version" git push origin "developer-v$version" ``` diff --git a/tools/developer/RELEASE_NOTES.md b/js/developer/tools/RELEASE_NOTES.md similarity index 100% rename from tools/developer/RELEASE_NOTES.md rename to js/developer/tools/RELEASE_NOTES.md diff --git a/tools/developer/archive-release.mjs b/js/developer/tools/archive-release.mjs similarity index 93% rename from tools/developer/archive-release.mjs rename to js/developer/tools/archive-release.mjs index 3eb7c4a0..7840416c 100644 --- a/tools/developer/archive-release.mjs +++ b/js/developer/tools/archive-release.mjs @@ -31,5 +31,5 @@ if (existing) { } else { console.log(gh('release', 'create', tag, '--repo', repository, '--verify-tag', '--prerelease', '--title', `WebFront developer packages ${metadata.version}`, - '--notes-file', resolve('tools/developer/RELEASE_NOTES.md'), ...files.map(name => resolve(distribution, name)))); + '--notes-file', resolve('js/developer/tools/RELEASE_NOTES.md'), ...files.map(name => resolve(distribution, name)))); } diff --git a/tools/developer/archive.mjs b/js/developer/tools/archive.mjs similarity index 100% rename from tools/developer/archive.mjs rename to js/developer/tools/archive.mjs diff --git a/tools/developer/build.mjs b/js/developer/tools/build.mjs similarity index 56% rename from tools/developer/build.mjs rename to js/developer/tools/build.mjs index cea09d79..c79d884a 100644 --- a/tools/developer/build.mjs +++ b/js/developer/tools/build.mjs @@ -1,15 +1,15 @@ // Maintainer provisioning only. Consumers download the resulting tarball, without Node/npm. -import {build} from '../assets/node_modules/esbuild/lib/main.js'; +import {build} from '../vendor/node_modules/esbuild/lib/main.js'; import {readFile, writeFile, mkdir, copyFile} from 'node:fs/promises'; import {resolve} from 'node:path'; import {fileURLToPath} from 'node:url'; import {createHash} from 'node:crypto'; import {execFileSync} from 'node:child_process'; -import {gzipSync} from '../../third_party/fflate/browser.mjs'; +import {gzipSync} from '../../../third_party/fflate/browser.mjs'; import {tar} from './archive.mjs'; import {baseUrl, versionPath, bootstrapHeader} from './site.mjs'; -const root = fileURLToPath(new URL('../../', import.meta.url)); +const root = fileURLToPath(new URL('../../../', import.meta.url)); const args = process.argv.slice(2); const refresh = args.includes('--refresh-bootstrap'); const output = resolve(args.find(arg => !arg.startsWith('--')) ?? resolve(root, 'build-developer-environment')); @@ -17,23 +17,23 @@ await mkdir(output, {recursive: true}); const options = { absWorkingDir: root, bundle: true, format: 'esm', platform: 'browser', target: 'es2020', minify: true, legalComments: 'inline', - nodePaths: [resolve(root, 'tools/assets/node_modules')], + nodePaths: [resolve(root, 'js/developer/vendor/node_modules')], plugins: [{name: 'terminal-assets', setup(build) { build.onResolve({filter: /^\.\/(xterm|addon-fit)\.mjs$/}, args => ({path: resolve(root, 'third_party/xterm', args.path)})); }}], }; -await build({...options, entryPoints: ['assets/developer/runtime.mjs'], outfile: resolve(output, 'runtime.mjs')}); -await build({...options, entryPoints: ['assets/developer/compiler.mjs'], outfile: resolve(output, 'compiler.mjs')}); -await copyFile(resolve(root, 'tools/assets/node_modules/esbuild-wasm/esbuild.wasm'), resolve(output, 'esbuild.wasm')); +await build({...options, entryPoints: ['js/developer/environment/runtime.mjs'], outfile: resolve(output, 'runtime.mjs')}); +await build({...options, entryPoints: ['js/developer/environment/compiler.mjs'], outfile: resolve(output, 'compiler.mjs')}); +await copyFile(resolve(root, 'js/developer/vendor/node_modules/esbuild-wasm/esbuild.wasm'), resolve(output, 'esbuild.wasm')); await copyFile(resolve(root, 'third_party/xterm/xterm.css'), resolve(output, 'xterm.css')); -const distribution = JSON.parse(await readFile(resolve(root, 'tools/developer/distribution.json'))); +const distribution = JSON.parse(await readFile(resolve(root, 'js/developer/tools/distribution.json'))); const version = distribution.version; const publicBase = baseUrl(distribution.baseUrl); versionPath(version); -const dependencies = JSON.parse(await readFile(resolve(root, 'tools/assets/package.json'))).dependencies; +const dependencies = JSON.parse(await readFile(resolve(root, 'js/developer/vendor/package.json'))).dependencies; const licenses = [ - ['esbuild-wasm', 'tools/assets/node_modules/esbuild-wasm/LICENSE.md'], - ['semver', 'tools/assets/node_modules/semver/LICENSE'], + ['esbuild-wasm', 'js/developer/vendor/node_modules/esbuild-wasm/LICENSE.md'], + ['semver', 'js/developer/vendor/node_modules/semver/LICENSE'], ['xterm', 'third_party/xterm/LICENSE'], ['xterm Fit addon', 'third_party/xterm/addon-fit-LICENSE'], ['fflate', 'third_party/fflate/LICENSE'], @@ -46,7 +46,7 @@ const starters = {}; for (const [name, provider] of [['pi', 'PiUI'], ['life', 'LifeUI']]) { const starterFiles = new Map(); for (const file of ['main.tsx', 'style.css']) - starterFiles.set(`package/${file}`, await readFile(resolve(root, `${name === 'life' ? 'examples/life/ui' : 'tools/developer/starters/pi'}/${file}`))); + starterFiles.set(`package/${file}`, await readFile(resolve(root, `${name === 'life' ? 'examples/life/ui' : 'js/developer/tools/starters/pi'}/${file}`))); const recipe = {format: 1, name, provider, entry: 'main.tsx', dependencies: { react: dependencies.react, 'react-dom': dependencies['react-dom']}}; starterFiles.set('package/webfront.project.json', Buffer.from(JSON.stringify(recipe, null, 2) + '\n')); @@ -72,16 +72,16 @@ await writeFile(resolve(output, 'provision.json'), JSON.stringify({format: 1, ve const header = bootstrapHeader(version, publicBase, integrity); await writeFile(resolve(output, 'DeveloperReleaseData.hpp'), header); if (refresh) { - const bootstrap = resolve(root, 'assets/developer/bootstrap.bundle.mjs'); - await build({...options, entryPoints: ['assets/developer/bootstrap-entry.mjs'], outfile: bootstrap}); - await build({...options, entryPoints: ['assets/developer/packages.mjs'], outfile: resolve(root, 'assets/developer/packages.bundle.mjs')}); - await copyFile(resolve(root, 'tools/assets/node_modules/semver/LICENSE'), resolve(root, 'assets/developer/PACKAGES-LICENSE.txt')); - await writeFile(resolve(root, 'include/system/DeveloperReleaseData.hpp'), header); + const bootstrap = resolve(root, 'js/core/bootstrap/bootstrap.bundle.mjs'); + await build({...options, entryPoints: ['js/developer/environment/bootstrap-entry.mjs'], outfile: bootstrap}); + await build({...options, entryPoints: ['js/developer/environment/packages.mjs'], outfile: resolve(root, 'js/developer/environment/packages.bundle.mjs')}); + await copyFile(resolve(root, 'js/developer/vendor/node_modules/semver/LICENSE'), resolve(root, 'js/developer/environment/PACKAGES-LICENSE.txt')); + await writeFile(resolve(root, 'include/webfront/system/DeveloperReleaseData.hpp'), header); const inputs = {}; - for (const path of ['assets/developer/bootstrap.mjs', 'assets/developer/bootstrap-entry.mjs', 'assets/developer/packages.mjs', 'assets/developer/starter.mjs', 'assets/developer/paths.mjs', 'assets/developer/runtime.mjs', 'assets/developer/compiler.mjs', 'assets/developer/bundler.mjs', 'assets/developer/entry.mjs', 'assets/developer/conditions.mjs', 'assets/developer/io.mjs', 'assets/developer/recipe.mjs', 'assets/developer/registry.mjs', 'assets/developer/archive.mjs', 'assets/developer/lock.mjs', 'assets/developer/pins.mjs', 'assets/developer/peers.mjs', 'assets/developer/resolve.mjs', 'assets/developer/embed.mjs', 'tools/developer/starters/pi/main.tsx', 'tools/developer/starters/pi/style.css', 'examples/life/ui/main.tsx', 'examples/life/ui/style.css', 'assets/components/tools/wf.mjs', 'tools/developer/distribution.json', 'tools/developer/build.mjs', 'tools/developer/site.mjs', 'tools/developer/archive.mjs', 'tools/assets/package-lock.json', 'assets/developer/bootstrap.bundle.mjs', 'assets/developer/packages.bundle.mjs', 'include/system/DeveloperReleaseData.hpp']) + for (const path of ['js/developer/environment/bootstrap.mjs', 'js/developer/environment/bootstrap-entry.mjs', 'js/developer/environment/packages.mjs', 'js/developer/environment/starter.mjs', 'js/developer/environment/paths.mjs', 'js/developer/environment/runtime.mjs', 'js/developer/environment/compiler.mjs', 'js/developer/environment/bundler.mjs', 'js/developer/environment/entry.mjs', 'js/developer/environment/conditions.mjs', 'js/developer/environment/io.mjs', 'js/developer/environment/recipe.mjs', 'js/developer/environment/registry.mjs', 'js/developer/environment/archive.mjs', 'js/developer/environment/lock.mjs', 'js/developer/environment/pins.mjs', 'js/developer/environment/peers.mjs', 'js/developer/environment/resolve.mjs', 'js/developer/environment/embed.mjs', 'js/developer/tools/starters/pi/main.tsx', 'js/developer/tools/starters/pi/style.css', 'examples/life/ui/main.tsx', 'examples/life/ui/style.css', 'js/developer/components/tools/wf.mjs', 'js/developer/tools/distribution.json', 'js/developer/tools/build.mjs', 'js/developer/tools/site.mjs', 'js/developer/tools/archive.mjs', 'js/developer/vendor/package-lock.json', 'js/core/bootstrap/bootstrap.bundle.mjs', 'js/developer/environment/packages.bundle.mjs', 'include/webfront/system/DeveloperReleaseData.hpp']) inputs[path] = createHash('sha256').update(await readFile(resolve(root, path))).digest('hex'); - await writeFile(resolve(root, 'assets/developer/bundles.json'), JSON.stringify(inputs, null, 2) + '\n'); - for (const [source, name] of [['assets/developer/index.html', 'DeveloperIndexHtmlData'], ['assets/developer/bootstrap.bundle.mjs', 'DeveloperBootstrapData']]) - execFileSync('cmake', [`-DINPUT=${resolve(root, source)}`, `-DOUTPUT=${resolve(root, 'include/system', name + '.hpp')}`, `-DSTRUCT=${name}`, '-P', resolve(root, 'cmake/EmbedTextAsset.cmake')]); + await writeFile(resolve(root, 'js/developer/environment/bundles.json'), JSON.stringify(inputs, null, 2) + '\n'); + for (const [source, name] of [['js/core/bootstrap/index.html', 'DeveloperIndexHtmlData'], ['js/core/bootstrap/bootstrap.bundle.mjs', 'DeveloperBootstrapData']]) + execFileSync('cmake', [`-DINPUT=${resolve(root, source)}`, `-DOUTPUT=${resolve(root, 'include/webfront/system', name + '.hpp')}`, `-DSTRUCT=${name}`, '-P', resolve(root, 'js/core/EmbedTextAsset.cmake')]); } console.log(`Environment: ${output}/environment.tgz\nIntegrity: ${integrity}\nStarters: ${Object.keys(starters).join(', ')}`); diff --git a/tools/developer/check.mjs b/js/developer/tools/check.mjs similarity index 95% rename from tools/developer/check.mjs rename to js/developer/tools/check.mjs index e02098e6..c12bd47f 100644 --- a/tools/developer/check.mjs +++ b/js/developer/tools/check.mjs @@ -3,11 +3,11 @@ import assert from 'node:assert/strict'; import {gunzipSync} from 'node:zlib'; import {createHash} from 'node:crypto'; import {readFile} from 'node:fs/promises'; -import {resolvePackages, downloadPackage, validateLock} from '../../assets/developer/packages.bundle.mjs'; -import {packageEntry, normalize, virtualPlugin} from '../../assets/developer/bundler.mjs'; -import {generateProvider, compress} from '../../assets/developer/embed.mjs'; -import {environmentFiles, bootstrap} from '../../assets/developer/bootstrap.mjs'; -import {publish, responseBytes} from '../../assets/developer/io.mjs'; +import {resolvePackages, downloadPackage, validateLock} from '../environment/packages.bundle.mjs'; +import {packageEntry, normalize, virtualPlugin} from '../environment/bundler.mjs'; +import {generateProvider, compress} from '../environment/embed.mjs'; +import {environmentFiles, bootstrap} from '../environment/bootstrap.mjs'; +import {publish, responseBytes} from '../environment/io.mjs'; import {tar} from './archive.mjs'; const encoder = new TextEncoder(); @@ -142,10 +142,10 @@ test('aborted publications never commit and clean their staging transaction', as }); test('checked-in browser bundles match their source and pinned dependency inputs', async () => { - const manifest = JSON.parse(await readFile(new URL('../../assets/developer/bundles.json', import.meta.url))); + const manifest = JSON.parse(await readFile(new URL('../environment/bundles.json', import.meta.url))); for (const [path, hash] of Object.entries(manifest)) { - const actual = createHash('sha256').update(await readFile(new URL('../../' + path, import.meta.url))).digest('hex'); - assert.equal(actual, hash, `${path} changed: run tools/developer/build.mjs --refresh-bootstrap`); + const actual = createHash('sha256').update(await readFile(new URL('../../../' + path, import.meta.url))).digest('hex'); + assert.equal(actual, hash, `${path} changed: run js/developer/tools/build.mjs --refresh-bootstrap`); } }); diff --git a/tools/developer/distribution-check.mjs b/js/developer/tools/distribution-check.mjs similarity index 98% rename from tools/developer/distribution-check.mjs rename to js/developer/tools/distribution-check.mjs index 01c5d98f..35d90b8a 100644 --- a/tools/developer/distribution-check.mjs +++ b/js/developer/tools/distribution-check.mjs @@ -6,8 +6,8 @@ import {join} from 'node:path'; import {createHash} from 'node:crypto'; import {tar} from './archive.mjs'; import {stageSite, bootstrapHeader, versionPath, distributionFiles} from './site.mjs'; -import {compress} from '../../assets/developer/embed.mjs'; -import {createStarter} from '../../assets/developer/starter.mjs'; +import {compress} from '../environment/embed.mjs'; +import {createStarter} from '../environment/starter.mjs'; const encode = value => new TextEncoder().encode(typeof value === 'string' ? value : JSON.stringify(value)); const integrity = bytes => 'sha512-' + createHash('sha512').update(bytes).digest('base64'); diff --git a/tools/developer/distribution.json b/js/developer/tools/distribution.json similarity index 74% rename from tools/developer/distribution.json rename to js/developer/tools/distribution.json index 82b7f6dd..05e7397d 100644 --- a/tools/developer/distribution.json +++ b/js/developer/tools/distribution.json @@ -1,4 +1,4 @@ { - "version": "0.4.0", + "version": "0.4.1", "baseUrl": "https://ambroise-leclerc.github.io/WebFront/" } diff --git a/tools/developer/fixtures.mjs b/js/developer/tools/fixtures.mjs similarity index 75% rename from tools/developer/fixtures.mjs rename to js/developer/tools/fixtures.mjs index ef62ba32..494c9b0e 100644 --- a/tools/developer/fixtures.mjs +++ b/js/developer/tools/fixtures.mjs @@ -4,12 +4,12 @@ import {resolve} from 'node:path'; import {fileURLToPath} from 'node:url'; import {createHash} from 'node:crypto'; import {tar} from './archive.mjs'; -import {compress} from '../../assets/developer/embed.mjs'; -const root = fileURLToPath(new URL('../../', import.meta.url)); +import {compress} from '../environment/embed.mjs'; +const root = fileURLToPath(new URL('../../../', import.meta.url)); const output = resolve(process.argv[2] ?? 'build-developer-environment'); await mkdir(resolve(output, 'registry'), {recursive: true}); for (const name of ['react', 'react-dom', 'scheduler']) { - const directory = resolve(root, 'tools/assets/node_modules', name); + const directory = resolve(root, 'js/developer/vendor/node_modules', name); const manifest = JSON.parse(await readFile(resolve(directory, 'package.json'))); const files = new Map(); async function walk(path = '') { @@ -27,7 +27,7 @@ for (const name of ['react', 'react-dom', 'scheduler']) { await writeFile(resolve(output, 'registry', name), JSON.stringify({'dist-tags': {latest: manifest.version}, versions: {[manifest.version]: {...manifest, dist: {tarball: `./${name}.tgz`, integrity}}}})); } -await copyFile(resolve(root, 'webtest/developer-specs.mjs'), resolve(output, 'run.mjs')); -await copyFile(resolve(root, 'tools/developer/starters/pi/main.tsx'), resolve(output, 'main.tsx')); -await copyFile(resolve(root, 'tools/developer/starters/pi/style.css'), resolve(output, 'style.css')); +await copyFile(resolve(root, 'test/web/developer-specs.mjs'), resolve(output, 'run.mjs')); +await copyFile(resolve(root, 'js/developer/tools/starters/pi/main.tsx'), resolve(output, 'main.tsx')); +await copyFile(resolve(root, 'js/developer/tools/starters/pi/style.css'), resolve(output, 'style.css')); console.log(`Offline developer fixtures: ${output}`); diff --git a/tools/developer/pages.mjs b/js/developer/tools/pages.mjs similarity index 100% rename from tools/developer/pages.mjs rename to js/developer/tools/pages.mjs diff --git a/tools/developer/release-check.mjs b/js/developer/tools/release-check.mjs similarity index 100% rename from tools/developer/release-check.mjs rename to js/developer/tools/release-check.mjs diff --git a/tools/developer/site.mjs b/js/developer/tools/site.mjs similarity index 95% rename from tools/developer/site.mjs rename to js/developer/tools/site.mjs index d0404aa5..5639cb59 100644 --- a/tools/developer/site.mjs +++ b/js/developer/tools/site.mjs @@ -25,7 +25,7 @@ export function bootstrapHeader(version, base, integrity) { const url = new URL(versionPath(version) + 'environment.tgz', baseUrl(base)); return `#pragma once -// Pinned developer distribution. Regenerate with tools/developer/build.mjs --refresh-bootstrap. +// Pinned developer distribution. Regenerate with js/developer/tools/build.mjs --refresh-bootstrap. #include namespace webfront::developer::release { @@ -102,6 +102,6 @@ export async function stageSite(distribution, site) { } if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) { const [distribution, site] = process.argv.slice(2); - if (!distribution || !site) throw new Error('Usage: node tools/developer/site.mjs '); + if (!distribution || !site) throw new Error('Usage: node js/developer/tools/site.mjs '); console.log(await stageSite(resolve(distribution), resolve(site))); } diff --git a/tools/developer/starters/pi/main.tsx b/js/developer/tools/starters/pi/main.tsx similarity index 100% rename from tools/developer/starters/pi/main.tsx rename to js/developer/tools/starters/pi/main.tsx diff --git a/tools/developer/starters/pi/style.css b/js/developer/tools/starters/pi/style.css similarity index 100% rename from tools/developer/starters/pi/style.css rename to js/developer/tools/starters/pi/style.css diff --git a/tools/assets/check.mjs b/js/developer/vendor/check.mjs similarity index 90% rename from tools/assets/check.mjs rename to js/developer/vendor/check.mjs index fd4e4818..ecc99892 100644 --- a/tools/assets/check.mjs +++ b/js/developer/vendor/check.mjs @@ -2,7 +2,7 @@ import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import { gunzipSync } from 'node:zlib'; -const root = new URL('../../', import.meta.url); +const root = new URL('../../../', import.meta.url); const assets = [ ['XtermModuleData', 'xterm/xterm.mjs'], ['XtermCssData', 'xterm/xterm.css'], @@ -16,7 +16,7 @@ const assets = [ ['JasmineFaviconData', 'jasmine/jasmine_favicon.png'], ]; for (const [name, source] of assets) { - const header = readFileSync(new URL(`include/system/${name}.hpp`, root), 'utf8'); + const header = readFileSync(new URL(`include/webfront/system/${name}.hpp`, root), 'utf8'); const size = Number(header.match(/dataSize\{(\d+)\}/)[1]); const words = [...header.matchAll(/0x([0-9a-f]{16})/g)].map(match => match[1]); const storage = Buffer.from(words.join(''), 'hex'); @@ -35,7 +35,7 @@ for (const [name, source] of assets) { } // React's npm distribution is CommonJS. A plain export-star silently loses named ESM exports. -const runtime = await import('../../third_party/react/runtime.mjs'); +const runtime = await import('../../../third_party/react/runtime.mjs'); assert.equal(runtime.version, '19.3.1'); assert.equal(runtime.default.version, runtime.version); for (const name of ['useState', 'useEffect', 'createRoot', 'hydrateRoot', 'jsx', 'jsxs']) diff --git a/tools/assets/gzip.mjs b/js/developer/vendor/gzip.mjs similarity index 85% rename from tools/assets/gzip.mjs rename to js/developer/vendor/gzip.mjs index 1f5826ec..aa8e1760 100644 --- a/tools/assets/gzip.mjs +++ b/js/developer/vendor/gzip.mjs @@ -1,5 +1,5 @@ // Pure-JavaScript DEFLATE avoids platform-dependent zlib streams. No npm install needed. -import { gzipSync } from '../../third_party/fflate/browser.mjs'; +import { gzipSync } from '../../../third_party/fflate/browser.mjs'; import { readFileSync, writeFileSync } from 'node:fs'; const [input, output] = process.argv.slice(2); const compressed = gzipSync(readFileSync(input), { level: 9, mem: 8, mtime: 0 }); diff --git a/tools/assets/package-lock.json b/js/developer/vendor/package-lock.json similarity index 100% rename from tools/assets/package-lock.json rename to js/developer/vendor/package-lock.json diff --git a/tools/assets/package.json b/js/developer/vendor/package.json similarity index 100% rename from tools/assets/package.json rename to js/developer/vendor/package.json diff --git a/tools/assets/update.mjs b/js/developer/vendor/update.mjs similarity index 87% rename from tools/assets/update.mjs rename to js/developer/vendor/update.mjs index ea05951b..630623da 100644 --- a/tools/assets/update.mjs +++ b/js/developer/vendor/update.mjs @@ -1,4 +1,4 @@ -// Maintenance only: npm ci --prefix tools/assets && node tools/assets/update.mjs +// Maintenance only: npm ci --prefix js/developer/vendor && node js/developer/vendor/update.mjs import { build } from 'esbuild'; import { copyFile, mkdir, readFile, writeFile } from 'node:fs/promises'; import { fileURLToPath } from 'node:url'; @@ -6,8 +6,8 @@ import path from 'node:path'; import { createRequire } from 'node:module'; const require = createRequire(import.meta.url); -const root = fileURLToPath(new URL('../../', import.meta.url)); -const modules = path.join(root, 'tools/assets/node_modules'); +const root = fileURLToPath(new URL('../../../', import.meta.url)); +const modules = path.join(root, 'js/developer/vendor/node_modules'); // CommonJS export-star cannot become static ESM exports. Read the production API explicitly // so the maintainer's NODE_ENV cannot change the generated module's exports. const reactExports = Object.keys(require(path.join(modules, 'react/cjs/react.production.js'))) @@ -33,17 +33,17 @@ await copy('scheduler', [['LICENSE', 'scheduler-LICENSE']], 'react'); await writeFile(path.join(root, 'third_party/react/VERSION'), `react ${manifest.dependencies.react}\nreact-dom ${manifest.dependencies['react-dom']}\nscheduler ${JSON.parse(await readFile(path.join(modules, 'scheduler/package.json'))).version}\nesbuild ${manifest.dependencies.esbuild}\n`); await build({ - absWorkingDir: path.join(root, 'tools/assets'), + absWorkingDir: path.join(root, 'js/developer/vendor'), stdin: { contents: `export { default, ${reactExports.join(', ')} } from 'react'; export { createRoot, hydrateRoot } from 'react-dom/client'; export { jsx, jsxs } from 'react/jsx-runtime';`, - resolveDir: path.join(root, 'tools/assets'), + resolveDir: path.join(root, 'js/developer/vendor'), sourcefile: 'react-runtime.js', }, outfile: path.join(root, 'third_party/react/runtime.mjs'), bundle: true, format: 'esm', platform: 'browser', target: 'es2020', minify: true, legalComments: 'inline', charset: 'utf8', define: { 'process.env.NODE_ENV': '"production"' }, - banner: { js: `// React and React DOM ${manifest.dependencies.react}; generated by tools/assets/update.mjs.` }, + banner: { js: `// React and React DOM ${manifest.dependencies.react}; generated by js/developer/vendor/update.mjs.` }, }); diff --git a/cmake/CheckCEFTestingState.cmake b/test/cmake/CheckCEFTestingState.cmake similarity index 90% rename from cmake/CheckCEFTestingState.cmake rename to test/cmake/CheckCEFTestingState.cmake index ec10444d..18613745 100644 --- a/cmake/CheckCEFTestingState.cmake +++ b/test/cmake/CheckCEFTestingState.cmake @@ -8,7 +8,7 @@ foreach(state undefined cache-ON cache-OFF cache-empty normal-ON normal-OFF norm set(directory "${CMAKE_CURRENT_BINARY_DIR}/cef-testing-state/${state}") file(REMOVE_RECURSE "${directory}") execute_process( - COMMAND "${CMAKE_COMMAND}" -S "${ROOT}/test/cef-testing" -B "${directory}" + COMMAND "${CMAKE_COMMAND}" -S "${ROOT}/test/cmake/cef-testing" -B "${directory}" -DROOT=${ROOT} -DCPM_MODULE=${CPM_MODULE} -DSTATE=${state} RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE error) if(NOT result EQUAL 0) @@ -21,7 +21,7 @@ foreach(kind static interface missing) set(directory "${CMAKE_CURRENT_BINARY_DIR}/cef-testing-state/apple-${kind}") file(REMOVE_RECURSE "${directory}") execute_process( - COMMAND "${CMAKE_COMMAND}" -S "${ROOT}/test/cef-testing" -B "${directory}" + COMMAND "${CMAKE_COMMAND}" -S "${ROOT}/test/cmake/cef-testing" -B "${directory}" -DROOT=${ROOT} -DCPM_MODULE=${CPM_MODULE} -DSTATE=undefined -DSIMULATE_APPLE=ON -DWRAPPER_KIND=${kind} RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE error) diff --git a/cmake/CheckFrontendGenerators.cmake b/test/cmake/CheckFrontendGenerators.cmake similarity index 87% rename from cmake/CheckFrontendGenerators.cmake rename to test/cmake/CheckFrontendGenerators.cmake index 347a3500..686f116f 100644 --- a/cmake/CheckFrontendGenerators.cmake +++ b/test/cmake/CheckFrontendGenerators.cmake @@ -3,13 +3,13 @@ cmake_minimum_required(VERSION 3.31) if(NOT ROOT) message(FATAL_ERROR "ROOT must point at the WebFront checkout") endif() -include("${ROOT}/cmake/FrontendTestHelpers.cmake") +include("${ROOT}/test/cmake/FrontendTestHelpers.cmake") set(directory "${CMAKE_CURRENT_BINARY_DIR}/frontend-tests/extension") foreach(generator Ninja "Ninja Multi-Config" Ninja) file(REMOVE_RECURSE "${directory}") execute_process( COMMAND "${CMAKE_COMMAND}" -E env "CMAKE_GENERATOR=${generator}" - "${CMAKE_COMMAND}" -S "${ROOT}/test/frontends" -B "${directory}" -DROOT=${ROOT} -DCASE=extension + "${CMAKE_COMMAND}" -S "${ROOT}/test/cmake/frontends" -B "${directory}" -DROOT=${ROOT} -DCASE=extension RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE error) if(NOT result EQUAL 0) message(FATAL_ERROR "Extension fixture with ${generator} failed: ${output}${error}") diff --git a/cmake/CheckFrontendSelection.cmake b/test/cmake/CheckFrontendSelection.cmake similarity index 98% rename from cmake/CheckFrontendSelection.cmake rename to test/cmake/CheckFrontendSelection.cmake index a8c541e8..17a58b53 100644 --- a/cmake/CheckFrontendSelection.cmake +++ b/test/cmake/CheckFrontendSelection.cmake @@ -1,7 +1,7 @@ # Exercises cmake/Frontends.cmake: registered names, defaults, rejection of unknown or unavailable # frontends and the generated C++ type name. Each case runs in its own cmake -P process so that a # FATAL_ERROR can be observed. Run with: -# cmake -DROOT= -P cmake/CheckFrontendSelection.cmake +# cmake -DROOT= -P test/cmake/CheckFrontendSelection.cmake cmake_minimum_required(VERSION 3.31) if(NOT ROOT) @@ -21,7 +21,7 @@ if(CASE) endforeach() list(PREPEND CMAKE_MODULE_PATH "${parent_modules}") endif() - list(APPEND CMAKE_MODULE_PATH "${ROOT}/test/frontends") + list(APPEND CMAKE_MODULE_PATH "${ROOT}/test/cmake/frontends") include("${ROOT}/cmake/Frontends.cmake") # Unquoted empty inputs intentionally unset these variables so option() supplies its default. set(WEBFRONT_EMBED_CEF ${CEF}) @@ -152,7 +152,7 @@ if(CASE) return() endif() -include("${ROOT}/cmake/FrontendTestHelpers.cmake") +include("${ROOT}/test/cmake/FrontendTestHelpers.cmake") set(failures "") function(run_case name expect_success expected_text) @@ -350,7 +350,7 @@ foreach(case webkitgtk-linux cef-linux cef-macos cef-windows cef-disabled missin # changed generator or previous discovery result cannot influence the next invocation. file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/frontend-tests/${case}") execute_process( - COMMAND "${CMAKE_COMMAND}" -S "${ROOT}/test/frontends" -B "${CMAKE_CURRENT_BINARY_DIR}/frontend-tests/${case}" + COMMAND "${CMAKE_COMMAND}" -S "${ROOT}/test/cmake/frontends" -B "${CMAKE_CURRENT_BINARY_DIR}/frontend-tests/${case}" -DROOT=${ROOT} -DCASE=${case} RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE error) if(NOT result EQUAL 0) @@ -439,7 +439,7 @@ run_case("WebKitGTK selector" TRUE "TYPE=webfront::frontend::WebKitGTKFrontend") set(CASE_WEBKITGTK OFF) run_case("WebKitGTK tests require support" FALSE "requires WEBFRONT_EMBED_WEBKITGTK=ON") -execute_process(COMMAND "${CMAKE_COMMAND}" -S "${ROOT}/test/frontends" +execute_process(COMMAND "${CMAKE_COMMAND}" -S "${ROOT}/test/cmake/frontends" -B "${CMAKE_CURRENT_BINARY_DIR}/frontend-tests/webkitgtk-missing-sdk" -DROOT=${ROOT} -DCASE=webkitgtk-missing-sdk RESULT_VARIABLE missing_sdk OUTPUT_VARIABLE sdk_output ERROR_VARIABLE sdk_error) if(missing_sdk EQUAL 0 OR NOT "${sdk_output}${sdk_error}" MATCHES "WEBFRONT_EMBED_WEBKITGTK=ON requires") diff --git a/cmake/CheckNewcomerDocs.cmake b/test/cmake/CheckNewcomerDocs.cmake similarity index 98% rename from cmake/CheckNewcomerDocs.cmake rename to test/cmake/CheckNewcomerDocs.cmake index 36c987d7..9e17a65b 100644 --- a/cmake/CheckNewcomerDocs.cmake +++ b/test/cmake/CheckNewcomerDocs.cmake @@ -26,7 +26,7 @@ _read(ci .github/workflows/BuildAndTest.yml) _read(frontends docs/FRONTENDS.md) _read(developer_guide docs/DEVELOPER_ENVIRONMENT.md) _read(wkwebview_guide docs/WKWEBVIEW.md) -_read(developer_release include/system/DeveloperReleaseData.hpp) +_read(developer_release include/webfront/system/DeveloperReleaseData.hpp) # The local-review instructions must not silently use an unpublished default archive. foreach(text readme wkwebview_guide) _require("${${text}}" "/webfront/developer/preview/provision/environment.tgz \"$integrity\"" "${text} local bootstrap arguments") diff --git a/cmake/CheckReleaseVersion.cmake b/test/cmake/CheckReleaseVersion.cmake similarity index 97% rename from cmake/CheckReleaseVersion.cmake rename to test/cmake/CheckReleaseVersion.cmake index 82ee20b0..f2d0d358 100644 --- a/cmake/CheckReleaseVersion.cmake +++ b/test/cmake/CheckReleaseVersion.cmake @@ -7,7 +7,7 @@ if(NOT ROOT OR NOT DEFINED EXPECTED_VERSION) message(FATAL_ERROR "ROOT and EXPECTED_VERSION are required") endif() -file(STRINGS "${ROOT}/include/WebFront.hpp" declarations +file(STRINGS "${ROOT}/include/webfront/WebFront.hpp" declarations REGEX "^inline constexpr std::string_view version = \"[0-9]+\\.[0-9]+\\.[0-9]+\";") list(LENGTH declarations count) if(NOT count EQUAL 1) diff --git a/cmake/CheckReleaseVersionTests.cmake b/test/cmake/CheckReleaseVersionTests.cmake similarity index 92% rename from cmake/CheckReleaseVersionTests.cmake rename to test/cmake/CheckReleaseVersionTests.cmake index f18e01b4..a5f28ad6 100644 --- a/cmake/CheckReleaseVersionTests.cmake +++ b/test/cmake/CheckReleaseVersionTests.cmake @@ -3,13 +3,13 @@ cmake_minimum_required(VERSION 3.31) if(NOT ROOT OR NOT WORK) message(FATAL_ERROR "ROOT and WORK are required") endif() -file(MAKE_DIRECTORY "${WORK}/archive/include") -file(WRITE "${WORK}/archive/include/WebFront.hpp" +file(MAKE_DIRECTORY "${WORK}/archive/include/webfront") +file(WRITE "${WORK}/archive/include/webfront/WebFront.hpp" "inline constexpr std::string_view version = \"0.1.0\";\n") function(check_case description expected_result expected_message) execute_process(COMMAND "${CMAKE_COMMAND}" "-DROOT=${WORK}/archive" ${ARGN} - -P "${ROOT}/cmake/CheckReleaseVersion.cmake" + -P "${ROOT}/test/cmake/CheckReleaseVersion.cmake" RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE error) if(expected_result STREQUAL "success") if(NOT result EQUAL 0) @@ -49,7 +49,7 @@ execute_process(COMMAND "${GIT_EXECUTABLE}" -c user.name=VersionTest -c user.ema execute_process(COMMAND "${GIT_EXECUTABLE}" tag v0.1.1 WORKING_DIRECTORY "${repo}" COMMAND_ERROR_IS_FATAL ANY) execute_process(COMMAND "${CMAKE_COMMAND}" "-DROOT=${repo}" -DEXPECTED_VERSION=0.1.0 - -P "${ROOT}/cmake/CheckReleaseVersion.cmake" + -P "${ROOT}/test/cmake/CheckReleaseVersion.cmake" RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE error) if(result EQUAL 0 OR NOT "${output}${error}" MATCHES "Release tag 'v0.1.1' differs") message(FATAL_ERROR "Tag at HEAD mismatch was not detected: ${output}${error}") diff --git a/test/cmake/CheckRepositoryLayout.cmake b/test/cmake/CheckRepositoryLayout.cmake new file mode 100644 index 00000000..979c5f44 --- /dev/null +++ b/test/cmake/CheckRepositoryLayout.cmake @@ -0,0 +1,59 @@ +# The tracked root of the repository is a closed list, so that the README stays visible on the +# GitHub page. third_party/ is a temporary exception removed by #319. +# cmake -DROOT= [-DGIT_EXECUTABLE=] -P test/cmake/CheckRepositoryLayout.cmake +cmake_minimum_required(VERSION 3.31) + +if(NOT ROOT) + message(FATAL_ERROR "ROOT is required") +endif() + +set(expected + .clang-format .clang-tidy .codescene .devcontainer .gitattributes .github .gitignore + AGENTS.md CMakeLists.txt README.md + cmake docs examples include js test third_party) + +set(actual "") +set(from_git OFF) +if(GIT_EXECUTABLE AND EXISTS "${ROOT}/.git") + execute_process(COMMAND "${GIT_EXECUTABLE}" ls-files + WORKING_DIRECTORY "${ROOT}" OUTPUT_VARIABLE tracked RESULT_VARIABLE git_result ERROR_QUIET) + if(git_result EQUAL 0) + set(from_git ON) + string(REPLACE "\n" ";" tracked "${tracked}") + foreach(path IN LISTS tracked) + string(REGEX REPLACE "/.*$" "" top "${path}") + list(APPEND actual "${top}") + endforeach() + endif() +endif() +if(NOT from_git) + # A source archive holds only tracked content. + file(GLOB entries LIST_DIRECTORIES true RELATIVE "${ROOT}" "${ROOT}/*" "${ROOT}/.[!.]*") + set(actual ${entries}) +endif() +list(REMOVE_ITEM actual "") +list(REMOVE_DUPLICATES actual) +list(SORT actual) +list(SORT expected) + +if(NOT actual STREQUAL expected) + set(unexpected ${actual}) + list(REMOVE_ITEM unexpected ${expected}) + set(missing ${expected}) + list(REMOVE_ITEM missing ${actual}) + message(FATAL_ERROR "The repository root drifted from the declared layout.\n" + " unexpected: ${unexpected}\n missing: ${missing}") +endif() + +# include/ exposes a single namespace directory, which holds headers only (no JavaScript, so that +# installers need no filter). +file(GLOB include_entries LIST_DIRECTORIES true RELATIVE "${ROOT}/include" "${ROOT}/include/*") +if(NOT include_entries STREQUAL "webfront") + message(FATAL_ERROR "include/ must contain only webfront/, found: ${include_entries}") +endif() +file(GLOB_RECURSE include_files LIST_DIRECTORIES false RELATIVE "${ROOT}/include/webfront" "${ROOT}/include/webfront/*") +foreach(file IN LISTS include_files) + if(NOT file MATCHES "\\.(hpp|h)$") + message(FATAL_ERROR "include/webfront must hold headers only: ${file}") + endif() +endforeach() diff --git a/cmake/CheckWKWebViewSupport.cmake b/test/cmake/CheckWKWebViewSupport.cmake similarity index 100% rename from cmake/CheckWKWebViewSupport.cmake rename to test/cmake/CheckWKWebViewSupport.cmake diff --git a/cmake/CheckWebView2Architecture.cmake b/test/cmake/CheckWebView2Architecture.cmake similarity index 95% rename from cmake/CheckWebView2Architecture.cmake rename to test/cmake/CheckWebView2Architecture.cmake index 51047317..bcfd5430 100644 --- a/cmake/CheckWebView2Architecture.cmake +++ b/test/cmake/CheckWebView2Architecture.cmake @@ -73,7 +73,7 @@ foreach(probe ARM64EC UNKNOWN) endif() endforeach() -# Call the lifecycle hook from this script's directory, outside webtest/, without building or +# Call the lifecycle hook from this script's directory, outside test/web/, without building or # downloading anything. Production source paths and test working directories must be absolute. function(add_executable target) foreach(source IN LISTS ARGN) @@ -91,8 +91,8 @@ function(set_tests_properties) endif() math(EXPR index "${index} + 1") list(GET ARGN ${index} directory) - if(NOT directory STREQUAL "${ROOT}/webtest") - message(FATAL_ERROR "Lifecycle hook must use '${ROOT}/webtest', got '${directory}'") + if(NOT directory STREQUAL "${ROOT}/test/web") + message(FATAL_ERROR "Lifecycle hook must use '${ROOT}/test/web', got '${directory}'") endif() endfunction() include("${ROOT}/cmake/Frontends.cmake") diff --git a/cmake/CheckWebView2Toolchain.cmake b/test/cmake/CheckWebView2Toolchain.cmake similarity index 100% rename from cmake/CheckWebView2Toolchain.cmake rename to test/cmake/CheckWebView2Toolchain.cmake diff --git a/cmake/FrontendTestHelpers.cmake b/test/cmake/FrontendTestHelpers.cmake similarity index 100% rename from cmake/FrontendTestHelpers.cmake rename to test/cmake/FrontendTestHelpers.cmake diff --git a/cmake/TestHardening.cmake b/test/cmake/TestHardening.cmake similarity index 100% rename from cmake/TestHardening.cmake rename to test/cmake/TestHardening.cmake diff --git a/cmake/WKWebViewTestInfo.plist.in b/test/cmake/WKWebViewTestInfo.plist.in similarity index 100% rename from cmake/WKWebViewTestInfo.plist.in rename to test/cmake/WKWebViewTestInfo.plist.in diff --git a/cmake/WebKitGTKTestEnvironment.cmake b/test/cmake/WebKitGTKTestEnvironment.cmake similarity index 100% rename from cmake/WebKitGTKTestEnvironment.cmake rename to test/cmake/WebKitGTKTestEnvironment.cmake diff --git a/test/cef-testing/CMakeLists.txt b/test/cmake/cef-testing/CMakeLists.txt similarity index 100% rename from test/cef-testing/CMakeLists.txt rename to test/cmake/cef-testing/CMakeLists.txt diff --git a/test/cef-testing/dependency/CMakeLists.txt b/test/cmake/cef-testing/dependency/CMakeLists.txt similarity index 100% rename from test/cef-testing/dependency/CMakeLists.txt rename to test/cmake/cef-testing/dependency/CMakeLists.txt diff --git a/test/consumer/CMakeLists.txt b/test/cmake/consumer/CMakeLists.txt similarity index 100% rename from test/consumer/CMakeLists.txt rename to test/cmake/consumer/CMakeLists.txt diff --git a/test/consumer/CheckOptions.cmake b/test/cmake/consumer/CheckOptions.cmake similarity index 100% rename from test/consumer/CheckOptions.cmake rename to test/cmake/consumer/CheckOptions.cmake diff --git a/test/consumer/main.cpp b/test/cmake/consumer/main.cpp similarity index 96% rename from test/consumer/main.cpp rename to test/cmake/consumer/main.cpp index 588b8f70..ec271820 100644 --- a/test/consumer/main.cpp +++ b/test/cmake/consumer/main.cpp @@ -11,7 +11,7 @@ #endif #endif -#include +#include int main(int argc, char**) { if (argc > 1) { // never taken by the smoke test: it only proves that the library compiles and links diff --git a/test/frontends/CMakeLists.txt b/test/cmake/frontends/CMakeLists.txt similarity index 97% rename from test/frontends/CMakeLists.txt rename to test/cmake/frontends/CMakeLists.txt index f9953781..67b1275c 100644 --- a/test/frontends/CMakeLists.txt +++ b/test/cmake/frontends/CMakeLists.txt @@ -64,7 +64,7 @@ elseif(CASE STREQUAL "webkitgtk-linux") set(name WebFrontWebKitGTKIntegration) set(expected_timeout 90) set(expect_xvfb ON) - include("${ROOT}/cmake/WebKitGTKTestEnvironment.cmake") + include("${ROOT}/test/cmake/WebKitGTKTestEnvironment.cmake") function(webfront_add_webkitgtk_tests) list(LENGTH ARGN shared_count) if(NOT shared_count EQUAL 8 OR NOT "WebFrontWebKitGTKIntegration" IN_LIST ARGN) @@ -125,7 +125,7 @@ if(expect_xvfb) # A deterministic stand-in: this fixture checks generated commands, never runs the browser. set(XVFB_RUN_EXECUTABLE "${CMAKE_COMMAND}" CACHE FILEPATH "Xvfb fixture" FORCE) endif() -webfront_add_browser_tests(browser "${frontend}" "${ROOT}/webtest" lifecycle) +webfront_add_browser_tests(browser "${frontend}" "${ROOT}/test/web" lifecycle) if(CASE STREQUAL "missing-xvfb-hook") if(TEST ${name} OR NOT TEST EngineLifecycle) message(FATAL_ERROR "Missing Xvfb must skip Jasmine while preserving independent engine tests") @@ -141,7 +141,7 @@ endif() set(expected_TIMEOUT "${expected_timeout}") set(expected_LABELS web-integration) set(expected_RESOURCE_LOCK webfront_port_9002) -set(expected_WORKING_DIRECTORY "${ROOT}/webtest") +set(expected_WORKING_DIRECTORY "${ROOT}/test/web") if(NOT EXISTS "${expected_WORKING_DIRECTORY}/JasmineTest.cpp") message(FATAL_ERROR "Expected the actual WebFront browser asset directory") endif() diff --git a/test/frontends/TestSupport.cmake b/test/cmake/frontends/TestSupport.cmake similarity index 100% rename from test/frontends/TestSupport.cmake rename to test/cmake/frontends/TestSupport.cmake diff --git a/fuzz/CMakeLists.txt b/test/fuzz/CMakeLists.txt similarity index 100% rename from fuzz/CMakeLists.txt rename to test/fuzz/CMakeLists.txt diff --git a/fuzz/GzipFuzz.cpp b/test/fuzz/GzipFuzz.cpp similarity index 91% rename from fuzz/GzipFuzz.cpp rename to test/fuzz/GzipFuzz.cpp index 892d50c3..42407087 100644 --- a/fuzz/GzipFuzz.cpp +++ b/test/fuzz/GzipFuzz.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/fuzz/HTTPFuzz.cpp b/test/fuzz/HTTPFuzz.cpp similarity index 95% rename from fuzz/HTTPFuzz.cpp rename to test/fuzz/HTTPFuzz.cpp index 4f95d574..d9bddc34 100644 --- a/fuzz/HTTPFuzz.cpp +++ b/test/fuzz/HTTPFuzz.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/fuzz/MessagesFuzz.cpp b/test/fuzz/MessagesFuzz.cpp similarity index 98% rename from fuzz/MessagesFuzz.cpp rename to test/fuzz/MessagesFuzz.cpp index fb78c37f..694f6281 100644 --- a/fuzz/MessagesFuzz.cpp +++ b/test/fuzz/MessagesFuzz.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/fuzz/README.md b/test/fuzz/README.md similarity index 92% rename from fuzz/README.md rename to test/fuzz/README.md index bd1a9f8d..f2c2f89f 100644 --- a/fuzz/README.md +++ b/test/fuzz/README.md @@ -14,11 +14,11 @@ The binary corpus files use the existing wire formats. Seeds derive from Empty strings, integer overflow and malformed HTTP versions retain hardening regressions. Message seeds use native little endian, as on the CI hosts. -CMake copies these files to `build-fuzz/fuzz/corpus/` at configuration. +CMake copies these files to `build-test/fuzz/fuzz/corpus/` at configuration. Run against that copy, since libFuzzer adds and minimizes inputs in its corpus: ```sh -./build-fuzz/fuzz/fuzz_messages build-fuzz/fuzz/corpus/messages \ +./build-test/fuzz/fuzz/fuzz_messages build-test/fuzz/fuzz/corpus/messages \ -max_total_time=30 -timeout=5 -max_len=65536 -rss_limit_mb=1024 ``` diff --git a/fuzz/WebSocketFuzz.cpp b/test/fuzz/WebSocketFuzz.cpp similarity index 97% rename from fuzz/WebSocketFuzz.cpp rename to test/fuzz/WebSocketFuzz.cpp index 4e8d9ecd..d3e90d1b 100644 --- a/fuzz/WebSocketFuzz.cpp +++ b/test/fuzz/WebSocketFuzz.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/fuzz/corpus/gzip/bad-crc b/test/fuzz/corpus/gzip/bad-crc similarity index 100% rename from fuzz/corpus/gzip/bad-crc rename to test/fuzz/corpus/gzip/bad-crc diff --git a/fuzz/corpus/gzip/distanceCount31 b/test/fuzz/corpus/gzip/distanceCount31 similarity index 100% rename from fuzz/corpus/gzip/distanceCount31 rename to test/fuzz/corpus/gzip/distanceCount31 diff --git a/fuzz/corpus/gzip/distanceCount32 b/test/fuzz/corpus/gzip/distanceCount32 similarity index 100% rename from fuzz/corpus/gzip/distanceCount32 rename to test/fuzz/corpus/gzip/distanceCount32 diff --git a/fuzz/corpus/gzip/dynamic b/test/fuzz/corpus/gzip/dynamic similarity index 100% rename from fuzz/corpus/gzip/dynamic rename to test/fuzz/corpus/gzip/dynamic diff --git a/fuzz/corpus/gzip/empty b/test/fuzz/corpus/gzip/empty similarity index 100% rename from fuzz/corpus/gzip/empty rename to test/fuzz/corpus/gzip/empty diff --git a/fuzz/corpus/gzip/fixed b/test/fuzz/corpus/gzip/fixed similarity index 100% rename from fuzz/corpus/gzip/fixed rename to test/fuzz/corpus/gzip/fixed diff --git a/fuzz/corpus/gzip/invalidDistance b/test/fuzz/corpus/gzip/invalidDistance similarity index 100% rename from fuzz/corpus/gzip/invalidDistance rename to test/fuzz/corpus/gzip/invalidDistance diff --git a/fuzz/corpus/gzip/missingEnd b/test/fuzz/corpus/gzip/missingEnd similarity index 100% rename from fuzz/corpus/gzip/missingEnd rename to test/fuzz/corpus/gzip/missingEnd diff --git a/fuzz/corpus/gzip/optional b/test/fuzz/corpus/gzip/optional similarity index 100% rename from fuzz/corpus/gzip/optional rename to test/fuzz/corpus/gzip/optional diff --git a/fuzz/corpus/gzip/oversubscribed b/test/fuzz/corpus/gzip/oversubscribed similarity index 100% rename from fuzz/corpus/gzip/oversubscribed rename to test/fuzz/corpus/gzip/oversubscribed diff --git a/fuzz/corpus/gzip/repeatOverflow b/test/fuzz/corpus/gzip/repeatOverflow similarity index 100% rename from fuzz/corpus/gzip/repeatOverflow rename to test/fuzz/corpus/gzip/repeatOverflow diff --git a/fuzz/corpus/gzip/repeatWithoutPrevious b/test/fuzz/corpus/gzip/repeatWithoutPrevious similarity index 100% rename from fuzz/corpus/gzip/repeatWithoutPrevious rename to test/fuzz/corpus/gzip/repeatWithoutPrevious diff --git a/fuzz/corpus/gzip/reserved-block b/test/fuzz/corpus/gzip/reserved-block similarity index 100% rename from fuzz/corpus/gzip/reserved-block rename to test/fuzz/corpus/gzip/reserved-block diff --git a/fuzz/corpus/gzip/reservedDistance b/test/fuzz/corpus/gzip/reservedDistance similarity index 100% rename from fuzz/corpus/gzip/reservedDistance rename to test/fuzz/corpus/gzip/reservedDistance diff --git a/fuzz/corpus/gzip/reservedLiteral b/test/fuzz/corpus/gzip/reservedLiteral similarity index 100% rename from fuzz/corpus/gzip/reservedLiteral rename to test/fuzz/corpus/gzip/reservedLiteral diff --git a/fuzz/corpus/gzip/stored b/test/fuzz/corpus/gzip/stored similarity index 100% rename from fuzz/corpus/gzip/stored rename to test/fuzz/corpus/gzip/stored diff --git a/fuzz/corpus/gzip/truncated b/test/fuzz/corpus/gzip/truncated similarity index 100% rename from fuzz/corpus/gzip/truncated rename to test/fuzz/corpus/gzip/truncated diff --git a/fuzz/corpus/http/accept-encoding b/test/fuzz/corpus/http/accept-encoding similarity index 100% rename from fuzz/corpus/http/accept-encoding rename to test/fuzz/corpus/http/accept-encoding diff --git a/fuzz/corpus/http/get b/test/fuzz/corpus/http/get similarity index 100% rename from fuzz/corpus/http/get rename to test/fuzz/corpus/http/get diff --git a/fuzz/corpus/http/unknown-method b/test/fuzz/corpus/http/unknown-method similarity index 100% rename from fuzz/corpus/http/unknown-method rename to test/fuzz/corpus/http/unknown-method diff --git a/fuzz/corpus/http/upgrade b/test/fuzz/corpus/http/upgrade similarity index 100% rename from fuzz/corpus/http/upgrade rename to test/fuzz/corpus/http/upgrade diff --git a/fuzz/corpus/http/version-overflow b/test/fuzz/corpus/http/version-overflow similarity index 100% rename from fuzz/corpus/http/version-overflow rename to test/fuzz/corpus/http/version-overflow diff --git a/fuzz/corpus/http/x-gzip b/test/fuzz/corpus/http/x-gzip similarity index 100% rename from fuzz/corpus/http/x-gzip rename to test/fuzz/corpus/http/x-gzip diff --git a/fuzz/corpus/messages/array-10 b/test/fuzz/corpus/messages/array-10 similarity index 100% rename from fuzz/corpus/messages/array-10 rename to test/fuzz/corpus/messages/array-10 diff --git a/fuzz/corpus/messages/array-11 b/test/fuzz/corpus/messages/array-11 similarity index 100% rename from fuzz/corpus/messages/array-11 rename to test/fuzz/corpus/messages/array-11 diff --git a/fuzz/corpus/messages/array-12 b/test/fuzz/corpus/messages/array-12 similarity index 100% rename from fuzz/corpus/messages/array-12 rename to test/fuzz/corpus/messages/array-12 diff --git a/fuzz/corpus/messages/array-13 b/test/fuzz/corpus/messages/array-13 similarity index 100% rename from fuzz/corpus/messages/array-13 rename to test/fuzz/corpus/messages/array-13 diff --git a/fuzz/corpus/messages/array-14 b/test/fuzz/corpus/messages/array-14 similarity index 100% rename from fuzz/corpus/messages/array-14 rename to test/fuzz/corpus/messages/array-14 diff --git a/fuzz/corpus/messages/array-15 b/test/fuzz/corpus/messages/array-15 similarity index 100% rename from fuzz/corpus/messages/array-15 rename to test/fuzz/corpus/messages/array-15 diff --git a/fuzz/corpus/messages/array-16 b/test/fuzz/corpus/messages/array-16 similarity index 100% rename from fuzz/corpus/messages/array-16 rename to test/fuzz/corpus/messages/array-16 diff --git a/fuzz/corpus/messages/array-17 b/test/fuzz/corpus/messages/array-17 similarity index 100% rename from fuzz/corpus/messages/array-17 rename to test/fuzz/corpus/messages/array-17 diff --git a/fuzz/corpus/messages/array-8 b/test/fuzz/corpus/messages/array-8 similarity index 100% rename from fuzz/corpus/messages/array-8 rename to test/fuzz/corpus/messages/array-8 diff --git a/fuzz/corpus/messages/array-9 b/test/fuzz/corpus/messages/array-9 similarity index 100% rename from fuzz/corpus/messages/array-9 rename to test/fuzz/corpus/messages/array-9 diff --git a/fuzz/corpus/messages/array-u8 b/test/fuzz/corpus/messages/array-u8 similarity index 100% rename from fuzz/corpus/messages/array-u8 rename to test/fuzz/corpus/messages/array-u8 diff --git a/fuzz/corpus/messages/empty-small-string b/test/fuzz/corpus/messages/empty-small-string similarity index 100% rename from fuzz/corpus/messages/empty-small-string rename to test/fuzz/corpus/messages/empty-small-string diff --git a/fuzz/corpus/messages/empty-string b/test/fuzz/corpus/messages/empty-string similarity index 100% rename from fuzz/corpus/messages/empty-string rename to test/fuzz/corpus/messages/empty-string diff --git a/fuzz/corpus/messages/function-return b/test/fuzz/corpus/messages/function-return similarity index 100% rename from fuzz/corpus/messages/function-return rename to test/fuzz/corpus/messages/function-return diff --git a/fuzz/corpus/messages/handshake b/test/fuzz/corpus/messages/handshake similarity index 100% rename from fuzz/corpus/messages/handshake rename to test/fuzz/corpus/messages/handshake diff --git a/fuzz/corpus/messages/integer-overflow b/test/fuzz/corpus/messages/integer-overflow similarity index 100% rename from fuzz/corpus/messages/integer-overflow rename to test/fuzz/corpus/messages/integer-overflow diff --git a/fuzz/corpus/messages/number b/test/fuzz/corpus/messages/number similarity index 100% rename from fuzz/corpus/messages/number rename to test/fuzz/corpus/messages/number diff --git a/fuzz/corpus/messages/print-call b/test/fuzz/corpus/messages/print-call similarity index 100% rename from fuzz/corpus/messages/print-call rename to test/fuzz/corpus/messages/print-call diff --git a/fuzz/corpus/messages/tuple b/test/fuzz/corpus/messages/tuple similarity index 100% rename from fuzz/corpus/messages/tuple rename to test/fuzz/corpus/messages/tuple diff --git a/fuzz/corpus/websocket/empty b/test/fuzz/corpus/websocket/empty similarity index 100% rename from fuzz/corpus/websocket/empty rename to test/fuzz/corpus/websocket/empty diff --git a/fuzz/corpus/websocket/extended b/test/fuzz/corpus/websocket/extended similarity index 100% rename from fuzz/corpus/websocket/extended rename to test/fuzz/corpus/websocket/extended diff --git a/fuzz/corpus/websocket/masked-hello b/test/fuzz/corpus/websocket/masked-hello similarity index 100% rename from fuzz/corpus/websocket/masked-hello rename to test/fuzz/corpus/websocket/masked-hello diff --git a/fuzz/corpus/websocket/oversized b/test/fuzz/corpus/websocket/oversized similarity index 100% rename from fuzz/corpus/websocket/oversized rename to test/fuzz/corpus/websocket/oversized diff --git a/test/AcceptEncodingTests.cpp b/test/unit/AcceptEncodingTests.cpp similarity index 99% rename from test/AcceptEncodingTests.cpp rename to test/unit/AcceptEncodingTests.cpp index b67c528d..927bfffb 100644 --- a/test/AcceptEncodingTests.cpp +++ b/test/unit/AcceptEncodingTests.cpp @@ -1,5 +1,5 @@ #include -#include +#include using webfront::http::Headers; diff --git a/test/ApplicationTaskTests.cpp b/test/unit/ApplicationTaskTests.cpp similarity index 99% rename from test/ApplicationTaskTests.cpp rename to test/unit/ApplicationTaskTests.cpp index bab373c4..bb2366f5 100644 --- a/test/ApplicationTaskTests.cpp +++ b/test/unit/ApplicationTaskTests.cpp @@ -1,6 +1,6 @@ #include "InjectableNetworking.hpp" #include -#include +#include #include #include diff --git a/test/ApplicationUrlTests.cpp b/test/unit/ApplicationUrlTests.cpp similarity index 98% rename from test/ApplicationUrlTests.cpp rename to test/unit/ApplicationUrlTests.cpp index e8bbe09e..6edd44e6 100644 --- a/test/ApplicationUrlTests.cpp +++ b/test/unit/ApplicationUrlTests.cpp @@ -1,5 +1,5 @@ #include -#include +#include SCENARIO("Frontend URLs use the configured listening address") { using webfront::frontend::detail::applicationUrl; diff --git a/test/BabelFSTests.cpp b/test/unit/BabelFSTests.cpp similarity index 92% rename from test/BabelFSTests.cpp rename to test/unit/BabelFSTests.cpp index 74f78b04..94ac1732 100644 --- a/test/BabelFSTests.cpp +++ b/test/unit/BabelFSTests.cpp @@ -1,5 +1,5 @@ #include "EmbeddedAssetChecks.hpp" -#include +#include using namespace webfront; diff --git a/test/CEFMacrosTests.cpp b/test/unit/CEFMacrosTests.cpp similarity index 92% rename from test/CEFMacrosTests.cpp rename to test/unit/CEFMacrosTests.cpp index a613e9eb..5e53f614 100644 --- a/test/CEFMacrosTests.cpp +++ b/test/unit/CEFMacrosTests.cpp @@ -4,7 +4,7 @@ #ifndef WEBFRONT_EMBED_CEF // frontend/CEF.hpp includes the stdnet and stdexec headers before CEF's headers, which define these // macros as include/base/cef_compiler_specific.h does (GCC and Clang with NDEBUG, MSVC). - #include + #include #ifdef _MSC_VER #define NOINLINE __declspec(noinline) @@ -16,7 +16,7 @@ #define NO_UNIQUE_ADDRESS [[no_unique_address]] #endif -#include +#include #include diff --git a/test/CEFPathsTests.cpp b/test/unit/CEFPathsTests.cpp similarity index 96% rename from test/CEFPathsTests.cpp rename to test/unit/CEFPathsTests.cpp index 9ae6815e..43e5464a 100644 --- a/test/CEFPathsTests.cpp +++ b/test/unit/CEFPathsTests.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include diff --git a/test/CMakeLists.txt b/test/unit/CMakeLists.txt similarity index 87% rename from test/CMakeLists.txt rename to test/unit/CMakeLists.txt index 874cbe39..bfa7e7e1 100644 --- a/test/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -35,11 +35,11 @@ catch_discover_tests(tests PROPERTIES TIMEOUT 60) add_test(NAME ReleaseVersionConsistency COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -DEXPECTED_VERSION=${PROJECT_VERSION} - -P ${PROJECT_SOURCE_DIR}/cmake/CheckReleaseVersion.cmake) + -P ${PROJECT_SOURCE_DIR}/test/cmake/CheckReleaseVersion.cmake) add_test(NAME ReleaseVersionRegression COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -DWORK=${CMAKE_CURRENT_BINARY_DIR}/release-version-regression - -P ${PROJECT_SOURCE_DIR}/cmake/CheckReleaseVersionTests.cmake) + -P ${PROJECT_SOURCE_DIR}/test/cmake/CheckReleaseVersionTests.cmake) # Windows bash.exe may be the WSL launcher rather than a native Bash runtime. if(UNIX) @@ -67,10 +67,13 @@ if(WEBFRONT_USE_MDDLOG) endif() # The documented newcomer commands and snippets must keep matching the built examples and CI. +add_test(NAME RepositoryLayout + COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} + -P ${PROJECT_SOURCE_DIR}/test/cmake/CheckRepositoryLayout.cmake) add_test(NAME NewcomerDocsMatchExamples - COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/CheckNewcomerDocs.cmake) + COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/test/cmake/CheckNewcomerDocs.cmake) add_test(NAME FrontendSelection - COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/CheckFrontendSelection.cmake) + COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/test/cmake/CheckFrontendSelection.cmake) # Exercise configuration-dependent CTest discovery and generator switches on single-config CI hosts. # The fixture configures no compiler and builds nothing; Ninja is optional for contributor builds. find_program(WEBFRONT_TEST_NINJA_EXECUTABLE ninja) @@ -78,7 +81,7 @@ if(WEBFRONT_TEST_NINJA_EXECUTABLE) file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/frontend-multiconfig") add_test(NAME FrontendSelectionMultiConfig COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} - -P ${PROJECT_SOURCE_DIR}/cmake/CheckFrontendGenerators.cmake) + -P ${PROJECT_SOURCE_DIR}/test/cmake/CheckFrontendGenerators.cmake) set_tests_properties(FrontendSelectionMultiConfig PROPERTIES WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/frontend-multiconfig") else() @@ -88,13 +91,13 @@ endif() # equivalent module path here so the offline fixture still exercises the same CPM as this build. add_test(NAME CEFTestingState COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -DCPM_MODULE=${CPM_DOWNLOAD_LOCATION} - -P ${PROJECT_SOURCE_DIR}/cmake/CheckCEFTestingState.cmake) + -P ${PROJECT_SOURCE_DIR}/test/cmake/CheckCEFTestingState.cmake) add_test(NAME WebView2UnsupportedToolchain - COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/CheckWebView2Toolchain.cmake) + COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/test/cmake/CheckWebView2Toolchain.cmake) add_test(NAME WebView2LoaderArchitecture - COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/CheckWebView2Architecture.cmake) + COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/test/cmake/CheckWebView2Architecture.cmake) add_test(NAME WKWebViewConfiguration - COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/CheckWKWebViewSupport.cmake) + COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/test/cmake/CheckWKWebViewSupport.cmake) # A minimal parent project must be able to add_subdirectory(WebFront) and link WebFront::WebFront # without building WebFront's examples or tests. Dependencies reuse this build's sources, so the @@ -112,7 +115,7 @@ if(DEFINED CMAKE_CXX_SCAN_FOR_MODULES) endif() add_test(NAME AddSubdirectoryConsumer COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test ${CMAKE_CURRENT_SOURCE_DIR}/consumer ${CMAKE_CURRENT_BINARY_DIR}/consumer-build + --build-and-test ${PROJECT_SOURCE_DIR}/test/cmake/consumer ${CMAKE_CURRENT_BINARY_DIR}/consumer-build --build-generator ${CMAKE_GENERATOR} --build-config $ --build-options -DWEBFRONT_SOURCE_DIR=${PROJECT_SOURCE_DIR} ${_consumer_dependency_args} diff --git a/test/ContentPolicyTests.cpp b/test/unit/ContentPolicyTests.cpp similarity index 98% rename from test/ContentPolicyTests.cpp rename to test/unit/ContentPolicyTests.cpp index 2eccc56e..06f0d6d3 100644 --- a/test/ContentPolicyTests.cpp +++ b/test/unit/ContentPolicyTests.cpp @@ -1,10 +1,10 @@ #include "Mocks.hpp" #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/test/DefaultFSTests.cpp b/test/unit/DefaultFSTests.cpp similarity index 97% rename from test/DefaultFSTests.cpp rename to test/unit/DefaultFSTests.cpp index 534cdf49..90ae6eed 100644 --- a/test/DefaultFSTests.cpp +++ b/test/unit/DefaultFSTests.cpp @@ -1,4 +1,4 @@ -#include +#include #include @@ -13,7 +13,7 @@ using namespace webfront; namespace { -// Minimal temp-directory fixture, following the convention used in test/NativeFSTests.cpp. +// Minimal temp-directory fixture, following the convention used in test/unit/NativeFSTests.cpp. class TemporaryRoot { public: TemporaryRoot() { diff --git a/test/DeveloperTests.cpp b/test/unit/DeveloperTests.cpp similarity index 99% rename from test/DeveloperTests.cpp rename to test/unit/DeveloperTests.cpp index 20c0521b..8f280617 100644 --- a/test/DeveloperTests.cpp +++ b/test/unit/DeveloperTests.cpp @@ -1,8 +1,8 @@ -#include "../test/fixtures/Pi.hpp" +#include "../fixtures/Pi.hpp" #include "TemporaryDirectory.hpp" #include -#include -#include +#include +#include #include #include diff --git a/test/EmbeddedAssetChecks.hpp b/test/unit/EmbeddedAssetChecks.hpp similarity index 95% rename from test/EmbeddedAssetChecks.hpp rename to test/unit/EmbeddedAssetChecks.hpp index e5102112..6ac6d838 100644 --- a/test/EmbeddedAssetChecks.hpp +++ b/test/unit/EmbeddedAssetChecks.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include #include diff --git a/test/EncodingsTests.cpp b/test/unit/EncodingsTests.cpp similarity index 99% rename from test/EncodingsTests.cpp rename to test/unit/EncodingsTests.cpp index f3c0f7d4..72589cc7 100644 --- a/test/EncodingsTests.cpp +++ b/test/unit/EncodingsTests.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/FileSystemTests.cpp b/test/unit/FileSystemTests.cpp similarity index 99% rename from test/FileSystemTests.cpp rename to test/unit/FileSystemTests.cpp index 8ba127c5..ce725e3d 100644 --- a/test/FileSystemTests.cpp +++ b/test/unit/FileSystemTests.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "Mocks.hpp" diff --git a/test/FrontendContractTests.cpp b/test/unit/FrontendContractTests.cpp similarity index 99% rename from test/FrontendContractTests.cpp rename to test/unit/FrontendContractTests.cpp index d9a3f378..df37b472 100644 --- a/test/FrontendContractTests.cpp +++ b/test/unit/FrontendContractTests.cpp @@ -1,8 +1,8 @@ #include "Mocks.hpp" #include #include -#include -#include +#include +#include #include #include diff --git a/test/FrontendUrlTests.cpp b/test/unit/FrontendUrlTests.cpp similarity index 98% rename from test/FrontendUrlTests.cpp rename to test/unit/FrontendUrlTests.cpp index 8ff801a9..12f11459 100644 --- a/test/FrontendUrlTests.cpp +++ b/test/unit/FrontendUrlTests.cpp @@ -1,7 +1,7 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/test/GzipFixtures.hpp b/test/unit/GzipFixtures.hpp similarity index 100% rename from test/GzipFixtures.hpp rename to test/unit/GzipFixtures.hpp diff --git a/test/GzipTests.cpp b/test/unit/GzipTests.cpp similarity index 99% rename from test/GzipTests.cpp rename to test/unit/GzipTests.cpp index 342010a2..59a97b87 100644 --- a/test/GzipTests.cpp +++ b/test/unit/GzipTests.cpp @@ -1,6 +1,6 @@ #include "GzipFixtures.hpp" #include -#include +#include #include diff --git a/test/HTTPEncodingTests.cpp b/test/unit/HTTPEncodingTests.cpp similarity index 99% rename from test/HTTPEncodingTests.cpp rename to test/unit/HTTPEncodingTests.cpp index dc13971d..668dc7dc 100644 --- a/test/HTTPEncodingTests.cpp +++ b/test/unit/HTTPEncodingTests.cpp @@ -1,7 +1,7 @@ #include "GzipFixtures.hpp" #include -#include -#include +#include +#include #include #include diff --git a/test/HTTPServerTests.cpp b/test/unit/HTTPServerTests.cpp similarity index 99% rename from test/HTTPServerTests.cpp rename to test/unit/HTTPServerTests.cpp index 426f43c3..6917f817 100644 --- a/test/HTTPServerTests.cpp +++ b/test/unit/HTTPServerTests.cpp @@ -1,9 +1,9 @@ #include "InjectableNetworking.hpp" #include "Mocks.hpp" #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/test/IndexFSTests.cpp b/test/unit/IndexFSTests.cpp similarity index 94% rename from test/IndexFSTests.cpp rename to test/unit/IndexFSTests.cpp index 8dbf8ac4..d1453dbc 100644 --- a/test/IndexFSTests.cpp +++ b/test/unit/IndexFSTests.cpp @@ -1,7 +1,7 @@ #include -#include -#include -#include +#include +#include +#include #include #include @@ -19,7 +19,7 @@ SCENARIO("IndexFileSystem provides basic files for browser support") { THEN("A correct HTML5 file loading WebFront.js and the fallback module is returned") { REQUIRE(indexFile.has_value()); - // The readable source (assets/fallback/index.html) is embedded raw, like WebFront.js, + // The readable source (js/core/fallback/index.html) is embedded raw, like WebFront.js, // so it is never Brotli-encoded; read it in full rather than assuming it fits a // single fixed-size buffer. REQUIRE_FALSE(indexFile->isEncoded()); diff --git a/test/InjectableNetworking.hpp b/test/unit/InjectableNetworking.hpp similarity index 99% rename from test/InjectableNetworking.hpp rename to test/unit/InjectableNetworking.hpp index 21aeef47..68798e5a 100644 --- a/test/InjectableNetworking.hpp +++ b/test/unit/InjectableNetworking.hpp @@ -2,8 +2,8 @@ #pragma once #include "InlineTaskScope.hpp" #include -#include -#include +#include +#include #include #include diff --git a/test/InlineTaskScope.hpp b/test/unit/InlineTaskScope.hpp similarity index 87% rename from test/InlineTaskScope.hpp rename to test/unit/InlineTaskScope.hpp index b19eca31..2e7153c6 100644 --- a/test/InlineTaskScope.hpp +++ b/test/unit/InlineTaskScope.hpp @@ -1,6 +1,6 @@ /// @brief Scope fixture for tasks whose mock scheduler and cancellation complete inline. #pragma once -#include +#include namespace webfront::testing { class InlineTaskScope : public networking::TaskScope { diff --git a/test/JSFunctionTests.cpp b/test/unit/JSFunctionTests.cpp similarity index 98% rename from test/JSFunctionTests.cpp rename to test/unit/JSFunctionTests.cpp index 9c9e52b7..31af9308 100644 --- a/test/JSFunctionTests.cpp +++ b/test/unit/JSFunctionTests.cpp @@ -1,7 +1,7 @@ #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/test/JasmineFSTests.cpp b/test/unit/JasmineFSTests.cpp similarity index 96% rename from test/JasmineFSTests.cpp rename to test/unit/JasmineFSTests.cpp index a4b1a3a7..bdd3c932 100644 --- a/test/JasmineFSTests.cpp +++ b/test/unit/JasmineFSTests.cpp @@ -1,5 +1,5 @@ #include "EmbeddedAssetChecks.hpp" -#include +#include #include #include diff --git a/test/JsFunctionSenderTests.cpp b/test/unit/JsFunctionSenderTests.cpp similarity index 99% rename from test/JsFunctionSenderTests.cpp rename to test/unit/JsFunctionSenderTests.cpp index ed345587..fff79df8 100644 --- a/test/JsFunctionSenderTests.cpp +++ b/test/unit/JsFunctionSenderTests.cpp @@ -1,7 +1,7 @@ #include "InjectableNetworking.hpp" #include #include -#include +#include #include #include diff --git a/test/LifeTests.cpp b/test/unit/LifeTests.cpp similarity index 97% rename from test/LifeTests.cpp rename to test/unit/LifeTests.cpp index aeb130a4..4fe0cb8e 100644 --- a/test/LifeTests.cpp +++ b/test/unit/LifeTests.cpp @@ -1,4 +1,4 @@ -#include "../examples/life/Life.hpp" +#include "../../examples/life/Life.hpp" #include using webfront::demo::LifeGrid; diff --git a/test/LoggerTests.cpp b/test/unit/LoggerTests.cpp similarity index 98% rename from test/LoggerTests.cpp rename to test/unit/LoggerTests.cpp index 0950ac70..e4a840ec 100644 --- a/test/LoggerTests.cpp +++ b/test/unit/LoggerTests.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/MddlogHeaderConsumer.cpp b/test/unit/MddlogHeaderConsumer.cpp similarity index 95% rename from test/MddlogHeaderConsumer.cpp rename to test/unit/MddlogHeaderConsumer.cpp index fe6c7d07..d060bd92 100644 --- a/test/MddlogHeaderConsumer.cpp +++ b/test/unit/MddlogHeaderConsumer.cpp @@ -1,5 +1,5 @@ /** @brief Ordinary consumer: the facade header supplies its complete API without imports. */ -#include "tooling/Logger.hpp" +#include int main() { namespace log = webfront::log; diff --git a/test/MddlogLoggerTests.cpp b/test/unit/MddlogLoggerTests.cpp similarity index 99% rename from test/MddlogLoggerTests.cpp rename to test/unit/MddlogLoggerTests.cpp index 00d2995f..ab07ae91 100644 --- a/test/MddlogLoggerTests.cpp +++ b/test/unit/MddlogLoggerTests.cpp @@ -1,5 +1,5 @@ /** @brief Module-free consumer regressions for WebFront's optional diagnostic facade. */ -#include "tooling/Logger.hpp" +#include #include #include diff --git a/test/MddlogTransportTests.cpp b/test/unit/MddlogTransportTests.cpp similarity index 99% rename from test/MddlogTransportTests.cpp rename to test/unit/MddlogTransportTests.cpp index 9e0ea692..8482b5cf 100644 --- a/test/MddlogTransportTests.cpp +++ b/test/unit/MddlogTransportTests.cpp @@ -1,8 +1,8 @@ /** @brief Bounded browser transport lane: context, saturation, failures, reentrance and WebLink lifecycle. */ #include "InjectableNetworking.hpp" #include -#include -#include +#include +#include #include #include diff --git a/test/MessagesTests.cpp b/test/unit/MessagesTests.cpp similarity index 99% rename from test/MessagesTests.cpp rename to test/unit/MessagesTests.cpp index cd1ee13f..35670732 100644 --- a/test/MessagesTests.cpp +++ b/test/unit/MessagesTests.cpp @@ -1,9 +1,9 @@ #include "InlineTaskScope.hpp" #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/test/MimeTypeTests.cpp b/test/unit/MimeTypeTests.cpp similarity index 98% rename from test/MimeTypeTests.cpp rename to test/unit/MimeTypeTests.cpp index 7bb2bae8..64d678b7 100644 --- a/test/MimeTypeTests.cpp +++ b/test/unit/MimeTypeTests.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include diff --git a/test/Mocks.hpp b/test/unit/Mocks.hpp similarity index 96% rename from test/Mocks.hpp rename to test/unit/Mocks.hpp index 63907153..5a5394e3 100644 --- a/test/Mocks.hpp +++ b/test/unit/Mocks.hpp @@ -2,7 +2,7 @@ /// @author Ambroise Leclerc /// @brief Mocks -#include +#include #include #include diff --git a/test/ModuleHTTPServerTests.cpp b/test/unit/ModuleHTTPServerTests.cpp similarity index 94% rename from test/ModuleHTTPServerTests.cpp rename to test/unit/ModuleHTTPServerTests.cpp index a0bbe7a7..5e684168 100644 --- a/test/ModuleHTTPServerTests.cpp +++ b/test/unit/ModuleHTTPServerTests.cpp @@ -1,11 +1,11 @@ #include "Mocks.hpp" #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -87,7 +87,7 @@ SCENARIO("Embedded browser dependencies support identity-only HTTP clients") { RequestHandler handler{"."}; for (const auto& [path, sourceName] : dependencies) { GIVEN(path) { - const auto sourcePath = std::filesystem::path{__FILE__}.parent_path().parent_path() / "third_party" / sourceName; + const auto sourcePath = std::filesystem::path{__FILE__}.parent_path().parent_path().parent_path() / "third_party" / sourceName; std::ifstream source{sourcePath, std::ios::binary}; REQUIRE(source.is_open()); const std::string expected{std::istreambuf_iterator{source}, std::istreambuf_iterator{}}; diff --git a/test/NativeFSTests.cpp b/test/unit/NativeFSTests.cpp similarity index 99% rename from test/NativeFSTests.cpp rename to test/unit/NativeFSTests.cpp index 8414295d..4c0bee41 100644 --- a/test/NativeFSTests.cpp +++ b/test/unit/NativeFSTests.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include diff --git a/test/ReactFSTests.cpp b/test/unit/ReactFSTests.cpp similarity index 93% rename from test/ReactFSTests.cpp rename to test/unit/ReactFSTests.cpp index 8b740e54..ac007307 100644 --- a/test/ReactFSTests.cpp +++ b/test/unit/ReactFSTests.cpp @@ -1,5 +1,5 @@ #include "EmbeddedAssetChecks.hpp" -#include +#include using namespace webfront; diff --git a/test/SignalDemoTests.cpp b/test/unit/SignalDemoTests.cpp similarity index 97% rename from test/SignalDemoTests.cpp rename to test/unit/SignalDemoTests.cpp index 29efd497..8e748764 100644 --- a/test/SignalDemoTests.cpp +++ b/test/unit/SignalDemoTests.cpp @@ -1,4 +1,4 @@ -#include "../test/fixtures/SignalDemo.hpp" +#include "../fixtures/SignalDemo.hpp" #include #include diff --git a/test/StdnetShutdownTests.cpp b/test/unit/StdnetShutdownTests.cpp similarity index 98% rename from test/StdnetShutdownTests.cpp rename to test/unit/StdnetShutdownTests.cpp index cec3cc83..50464f2d 100644 --- a/test/StdnetShutdownTests.cpp +++ b/test/unit/StdnetShutdownTests.cpp @@ -1,13 +1,13 @@ #include "InjectableNetworking.hpp" #include #include -#include -#include -#include -#include +#include +#include +#include +#include #ifdef _WIN32 - #include + #include #else #include #endif diff --git a/test/StructuredShutdownTests.cpp b/test/unit/StructuredShutdownTests.cpp similarity index 98% rename from test/StructuredShutdownTests.cpp rename to test/unit/StructuredShutdownTests.cpp index 1e537552..394719ee 100644 --- a/test/StructuredShutdownTests.cpp +++ b/test/unit/StructuredShutdownTests.cpp @@ -1,8 +1,8 @@ #include "InlineTaskScope.hpp" #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/test/TemporaryDirectory.hpp b/test/unit/TemporaryDirectory.hpp similarity index 100% rename from test/TemporaryDirectory.hpp rename to test/unit/TemporaryDirectory.hpp diff --git a/test/TerminalFSTests.cpp b/test/unit/TerminalFSTests.cpp similarity index 96% rename from test/TerminalFSTests.cpp rename to test/unit/TerminalFSTests.cpp index 9103317f..9051fa34 100644 --- a/test/TerminalFSTests.cpp +++ b/test/unit/TerminalFSTests.cpp @@ -1,8 +1,8 @@ #include "EmbeddedAssetChecks.hpp" #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/test/TerminalTests.cpp b/test/unit/TerminalTests.cpp similarity index 99% rename from test/TerminalTests.cpp rename to test/unit/TerminalTests.cpp index 23e2260e..98461e8d 100644 --- a/test/TerminalTests.cpp +++ b/test/unit/TerminalTests.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/test/ToolManagerTests.cpp b/test/unit/ToolManagerTests.cpp similarity index 98% rename from test/ToolManagerTests.cpp rename to test/unit/ToolManagerTests.cpp index fba5899e..bb5248e9 100644 --- a/test/ToolManagerTests.cpp +++ b/test/unit/ToolManagerTests.cpp @@ -1,10 +1,10 @@ #include "TemporaryDirectory.hpp" #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/test/ToolStoreTests.cpp b/test/unit/ToolStoreTests.cpp similarity index 99% rename from test/ToolStoreTests.cpp rename to test/unit/ToolStoreTests.cpp index 4d505143..a4baf262 100644 --- a/test/ToolStoreTests.cpp +++ b/test/unit/ToolStoreTests.cpp @@ -1,8 +1,8 @@ #include "TemporaryDirectory.hpp" #include #include -#include -#include +#include +#include #include #include diff --git a/test/TypeErasedFunctionTests.cpp b/test/unit/TypeErasedFunctionTests.cpp similarity index 97% rename from test/TypeErasedFunctionTests.cpp rename to test/unit/TypeErasedFunctionTests.cpp index a9715187..90b681a9 100644 --- a/test/TypeErasedFunctionTests.cpp +++ b/test/unit/TypeErasedFunctionTests.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/UISubscribersTests.cpp b/test/unit/UISubscribersTests.cpp similarity index 99% rename from test/UISubscribersTests.cpp rename to test/unit/UISubscribersTests.cpp index 960598b0..97bef257 100644 --- a/test/UISubscribersTests.cpp +++ b/test/unit/UISubscribersTests.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/test/Version.hpp.in b/test/unit/Version.hpp.in similarity index 100% rename from test/Version.hpp.in rename to test/unit/Version.hpp.in diff --git a/test/WebFrontTests.cpp b/test/unit/WebFrontTests.cpp similarity index 99% rename from test/WebFrontTests.cpp rename to test/unit/WebFrontTests.cpp index adffb8a4..6d9a6562 100644 --- a/test/WebFrontTests.cpp +++ b/test/unit/WebFrontTests.cpp @@ -1,9 +1,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include "Mocks.hpp" #include "Version.hpp" diff --git a/test/WebKitGTKPolicyTests.cpp b/test/unit/WebKitGTKPolicyTests.cpp similarity index 99% rename from test/WebKitGTKPolicyTests.cpp rename to test/unit/WebKitGTKPolicyTests.cpp index ba63bfe6..aa4267c7 100644 --- a/test/WebKitGTKPolicyTests.cpp +++ b/test/unit/WebKitGTKPolicyTests.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include diff --git a/test/WebLinkTests.cpp b/test/unit/WebLinkTests.cpp similarity index 99% rename from test/WebLinkTests.cpp rename to test/unit/WebLinkTests.cpp index 09b58792..3ad22773 100644 --- a/test/WebLinkTests.cpp +++ b/test/unit/WebLinkTests.cpp @@ -1,8 +1,8 @@ #include "InjectableNetworking.hpp" #include -#include -#include +#include +#include #include #include diff --git a/test/WebSocketTests.cpp b/test/unit/WebSocketTests.cpp similarity index 99% rename from test/WebSocketTests.cpp rename to test/unit/WebSocketTests.cpp index 7986d537..fea4679f 100644 --- a/test/WebSocketTests.cpp +++ b/test/unit/WebSocketTests.cpp @@ -2,8 +2,8 @@ #include "InlineTaskScope.hpp" #include #include -#include -#include +#include +#include #include #include diff --git a/test/WebView2ControllerMock.hpp b/test/unit/WebView2ControllerMock.hpp similarity index 98% rename from test/WebView2ControllerMock.hpp rename to test/unit/WebView2ControllerMock.hpp index a5903bb6..9dc5a6e4 100644 --- a/test/WebView2ControllerMock.hpp +++ b/test/unit/WebView2ControllerMock.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include diff --git a/test/WebView2PolicyMocks.hpp b/test/unit/WebView2PolicyMocks.hpp similarity index 99% rename from test/WebView2PolicyMocks.hpp rename to test/unit/WebView2PolicyMocks.hpp index caa7f59c..96bcc9fd 100644 --- a/test/WebView2PolicyMocks.hpp +++ b/test/unit/WebView2PolicyMocks.hpp @@ -1,5 +1,5 @@ #pragma once -#include +#include #include diff --git a/test/WebView2Tests.cpp b/test/unit/WebView2Tests.cpp similarity index 99% rename from test/WebView2Tests.cpp rename to test/unit/WebView2Tests.cpp index 27996c5b..a0c7715a 100644 --- a/test/WebView2Tests.cpp +++ b/test/unit/WebView2Tests.cpp @@ -2,7 +2,7 @@ #include "WebView2PolicyMocks.hpp" #include #include -#include +#include SCENARIO("WebView2 encodes application paths") { using webfront::frontend::detail::webview2::applicationUrl; diff --git a/webtest/CEFContentPolicy.cpp b/test/web/CEFContentPolicy.cpp similarity index 98% rename from webtest/CEFContentPolicy.cpp rename to test/web/CEFContentPolicy.cpp index 4d98154c..bafc5128 100644 --- a/webtest/CEFContentPolicy.cpp +++ b/test/web/CEFContentPolicy.cpp @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include #include diff --git a/webtest/CMakeLists.txt b/test/web/CMakeLists.txt similarity index 97% rename from webtest/CMakeLists.txt rename to test/web/CMakeLists.txt index ce224f3a..b5f03fd1 100644 --- a/webtest/CMakeLists.txt +++ b/test/web/CMakeLists.txt @@ -37,7 +37,7 @@ if(WEBFRONT_DEVELOPER_FIXTURES AND ${WEBFRONT_FRONTEND_${WEBFRONT_WEBTEST_FRONTEND}_OPTION} AND CMAKE_SYSTEM_NAME IN_LIST WEBFRONT_FRONTEND_${WEBFRONT_WEBTEST_FRONTEND}_TEST_PLATFORMS) if(NOT EXISTS "${WEBFRONT_DEVELOPER_FIXTURES}/provision.json") - message(FATAL_ERROR "Prepare WEBFRONT_DEVELOPER_FIXTURES with tools/developer/build.mjs and fixtures.mjs") + message(FATAL_ERROR "Prepare WEBFRONT_DEVELOPER_FIXTURES with js/developer/tools/build.mjs and fixtures.mjs") endif() add_executable(developer_integration DeveloperTest.cpp) target_link_libraries(developer_integration PRIVATE WebFront_test_hardening WebFront WebFront_warnings WebFront_options) @@ -89,7 +89,7 @@ if(WEBFRONT_DEVELOPER_FIXTURES webfront_set_browser_test_properties(LifeEmbeddedIntegration "${CMAKE_CURRENT_SOURCE_DIR}" 60) set_tests_properties(LifeEmbeddedIntegration PROPERTIES FIXTURES_REQUIRED LifeEmbedded) if(WEBFRONT_WEBTEST_FRONTEND STREQUAL "WKWebView") - get_filename_component(_developer_wk_plist "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/WKWebViewTestInfo.plist.in" ABSOLUTE) + get_filename_component(_developer_wk_plist "${PROJECT_SOURCE_DIR}/test/cmake/WKWebViewTestInfo.plist.in" ABSOLUTE) foreach(target developer_integration developer_embedded life_embedded) string(REPLACE "_" "-" identifier "${target}") set_target_properties(${target} PROPERTIES diff --git a/webtest/DeveloperEmbeddedTest.cpp b/test/web/DeveloperEmbeddedTest.cpp similarity index 95% rename from webtest/DeveloperEmbeddedTest.cpp rename to test/web/DeveloperEmbeddedTest.cpp index ada7cfc1..f69d85f2 100644 --- a/webtest/DeveloperEmbeddedTest.cpp +++ b/test/web/DeveloperEmbeddedTest.cpp @@ -1,7 +1,7 @@ -#include +#include #include WEBFRONT_PI_ASSETS_HEADER -#include "../test/fixtures/Pi.hpp" -#include "../test/TemporaryDirectory.hpp" +#include "../fixtures/Pi.hpp" +#include "../unit/TemporaryDirectory.hpp" #include #include diff --git a/webtest/DeveloperTest.cpp b/test/web/DeveloperTest.cpp similarity index 97% rename from webtest/DeveloperTest.cpp rename to test/web/DeveloperTest.cpp index eff9bc87..b9f35887 100644 --- a/webtest/DeveloperTest.cpp +++ b/test/web/DeveloperTest.cpp @@ -1,7 +1,7 @@ -#include "../examples/life/Life.hpp" -#include "../test/fixtures/Pi.hpp" -#include "../test/TemporaryDirectory.hpp" -#include +#include "../../examples/life/Life.hpp" +#include "../fixtures/Pi.hpp" +#include "../unit/TemporaryDirectory.hpp" +#include #include #include diff --git a/webtest/FrontendLifecycle.cpp b/test/web/FrontendLifecycle.cpp similarity index 99% rename from webtest/FrontendLifecycle.cpp rename to test/web/FrontendLifecycle.cpp index 76ec8972..3f189244 100644 --- a/webtest/FrontendLifecycle.cpp +++ b/test/web/FrontendLifecycle.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include diff --git a/webtest/JasmineTest.cpp b/test/web/JasmineTest.cpp similarity index 94% rename from webtest/JasmineTest.cpp rename to test/web/JasmineTest.cpp index 664400b7..836f3bb6 100644 --- a/webtest/JasmineTest.cpp +++ b/test/web/JasmineTest.cpp @@ -1,20 +1,20 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "RejectedWebSocketServer.hpp" -#include "../test/fixtures/SignalDemo.hpp" +#include "../fixtures/SignalDemo.hpp" #include #include @@ -56,7 +56,7 @@ struct TestState { atomic passed{false}; }; -/// Project directory of the tools installed by webtest/js/tools-specs.mjs: a fresh temporary +/// Project directory of the tools installed by test/web/js/tools-specs.mjs: a fresh temporary /// directory, removed by main(), so the test never writes into the source tree. struct TestToolsProject { static filesystem::path get() { @@ -70,8 +70,8 @@ struct TestToolsProject { } }; -/// Search endpoint of the fake npm registry used by webtest/js/tools-specs.mjs; its packuments and -/// tarball are plain files under webtest/registry/ (see make_fixture.py), served by NativeDebugFS. +/// Search endpoint of the fake npm registry used by test/web/js/tools-specs.mjs; its packuments and +/// tarball are plain files under test/web/registry/ (see make_fixture.py), served by NativeDebugFS. /// The server drops the query string before looking up files, so tools-specs.mjs checks the query /// wf.mjs sends. class FakeRegistrySearchFS { @@ -164,7 +164,7 @@ class BrowserIntegrationTest { #ifdef _MSC_VER // With an unavailable embedded frontend, openAndRun() unconditionally throws. MSVC's // inliner detects that and flags the return below as unreachable, uniquely among our compilers, - // turning it into an error under /WX; see the matching suppression in include/WebFront.hpp. + // turning it into an error under /WX; see the matching suppression in include/webfront/WebFront.hpp. #pragma warning(push) #pragma warning(disable : 4702) #endif @@ -402,8 +402,8 @@ class BrowserIntegrationTest { }); } - /// Commands driven by webtest/js/terminal-specs.mjs, and the tool manager driven by - /// webtest/js/tools-specs.mjs against the fake registry under webtest/registry/. + /// Commands driven by test/web/js/terminal-specs.mjs, and the tool manager driven by + /// test/web/js/tools-specs.mjs against the fake registry under test/web/registry/. void registerTerminalCommands() { Terminal terminal{webFront, {.prompt = "test> ", .banner = "webtest terminal"}}; terminal.command("greet", "Greet someone", [](CommandArgs args) { diff --git a/webtest/LifeEmbeddedTest.cpp b/test/web/LifeEmbeddedTest.cpp similarity index 97% rename from webtest/LifeEmbeddedTest.cpp rename to test/web/LifeEmbeddedTest.cpp index 92c6677c..b5a7286c 100644 --- a/webtest/LifeEmbeddedTest.cpp +++ b/test/web/LifeEmbeddedTest.cpp @@ -1,7 +1,7 @@ -#include +#include #include WEBFRONT_LIFE_ASSETS_HEADER -#include "../examples/life/Life.hpp" -#include "../test/TemporaryDirectory.hpp" +#include "../../examples/life/Life.hpp" +#include "../unit/TemporaryDirectory.hpp" #include #include diff --git a/webtest/RejectedWebSocketServer.hpp b/test/web/RejectedWebSocketServer.hpp similarity index 96% rename from webtest/RejectedWebSocketServer.hpp rename to test/web/RejectedWebSocketServer.hpp index b228ddc7..fcb31fec 100644 --- a/webtest/RejectedWebSocketServer.hpp +++ b/test/web/RejectedWebSocketServer.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include +#include #include #include diff --git a/webtest/SpecRunner.html b/test/web/SpecRunner.html similarity index 100% rename from webtest/SpecRunner.html rename to test/web/SpecRunner.html diff --git a/webtest/WKWebViewClassImages.cpp b/test/web/WKWebViewClassImages.cpp similarity index 97% rename from webtest/WKWebViewClassImages.cpp rename to test/web/WKWebViewClassImages.cpp index 9b8f93bb..837ecd9c 100644 --- a/webtest/WKWebViewClassImages.cpp +++ b/test/web/WKWebViewClassImages.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/webtest/WKWebViewClassModule.cpp b/test/web/WKWebViewClassModule.cpp similarity index 94% rename from webtest/WKWebViewClassModule.cpp rename to test/web/WKWebViewClassModule.cpp index ac891059..fe999de8 100644 --- a/webtest/WKWebViewClassModule.cpp +++ b/test/web/WKWebViewClassModule.cpp @@ -1,4 +1,4 @@ -#include +#include using namespace webfront::frontend::detail::wkwebview; diff --git a/webtest/WKWebViewHeaderConsumer.cpp b/test/web/WKWebViewHeaderConsumer.cpp similarity index 92% rename from webtest/WKWebViewHeaderConsumer.cpp rename to test/web/WKWebViewHeaderConsumer.cpp index c37a1007..f2e2a8c5 100644 --- a/webtest/WKWebViewHeaderConsumer.cpp +++ b/test/web/WKWebViewHeaderConsumer.cpp @@ -1,4 +1,4 @@ -#include +#include static_assert(requires { webfront::frontend::WKWebViewFrontend::open("127.0.0.1", "9002", "index.html", {}); diff --git a/webtest/WKWebViewLifecycle.cpp b/test/web/WKWebViewLifecycle.cpp similarity index 99% rename from webtest/WKWebViewLifecycle.cpp rename to test/web/WKWebViewLifecycle.cpp index 4420b37c..8d1d4d26 100644 --- a/webtest/WKWebViewLifecycle.cpp +++ b/test/web/WKWebViewLifecycle.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/webtest/WebKitGTKLifecycle.cpp b/test/web/WebKitGTKLifecycle.cpp similarity index 98% rename from webtest/WebKitGTKLifecycle.cpp rename to test/web/WebKitGTKLifecycle.cpp index b34f3feb..ea1081bc 100644 --- a/webtest/WebKitGTKLifecycle.cpp +++ b/test/web/WebKitGTKLifecycle.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include diff --git a/webtest/WebView2HeaderConsumer.cpp b/test/web/WebView2HeaderConsumer.cpp similarity index 85% rename from webtest/WebView2HeaderConsumer.cpp rename to test/web/WebView2HeaderConsumer.cpp index 5af4d66e..d20af187 100644 --- a/webtest/WebView2HeaderConsumer.cpp +++ b/test/web/WebView2HeaderConsumer.cpp @@ -1,5 +1,5 @@ // A second translation unit catches standalone include and ODR regressions. -#include +#include bool webView2ClosesServer() { static_assert(webfront::frontend::WebView2Frontend::action == webfront::frontend::Action::closeServerAfterOpen); diff --git a/webtest/WebView2Lifecycle.cpp b/test/web/WebView2Lifecycle.cpp similarity index 99% rename from webtest/WebView2Lifecycle.cpp rename to test/web/WebView2Lifecycle.cpp index ffa22544..456905d4 100644 --- a/webtest/WebView2Lifecycle.cpp +++ b/test/web/WebView2Lifecycle.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include diff --git a/webtest/content-policy.html b/test/web/content-policy.html similarity index 100% rename from webtest/content-policy.html rename to test/web/content-policy.html diff --git a/webtest/developer-specs.mjs b/test/web/developer-specs.mjs similarity index 100% rename from webtest/developer-specs.mjs rename to test/web/developer-specs.mjs diff --git a/webtest/encoded path #.html b/test/web/encoded path #.html similarity index 100% rename from webtest/encoded path #.html rename to test/web/encoded path #.html diff --git a/webtest/fixtures/react.html b/test/web/fixtures/react.html similarity index 100% rename from webtest/fixtures/react.html rename to test/web/fixtures/react.html diff --git a/webtest/js/content-policy-specs.mjs b/test/web/js/content-policy-specs.mjs similarity index 100% rename from webtest/js/content-policy-specs.mjs rename to test/web/js/content-policy-specs.mjs diff --git a/webtest/js/module-fixture.mjs b/test/web/js/module-fixture.mjs similarity index 100% rename from webtest/js/module-fixture.mjs rename to test/web/js/module-fixture.mjs diff --git a/webtest/js/origin-probe.mjs b/test/web/js/origin-probe.mjs similarity index 100% rename from webtest/js/origin-probe.mjs rename to test/web/js/origin-probe.mjs diff --git a/webtest/js/react-demo-specs.mjs b/test/web/js/react-demo-specs.mjs similarity index 100% rename from webtest/js/react-demo-specs.mjs rename to test/web/js/react-demo-specs.mjs diff --git a/webtest/js/terminal-specs.mjs b/test/web/js/terminal-specs.mjs similarity index 98% rename from webtest/js/terminal-specs.mjs rename to test/web/js/terminal-specs.mjs index 07c70a61..99db7cc4 100644 --- a/webtest/js/terminal-specs.mjs +++ b/test/web/js/terminal-specs.mjs @@ -1,5 +1,5 @@ // Drives the embedded terminal component (served by fs::TerminalFS) against the commands that -// webtest/JasmineTest.cpp registers through webfront::Terminal. Trailing spaces are trimmed when +// test/web/JasmineTest.cpp registers through webfront::Terminal. Trailing spaces are trimmed when // reading the screen, so a prompt line reads 'test>'. import { mount, runLine, tokenize } from '/webfront/components/terminal/terminal.mjs'; diff --git a/webtest/js/tools-specs.mjs b/test/web/js/tools-specs.mjs similarity index 98% rename from webtest/js/tools-specs.mjs rename to test/web/js/tools-specs.mjs index 9f4c0b7b..a81192ff 100644 --- a/webtest/js/tools-specs.mjs +++ b/test/web/js/tools-specs.mjs @@ -1,6 +1,6 @@ // Drives the wf tool manager: the browser module served by fs::ToolManagerFS, loaded by the terminal -// as an extension, against the webfront::ToolManager that webtest/JasmineTest.cpp registers with the -// fake npm registry under webtest/registry/ (no public network). Installed tools go to a temporary +// as an extension, against the webfront::ToolManager that test/web/JasmineTest.cpp registers with the +// fake npm registry under test/web/registry/ (no public network). Installed tools go to a temporary // project directory, served by fs::BasicPackageFS. import { mount } from '/webfront/components/terminal/terminal.mjs'; import { chunkSize, gunzip, installed, parseSpec, readTar, verifyIntegrity } from '/webfront/components/tools/wf.mjs'; diff --git a/webtest/js/webfront-specs.mjs b/test/web/js/webfront-specs.mjs similarity index 100% rename from webtest/js/webfront-specs.mjs rename to test/web/js/webfront-specs.mjs diff --git a/webtest/no-bridge.html b/test/web/no-bridge.html similarity index 100% rename from webtest/no-bridge.html rename to test/web/no-bridge.html diff --git a/webtest/origin-probe.html b/test/web/origin-probe.html similarity index 100% rename from webtest/origin-probe.html rename to test/web/origin-probe.html diff --git a/webtest/policy-controls.html b/test/web/policy-controls.html similarity index 100% rename from webtest/policy-controls.html rename to test/web/policy-controls.html diff --git a/webtest/policy-escaped.html b/test/web/policy-escaped.html similarity index 100% rename from webtest/policy-escaped.html rename to test/web/policy-escaped.html diff --git a/webtest/registry/make_fixture.py b/test/web/registry/make_fixture.py similarity index 95% rename from webtest/registry/make_fixture.py rename to test/web/registry/make_fixture.py index a0365018..7f93df33 100644 --- a/webtest/registry/make_fixture.py +++ b/test/web/registry/make_fixture.py @@ -1,7 +1,7 @@ -"""Regenerates the fake npm registry served to webtest/js/tools-specs.mjs: the tarball of the +"""Regenerates the fake npm registry served to test/web/js/tools-specs.mjs: the tarball of the webfront-test-tool package and the packuments that point at it. Run from any directory: - python3 webtest/registry/make_fixture.py + python3 test/web/registry/make_fixture.py The output is deterministic (no timestamps), so an unchanged script leaves the files unchanged. """ diff --git a/webtest/registry/search.json b/test/web/registry/search.json similarity index 100% rename from webtest/registry/search.json rename to test/web/registry/search.json diff --git a/webtest/registry/tarballs/webfront-test-tool-1.0.0.tgz b/test/web/registry/tarballs/webfront-test-tool-1.0.0.tgz similarity index 100% rename from webtest/registry/tarballs/webfront-test-tool-1.0.0.tgz rename to test/web/registry/tarballs/webfront-test-tool-1.0.0.tgz diff --git a/webtest/registry/webfront-test-corrupt b/test/web/registry/webfront-test-corrupt similarity index 100% rename from webtest/registry/webfront-test-corrupt rename to test/web/registry/webfront-test-corrupt diff --git a/webtest/registry/webfront-test-tool b/test/web/registry/webfront-test-tool similarity index 100% rename from webtest/registry/webfront-test-tool rename to test/web/registry/webfront-test-tool diff --git a/webtest/rejected-ready.html b/test/web/rejected-ready.html similarity index 100% rename from webtest/rejected-ready.html rename to test/web/rejected-ready.html diff --git a/webtest/slow-page.html b/test/web/slow-page.html similarity index 100% rename from webtest/slow-page.html rename to test/web/slow-page.html diff --git a/webtest/slow-resource.js b/test/web/slow-resource.js similarity index 100% rename from webtest/slow-resource.js rename to test/web/slow-resource.js diff --git a/webfront/DOM/HTTPServer.cpp b/webfront/DOM/HTTPServer.cpp deleted file mode 100644 index be070d02..00000000 --- a/webfront/DOM/HTTPServer.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// HTTPServer.cpp : Defines the entry point for the console application. -// -#include "webfront.h" -#include "page.h" -#include - - - -int main(int argc, char* argv[]) -{ - { - WebFront::Site my_site("1600"); - auto index_page = my_site.CreatePage("index.html"); - - - std::cout << "Press Return to quit" << std::endl; std::cin.get(); - } - std::cout << "Press Return to quit" << std::endl; std::cin.get(); - return 0; -} - diff --git a/webfront/DOM/HTTPServer.vcxproj b/webfront/DOM/HTTPServer.vcxproj deleted file mode 100644 index fabaa9c4..00000000 --- a/webfront/DOM/HTTPServer.vcxproj +++ /dev/null @@ -1,132 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {1B2A103E-BE0B-49C7-BF4F-EBFA98D6EB56} - Win32Proj - HTTPServer - - - - Application - true - v110 - Unicode - - - Application - false - v110 - true - Unicode - - - - - - - - - - - - - true - - - false - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - true - - - Console - true - - - true - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/webfront/DOM/HTTPServer.vcxproj.filters b/webfront/DOM/HTTPServer.vcxproj.filters deleted file mode 100644 index 06d635a2..00000000 --- a/webfront/DOM/HTTPServer.vcxproj.filters +++ /dev/null @@ -1,144 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/webfront/DOM/http_connexion.cpp b/webfront/DOM/http_connexion.cpp deleted file mode 100644 index 2bb59cdb..00000000 --- a/webfront/DOM/http_connexion.cpp +++ /dev/null @@ -1,155 +0,0 @@ -#include "http_connexion.h" -#include "http_request.h" -#include -#include -#include - -#include -#include - -class HTTPConnexion::Impl : public SocketHelper -{ -public: - Impl(SocketType socket) : socket_(socket) - { - // Test(); - - { // Add connexion to connexions list - std::unique_lock(connexions_mutex); - connexions.push_back(std::unique_ptr(this)); - } - } - - void Disconnect() - { - Shutdown(socket_); - CloseSocket(socket_); - { // Remove this connexion from connexions list - std::unique_lock(connexions_mutex); - connexions.remove_if([this](std::unique_ptr& cnx) { return cnx.get() == this; }); - } - } - - static void CloseAllConnexions() - { - std::unique_lock(connexions_mutex); - while (!connexions.empty()) - { - connexions.front()->Disconnect(); - } - } - - void Serve() - { -// std::cout << "thread:" << std::this_thread::get_id() << " Serve" << std::endl; - - int received_bytes; - - send(socket_, "SERVER OK\r\n", 11, 0); - - HTTPRequest request; - while ((received_bytes = recv(socket_, request.GetBuffer(), request.GetBufferSize(), 0)) > 0) - { - //std::cout << "Recv " << received_bytes << std::endl; - //HexDump(buffer.data(), received_bytes); - request.GetBuffer()[received_bytes] = 0; - - request.ParseData(received_bytes); - if (request.HeaderIsComplete()) - { - switch (request.method()) - { - case HTTPRequest::kGet: - std::cout << "Method GET on url " << request.url() << std::endl; - std::cout << " host : " << request.host() << std::endl; - break; - case HTTPRequest::kHead: - std::cout << "Method HEAD" << std::endl; - break; - } - } - - - } - std::cout << "thread:" << std::this_thread::get_id() << " Serve ended" << std::endl; - - Disconnect(); - } - - void Test() - { - HTTPRequest request; - std::string test_header = "GET /myurl HTTP/1.1\r\nHost:1\r\nUser-Agent:2\r\n 0\r\n\r\n"; - - char* buffer = request.GetBuffer(); - for (auto c : test_header) - *buffer++ = c; - - request.ParseData(test_header.length()); - if (HTTPRequest::kGet == request.method()) std::cout << "GET ok" << std::endl; else std::cout << "GET no" << std::endl; - std::cout << "Url:" << request.url() << std::endl; - std::cout << "Host:" << request.host() << std::endl; - std::cout << "User-Agent:" << request.user_agent() << std::endl; - } - -private: - SocketType socket_; - - static std::list> connexions; //< List all connections - static std::mutex connexions_mutex; - -private: - static void HexDump(void* data, unsigned int bytes) - { - char *parser, *last=reinterpret_cast(data); - parser = last; - last += bytes; - - char output_line[] = " | ................"; - - for (; parser<=last; parser+=16) - { - for (unsigned int charac=0; charac<16; charac++) - { - if (parser+charac < last) - { - char towrite = parser[charac]; - if ((towrite>>4)<10) - output_line[charac*3] = (towrite>>4) + 48; - else - output_line[charac*3] = (towrite>>4) + 55; - if ((towrite%16)<10) - output_line[charac*3+1] = (towrite%16) + 48; - else - output_line[charac*3+1] = (towrite%16) + 55; - if (towrite>31) - { - output_line[51+charac] = towrite; - } - else - { - output_line[51+charac] = '.'; - } - } - else - { - output_line[charac*3] = '.'; - output_line[charac*3+1] = '.'; - output_line[51+charac] = '.'; - } - } - std::cout << std::setw(8) << std::setfill('0') << std::hex << reinterpret_cast(parser); - std::cout << " " << output_line << std::endl; - } - } -}; - - -HTTPConnexion::HTTPConnexion(SocketType socket) : pimpl_(new Impl(socket)) {} -HTTPConnexion::~HTTPConnexion() {} -void HTTPConnexion::Serve() { pimpl_->Serve(); } -void HTTPConnexion::CloseAllConnexions() { Impl::CloseAllConnexions(); } - -std::list> HTTPConnexion::Impl::connexions; -std::mutex HTTPConnexion::Impl::connexions_mutex; - diff --git a/webfront/DOM/http_connexion.h b/webfront/DOM/http_connexion.h deleted file mode 100644 index 4206cdb2..00000000 --- a/webfront/DOM/http_connexion.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __HTTP_CONNEXION_H_ -#define __HTTP_CONNEXION_H_ -#include -#include "socket_helper.h" - - -class HTTPConnexion -{ -public: - HTTPConnexion(SocketType socket); - ~HTTPConnexion(); - void Serve(); //< Connexion main loop - static void CloseAllConnexions(); //< Close all open HTTPConnexions sockets - -private: - class Impl; - std::unique_ptr pimpl_; -}; - -#endif //__HTTP_CONNEXION_H_ \ No newline at end of file diff --git a/webfront/DOM/http_request.cpp b/webfront/DOM/http_request.cpp deleted file mode 100644 index 34447623..00000000 --- a/webfront/DOM/http_request.cpp +++ /dev/null @@ -1,356 +0,0 @@ -#include "http_request.h" -#include -#include -#include -#include - -#define HT 9 -#define SP ' ' -#define CR '\r' -#define LF '\n' -#define AFFECT ':' - -class HTTPRequest::Impl -{ -private: - enum HeaderField; - -public: - Impl() - { - Reinitialize(); - } - - void Reinitialize() - { - set_method(kUndefined); - set_parse_status(kUnparsed); - set_connection_keepalive(true); - buffer_parser_ = buffer_.data(); - buffer_end_ = buffer_parser_; - } - - bool ParseData(size_t bytes) - { - static char* affect_sign=nullptr; - - if (kUnparsed == parse_status()) - { - // Find end of first line (CRLF) - while (LF != *buffer_end_) - { - if (0 == bytes) // if there is no more data to parse before CRLF, that means - return true; // that we get to wait for more data (in the next call to ParseData) - --bytes; - buffer_end_++; - } - - - if (CR == buffer_end_[-1]) - { - // CRLF found : we have a first header line. Let's fine the method - switch (buffer_parser_[0]) - { - case 'G': - if (('E' == buffer_parser_[1]) && ('T' == buffer_parser_[2])) - { - set_method(kGet); - set_parse_status(kMethodParsed); - buffer_parser_+=3;; - }; - break; - case 'H': - if (('E' == buffer_parser_[1]) && ('A' == buffer_parser_[2]) && ('D' == buffer_parser_[3])) - { - set_method(kHead); - set_parse_status(kMethodParsed); - buffer_parser_+=4;; - } - break; - } - - // if no method had been recognized, we return and ask for connection termination - if (kMethodParsed != parse_status()) - return false; - - // Extract URL - while (SP == *buffer_parser_ || HT == *buffer_parser_) - ++buffer_parser_; - while (SP != *buffer_parser_ && HT != *buffer_parser_) - { - url_.append(buffer_parser_, 1); - ++buffer_parser_; - } - - // Extract HTTP version - while (SP == *buffer_parser_ || HT == *buffer_parser_) - ++buffer_parser_; - while (SP != *buffer_parser_ && HT != *buffer_parser_ && buffer_parser_<(buffer_end_-1)) - { - http_version_.append(buffer_parser_, 1); - ++buffer_parser_; - } - - buffer_parser_ = buffer_end_; - set_parse_status(kMethodLineParsed); - } - } - - while (kMethodLineParsed == parse_status()) - { - while (LF != *buffer_end_) - { - if (0 == bytes) return true; - if (nullptr == affect_sign) - { - if (AFFECT == *buffer_end_) affect_sign = buffer_end_; - } - --bytes; - buffer_end_++; - } - if (CR == buffer_end_[-1]) - { - // if the completed line begins with a space character then it is - // the continuation of the precedent affection. - if ((SP == *buffer_parser_) || (HT == *buffer_parser_)) - { - ++buffer_parser_; - while (SP == *buffer_parser_ || HT == *buffer_parser_) // remove leading spaces - ++buffer_parser_; - - AffectFieldValue(last_header_field_, buffer_parser_, buffer_end_-1); - } - else - // If the completed line has a ':', then we can extract the field association - if (nullptr != affect_sign) - { - ExtractAssociation(buffer_parser_, affect_sign, buffer_end_-1); - affect_sign = nullptr; - } - - - if (LF == buffer_end_[-2] && CR == buffer_end_[-3]) - { - // CRLFCRLF found : the header is completely parsed - set_parse_status(kHeaderParsed); - return true; - } - - ++buffer_end_; - buffer_parser_ = buffer_end_; - } - else - { - // CR missing : we abort the connection - return false; - } - } - return true; - } - - void ExtractAssociation(const char* begin, const char* affect_sign, const char* end) - { - std::string name, value; - const char* end_name = affect_sign; - while ((SP == *begin) || (HT == *begin)) ++begin; // Remove leading spaces - while ((SP == *end_name) || (HT == *end_name)) --end_name; // Remove trailing spaces - name.append(begin, end_name); - - const char* begin_value = affect_sign + 1; - while ((SP == *begin_value) || (HT == *begin_value)) ++begin_value; // Remove leading spaces - while ((SP == *end) || (HT == *end)) --end; // Remove trailing spaces - value.append(begin_value, end); - -// for (auto& c : name) if (c>='A'&& c<='Z') c-='A'-'a'; // Convert name to lowercase - - - - - switch (name[0]) - { - case 'A': // Accept, Accept-encoding, Accept-language, Accept-charset, Authorization - if (name.length()>=6) - { - switch (name[1]) - { - case 'c': - if (0 == name.compare(2, 4, "cept")) - { - if (6 ==name.length()) last_header_field_ = kAccept; - else - { - if (0 == name.compare(6, 9, "-encoding")) last_header_field_ = kAccept_encoding; - else - if (0 == name.compare(6, 9, "-language")) last_header_field_ = kAccept_language; - else - if (0 == name.compare(6, 8, "-charset")) last_header_field_ = kAccept_charset; - } - } - break; - - case 'u': - if (0 == name.compare(2, 11, "thorization")) last_header_field_ = kAuthorization; - break; - } - } - break; - - case 'C': // Connection, Cookie - if (0 == name.compare(1, 9, "onnection")) last_header_field_ = kConnection; - else - if (0 == name.compare(1, 5, "ookie")) last_header_field_ = kCookie; - else - if (0 == name.compare(1, 12, "ache-Control")) last_header_field_ = kCache_Control; - break; - - case 'H': // Host - if (0 == name.compare(1, 3, "ost")) last_header_field_ = kHost; - break; - - case 'R': // Referer - if (0 == name.compare(1, 6, "eferer")) last_header_field_ = kReferer; - break; - - case 'U': // Upgrade, User-agent - if (0 == name.compare(1, 6, "pgrade")) last_header_field_ = kUpgrade; - else - if (0 == name.compare(1, 9, "ser-Agent")) last_header_field_ = kUser_Agent; - break; - } - - AffectFieldValue(last_header_field_, begin_value, end); -// std::cout << "ExtractAssociation : " << name << " -> " << value << std::endl; - } - - void AffectFieldValue(HeaderField field, const char* value_begin, const char* value_end) - { - switch (field) - { - case kNone: - break; - case kAccept: - accept_.append(value_begin, value_end); - break; - case kAccept_encoding: - accept_encoding_.append(value_begin, value_end); - break; - case kAccept_language: - accept_language_.append(value_begin, value_end); - break; - case kAccept_charset: - accept_charset_.append(value_begin, value_end); - break; - case kAuthorization: - authorization_.append(value_begin, value_end); - break; - case kConnection: - if ('c' == *value_begin) // close - set_connection_keepalive(false); - break; - case kCookie: - cookie_.append(value_begin, value_end); - break; - case kCache_Control: - cache_control_.append(value_begin, value_end); - break; - case kHost: - host_.append(value_begin, value_end); - break; - case kReferer: - referer_.append(value_begin, value_end); - break; - case kUpgrade: - upgrade_.append(value_begin, value_end); - break; - case kUser_Agent: - user_agent_.append(value_begin, value_end); - break; - } - } - - bool HeaderIsComplete() const { return parse_status() >= kHeaderParsed; } - char* GetBuffer() { return buffer_end_; } - size_t GetBufferSize() const { return buffer_.size(); } - Method method() const { return method_; } - - const std::string& url() const { return url_; } - const std::string& host() const { return host_; } - const std::string& user_agent() const { return user_agent_; } - const std::string& accept() const { return accept_; } - const std::string& accept_encoding() const { return accept_encoding_; } - const std::string& accept_language() const { return accept_language_; } - const std::string& accept_charset() const { return accept_charset_; } - const std::string& authorization() const { return authorization_; } - const std::string& cache_control() const { return cache_control_; } - const std::string& cookie() const { return cookie_; } - const std::string& referer() const { return referer_; } - const std::string& upgrade() const { return upgrade_; } - bool connection_keepalive() const { return connection_keepalive_; } - -private: - enum ParseStatus; - - void set_method(Method method) { method_ = method; } - void set_parse_status(ParseStatus status) { parse_status_ = status; } - void set_connection_keepalive(bool keep) { connection_keepalive_ = keep; } - ParseStatus parse_status() const { return parse_status_; } - - - // Request header data - Method method_; - std::string url_; - std::string http_version_; - std::string host_; - std::string user_agent_; - std::string accept_; - std::string accept_encoding_; - std::string accept_language_; - std::string accept_charset_; - std::string authorization_; - std::string cache_control_; - std::string cookie_; - std::string referer_; - std::string upgrade_; - bool connection_keepalive_; - -private: - enum ParseStatus - { - kUnparsed = 1, kMethodParsed, kMethodLineParsed, kHeaderParsed, kContentParsed - } parse_status_; - - enum HeaderField - { - kNone, kAccept, kAccept_encoding, kAccept_language, kAccept_charset, kAuthorization, - kCache_Control, kConnection, kCookie, kHost, kReferer, kUpgrade, kUser_Agent - }; - - - - static const unsigned int kReceiveBufferSize = 16384; - std::array buffer_; - char* buffer_end_; //< First unfilled character in the buffer - char* buffer_parser_; //< Next character to be parsed - HeaderField last_header_field_; -}; - -HTTPRequest::HTTPRequest() : pimpl_(new Impl()) {} -HTTPRequest::~HTTPRequest() {}; -void HTTPRequest::Reinitialize() { pimpl_->Reinitialize(); } -bool HTTPRequest::ParseData(size_t bytes) { return pimpl_->ParseData(bytes); } -bool HTTPRequest::HeaderIsComplete() const { return pimpl_->HeaderIsComplete(); } -char* HTTPRequest::GetBuffer() { return pimpl_->GetBuffer(); } -size_t HTTPRequest::GetBufferSize() const { return pimpl_->GetBufferSize(); } -HTTPRequest::Method HTTPRequest::method() const { return pimpl_->method(); } -const std::string& HTTPRequest::url() const { return pimpl_->url(); } -const std::string& HTTPRequest::host() const { return pimpl_->host(); } -const std::string& HTTPRequest::user_agent() const { return pimpl_->user_agent(); } -const std::string& HTTPRequest::accept_encoding() const { return pimpl_->accept_encoding(); } -const std::string& HTTPRequest::accept_language() const { return pimpl_->accept_language(); } -const std::string& HTTPRequest::accept_charset() const { return pimpl_->accept_charset(); } -const std::string& HTTPRequest::authorization() const { return pimpl_->authorization(); } -const std::string& HTTPRequest::cache_control() const { return pimpl_->cache_control(); } -const std::string& HTTPRequest::cookie() const { return pimpl_->cookie(); } -const std::string& HTTPRequest::referer() const { return pimpl_->referer(); } -const std::string& HTTPRequest::upgrade() const { return pimpl_->upgrade(); } -bool HTTPRequest::connection_keepalive() const { return pimpl_->connection_keepalive(); } diff --git a/webfront/DOM/http_request.h b/webfront/DOM/http_request.h deleted file mode 100644 index f4d094cf..00000000 --- a/webfront/DOM/http_request.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef __HTTP_REQUEST_H_ -#define __HTTP_REQUEST_H_ - -#include -#include - -class HTTPRequest -{ -public: - enum Method - { - kUndefined, kGet, kHead - }; - -public: - HTTPRequest(); - ~HTTPRequest(); - void Reinitialize(); - bool ParseData(size_t bytes); //< Parse newly received data. Return false if there is a non-recoverable parse error. - bool HeaderIsComplete() const; //< Returns true if a complete header has been parsed - char* GetBuffer(); - size_t GetBufferSize() const; - Method method() const; - const std::string& url() const; - const std::string& host() const; - const std::string& user_agent() const; - const std::string& accept_encoding() const; - const std::string& accept_language() const; - const std::string& accept_charset() const; - const std::string& authorization() const; - const std::string& cache_control() const; - const std::string& cookie() const; - const std::string& referer() const; - const std::string& upgrade() const; - bool connection_keepalive() const; - -private: - class Impl; - std::unique_ptr pimpl_; -}; - -#endif \ No newline at end of file diff --git a/webfront/DOM/page.h b/webfront/DOM/page.h deleted file mode 100644 index 516c044b..00000000 --- a/webfront/DOM/page.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __WEBFRONT_PAGE_H_ -#define __WEBFRONT_PAGE_H_ - -#include -#include - -namespace WebFront -{ -class Site; - -class Page -{ -public: - Page(std::string page_name) : page_name_(page_name) - { - } - - /* - Create - */ - const std::vector& Render(); - -public: - std::string page_name_; -}; - -} - -#endif //__WEBFRONT_PAGE_H_ \ No newline at end of file diff --git a/webfront/DOM/socket_helper.h b/webfront/DOM/socket_helper.h deleted file mode 100644 index 5f16be8f..00000000 --- a/webfront/DOM/socket_helper.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __SOCKET_HELPER_H_ -#define __SOCKET_HELPER_H_ - -#ifdef WIN32 -#include -#include -#pragma comment(lib, "Ws2_32.lib") -typedef SOCKET SocketType; -class SocketHelper -{ -public: - static const SocketType kInvalidSocket = INVALID_SOCKET; - - static bool InitializeLib() - { - WSADATA wsa_data; - int init_value = WSAStartup(MAKEWORD(2, 2), &wsa_data); - return init_value == 0; - } - - static void CleanupLib() { WSACleanup(); } - static void CloseSocket(SocketType socket) { closesocket(socket); } - static void Shutdown(SocketType socket) { shutdown(socket, SD_BOTH); } -}; -#else -#include -#include -#include -#include - -typedef int SocketType; -class SocketHelper -{ -public: - static const SocketType kInvalidSocket = -1; - - static bool InitializeLib() { return true; } - static void CleanupLib() {} - static void CloseSocket(SocketType socket) { close(socket); } - static void Shutdown(SocketType socket) { shutdown(socket, SHUT_RDWR); } -}; - -#endif -#endif //__SOCKET_HELPER_H_ \ No newline at end of file diff --git a/webfront/DOM/socket_server.cpp b/webfront/DOM/socket_server.cpp deleted file mode 100644 index a3171e08..00000000 --- a/webfront/DOM/socket_server.cpp +++ /dev/null @@ -1,143 +0,0 @@ -#include "socket_server.h" -#include -#include -#include - -#include "socket_helper.h" -#include "thread_pool.h" -#include "http_request.h" -#include "http_connexion.h" - - -class SocketServer::Impl : public SocketHelper -{ -public: - Impl(int port) : server_status_(kUninitialized), server_info_(nullptr) - { - InitializeSocket(std::to_string(port)); - } - - Impl(std::string protocol) : server_status_(kUninitialized), server_info_(nullptr) - { - InitializeSocket(protocol); - } - - ~Impl() - { - freeaddrinfo(server_info_); - CleanupLib(); - } - - bool Start() - { - if (nullptr == server_info_) - return false; - listening_socket_ = socket(server_info_->ai_family, server_info_->ai_socktype, server_info_->ai_protocol); - if (kInvalidSocket == listening_socket_) - return false; - - if (0 != bind(listening_socket_, server_info_->ai_addr, server_info_->ai_addrlen)) - return false; - - if (0 != listen(listening_socket_, SOMAXCONN)) - return false; - - listening_ = true; - listening_thread_ = std::thread(&Impl::ListenLoop, this); - set_server_status(kStarted); - return true; - } - - void Stop() - { - Shutdown(listening_socket_); - - listening_ = false; - CloseSocket(listening_socket_); - std::cout << "socket closed" << std::endl; - listening_thread_.join(); - std::cout << "thread joined" << std::endl; - set_server_status(kStopped); - } - - ServerStatus server_status() const { return server_status_; } - -private: - void InitializeSocket(std::string protocol) - { - set_server_status(kUninitialized); - listening_ = false; - if (!InitializeLib()) - { - set_server_status(kInitializationFailed); - return; - } - - int status; - addrinfo hints = {}; - - hints.ai_family = AF_UNSPEC; // don't care IPv4 or IPv6 - hints.ai_socktype = SOCK_STREAM; // TCP stream sockets - hints.ai_flags = AI_PASSIVE; // Fill my IP for me - status = getaddrinfo(nullptr, protocol.c_str(), &hints, &server_info_); - - if (0 != status) - { - set_server_status(kInitializationFailed); - return; - } - - set_server_status(kInitialized); - } - - void set_server_status(ServerStatus status) - { - const char* nom[] = { "Uninitialized", "InitializationFailed", "Initialized", "Started", "Stopped" }; - server_status_ = status; - std::cout << "server_status changed to " << nom[status] << std::endl; - } - - void ListenLoop() - { - std::cout << "ListenLoop started" << std::endl; - sockaddr_storage client_addr; - socklen_t client_addr_size; - SocketType client_socket; - - ThreadPool thread_pool; - - client_addr_size = sizeof client_addr; - while (listening_) - { - client_socket = accept(listening_socket_, reinterpret_cast(&client_addr), &client_addr_size); - if (kInvalidSocket == client_socket) - { - std::cout << "Erreur socket" << std::endl; - } - else - { - HTTPConnexion* connexion = new HTTPConnexion(client_socket); - std::function myfunc = std::bind(&HTTPConnexion::Serve, connexion); - thread_pool.EnqueueTask(myfunc); - } - } - HTTPConnexion::CloseAllConnexions(); - std::cout << "ListenLoop end" << std::endl; - } - -private: - addrinfo *server_info_; //< Listening socket address structure - ServerStatus server_status_; - SocketType listening_socket_; - std::thread listening_thread_; - bool listening_; //< Is the listening loop started ? - -}; - - -SocketServer::SocketServer(int port) : pimpl_(new Impl(port)) {} -SocketServer::SocketServer(std::string protocol) : pimpl_(new Impl(protocol)) {} -SocketServer::~SocketServer() {} -bool SocketServer::Start() { return pimpl_->Start(); } -void SocketServer::Stop() { return pimpl_->Stop(); } -SocketServer::ServerStatus SocketServer::server_status() const { return pimpl_->server_status(); } diff --git a/webfront/DOM/socket_server.h b/webfront/DOM/socket_server.h deleted file mode 100644 index 18988b98..00000000 --- a/webfront/DOM/socket_server.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __SOCKET_SERVER_H_ -#define __SOCKET_SERVER_H_ - -#include -#include - - -class SocketServer -{ -public: - enum ServerStatus - { kUninitialized, - kInitializationFailed, - kInitialized, - kStarted, - kStopped }; - -public: - SocketServer(int port); - SocketServer(std::string protocol); - ~SocketServer(); - - bool Start(); - void Stop(); - ServerStatus server_status() const; - -private: - class Impl; - std::unique_ptr pimpl_; -}; - - - -#endif //__SOCKET_SERVER_H_ \ No newline at end of file diff --git a/webfront/DOM/thread_pool.cpp b/webfront/DOM/thread_pool.cpp deleted file mode 100644 index 2a330c92..00000000 --- a/webfront/DOM/thread_pool.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include "thread_pool.h" -#include -#include -#include -#include -#include -#include - -class ThreadPool::Impl -{ -public: - Impl(size_t number_of_threads) : running_(true) - { - for (size_t thread =0; thread < number_of_threads; ++thread) - workers_.push_back(std::thread(&Impl::Worker, this)); - } - - ~Impl() - { - std::cout << "ThreadPool destructor" << std::endl; - running_ = false; - tasks_condition_.notify_all(); - - // Wait for threads termination - for (auto &thread : workers_) - { - thread.join(); - } - } - - template void EnqueueTask(Function function) - { - { - std::unique_lock lock(tasks_mutex_); - tasks_.push_back(std::function(function)); - } - tasks_condition_.notify_one(); - } - -private: - bool running_; - std::vector workers_; //< workers threads - std::deque> tasks_; //< task queue - std::mutex tasks_mutex_; - std::condition_variable tasks_condition_; - -private: - void Worker() - { - std::function task; - while (running_) - { - { - // acquire a lock for the condition variable - std::unique_lock lock(tasks_mutex_); - - // wait for a new task (in a loop in case of spurious wakeup) - while (tasks_.empty() && running_) - tasks_condition_.wait(lock); - - if (running_) - { - task = tasks_.front(); - tasks_.pop_front(); - } - } - if (running_) - { - task(); - } - } - } -}; - -ThreadPool::ThreadPool(size_t number_of_threads) : pimpl_(new Impl(number_of_threads)) {} -ThreadPool::ThreadPool() : pimpl_(new Impl(std::thread::hardware_concurrency())) {} -ThreadPool::~ThreadPool() {} -template void ThreadPool::EnqueueTask(Function function) { pimpl_->EnqueueTask(function); } - -template void ThreadPool::EnqueueTask(std::function); diff --git a/webfront/DOM/thread_pool.h b/webfront/DOM/thread_pool.h deleted file mode 100644 index a9e3a1a1..00000000 --- a/webfront/DOM/thread_pool.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __THREAD_POOL_H_ -#define __THREAD_POOL_H_ -#include - -class ThreadPool -{ -public: - ThreadPool( size_t number_of_threads); - ThreadPool(); //< Create a thread pool with the maximum number of concurrent threads supported by the hardware - ~ThreadPool(); - template void EnqueueTask(Function function); - -private: - class Impl; - std::unique_ptr pimpl_; -}; - - -#endif //__THREAD_POOL_H_ \ No newline at end of file diff --git a/webfront/DOM/webfront.cpp b/webfront/DOM/webfront.cpp deleted file mode 100644 index 3d0a4c45..00000000 --- a/webfront/DOM/webfront.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include - -#include "webfront.h" -#include "socket_server.h" - - -#define HTTP_PROTOCOL "http" -namespace WebFront -{ - -class Site::Impl -{ -public: - template Impl(Protocol protocol) : server_(protocol) - { - server_.Start(); - } - - std::shared_ptr CreatePage(const std::string page_name) - { - std::shared_ptr new_page = std::make_shared(page_name); - pages_.insert(PagesMap::value_type(page_name, new_page)); - return new_page; - } - - std::shared_ptr GetPage(const std::string page_name) const - { - const auto page = pages_.find(page_name); - if (pages_.end() == page) - { - return nullptr; - } - return page->second; - } - - std::shared_ptr RemovePage(const std::string page_name) - { - auto page = pages_.find(page_name); - if (pages_.end() == page) - { - return nullptr; - } - pages_.erase(page); - return page->second; - } - -private: - -private: - SocketServer server_; - typedef std::unordered_map> PagesMap; - PagesMap pages_; -}; - -Site::Site() : pimpl_(new Impl(HTTP_PROTOCOL)) { } -Site::Site(unsigned int port) : pimpl_(new Impl(port)) {} -Site::Site(std::string protocol) : pimpl_(new Impl(protocol)) {} -Site::~Site() {} - -/** Creates a new Page and returns a pointer on it. - * If the page_name already exist, the Page is created but not linked to the site. - * \param[in] page_name name/path of the Page - * \return The created Page - */ -std::shared_ptr Site::CreatePage(const std::string page_name) { return pimpl_->CreatePage(page_name); } - -/** Get a Page from Site. A pointer on the page is returned. - * \param[in] page_name name/path of the Page - * \return The removed Page. nullptr if page_name doesn't exist. - */ -std::shared_ptr Site::GetPage(const std::string page_name) { return pimpl_->GetPage(page_name); } - -/** Removes a Page from Site. A pointer on the removed page is returned. - * \param[in] page_name name/path of the Page - * \return The removed Page. nullptr if page_name doesn't exist. - */ -std::shared_ptr Site::RemovePage(const std::string page_name) { return pimpl_->RemovePage(page_name); } - -} \ No newline at end of file diff --git a/webfront/DOM/webfront.h b/webfront/DOM/webfront.h deleted file mode 100644 index 190eb2a3..00000000 --- a/webfront/DOM/webfront.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __WEBFRONT_SITE_H_ -#define __WEBFRONT_SITE_H_ - -#include -#include - -#include "page.h" - -namespace WebFront -{ -class Site -{ -public: - Site(); - Site(unsigned int port); - Site(std::string protocol); - ~Site(); - - std::shared_ptr CreatePage(const std::string page_name); - std::shared_ptr GetPage(const std::string page_name); - std::shared_ptr RemovePage(const std::string page_name); - -private: - class Impl; - std::unique_ptr pimpl_; -}; -} -#endif //__WEBFRONT_H_ diff --git a/webfront/DOM/xmldoc.cpp b/webfront/DOM/xmldoc.cpp deleted file mode 100644 index fbb74ee3..00000000 --- a/webfront/DOM/xmldoc.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "xmldoc.h" - -namespace WebFront { namespace XMLDoc -{ - - - - - - - -/*void Traverse() -{ - auto node = getFirstChild(); - while (nullptr != node) - { - // std::cout << node.getNodeName() << " = " << std::getNodeValue()); - - if (node->hasChildNodes()) - { - node = node->getFirstChild(); - } - else - { // leaf - // Get to the parent level - while (nullptr == node->getNextSibling() && node.get() != this) - node = node->getParentNode(); - node = node->getNextSibling(); - } - } -} -*/ -}} \ No newline at end of file diff --git a/webfront/DOM/xmldoc.h b/webfront/DOM/xmldoc.h deleted file mode 100644 index 59cf8310..00000000 --- a/webfront/DOM/xmldoc.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_H_ -#define __WEBFRONT_XMLDOC_H_ - -#include -#include -#include -#include -#include -#include - -#include "xmldoc_attr.h" -#include "xmldoc_character_data.h" -#include "xmldoc_comment.h" -#include "xmldoc_document.h" -#include "xmldoc_document_fragment.h" -#include "xmldoc_document_type.h" -#include "xmldoc_dom_exception.h" -#include "xmldoc_element.h" -#include "xmldoc_named_node_map.h" -#include "xmldoc_node.h" -#include "xmldoc_node_list.h" - - - -namespace WebFront { namespace XMLDoc { - -class XMLDoc -{ -public: - -}; - -}} -#endif //__WEBFRONT_XMLDOC_H_ \ No newline at end of file diff --git a/webfront/DOM/xmldoc_attr.cpp b/webfront/DOM/xmldoc_attr.cpp deleted file mode 100644 index 113466a3..00000000 --- a/webfront/DOM/xmldoc_attr.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "xmldoc_attr.h" - -namespace WebFront { namespace XMLDoc { - -Attr::Attr() : Node(ATTRIBUTE_NODE) -{ -} - -/** - * Returns the name of this attribute. - * @return The name of this attribute. - */ -const std::string& Attr::getName() const -{ - return getNodeName(); -} - - -/** - * Tells if the attribute value has been specified in the original - * document. - * @return true if the attribute has an assigned value - * in the Document (and the value is the assigned value). - * false if the attribute value came from the default - * value declared in the Document's DTD. - */ -bool Attr::getSpecified() -{ - return specified_; -} - - -const std::string& Attr::getValue() const -{ - return getNodeValue(); -} - - -void Attr::setValue(const std::string& value) -{ - setNodeValue(value); -} - - -std::shared_ptr Attr::getOwnerElement() const -{ - // NOT IMPLEMENTED - return nullptr; -} - - -}} \ No newline at end of file diff --git a/webfront/DOM/xmldoc_attr.h b/webfront/DOM/xmldoc_attr.h deleted file mode 100644 index c982e4dd..00000000 --- a/webfront/DOM/xmldoc_attr.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_ATTR_H_ -#define __WEBFRONT_XMLDOC_ATTR_H_ - -#include "xmldoc_node.h" -#include "xmldoc_element.h" - -namespace WebFront { namespace XMLDoc { -class Attr : public Node -{ -public: - const std::string& getName() const; - bool getSpecified(); - const std::string& getValue() const; - void setValue(const std::string& value) throw(DOMException); - std::shared_ptr getOwnerElement() const; - -private: - std::shared_ptr ownerElement_; // The Element node this attribute is attached to. - bool specified_; // True if the attribute has an assigned value in the Document. - -protected: - Attr(); - friend class Document; -}; - -}} -#endif // __WEBFRONT_XMLDOC_ATTR_H_ diff --git a/webfront/DOM/xmldoc_c_data_section.h b/webfront/DOM/xmldoc_c_data_section.h deleted file mode 100644 index 2c0fe6f5..00000000 --- a/webfront/DOM/xmldoc_c_data_section.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_CDATA_SECTION_H_ -#define __WEBFRONT_XMLDOC_CDATA_SECTION_H_ - -#include "xmldoc_text.h" - -namespace WebFront { namespace XMLDoc { - -class CDATASection : public Text -{ -}; - - -}} -#endif // __WEBFRONT_XMLDOC_CDATA_SECTION_H_ \ No newline at end of file diff --git a/webfront/DOM/xmldoc_character_data.cpp b/webfront/DOM/xmldoc_character_data.cpp deleted file mode 100644 index f7588f7a..00000000 --- a/webfront/DOM/xmldoc_character_data.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#include "xmldoc_character_data.h" - -namespace WebFront { namespace XMLDoc { - -/** - * Returns the character data of the node. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. - * @exception DOMException - */ -const std::string& CharacterData::getData() const -{ - return getNodeValue(); -} - - -/** - * Set the character data of the node. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. - * @exception DOMException - */ -void CharacterData::setData(const std::string& data) -{ - setNodeValue(data); -} - -/** - * The number of characters in the node. - */ -unsigned int CharacterData::getLength() const -{ - return nodeValue_.length(); -} - -/** - * Extracts a range of data from the node. - * @param[in] offset Offset of substring to extract. - * @param[in] count The number of characters to extract. - * @return The specified substring. - * @exception DOMException - * DOMSTRING_SIZE_ERR: Raised if the specified range of text does - * not fit into a DOMString. - */ -std::string CharacterData::substringData(unsigned int offset, unsigned int count) const -{ - try - { - return nodeValue_.substr(offset, count); - } - catch (std::out_of_range&) - { - throw DOMException(DOMException::DOMSTRING_SIZE_ERR, "offset out of range"); - } -} - -/** - * Appends the string to the end of the character data of the node. - * @param[in] arg The string to append. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - */ -void CharacterData::appendData(const std::string& arg) -{ - if (isReadOnly()) - throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, "node is read only"); - nodeValue_.append(arg); -} - - -/** - * Inserts a string at the specified offset. - * @param[in] offset The offset at which to insert. - * @param[in] arg The string to insert. - * @exception DOMException - * INDEX_SIZE_ERR: Raised if the specified offset is - * greater than the number of characters in data. - * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - */ -void CharacterData::insertData(unsigned int offset, const std::string& arg) -{ - if (isReadOnly()) - { - throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, "node is read only"); - } - try - { - nodeValue_.insert(offset, arg); - } - catch (std::out_of_range& ) - { - throw DOMException(DOMException::INDEX_SIZE_ERR, "offset out of range"); - } -} - -/** - * Removes a range of characters from the node. - * @param[in] offset The offset from which to start removing. - * @param[in] count The number of characters to delete. - * @exception DOMException - * INDEX_SIZE_ERR: Raised if the specified offset is - * greater than the number of characters in data. - * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - */ -void CharacterData::deleteData(unsigned int offset, unsigned int count) -{ - if (isReadOnly()) - throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, "node is read only"); - try - { - nodeValue_.erase(offset, count); - } - catch (std::out_of_range&) - { - throw DOMException(DOMException::INDEX_SIZE_ERR, "offset out of range"); - } -} - -/** -* Replaces the characters specified by the given string. -* @param[in] offset The offset of the first character to be replaced. -* @param[in] count The number of characters to replace. -* @param[in] arg The other string that will be copied. -* @exception DOMException -* INDEX_SIZE_ERR: Raised if the specified offset is -* greater than the number of characters in data. -* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. -*/void CharacterData::replaceData(unsigned int offset, unsigned int count, const std::string& arg) -{ - if (isReadOnly()) - { - throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, "node is read only"); - } - try - { - nodeValue_.replace(offset, count, arg); - } - catch (std::out_of_range&) - { - throw DOMException(DOMException::INDEX_SIZE_ERR, "offset out of range"); - } -} - -}} \ No newline at end of file diff --git a/webfront/DOM/xmldoc_character_data.h b/webfront/DOM/xmldoc_character_data.h deleted file mode 100644 index 2701d3be..00000000 --- a/webfront/DOM/xmldoc_character_data.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_CHARACTER_DATA_H_ -#define __WEBFRONT_XMLDOC_CHARACTER_DATA_H_ - -#include "xmldoc_node.h" - -namespace WebFront { namespace XMLDoc { - -class CharacterData : public Node -{ -public: - - const std::string& getData() const; - void setData(const std::string& data) throw(DOMException); - unsigned int getLength() const; - std::string substringData(unsigned int offset, unsigned int count) const throw(DOMException); - void appendData(const std::string& arg); - void insertData(unsigned int offset, const std::string& arg) throw(DOMException); - void deleteData(unsigned int offset, unsigned int count) throw(DOMException); - void replaceData(unsigned int offset, unsigned int count, const std::string& arg) throw(DOMException); - -protected: - CharacterData(unsigned short nodeType) : Node(nodeType) {} - -}; - - -}} -#endif // __WEBFRONT_XMLDOC_CHARACTER_DATA_H_ \ No newline at end of file diff --git a/webfront/DOM/xmldoc_comment.h b/webfront/DOM/xmldoc_comment.h deleted file mode 100644 index f66b5792..00000000 --- a/webfront/DOM/xmldoc_comment.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_COMMENT_H_ -#define __WEBFRONT_XMLDOC_COMMENT_H_ - -#include "xmldoc_character_data.h" - -namespace WebFront { namespace XMLDoc -{ - -class Comment : public CharacterData -{ -protected: - Comment() : CharacterData(COMMENT_NODE) {} - friend class Document; - -}; - -}} -#endif // __WEBFRONT_XMLDOC_COMMENT_H_ diff --git a/webfront/DOM/xmldoc_document.cpp b/webfront/DOM/xmldoc_document.cpp deleted file mode 100644 index 4076ba8a..00000000 --- a/webfront/DOM/xmldoc_document.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#include "xmldoc_document.h" -#include "xmldoc_attr.h" -#include "xmldoc_c_data_section.h" -#include "xmldoc_comment.h" -#include "xmldoc_document_fragment.h" -#include "xmldoc_document_type.h" -#include "xmldoc_dom_implementation.h" -#include "xmldoc_element.h" -#include "xmldoc_entity_reference.h" -#include "xmldoc_node_list.h" -#include "xmldoc_processing_instruction.h" -#include "xmldoc_text.h" - -namespace WebFront { namespace XMLDoc { - -std::shared_ptr Document::getDoctype() -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::shared_ptr Document::getImplementation() const -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::shared_ptr Document::getDocumentElement() const -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::unique_ptr Document::createElement(const std::string& tagName) const -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::unique_ptr Document::createDocumentFragment() const -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::unique_ptr Document::createTextNode(const std::string& data) const -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::unique_ptr Document::createComment(const std::string& data) const -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::unique_ptr Document::createCDATASection(const std::string& data) const -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::unique_ptr Document::createProcessingInstruction( - const std::string& target, const std::string& data) const -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::unique_ptr Document::createAttribute(const std::string& name) const -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::unique_ptr Document::createEntityReference(const std::string& name) const -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::shared_ptr Document::getElementsByTagName(const std::string& tagname) const -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::shared_ptr Document::importNode(std::shared_ptr importedNode, bool deep) const -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::unique_ptr Document::createElementNS( - const std::string& namespaceURI, const std::string& qualifiedName) -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::unique_ptr Document::createAttributeNS( - const std::string& namespaceURI, const std::string& qualifiedName) -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::shared_ptr Document::getElementsByTagNameNS( - const std::string& namespaceURI, const std::string& localName) const -{ - // NOT IMPLEMENTED - return nullptr; -} - -std::shared_ptr Document::getElementById(const std::string& elementId) -{ - // NOT IMPLEMENTED - return nullptr; -} - -}} \ No newline at end of file diff --git a/webfront/DOM/xmldoc_document.h b/webfront/DOM/xmldoc_document.h deleted file mode 100644 index ed6451c2..00000000 --- a/webfront/DOM/xmldoc_document.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_DOCUMENT_H_ -#define __WEBFRONT_XMLDOC_DOCUMENT_H_ - -#include "xmldoc_node.h" - -namespace WebFront { namespace XMLDoc { - -class DocumentType; -class DOMImplementation; -class Element; -class DocumentFragment; -class Text; -class Comment; -class CDATASection; -class ProcessingInstruction; -class Attr; -class EntityReference; -class NodeList; - -class Document : public Node -{ -public: - std::shared_ptr getDoctype(); - std::shared_ptr getImplementation() const; - std::shared_ptr getDocumentElement() const; - std::unique_ptr createElement(const std::string& tagName) const throw(DOMException); - std::unique_ptr createDocumentFragment() const; - std::unique_ptr createTextNode(const std::string& data) const; - std::unique_ptr createComment(const std::string& data) const; - std::unique_ptr createCDATASection(const std::string& data) const throw(DOMException); - std::unique_ptr createProcessingInstruction(const std::string& target, - const std::string& data) const throw(DOMException); - std::unique_ptr createAttribute(const std::string& name) const throw(DOMException); - std::unique_ptr createEntityReference(const std::string& name) const throw(DOMException); - std::shared_ptr getElementsByTagName(const std::string& tagname) const; - std::shared_ptr importNode(std::shared_ptr importedNode, bool deep) const throw(DOMException); - - std::unique_ptr createElementNS(const std::string& namespaceURI, - const std::string& qualifiedName) throw(DOMException); - std::unique_ptr createAttributeNS(const std::string& namespaceURI, - const std::string& qualifiedName) throw(DOMException); - std::shared_ptr getElementsByTagNameNS(const std::string& namespaceURI, - const std::string& localName) const; - std::shared_ptr getElementById(const std::string& elementId); - -protected: - Document() : Node(DOCUMENT_NODE) {} - friend class DOMImplementation; - -}; - - -}} -#endif // __WEBFRONT_XMLDOC_DOCUMENT_H_ diff --git a/webfront/DOM/xmldoc_document_fragment.h b/webfront/DOM/xmldoc_document_fragment.h deleted file mode 100644 index 9133aec6..00000000 --- a/webfront/DOM/xmldoc_document_fragment.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_DOCUMENT_FRAGMENT_H_ -#define __WEBFRONT_XMLDOC_DOCUMENT_FRAGMENT_H_ - -#include "xmldoc.h" - -namespace WebFront { namespace XMLDoc -{ - -class DocumentFragment : public Node -{ -protected: - DocumentFragment() : Node(DOCUMENT_FRAGMENT_NODE) {} - friend class Document; -}; - -}} -#endif // __WEBFRONT_XMLDOC_DOCUMENT_FRAGMENT_H_ diff --git a/webfront/DOM/xmldoc_document_type.cpp b/webfront/DOM/xmldoc_document_type.cpp deleted file mode 100644 index 9f2fce62..00000000 --- a/webfront/DOM/xmldoc_document_type.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "xmldoc_document_type.h" - -namespace WebFront { namespace XMLDoc { - - /** - * The name of DTD (immediately following the DOCTYPE keyword. - */ -std::string DocumentType::getName() const -{ - return name_; -} - - -/** - * A NamedNodeMap containing the general entities declared in the DTD. - */ -std::unique_ptr DocumentType::getEntities() const -{ - return nullptr; -} - - -/** - * A NamedNodeMap containing the notations declared in the DTD. - */ -std::unique_ptr DocumentType::getNotations() const -{ - return nullptr; -} - - -/** - * The public identifier of the external subset. - */ -const std::string& DocumentType::getPublicId() const -{ - return public_id_; -} - - -/** - * The system identifier of the external subset. - */ -const std::string& DocumentType::getSystemId() const -{ - return system_id_; -} - - -/** - * The internal subset. - */ -const std::string& DocumentType::getInternalSubset() const -{ - return internal_subset_; -} - -}} \ No newline at end of file diff --git a/webfront/DOM/xmldoc_document_type.h b/webfront/DOM/xmldoc_document_type.h deleted file mode 100644 index 78a600f3..00000000 --- a/webfront/DOM/xmldoc_document_type.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_DOCUMENT_TYPE_H_ -#define __WEBFRONT_XMLDOC_DOCUMENT_TYPE_H_ - -#include "xmldoc_node.h" - -namespace WebFront { namespace XMLDoc { - -class DocumentType : public Node -{ -public: - std::string getName() const; - std::unique_ptr getEntities() const; - std::unique_ptr getNotations() const; - const std::string& getPublicId() const; - const std::string& getSystemId() const; - const std::string& getInternalSubset() const; - - -private: - friend class DOMImplementation; - DocumentType() : Node(DOCUMENT_TYPE_NODE) {} - -private: - std::string name_, public_id_, system_id_, internal_subset_; -}; - - -}} -#endif // __WEBFRONT_XMLDOC_DOCUMENT_TYPE_H_ \ No newline at end of file diff --git a/webfront/DOM/xmldoc_dom_exception.h b/webfront/DOM/xmldoc_dom_exception.h deleted file mode 100644 index a0394d26..00000000 --- a/webfront/DOM/xmldoc_dom_exception.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_DOM_EXCEPTION_H_ -#define __WEBFRONT_XMLDOC_DOM_EXCEPTION_H_ - -#include -#include - -namespace WebFront { namespace XMLDoc { - -class DOMException : public std::runtime_error -{ -public: - DOMException(short code, const std::string& message) : runtime_error(message) { code_ = code; } - short code_; - - // ExceptionCode - static const short INDEX_SIZE_ERR = 1, DOMSTRING_SIZE_ERR = 2, HIERARCHY_REQUEST_ERR = 3, - WRONG_DOCUMENT_ERR = 4, INVALID_CHARACTER_ERR = 5, NO_DATA_ALLOWED_ERR = 6, - NO_MODIFICATION_ALLOWED_ERR = 7, NOT_FOUND_ERR = 8, NOT_SUPPORTED_ERR = 9, - INUSE_ATTRIBUTE_ERR = 10, INVALID_STATE_ERR = 11, SYNTAX_ERR = 12, - INVALID_MODIFICATION_ERR = 13, NAMESPACE_ERR = 14, INVALID_ACCESS_ERR = 15; -}; - - #pragma warning(disable: 4290) // Visual Studio does not implement checked exceptions. -}} -#endif // __WEBFRONT_XMLDOC_DOM_EXCEPTION_H_ \ No newline at end of file diff --git a/webfront/DOM/xmldoc_dom_implementation.cpp b/webfront/DOM/xmldoc_dom_implementation.cpp deleted file mode 100644 index 1d8d655b..00000000 --- a/webfront/DOM/xmldoc_dom_implementation.cpp +++ /dev/null @@ -1,165 +0,0 @@ -#include "xmldoc_dom_implementation.h" -#include "xmldoc_document_type.h" -#include "xmldoc_document.h" -#include - - -class WebFront::XMLDoc::DOMImplementation::Impl -{ -public: - bool hasFeature(std::string feature_name, const std::string& version_name) const - { - auto feature = getFeature(feature_name); - if (feature) - { - if (version_name.empty()) - { - return true; - } - else - if (feature->SupportVersion(version_name)) - { - return true; - } - } - return false; - } - -private: - struct Feature - { - std::string name_; - std::list supported_versions_; - bool SupportVersion(const std::string& version) const - { - for (auto supported_version : supported_versions_) - { - if (0 == supported_version.compare(version)) - return true; - } - return false; - } - }; - std::list features_; - -private: - - void addFeature(std::string feature_name, std::string version_name) - { - auto feature = getFeature(feature_name); - if (feature) - { - if (!feature->SupportVersion(version_name)) - { - feature->supported_versions_.push_back(version_name); - } - } - else - { - Feature feat; - feat.name_=feature_name; - feat.supported_versions_.push_back(version_name); - features_.push_back(feat); - } - } - - std::shared_ptr getFeature(std::string feature_name) const - { - std::transform(feature_name.begin(), feature_name.end(), feature_name.begin(), ::tolower); - for (auto feature : features_) - { - if (0 == feature.name_.compare(feature_name)) - { - return std::make_shared(feature); - } - } - return nullptr; - } - - -}; - -namespace WebFront { namespace XMLDoc { - DOMImplementation::DOMImplementation() : impl_(new Impl) {} - DOMImplementation::~DOMImplementation() {} - - /** - * Test if the DOM implementation implements a specific feature. - * @param feature The name of the feature to test (case-insensitive). - * @param version Version number of the feature to test. - * @return true if the feature is implemented in the - * specified version, false otherwise. - */ - bool DOMImplementation::hasFeature(const std::string& feature, const std::string& version) const - { - return impl_->hasFeature(feature, version); - } - - /** - * Creates an empty DocumentType node. - */ - std::unique_ptr DOMImplementation::createDocumentType( - const std::string& qualifiedName, - const std::string& publicId, - const std::string& systemId) const - { - std::unique_ptr doctype(new DocumentType); - doctype->name_=qualifiedName; - doctype->public_id_=publicId; - doctype->system_id_=systemId; - - return doctype; - } - - /** - * Creates an XML Document object of the specified type with - * its document element. HTML-only DOM implementations do not need to - * implement this method. - * @param[in] namespaceURI The namespace URI of the document element to create. - * @param[in] qualifiedName The qualified name of the document element to be - * created. - * @param doctype The type of document to be created or nullptr. - * When doctype is not nullptr, its - * Node.ownerDocument attribute is set to the document - * being created. - * @return A new Document object. - * @exception DOMException - * INVALID_CHARACTER_ERR: Raised if the specified qualified name - * contains an illegal character. - *
NAMESPACE_ERR: Raised if the qualifiedName is - * malformed, if the qualifiedName has a prefix and the - * namespaceURI is null, or if the - * qualifiedName has a prefix that is "xml" and the - * namespaceURI is different from " - * http://www.w3.org/XML/1998/namespace" . - *
WRONG_DOCUMENT_ERR: Raised if doctype has already - * been used with a different document or was created from a different - * implementation. - * @since DOM Level 2 - */ - std::shared_ptr DOMImplementation::createDocument( - const std::string& namespaceURI, - const std::string& qualifiedName, - std::shared_ptr doctype) const - { - std::shared_ptr new_doc(new Document); - new_doc->namespace_uri_ = namespaceURI; - new_doc->nodeName_ = qualifiedName; - - if (nullptr == doctype->getOwnerDocument()) - { - doctype->ownerDocument_ = new_doc; - } - else - { - if (new_doc != doctype->getOwnerDocument()) - { - throw DOMException(DOMException::WRONG_DOCUMENT_ERR, "Doctype has already been used with a different document"); - } - } - - return new_doc; - - } - -}} \ No newline at end of file diff --git a/webfront/DOM/xmldoc_dom_implementation.h b/webfront/DOM/xmldoc_dom_implementation.h deleted file mode 100644 index b85e4d7b..00000000 --- a/webfront/DOM/xmldoc_dom_implementation.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_DOM_IMPLEMENTATION_H_ -#define __WEBFRONT_XMLDOC_DOM_IMPLEMENTATION_H_ - -#include "xmldoc_document.h" -#include "xmldoc_document_type.h" - -namespace WebFront { namespace XMLDoc { - -class DOMImplementation -{ -public: - DOMImplementation(); - ~DOMImplementation(); - bool hasFeature(const std::string& feature, const std::string& version) const; - std::unique_ptr createDocumentType( - const std::string& qualifiedName, - const std::string& publicId, - const std::string& systemId) const throw(DOMException); - std::shared_ptr createDocument( - const std::string& namespaceURI, - const std::string& qualifiedName, - const std::shared_ptr doctype) const throw(DOMException); - -private: - class Impl; - std::unique_ptr impl_; -}; - -}} -#endif // __WEBFRONT_XMLDOC_DOM_IMPLEMENTATION_H_ \ No newline at end of file diff --git a/webfront/DOM/xmldoc_element.cpp b/webfront/DOM/xmldoc_element.cpp deleted file mode 100644 index 418ec477..00000000 --- a/webfront/DOM/xmldoc_element.cpp +++ /dev/null @@ -1,164 +0,0 @@ -#include "xmldoc_element.h" -#include "xmldoc_attr.h" -#include "xmldoc_document.h" -#include "xmldoc_node_list.h" - -namespace WebFront { namespace XMLDoc { - - -/** - * The name of the element. - */ -const std::string& Element::getTagName() const -{ - return getNodeName(); -} - - -/** - * Retrieves an attribute value by name. - * @param[in] name The name of the attribute to retrieve. - * @return The attribute value. -*/ -std::string Element::getAttribute(const std::string& name) const -{ - auto attribute = getAttributeNode(name); - if (attribute) - { - return attribute->getNodeValue(); - } - return std::string(); -} - - -/** - * Adds a new attribute. - * @param[in] name The name of the attribute to create or alter. - * @param[in] value Value to set in string form. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - */ -void Element::setAttribute(const std::string& name, const std::string& value) -{ - if (isReadOnly()) throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, "node is read only"); - auto attribute = getAttributeNode(name); - if (nullptr == attribute) - { - auto new_attribute = getOwnerDocument()->createAttribute(name); - new_attribute->setValue(value); - appendChild(new_attribute); - } - else - { - attribute->setNodeValue(value); - } -} - -/** - * Removes an attribute by name. - * @param[in] name The name of the attribute to remove. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - */ -void Element::removeAttribute(const std::string& name) -{ - if (isReadOnly()) throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, "node is read only"); - auto attribute = getAttributeNode(name); - if (nullptr != attribute) - { - removeAttributeNode(attribute); - } -} - - -/** - * Retrieves an attribute node by name. - * @param[in] name The name of the attribute to retrieve. - * @return The Attr node with the specified name ( - * nodeName) or nullptr. - */ -std::shared_ptr Element::getAttributeNode(const std::string& name) const -{ - for (auto node : childNodes_) - { - if (ATTRIBUTE_NODE == node->getNodeType()) - { - auto attr = std::static_pointer_cast(node); - if (0 == name.compare(attr->getNodeName())) - { - return attr; - } - } - } - return nullptr; -} - - -/** - * Removes the given attribute node. - * @param old_attr The Attr node to remove. - * @return The Attr node that was removed. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - *
NOT_FOUND_ERR: Raised if oldAttr is not an attribute - * of the element. - */ -std::shared_ptr Element::removeAttributeNode(std::shared_ptr old_attr) -{ - removeChild(old_attr); - return old_attr; -} - - -/** - * Returns a NodeList of all descendant Elements with a given tag name. - * @param[in] tag_name The name of the tag to match on. The special value "*" - * matches all tags. - * @return A list of matching Element nodes. - */ -std::unique_ptr Element::getElementsByTagName(const std::string& tag_name) const -{ - std::list> tagged_list; - auto node = getFirstChild(); - while (nullptr != node) - { - if (ELEMENT_NODE == node->getNodeType()) - { - if (0 == tag_name.compare(std::static_pointer_cast(node)->getTagName()) - || tag_name == "*") - { - tagged_list.push_back(node); - } - } - if (node->hasChildNodes()) - { - node = node->getFirstChild(); - } - else - { - while (nullptr == node->getNextSibling() && node.get() != this) - { - node = node->getParentNode(); - } - node = node->getNextSibling(); - } - } - return std::unique_ptr(new NodeList(tagged_list)); -} - - -/** -* Returns true if named attribute exists. -* @param[in] name The name of the attribute to look for. -* @return true if an attribute with the given name is -* specified on this element or has a default value, false -* otherwise. -*/ -bool Element::hasAttribute(const std::string& name) const -{ - return (getAttributeNode(name) != nullptr); -} - - - -}}; \ No newline at end of file diff --git a/webfront/DOM/xmldoc_element.h b/webfront/DOM/xmldoc_element.h deleted file mode 100644 index cd80f3ab..00000000 --- a/webfront/DOM/xmldoc_element.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_ELEMENT_H_ -#define __WEBFRONT_XMLDOC_ELEMENT_H_ - -#include "xmldoc_node.h" - -namespace WebFront { namespace XMLDoc { - -class Attr; -class Element : public Node -{ -public: - const std::string& getTagName() const; - - std::string getAttribute(const std::string& name) const; - void setAttribute(const std::string& name, const std::string& value) throw(DOMException); - void removeAttribute(const std::string& name) throw(DOMException); - std::shared_ptr getAttributeNode(const std::string& name) const; - std::shared_ptr setAttributeNode(std::shared_ptr new_attr); - std::shared_ptr removeAttributeNode(std::shared_ptr old_attr) throw(DOMException); - std::unique_ptr getElementsByTagName(const std::string& tag_name) const; - bool hasAttribute(const std::string& name) const; - -protected: - Element(); - friend class Document; -}; - - -}} -#endif // __WEBFRONT_XMLDOC_ELEMENT_H_ \ No newline at end of file diff --git a/webfront/DOM/xmldoc_entity_reference.h b/webfront/DOM/xmldoc_entity_reference.h deleted file mode 100644 index 83c43165..00000000 --- a/webfront/DOM/xmldoc_entity_reference.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_ENTITY_REFERENCE_H_ -#define __WEBFRONT_XMLDOC_ENTITY_REFERENCE_H_ - -#include "xmldoc_text.h" - -namespace WebFront { namespace XMLDoc { - -class EntityReference : public Node -{ -protected: - EntityReference() : Node(ENTITY_REFERENCE_NODE) {} - friend class Document; -}; - - -}} -#endif // __WEBFRONT_XMLDOC_ENTITY_REFERENCE_H_ \ No newline at end of file diff --git a/webfront/DOM/xmldoc_named_node_map.cpp b/webfront/DOM/xmldoc_named_node_map.cpp deleted file mode 100644 index 6964bebe..00000000 --- a/webfront/DOM/xmldoc_named_node_map.cpp +++ /dev/null @@ -1,141 +0,0 @@ -#include "xmldoc_named_node_map.h" -#include "xmldoc_node.h" -#include "xmldoc_attr.h" - -namespace WebFront { namespace XMLDoc -{ - NamedNodeMap::NamedNodeMap() : read_only_(false) - { - } - - - /** - * Retrieves a node specified by name. - * @param[in] name The nodeName of the node to retrieve. - * @return A Node with the specified nodeName of nullptr/ - */ - std::shared_ptr NamedNodeMap::getNamedItem(const std::string& name) const - { - try - { - return nodes_.at(name); - } - catch (std::out_of_range&) - { - return nullptr; - } - } - - - /** - * Adds a node using its nodeName attribute. If a node with - * that name is already present in this map, it is replaced by the new - * one. - * @param[in] node The node to store in the map. - * @return If the new Node replaces an existing node, the replaced node - * is returned, otherwise nullptr is returned. - * @exception DOMException - * WRONG_DOCUMENT_ERR: Raised if node was created from a - * different document than the one that created this map. - *
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly. - *
INUSE_ATTRIBUTE_ERR: Raised if node is an - * Attr that is already an attribute of another - * Element object. The DOM user must explicitly clone - * Attr nodes to re-use them in other elements. - */ - std::shared_ptr NamedNodeMap::setNamedItem(std::shared_ptr node) - { - if (node->getOwnerDocument() != owner_document_) - { - throw DOMException(DOMException::WRONG_DOCUMENT_ERR, - "node was created from a different document than the one that created this NamedNodeMap."); - } - - if (read_only_) - { - throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, "NamedNodeMap is readonly."); - } - - if (Node::ATTRIBUTE_NODE == node->getNodeType()) - { - if (nullptr != std::static_pointer_cast(node)->getOwnerElement()) - { - throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR, "node is already an attribute of another Element."); - } - } - - auto old_node_iter = nodes_.find(node->getNodeName()); - std::shared_ptr old_node; - if (nodes_.end() == old_node_iter) - { - old_node = nullptr; - } - else - { - old_node = old_node_iter->second; - } - - nodes_[node->getNodeName()] = node; - return old_node; - } - - - /** - * Removes a node specified by name. - * @param[in] name The nodeName of the node to remove. - * @return The node removed from this map if a node with such a name - * exists. - * @exception DOMException - * NOT_FOUND_ERR: Raised if there is no node named name in - * this map. - *
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly. - */ - std::shared_ptr NamedNodeMap::removeNamedItem(const std::string& name) - { - if (read_only_) - { - throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, "NamedNodeMap is readonly."); - } - auto old_node_iter = nodes_.find(name); - if (nodes_.end() == old_node_iter) - { - throw DOMException(DOMException::NOT_FOUND_ERR, "No node with this name found."); - } - return old_node_iter->second; - - } - - - /** - * Returns the indexth item in the map. If index - * is greater than or equal to the number of nodes in this map, this - * returns nullptr. - * @param[in] index Index into this map. - * @return The node at the indexth position in the map, or - * nullptr if that is not a valid index. - */ - std::shared_ptr NamedNodeMap::item(unsigned int index) const - { - for (auto node : nodes_) - { - if (0 == index) - { - return node.second; - } - else - { - index--; - } - } - return nullptr; - } - - /** - * The number of nodes in this map. - * @return The number of nodes in this map. - */ - unsigned int NamedNodeMap::getLength() const - { - return nodes_.size(); - } -}} \ No newline at end of file diff --git a/webfront/DOM/xmldoc_named_node_map.h b/webfront/DOM/xmldoc_named_node_map.h deleted file mode 100644 index 155ce1f5..00000000 --- a/webfront/DOM/xmldoc_named_node_map.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_NAMED_NODE_MAP_H_ -#define __WEBFRONT_XMLDOC_NAMED_NODE_MAP_H_ - -#include "xmldoc_dom_exception.h" -#include -#include - -namespace WebFront { namespace XMLDoc -{ -class Node; -class NamedNodeMap -{ -public: - - std::shared_ptr getNamedItem(const std::string& name) const; - std::shared_ptr setNamedItem(std::shared_ptr node) throw(DOMException); - std::shared_ptr removeNamedItem(const std::string& name) throw(DOMException); - std::shared_ptr item(unsigned int index) const; - unsigned int getLength() const; - -private: - NamedNodeMap(); - friend class Document; - - std::shared_ptr owner_document_; - std::unordered_map> nodes_; - bool read_only_; -}; - -}} -#endif // __WEBFRONT_XMLDOC_NAMED_NODE_MAP_H_ \ No newline at end of file diff --git a/webfront/DOM/xmldoc_node.cpp b/webfront/DOM/xmldoc_node.cpp deleted file mode 100644 index 2e05605a..00000000 --- a/webfront/DOM/xmldoc_node.cpp +++ /dev/null @@ -1,195 +0,0 @@ -#include "xmldoc_node.h" -#include "xmldoc_node_list.h" - -namespace WebFront { namespace XMLDoc { - -Node::Node(short type) : nodeType_(type), flags_(0) -{ -} - - -const std::string& Node::getNodeName() const -{ - return nodeName_; -} - - -const std::string& Node::getNodeValue() const -{ - return nodeValue_; -} - - -void Node::setNodeValue(std::string nodeValue) -{ - if (isReadOnly()) - { - throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, "node is read only"); - } - nodeValue_ = nodeValue; -} - - -short Node::getNodeType() const -{ - return nodeType_; -} - - -std::shared_ptr Node::getParentNode() const -{ - return parentNode_; -} - - -std::shared_ptr Node::getFirstChild() const -{ - return firstChild_; -} - - -std::shared_ptr Node::getLastChild() const -{ - return lastChild_; -} - - -std::shared_ptr Node::getPreviousSibling() const -{ - return previousSibling_; -} - - -std::shared_ptr Node::getNextSibling() const -{ - return nextSibling_; -} - - -std::unique_ptr Node::getAttributes() const -{ - // NOT IMPLEMENTED - return nullptr; -} - - -std::shared_ptr Node::getOwnerDocument() const -{ - // NOT IMPLEMENTED - return nullptr; -} - - -std::shared_ptr Node::insertBefore( std::shared_ptr new_child, - std::shared_ptr ref_child) -{ - // NOT IMPLEMENTED - return nullptr; -} - - -std::shared_ptr Node::replaceChild( std::shared_ptr new_child, - std::shared_ptr old_child) -{ - // NOT IMPLEMENTED - return nullptr; -} - - -/** - * Removes the given child node. - * @param[in] old_child The node to remove. - * @return The node that was removed. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - *
NOT_FOUND_ERR: Raised if oldAttr is not an attribute - * of the element. - */ -std::shared_ptr Node::removeChild(std::shared_ptr old_child) -{ - if (isReadOnly()) throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, "node is read only"); - for (auto node : childNodes_) - { - if (node == old_child) - { - removeChild(old_child); - return node; - } - } - throw DOMException(DOMException::NOT_FOUND_ERR, "not an attribute of the element"); -} - - -std::shared_ptr Node::appendChild(std::shared_ptr new_child) -{ - // NOT IMPLEMENTED - return nullptr; -} - - -bool Node::hasChildNodes() const -{ - return nodes_count_ > 0; -} - - -std::unique_ptr Node::cloneNode(bool deep) const -{ - // NOT IMPLEMENTED - return nullptr; -} - - -void Node::normalize() -{ - // NOT IMPLEMENTED -} - - -bool Node::isSupported(const std::string& feature, const std::string& version) const -{ - // NOT IMPLEMENTED - return false; -} - - -const std::string& Node::getNamespaceURI() const -{ - // NOT IMPLEMENTED - return namespace_uri_; -} - - -const std::string& Node::getPrefix() const -{ - return prefix_; -} - - -void Node::setPrefix(const std::string& prefix) -{ - prefix_ = prefix; -} - - -const std::string& Node::getLocalName() const -{ - // NOT IMPLEMENTED - return nodeName_; -} - - -bool Node::hasAttributes() const -{ - // NOT IMPLEMENTED - return false; -} - - -std::unique_ptr Node::getChildNodes() const -{ - return std::unique_ptr(new NodeList(childNodes_)); -} - - -}} \ No newline at end of file diff --git a/webfront/DOM/xmldoc_node.h b/webfront/DOM/xmldoc_node.h deleted file mode 100644 index 3e8ffacf..00000000 --- a/webfront/DOM/xmldoc_node.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_NODE_H_ -#define __WEBFRONT_XMLDOC_NODE_H_ - -#include -#include -#include -#include "xmldoc_dom_exception.h" -#include "xmldoc_named_node_map.h" - -namespace WebFront { namespace XMLDoc { - -class Document; -class NodeList; -class Node -{ -public: - static const short ELEMENT_NODE = 1, ATTRIBUTE_NODE = 2, TEXT_NODE = 3, CDATA_SECTION_NODE = 4, - ENTITY_REFERENCE_NODE = 5, ENTITY_NODE = 6, PROCESSING_INSTRUCTION_NODE = 7, - COMMENT_NODE = 8, DOCUMENT_NODE = 9, DOCUMENT_TYPE_NODE = 10, - DOCUMENT_FRAGMENT_NODE = 11, NOTATION_NODE = 12; -public: - const std::string& getNodeName() const; - const std::string& getNodeValue() const; - void setNodeValue(std::string nodeValue) throw(DOMException); - short getNodeType() const; - - std::shared_ptr getParentNode() const; - std::unique_ptr getChildNodes() const; - std::shared_ptr getFirstChild() const; - std::shared_ptr getLastChild() const; - std::shared_ptr getPreviousSibling() const; - std::shared_ptr getNextSibling() const; - std::unique_ptr getAttributes() const; - std::shared_ptr getOwnerDocument() const; - std::shared_ptr insertBefore( std::shared_ptr new_child, - std::shared_ptr ref_child) throw(DOMException); - std::shared_ptr replaceChild( std::shared_ptr new_child, - std::shared_ptr old_child) throw(DOMException); - std::shared_ptr removeChild(std::shared_ptr old_child) throw(DOMException); - std::shared_ptr appendChild(std::shared_ptr new_child) throw(DOMException); - bool hasChildNodes() const; - std::unique_ptr cloneNode(bool deep) const; - void normalize(); - bool isSupported(const std::string& feature, const std::string& version) const; - const std::string& getNamespaceURI() const; - const std::string& getPrefix() const; - void setPrefix(const std::string& prefix); - const std::string& getLocalName() const; - bool hasAttributes() const; - - - // std::unique_ptr helpers - template std::shared_ptr appendChild(std::unique_ptr& newChild) throw(DOMException) - { return appendChild(std::shared_ptr(newChild.get())); } - template std::shared_ptr insertBefore(std::unique_ptr& newChild, - std::shared_ptr refChild) throw(DOMException) - { return insertBefore(std::shared_ptr(newChild.get()), refChild); } - template std::shared_ptr replaceChild(std::unique_ptr& newChild, - std::shared_ptr oldChild) throw(DOMException) - { return replaceChild(std::shared_ptr(newChild.get()), oldChild); } - - - -protected: - std::vector> childNodes_; - std::string nodeValue_; - -private: - std::unordered_map attributes_indexes_; - std::string nodeName_; - std::string namespace_uri_; - - std::shared_ptr parentNode_; - std::shared_ptr nextSibling_, previousSibling_; - std::shared_ptr firstChild_, lastChild_; - std::shared_ptr ownerDocument_; - - unsigned int nodes_count_; - short nodeType_; - std::string prefix_; - -private: - enum NodeFlags { kReadOnly = 0x1<<1 }; - unsigned short flags_; - -protected: - friend class DOMImplementation; - Node(short type); - - bool isReadOnly() const { return (flags_ & kReadOnly) !=0; }; - void setReadOnly(bool read_only) { flags_ = (read_only ? flags_ | kReadOnly : flags_ & ~kReadOnly); } - -}; - -}} -#endif // __WEBFRONT_XMLDOC_NODE_H_ \ No newline at end of file diff --git a/webfront/DOM/xmldoc_node_list.h b/webfront/DOM/xmldoc_node_list.h deleted file mode 100644 index 3a472802..00000000 --- a/webfront/DOM/xmldoc_node_list.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_NODE_LIST_H_ -#define __WEBFRONT_XMLDOC_NODE_LIST_H_ - -#include "xmldoc.h" -#include -namespace WebFront { namespace XMLDoc -{ -class Node; -class NodeList -{ -public: - template NodeList(const NodesContainer& container) - { nodes_.resize(container.size()); std::copy(container.cbegin(), container.cend(), nodes_.begin()); } - - size_t length() const { return nodes_.size(); } - std::shared_ptr item(size_t index) const { if (index operator[](size_t index) const { return item(index); } -private: - std::vector> nodes_; -}; - -}} -#endif // __WEBFRONT_XMLDOC_NODE_LIST_H_ \ No newline at end of file diff --git a/webfront/DOM/xmldoc_processing_instruction.h b/webfront/DOM/xmldoc_processing_instruction.h deleted file mode 100644 index ab68152a..00000000 --- a/webfront/DOM/xmldoc_processing_instruction.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_PROCESSING_INSTRUCTION_H_ -#define __WEBFRONT_XMLDOC_PROCESSING_INSTRUCTION_H_ - -#include "xmldoc_node.h" - -namespace WebFront { namespace XMLDoc { - -class ProcessingInstruction : public Node -{ -public: - const std::string& getTarget() const; - const std::string& getData() const; - void setData(const std::string& data) throw(DOMException); - -protected: - ProcessingInstruction() : Node(PROCESSING_INSTRUCTION_NODE) {} - friend class Document; -}; - - -}} -#endif // __WEBFRONT_XMLDOC_PROCESSING_INSTRUCTION_H_ \ No newline at end of file diff --git a/webfront/DOM/xmldoc_text.cpp b/webfront/DOM/xmldoc_text.cpp deleted file mode 100644 index f6a546f0..00000000 --- a/webfront/DOM/xmldoc_text.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "xmldoc_text.h" - -namespace WebFront { namespace XMLDoc { - - -/** - * Splits this node into two nodes at the specified offset. - * @param[in] offset The offset at which to split. - * @return The new node. - * @exception DOMException - * INDEX_SIZE_ERR: Raised if the specified offset is out of range. - *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - */ -std::shared_ptr Text::splitText(unsigned int offset) -{ - /*NOT IMPLEMENTED*/ -/* -* keeping both in the tree as siblings. After being split, this node -* will contain all the content up to the offset point. A -* new node of the same type, which contains all the content at and -* after the offset point, is returned. If the original -* node had a parent node, the new node is inserted as the next sibling -* of the original node. When the offset is equal to the -* length of this node, the new node has no data. -*/ - return nullptr; -} - -}} \ No newline at end of file diff --git a/webfront/DOM/xmldoc_text.h b/webfront/DOM/xmldoc_text.h deleted file mode 100644 index 949939b5..00000000 --- a/webfront/DOM/xmldoc_text.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __WEBFRONT_XMLDOC_TEXT_H_ -#define __WEBFRONT_XMLDOC_TEXT_H_ - -#include "xmldoc_character_data.h" - -namespace WebFront { namespace XMLDoc { - - -class Text : public CharacterData -{ -public: - std::shared_ptr splitText(unsigned int offset) throw(DOMException); - -protected: - Text() : CharacterData(TEXT_NODE) {} - friend class Document; -}; - - -}} -#endif // __WEBFRONT_XMLDOC_TEXT_H_ \ No newline at end of file diff --git a/webfront/net/Socket.hpp b/webfront/net/Socket.hpp deleted file mode 100644 index 0821ad48..00000000 --- a/webfront/net/Socket.hpp +++ /dev/null @@ -1,184 +0,0 @@ -/// @date 13/08/2015 -/// @author Ambroise Leclerc -/// -/// socket base classes for MSVC, Linux and Cygwin. -/// -#pragma once -#include "SocketLibOS.hpp" - -#include -#include -#include -#include - -namespace webfront { -namespace net { - -class SocketLib; -class IPv4; - -class SocketException : public std::runtime_error { -public: - explicit SocketException(const std::string& what) : std::runtime_error(what) {} -}; - -class TimeoutException : public std::runtime_error { -public: - explicit TimeoutException(const std::string& what) : std::runtime_error(what) {} -}; - - -template -class Socket : public SockLib, public IPv { -public: - Socket() noexcept : sock(SockLib::invalidSocket) {} - - ~Socket() { - if (sock != SockLib::invalidSocket) { - close(); - } - } - - /// Shutdown and close a socket - void close() { - auto toClose = sock; - sock = SockLib::invalidSocket; - if (toClose != SockLib::invalidSocket) { - ::shutdown(toClose, static_cast(SockLib::Shutdown::ReadWrite)); - SockLib::closeSocket(toClose); - } - } - - void bind() { - if (::bind(sock, reinterpret_cast(&this->sockAddr), sizeof(this->sockAddr)) < 0) - throw SocketException("Error on binding"); - } - - void listen() { - if (::listen(sock, SOMAXCONN) < 0) - throw SocketException("Error on listen"); - } - - Socket accept() { - Socket client; - decltype(IPv::sockAddr) addr; - socklen_t addrSize = sizeof(IPv::sockAddr); - client.sock = ::accept(sock, reinterpret_cast(&addr), &addrSize); - if (client.sock < 0) - throw SocketException("ERROR on accept"); - - return client; - } - - /// Ping the target address - /// @return <0> number of replies, 0 if host is unreachable - /// @return <1> round trip time - std::tuple ping() const noexcept { return SockLib::ping(IPv::getIP()); } - - static constexpr auto nbReplies = 0; - static constexpr auto roundtripTime = 0; - -protected: - typename SockLib::SocketType sock; - - enum class Option { ReuseAddr = SO_REUSEADDR, RcvTimeout = SO_RCVTIMEO, RcvBufferSize = SO_RCVBUF, TTL = IP_TTL }; - enum class Level : uint16_t { Socket = SOL_SOCKET, IP = IPPROTO_IP }; - - /// Set socket option (i.e. setsockopt) - /// @param option option to be modified - /// @param value value which will be affected to option - /// @param level - template - void setOption(Option option, ValueType value, Level level = Level::Socket) const { - auto errorCode = setsockopt(sock, static_cast(level), static_cast(option), - reinterpret_cast(&value), static_cast(sizeof(ValueType))); - if (errorCode == SockLib::socketError) - throw SocketException(std::string("In Socket::setOption : ") + SockLib::getErrorText()); - } - - /// Get socket option (i.e. getsockopt) - /// @param option option from which the value will be get - /// @tparam ValueType type of option's value - template - ValueType getOption(Option option, Level level = Level::Socket) const { - ValueType value; - auto valueSize = static_cast(sizeof(ValueType)); - auto errorCode = ::getsockopt(sock, static_cast(level), static_cast(option), reinterpret_cast(&value), - reinterpret_cast(&valueSize)); - if (errorCode == SockLib::socketError) - throw SocketException(std::string("In Socket::getOption : ") + SockLib::getErrorText()); - - return value; - } -}; - -class IPv4 { -public: - IPv4() noexcept : sockAddr{aiFamily, 0, INADDR_ANY, {}} {} - - std::string getAddress() const noexcept { - char ip[INET_ADDRSTRLEN]; - auto addr = sockAddr.sin_addr; - inet_ntop(aiFamily, &addr, ip, INET_ADDRSTRLEN); - return ip; - } - - auto getIP() const noexcept { return sockAddr.sin_addr.s_addr; } - - void setPort(const sockaddr* addr) noexcept { sockAddr.sin_port = reinterpret_cast(addr)->sin_port; } - void setPort(uint16_t port) noexcept { sockAddr.sin_port = port; } - -protected: - sockaddr_in sockAddr; - static constexpr auto aiFamily = AF_INET; - static constexpr int protoIcmp = IPPROTO_ICMP; -}; - -class IPv6 { -public: - IPv6() noexcept : sockAddr{aiFamily, 0, 0, in6addr_any, 0} {} - - std::string getAddress() const noexcept { - char ip[INET6_ADDRSTRLEN]; - auto addr = sockAddr.sin6_addr; - inet_ntop(aiFamily, &addr, ip, INET6_ADDRSTRLEN); - return ip; - } - - auto getIP() const noexcept { return sockAddr; } - - void setPort(const sockaddr* addr) noexcept { sockAddr.sin6_port = reinterpret_cast(addr)->sin6_port; } - void setPort(uint16_t port) noexcept { sockAddr.sin6_port = port; } - -protected: - sockaddr_in6 sockAddr; - static constexpr auto aiFamily = AF_INET6; - static constexpr int protoIcmp = IPPROTO_ICMPV6; -}; - -class SocketLib : public SocketLibOS { -public: - static void closeSocket(SocketType socket) { - if (!SocketLibOS::closeSocket(socket)) { - throw SocketException("In SocketLib::closeSocket : " + getErrorText()); - } - } - - static void shutdown(SocketType socket, Shutdown direction = Shutdown::ReadWrite) { - if (::shutdown(socket, static_cast(direction)) == socketError) { - throw SocketException("In SocketLib::shutdown : " + getErrorText()); - } - } -}; - -class ScopeExitGuard { - std::function f; -public: - template ScopeExitGuard(Callable&& f) : f(std::forward(f)) {} - ~ScopeExitGuard() { try { f(); } catch(...) {} } -}; - - - -} // namespace net -} // namespace webfront diff --git a/webfront/net/SocketLibOS.hpp b/webfront/net/SocketLibOS.hpp deleted file mode 100644 index d89ec86c..00000000 --- a/webfront/net/SocketLibOS.hpp +++ /dev/null @@ -1,163 +0,0 @@ -/// @date 13/08/2015 -/// @author Ambroise Leclerc -/// -/// OS abstration layers for socket libraries. -/// -#pragma once -#include -#include -#include -#include - - -#ifdef WIN32 -#include -#include -#include -#include -#pragma comment(lib, "Ws2_32.lib") -#pragma comment(lib, "iphlpapi.lib") - -namespace webfront { -namespace net { - -class SocketLibOS { -public: - static bool initializeLib() noexcept { - WSADATA wsa_data; - int init_value = WSAStartup(MAKEWORD(2, 2), &wsa_data); - return init_value == 0; - } - - static void cleanupLib() noexcept { WSACleanup(); } - -protected: - using SocketType = SOCKET; - using SockLen = int; - static const SocketType invalidSocket = INVALID_SOCKET; - static const int socketError = SOCKET_ERROR; - enum class Shutdown { Read = SD_SEND, Write = SD_RECEIVE, ReadWrite = SD_BOTH }; - enum class Error { Timeout = WSAETIMEDOUT, WouldBlock = WSAEWOULDBLOCK }; - - static bool closeSocket(SocketType socket) noexcept { return closesocket(socket) != socketError; } - - static auto getLastError() { return WSAGetLastError(); } - static std::string getErrorText(bool prependErrorId = true) { return getErrorText(getLastError(), prependErrorId); } - static std::string getErrorText(int error, bool prependErrorId = true) { - LPVOID lpMsgBuf; - auto bufLen = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - nullptr, error, 0, reinterpret_cast(&lpMsgBuf), 0, nullptr); - if (bufLen) { - auto lpMsgStr = reinterpret_cast(lpMsgBuf); - std::string result(lpMsgStr, lpMsgStr + bufLen); - LocalFree(lpMsgBuf); - if (prependErrorId) { - result.insert(0, std::to_string(error) + ":"); - } - return result; - } - return std::string(); - } - - static std::tuple ping(uint32_t address) noexcept { - auto icmpFile = IcmpCreateFile(); - - if (icmpFile == INVALID_HANDLE_VALUE) return std::make_tuple(uint8_t(0), std::chrono::milliseconds{0}); - - std::array sendBuffer{"Data Buffer"}; - std::array replyBuffer; - auto replies = - static_cast(IcmpSendEcho(icmpFile, address, sendBuffer.data(), static_cast(sendBuffer.size()), nullptr, - replyBuffer.data(), static_cast(replyBuffer.size()), 1000)); - IcmpCloseHandle(icmpFile); - return std::make_tuple( - replies, std::chrono::microseconds(reinterpret_cast(replyBuffer.data())->RoundTripTime * 1000)); - } - - static constexpr auto toTimeout(const std::chrono::microseconds value) noexcept { - return static_cast(value.count() / 1000); - } -}; -#else -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace webfront { -namespace net { - -class SocketLibOS { -protected: - static auto getLastError() { return errno; } - -public: - static bool initializeLib() noexcept { return true; } - static void cleanupLib() noexcept {} - - static std::string getErrorText(bool prependErrorId = true) { return getErrorText(getLastError(), prependErrorId); } - static std::string getErrorText(int error, bool prependErrorId = true) { - auto errorText = strerror(error); - std::string result(errorText ? errorText : ""); - if (prependErrorId) { - result.insert(0, std::to_string(error) + ":"); - } - return result; - } - - static std::tuple ping(uint32_t address) noexcept { - using namespace std; - using namespace string_literals; - - char addrStrBuffer[INET_ADDRSTRLEN]; - string addressText = inet_ntop(AF_INET, &address, addrStrBuffer, INET_ADDRSTRLEN); - auto command = ::popen(("/bin/ping -c 1 "s + addressText).c_str(), "r"); - if (command == nullptr) return make_tuple(0, std::chrono::microseconds{0}); - - auto nbReplies = 0; - auto tripTime = .0; - regex replyRegex(".*time=\\s*([0-9]+(\\.[0-9]+)?)\\s*ms.*\n*$"); - cmatch timeResult; - array reply; - - while (::fgets(reply.data(), reply.size() - 1, command) != nullptr) { - if (regex_match(reply.data(), timeResult, replyRegex)) { - nbReplies++; - tripTime += stod(timeResult.str(1)); - } - } - if (nbReplies == 0) return make_tuple(0, std::chrono::microseconds{0}); - - return make_tuple(nbReplies, std::chrono::microseconds{uint32_t(1000. * tripTime / nbReplies)}); - } - - static constexpr auto toTimeout(std::chrono::microseconds uSec) noexcept { - timeval timeoutTimeValue{static_cast(uSec.count() / 1000000u), - static_cast(uSec.count() % 1000000u)}; - - return timeoutTimeValue; - } - -protected: - using SocketType = int; - using SockLen = socklen_t; - static const SocketType invalidSocket = -1; - static const int socketError = -1; - - enum class Shutdown { Read = SHUT_RD, Write = SHUT_WR, ReadWrite = SHUT_RDWR }; - enum class Error { Timeout = EAGAIN, WouldBlock = EWOULDBLOCK }; - - static bool closeSocket(SocketType socket) { return ::close(socket) != socketError; } -}; - -#endif - -} // namespace net -} // namespace webfront diff --git a/webfront/net/TCPServer.hpp b/webfront/net/TCPServer.hpp deleted file mode 100644 index 05ae7d5b..00000000 --- a/webfront/net/TCPServer.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#include "Socket.hpp" - -#include -#include -#include - -namespace webfront { -namespace net { - -class TCPClient { -public: - std::function)> onReceive; -}; - -template -class TCPServer : private Socket { - using Sock = Socket; - -public: - TCPServer(uint16_t port) { - Sock::sock = socket(IPv::aiFamily, SOCK_STREAM, 0); - if (Sock::sock < 0) throw SocketException("Error opening socket"); - - IPv::setPort(port); - Sock::bind(); - Sock::listen(); - - std::cout << "waiting clients on port " << port << '\n'; - Sock::accept(); - std::cout << "end\n"; - } - - void start() { - } - -public: - std::function)> onNewClient; -}; - - -} // namespace net -} // namespace webfront \ No newline at end of file diff --git a/webfront/net/UDPSocket.hpp b/webfront/net/UDPSocket.hpp deleted file mode 100644 index 92b06b28..00000000 --- a/webfront/net/UDPSocket.hpp +++ /dev/null @@ -1,108 +0,0 @@ -/// @date 13/08/2015 -/// @author Ambroise Leclerc -/// -/// UDP/IP(v4/v6) socket class for MSVC, Linux and Cygwin. -#pragma once -#include "Socket.hpp" - -#include - -namespace webfront { -namespace net { - -template -class UDPSocket : public Socket { - using Sock = Socket; - -public: - static constexpr size_t maxMessageSize = maxDatagramSize; - -public: - /// Initializes an UDP socket and associates it with the given address - /// @param address host name of dotted-decimal IPv4 address or IPv6 hex address - /// @param service service name or port number (i.e. "80" or "http") - void initialize(const std::string& address, const std::string& service) { - addrinfo* addrInfo; - addrinfo hints = {}; - - hints.ai_family = IPv::aiFamily; - hints.ai_socktype = SOCK_DGRAM; - hints.ai_protocol = IPPROTO_UDP; - hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG; - - auto status = getaddrinfo(address.c_str(), service.c_str(), &hints, &addrInfo); - if (status != 0) throw SocketException(std::string("In UDPSocket::initialize getaddrinfo : ") + gai_strerror(status)); - - ScopeExitGuard releaseAddrinfo([addrInfo]() { freeaddrinfo(addrInfo); }); - - Sock::sock = socket(addrInfo->ai_family, addrInfo->ai_socktype, addrInfo->ai_protocol); - if (Sock::sock == SockLib::invalidSocket) - throw SocketException(std::string("In UDPSocket::initialize socket : ") + SockLib::getErrorText()); - - Sock::setOption(Sock::Option::ReuseAddr, int(1)); - - IPv::setPort(addrInfo->ai_addr); - IPv::sockAddr.sin_addr.s_addr = INADDR_ANY; - - if (::bind(Sock::sock, reinterpret_cast(&this->sockAddr), sizeof(IPv::sockAddr)) == - SockLib::socketError) { - auto errorText = SockLib::getErrorText(); - SocketLib::closeSocket(Sock::sock); - throw SocketException(std::string("In UDPSocket::initialize bind : ") + errorText); - } - - IPv::sockAddr = *(reinterpret_cast(addrInfo->ai_addr)); - - if (::connect(Sock::sock, reinterpret_cast(&this->sockAddr), sizeof(IPv::sockAddr)) == SockLib::socketError) - throw SocketException(std::string("In UDPSocket::initialize connect : ") + SockLib::getErrorText()); - } - - template - void setReceiveTimeout(std::chrono::duration timeout) const { - auto uSec = std::chrono::duration_cast(timeout); - Sock::setOption(Sock::Option::RcvTimeout, SockLib::toTimeout(uSec)); - } - - void enlargeReceiveBufferSize(size_t size) const { - auto actualBufferSize = static_cast(Sock::template getOption(Sock::Option::RcvBufferSize)); - if (actualBufferSize < size) Sock::setOption(Sock::Option::RcvBufferSize, static_cast(size)); - } - - /// Send data - /// @tparam Buffer a type which exposes data() and size() members - /// @param buffer data to be sent - template - void send(Buffer buffer) const { - auto data = reinterpret_cast(buffer.data()); - auto remainingDataToSend = static_cast(buffer.size()); - while (remainingDataToSend > 0) { - auto sent = ::send(Sock::sock, data, static_cast(std::min(maxDatagramSize, remainingDataToSend)), 0); - if (sent == SockLib::socketError) - throw SocketException(std::string("In UDPSocket::send : ") + SockLib::getErrorText()); - remainingDataToSend -= sent; - data += sent; - } - } - - /// Receive a datagram - /// @param buffer pointer on the buffer which will receive the data - /// @return number of received bytes - size_t receive(std::span buffer) const { - auto received = ::recv(Sock::sock, reinterpret_cast(buffer.data()), static_cast(buffer.size()), 0); - - if (received == SockLib::socketError) { - auto error = Sock::getLastError(); - auto errorNo = static_cast(error); - if ((errorNo == SockLib::Error::Timeout) || (errorNo == SockLib::Error::WouldBlock)) - throw TimeoutException("Timeout on UDPSocket::receive"); - - throw SocketException(std::string("In UDPSocket::receive : ") + SockLib::getErrorText(error)); - } - - return received; - } -}; - -} // namespace net -} // namespace webfront - diff --git a/webfront/system/Socket.hpp b/webfront/system/Socket.hpp deleted file mode 100644 index 2fd1e8db..00000000 --- a/webfront/system/Socket.hpp +++ /dev/null @@ -1,149 +0,0 @@ -/// @date 13/08/2015 -/// @author Ambroise Leclerc -/// -/// socket base classes for MSVC, Linux and Cygwin. -/// -#pragma once -#include - -#include -#include -#include -#include - -namespace webfront { -namespace net { - -class SocketLib; -class IPv4; -class SocketException; - -template -class Socket : public SockLib, public IPv { -public: - Socket() noexcept : sock(SockLib::invalidSocket) {} - - ~Socket() { - if (sock != SockLib::invalidSocket) { - close(); - } - } - - /// Shutdown and close a socket - void close() { - auto toClose = sock; - sock = SockLib::invalidSocket; - if (toClose != SockLib::invalidSocket) { - ::shutdown(toClose, static_cast(SockLib::Shutdown::ReadWrite)); - SockLib::closeSocket(toClose); - } - } - - /// Ping the target address - /// @return <0> number of replies, 0 if host is unreachable - /// @return <1> round trip time - std::tuple ping() const noexcept { return SockLib::ping(IPv::getIP()); } - - static constexpr auto nbReplies = 0; - static constexpr auto roundtripTime = 0; - -protected: - typename SockLib::SocketType sock; - - enum class Option { ReuseAddr = SO_REUSEADDR, RcvTimeout = SO_RCVTIMEO, RcvBufferSize = SO_RCVBUF, TTL = IP_TTL }; - enum class Level : uint16_t { Socket = SOL_SOCKET, IP = IPPROTO_IP }; - - /// Set socket option (i.e. setsockopt) - /// @param option option to be modified - /// @param value value which will be affected to option - /// @param level - template - void setOption(Option option, ValueType value, Level level = Level::Socket) const { - auto errorCode = setsockopt(sock, static_cast(level), static_cast(option), - reinterpret_cast(&value), static_cast(sizeof(ValueType))); - if (errorCode == SockLib::socketError) - throw SocketException(std::string("In Socket::setOption : ") + SockLib::getErrorText()); - } - - /// Get socket option (i.e. getsockopt) - /// @param option option from which the value will be get - /// @tparam ValueType type of option's value - template - ValueType getOption(Option option, Level level = Level::Socket) const { - ValueType value; - auto valueSize = static_cast(sizeof(ValueType)); - auto errorCode = ::getsockopt(sock, static_cast(level), static_cast(option), reinterpret_cast(&value), - reinterpret_cast(&valueSize)); - if (errorCode == SockLib::socketError) - throw SocketException(std::string("In Socket::getOption : ") + SockLib::getErrorText()); - - return value; - } -}; - -class IPv4 { -public: - IPv4() noexcept : sockAddr{aiFamily, 0, INADDR_ANY, {}} {} - - std::string getAddress() const noexcept { - char ip[INET_ADDRSTRLEN]; - auto addr = sockAddr.sin_addr; - inet_ntop(aiFamily, &addr, ip, INET_ADDRSTRLEN); - return ip; - } - - auto getIP() const noexcept { return sockAddr.sin_addr.s_addr; } - - void setPort(const sockaddr* addr) noexcept { sockAddr.sin_port = reinterpret_cast(addr)->sin_port; } - -protected: - sockaddr_in sockAddr; - static constexpr auto aiFamily = AF_INET; - static constexpr int protoIcmp = IPPROTO_ICMP; -}; - -class IPv6 { -public: - IPv6() noexcept : sockAddr{aiFamily, 0, 0, in6addr_any, 0} {} - - std::string getAddress() const noexcept { - char ip[INET6_ADDRSTRLEN]; - auto addr = sockAddr.sin6_addr; - inet_ntop(aiFamily, &addr, ip, INET6_ADDRSTRLEN); - return ip; - } - - auto getIP() const noexcept { return sockAddr; } - - void setPort(const sockaddr* addr) noexcept { sockAddr.sin6_port = reinterpret_cast(addr)->sin6_port; } - -protected: - sockaddr_in6 sockAddr; - static constexpr auto aiFamily = AF_INET6; - static constexpr int protoIcmp = IPPROTO_ICMPV6; -}; - -class SocketLib : public SocketLibOS { -public: - static void closeSocket(SocketType socket) { - if (!SocketLibOS::closeSocket(socket)) { - throw SocketException("In SocketLib::closeSocket : " + getErrorText()); - } - } - - static void shutdown(SocketType socket, Shutdown direction = Shutdown::ReadWrite) { - if (::shutdown(socket, static_cast(direction)) == socketError) { - throw SocketException("In SocketLib::shutdown : " + getErrorText()); - } - } -}; - -class SocketException : public std::runtime_error { -public: - explicit SocketException(const std::string& what) : std::runtime_error(what) {} -}; - - - -} // namespace net -} // namespace webfront diff --git a/webfront/system/SocketLibOS.hpp b/webfront/system/SocketLibOS.hpp deleted file mode 100644 index 9db87434..00000000 --- a/webfront/system/SocketLibOS.hpp +++ /dev/null @@ -1,159 +0,0 @@ -/// @date 13/08/2015 -/// @author Ambroise Leclerc -/// -/// OS abstration layers for socket libraries. -/// -#pragma once -#include -#include -#include -#include - -#ifdef WIN32 -#include -#include -#include -#include -#pragma comment(lib, "Ws2_32.lib") -#pragma comment(lib, "iphlpapi.lib") - -namespace webfront { -namespace net { - -class SocketLibOS { -public: - static bool initializeLib() noexcept { - WSADATA wsa_data; - int init_value = WSAStartup(MAKEWORD(2, 2), &wsa_data); - return init_value == 0; - } - - static void cleanupLib() noexcept { WSACleanup(); } - -protected: - using SocketType = SOCKET; - using SockLen = int; - static const SocketType invalidSocket = INVALID_SOCKET; - static const int socketError = SOCKET_ERROR; - enum class Shutdown { Read = SD_SEND, Write = SD_RECEIVE, ReadWrite = SD_BOTH }; - enum class Error { Timeout = WSAETIMEDOUT, WouldBlock = WSAEWOULDBLOCK }; - - static bool closeSocket(SocketType socket) noexcept { return closesocket(socket) != socketError; } - - static auto getLastError() { return WSAGetLastError(); } - static std::string getErrorText(bool prependErrorId = true) { return getErrorText(getLastError(), prependErrorId); } - static std::string getErrorText(int error, bool prependErrorId = true) { - LPVOID lpMsgBuf; - auto bufLen = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - nullptr, error, 0, reinterpret_cast(&lpMsgBuf), 0, nullptr); - if (bufLen) { - auto lpMsgStr = reinterpret_cast(lpMsgBuf); - std::string result(lpMsgStr, lpMsgStr + bufLen); - LocalFree(lpMsgBuf); - if (prependErrorId) { - result.insert(0, std::to_string(error) + ":"); - } - return result; - } - return std::string(); - } - - static std::tuple ping(uint32_t address) noexcept { - auto icmpFile = IcmpCreateFile(); - - if (icmpFile == INVALID_HANDLE_VALUE) return std::make_tuple(uint8_t(0), std::chrono::milliseconds{0}); - - std::array sendBuffer{"Data Buffer"}; - std::array replyBuffer; - auto replies = - static_cast(IcmpSendEcho(icmpFile, address, sendBuffer.data(), static_cast(sendBuffer.size()), nullptr, - replyBuffer.data(), static_cast(replyBuffer.size()), 1000)); - IcmpCloseHandle(icmpFile); - return std::make_tuple( - replies, std::chrono::microseconds(reinterpret_cast(replyBuffer.data())->RoundTripTime * 1000)); - } - - static constexpr auto toTimeout(const std::chrono::microseconds value) noexcept { - return static_cast(value.count() / 1000); - } -}; -#else -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -class SocketLibOS { -protected: - static auto getLastError() { return errno; } - -public: - static bool initializeLib() noexcept { return true; } - static void cleanupLib() noexcept {} - - static std::string getErrorText(bool prependErrorId = true) { return getErrorText(getLastError(), prependErrorId); } - static std::string getErrorText(int error, bool prependErrorId = true) { - auto errorText = strerror(error); - std::string result(errorText ? errorText : ""); - if (prependErrorId) { - result.insert(0, std::to_string(error) + ":"); - } - return result; - } - - static std::tuple ping(uint32_t address) noexcept { - using namespace std; - using namespace string_literals; - - char addrStrBuffer[INET_ADDRSTRLEN]; - string addressText = inet_ntop(AF_INET, &address, addrStrBuffer, INET_ADDRSTRLEN); - auto command = ::popen(("/bin/ping -c 1 "s + addressText).c_str(), "r"); - if (command == nullptr) return make_tuple(0, std::chrono::microseconds{0}); - - auto nbReplies = 0; - auto tripTime = .0; - regex replyRegex(".*time=\\s*([0-9]+(\\.[0-9]+)?)\\s*ms.*\n*$"); - cmatch timeResult; - array reply; - - while (::fgets(reply.data(), reply.size() - 1, command) != nullptr) { - if (regex_match(reply.data(), timeResult, replyRegex)) { - nbReplies++; - tripTime += stod(timeResult.str(1)); - } - } - if (nbReplies == 0) return make_tuple(0, std::chrono::microseconds{0}); - - return make_tuple(nbReplies, std::chrono::microseconds{uint32_t(1000. * tripTime / nbReplies)}); - } - - static constexpr auto toTimeout(std::chrono::microseconds uSec) noexcept { - timeval timeoutTimeValue{static_cast(uSec.count() / 1000000u), - static_cast(uSec.count() % 1000000u)}; - - return timeoutTimeValue; - } - -protected: - using SocketType = int; - using SockLen = socklen_t; - static const SocketType invalidSocket = -1; - static const int socketError = -1; - - enum class Shutdown { Read = SHUT_RD, Write = SHUT_WR, ReadWrite = SHUT_RDWR }; - enum class Error { Timeout = EAGAIN, WouldBlock = EWOULDBLOCK }; - - static bool closeSocket(SocketType socket) { return ::close(socket) != socketError; } -}; - -#endif - -} // namespace net -} // namespace webfront diff --git a/webfront/system/UDPSocket.hpp b/webfront/system/UDPSocket.hpp deleted file mode 100644 index 12445303..00000000 --- a/webfront/system/UDPSocket.hpp +++ /dev/null @@ -1,107 +0,0 @@ -/// @date 13/08/2015 -/// @author Ambroise Leclerc -/// -/// UDP/IP(v4/v6) socket class for MSVC, Linux and Cygwin. -#pragma once -#include -#include - -namespace webfront { -namespace net { - -template -class UDPSocket : public Socket { - using Sock = Socket; - -public: - static constexpr size_t maxMessageSize = maxDatagramSize; - -public: - /// Initializes an UDP socket and associates it with the given address - /// @param address host name of dotted-decimal IPv4 address or IPv6 hex address - /// @param service service name or port number (i.e. "80" or "http") - void initialize(const std::string& address, const std::string& service) { - addrinfo* addrInfo; - addrinfo hints = {}; - - hints.ai_family = IPv::aiFamily; - hints.ai_socktype = SOCK_DGRAM; - hints.ai_protocol = IPPROTO_UDP; - hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG; - - auto status = getaddrinfo(address.c_str(), service.c_str(), &hints, &addrInfo); - if (status != 0) throw SocketException(std::string("In UDPSocket::initialize getaddrinfo : ") + gai_strerror(status)); - - ScopeExitGuard releaseAddrinfo([addrInfo]() { freeaddrinfo(addrInfo); }); - - Sock::sock = socket(addrInfo->ai_family, addrInfo->ai_socktype, addrInfo->ai_protocol); - if (Sock::sock == SockLib::invalidSocket) - throw SocketException(std::string("In UDPSocket::initialize socket : ") + SockLib::getErrorText()); - - Sock::setOption(Sock::Option::ReuseAddr, int(1)); - - IPv::setPort(addrInfo->ai_addr); - IPv::sockAddr.sin_addr.s_addr = INADDR_ANY; - - if (::bind(Sock::sock, reinterpret_cast(&this->sockAddr), sizeof(IPv::sockAddr)) == - SockLib::socketError) { - auto errorText = SockLib::getErrorText(); - SocketLib::closeSocket(Sock::sock); - throw SocketException(std::string("In UDPSocket::initialize bind : ") + errorText); - } - - IPv::sockAddr = *(reinterpret_cast(addrInfo->ai_addr)); - - if (::connect(Sock::sock, reinterpret_cast(&this->sockAddr), sizeof(IPv::sockAddr)) == SockLib::socketError) - throw SocketException(std::string("In UDPSocket::initialize connect : ") + SockLib::getErrorText()); - } - - template - void setReceiveTimeout(std::chrono::duration timeout) const { - auto uSec = std::chrono::duration_cast(timeout); - Sock::setOption(Sock::Option::RcvTimeout, SockLib::toTimeout(uSec)); - } - - void enlargeReceiveBufferSize(size_t size) const { - auto actualBufferSize = static_cast(Sock::template getOption(Sock::Option::RcvBufferSize)); - if (actualBufferSize < size) Sock::setOption(Sock::Option::RcvBufferSize, static_cast(size)); - } - - /// Send data - /// @tparam Buffer a type which exposes data() and size() members - /// @param buffer data to be sent - template - void send(Buffer buffer) const { - auto data = reinterpret_cast(buffer.data()); - auto remainingDataToSend = static_cast(buffer.size()); - while (remainingDataToSend > 0) { - auto sent = ::send(Sock::sock, data, static_cast(std::min(maxDatagramSize, remainingDataToSend)), 0); - if (sent == SockLib::socketError) - throw SocketException(std::string("In UDPSocket::send : ") + SockLib::getErrorText()); - remainingDataToSend -= sent; - data += sent; - } - } - - /// Receive a datagram - /// @param buffer pointer on the buffer which will receive the data - /// @return number of received bytes - size_t receive(std::span buffer) const { - auto received = ::recv(Sock::sock, reinterpret_cast(buffer.data()), static_cast(buffer.size()), 0); - - if (received == SockLib::socketError) { - auto error = Sock::getLastError(); - auto errorNo = static_cast(error); - if ((errorNo == SockLib::Error::Timeout) || (errorNo == SockLib::Error::WouldBlock)) - throw TimeoutException("Timeout on UDPSocket::receive"); - - throw SocketException(std::string("In UDPSocket::receive : ") + SockLib::getErrorText(error)); - } - - return received; - } -}; - -} // namespace net -} // namespace webfront - diff --git a/webfront/utils/Delegate.hpp b/webfront/utils/Delegate.hpp deleted file mode 100644 index a6b3d80c..00000000 --- a/webfront/utils/Delegate.hpp +++ /dev/null @@ -1,59 +0,0 @@ -/// @data 31/07/2017 19:32:53 -/// @author Ambroise Leclerc -/// @brief Webfront main UI -// -// Copyright (c) 2017, Ambroise Leclerc -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in -// the documentation and/or other materials provided with the -// distribution. -// * Neither the name of the copyright holders nor the names of -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -#include -#include - -template -class Delegate { -public: - void call(DelegateArgs... args) { - for (auto& callee : delegates) - callee(args...); - } - - Delegate& operator+=(std::function func) { - delegates.push_back(func); - return *this; - } - - Delegate& operator=(std::function func) { - delegates.clear(); - delegates.push_back(func); - return *this; - } - - bool isDefined() const { return !delegates.empty(); } - -private: - std::list> delegates; -}; \ No newline at end of file diff --git a/webfront/utils/StringHash.hpp b/webfront/utils/StringHash.hpp deleted file mode 100644 index 20c97e35..00000000 --- a/webfront/utils/StringHash.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/// @data 31/07/2017 19:32:53 -/// @author Ambroise Leclerc -/// @brief StringHash provides constexpr string hash function in order to generate -/// compile-time integer hashes for string : -/// switch (StringHash::calc(command.c_str())) { -/// case "click"_hash : onClick.call(); break; -/// case "mouseup"_hash : onMouseUp.call(); break; -/// } - -// -// Copyright (c) 2017, Ambroise Leclerc -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in -// the documentation and/or other materials provided with the -// distribution. -// * Neither the name of the copyright holders nor the names of -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -#include - -class StringHash { -public: - using type = uint32_t; - - static type calc(const char* zStr, type seed = 0) { - while (*zStr) { - seed = seed * 101 + *zStr++; - } - return seed; - } - - template - static type calc(Iter first, Iter last, type seed = 0) { - while (first != last) { - seed = seed * 101 + *first++; - } - return seed; - } - - - -private: - static constexpr type compileTime(const char* zStr, type seed = 0) { - return *zStr ? (compileTime(zStr + 1, (seed * 101ull) + *zStr)) : seed; - } - - friend constexpr type operator""_hash(char const* zStr, size_t); -}; - -constexpr StringHash::type operator""_hash(char const* zStr, size_t) { - return StringHash::compileTime(zStr); -} From debc04b819194a69175f8bb3f265043a17b42c7b Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Wed, 21 Oct 2026 22:45:20 +0200 Subject: [PATCH 002/134] Reduce asset check cost and parallelize CI tests [#298] --- .github/workflows/BuildAndTest.yml | 49 +++++++-- AGENTS.md | 10 +- README.md | 9 +- cmake/CheckCEFTestingState.cmake | 7 ++ cmake/CheckFrontendSelection.cmake | 14 ++- cmake/CheckNewcomerDocs.cmake | 2 +- cmake/EmbedTextAsset.cmake | 78 +++----------- cmake/WebFrontAssets.cmake | 4 + docs/EMBEDDED_ASSETS.md | 11 +- docs/PROJECT_STATUS.md | 24 +++++ docs/TEST_PERFORMANCE.md | 160 +++++++++++++++++++++++++++++ test/CMakeLists.txt | 11 +- test/DefaultFSTests.cpp | 22 +--- test/DeveloperTests.cpp | 2 +- test/NativeFSTests.cpp | 11 +- tools/assets/embed.mjs | 67 ++++++++++++ tools/assets/embed.test.mjs | 147 ++++++++++++++++++++++++++ tools/assets/gzip.mjs | 7 -- webtest/CMakeLists.txt | 9 +- 19 files changed, 525 insertions(+), 119 deletions(-) create mode 100644 docs/TEST_PERFORMANCE.md create mode 100644 tools/assets/embed.mjs create mode 100644 tools/assets/embed.test.mjs delete mode 100644 tools/assets/gzip.mjs diff --git a/.github/workflows/BuildAndTest.yml b/.github/workflows/BuildAndTest.yml index cb18157a..71f16a96 100644 --- a/.github/workflows/BuildAndTest.yml +++ b/.github/workflows/BuildAndTest.yml @@ -8,6 +8,11 @@ on: schedule: - cron: '23 4 * * 1' workflow_dispatch: + inputs: + repeat_desktop_tests: + description: 'Also run the desktop matrix, repeating each CTest case three times' + type: boolean + default: false permissions: contents: read @@ -24,8 +29,8 @@ env: # Third-party actions are pinned to commit SHAs; GitHub-owned actions/* use version tags. jobs: desktop: - # PR/push jobs already cover desktops; manual runs add only the extended checks. - if: github.event_name != 'workflow_dispatch' + # Manual runs normally add only extended checks; stability checks opt into desktops. + if: github.event_name != 'workflow_dispatch' || inputs.repeat_desktop_tests # No `name:` expression: a skipped matrix job would display it unevaluated. timeout-minutes: 25 strategy: @@ -134,7 +139,10 @@ jobs: - name: Test C++ and native browser integration # Only Linux trusted fixtures need the sandbox opt-out on hosted runners. env: ${{ matrix.test_env }} - run: ctest --test-dir build -C ${{ matrix.build_type }} --output-on-failure --no-tests=error + run: >- + ctest --test-dir build -C ${{ matrix.build_type }} --output-on-failure --no-tests=error --parallel 4 + --repeat until-fail:${{ github.event_name == 'workflow_dispatch' && inputs.repeat_desktop_tests && '3' || '1' }} + --output-junit "${{ github.workspace }}/build/test-results.xml" - name: Collect coverage if: runner.os == 'Linux' working-directory: build @@ -150,12 +158,15 @@ jobs: files: build/coverage.info fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} - - name: Retain diagnostics - if: failure() + - name: Retain test timings and diagnostics + if: always() uses: actions/upload-artifact@v4 with: name: test-log-${{ runner.os }} - path: build/Testing/Temporary/LastTest.log + path: | + build/test-results.xml + build/Testing/Temporary/LastTest.log + if-no-files-found: ignore sanitizers: if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' @@ -202,7 +213,18 @@ jobs: - name: Build run: cmake --build build-sanitizers --parallel 2 - name: Run full CEF-off suite - run: ctest --test-dir build-sanitizers --output-on-failure --no-tests=error + run: >- + ctest --test-dir build-sanitizers --output-on-failure --no-tests=error --parallel 4 + --output-junit "${{ github.workspace }}/build-sanitizers/test-results.xml" + - name: Retain test timings and diagnostics + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-log-${{ matrix.sanitizer }} + path: | + build-sanitizers/test-results.xml + build-sanitizers/Testing/Temporary/LastTest.log + if-no-files-found: ignore - name: Fuzz decoders (30 seconds each) if: matrix.sanitizer == 'address-undefined' shell: bash @@ -268,4 +290,15 @@ jobs: run: cmake --build ${{github.workspace}}/build-cef --target webtest developer_integration --parallel 2 - name: Run Jasmine bridge test - run: ctest --test-dir ${{github.workspace}}/build-cef -L web-integration --output-on-failure --no-tests=error + run: >- + ctest --test-dir ${{github.workspace}}/build-cef -L web-integration --output-on-failure --no-tests=error --parallel 4 + --output-junit "${{ github.workspace }}/build-cef/test-results.xml" + - name: Retain test timings and diagnostics + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-log-cef-${{ matrix.compiler }} + path: | + build-cef/test-results.xml + build-cef/Testing/Temporary/LastTest.log + if-no-files-found: ignore diff --git a/AGENTS.md b/AGENTS.md index d8304aff..5252faea 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -48,7 +48,7 @@ cmake --build . --parallel 2 cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \ -DWEBFRONT_EMBED_CEF=OFF -DENABLE_TESTING=ON cmake --build build --parallel -ctest --test-dir build --output-on-failure +ctest --test-dir build --output-on-failure --parallel 4 # Run one Catch2 scenario directly ./build/test/tests "Scenario: JsFunction" @@ -57,12 +57,16 @@ ctest --test-dir build --output-on-failure cmake -S . -B build-cef -DCMAKE_BUILD_TYPE=Release \ -DWEBFRONT_EMBED_CEF=ON -DENABLE_TESTING=ON cmake --build build-cef --target webtest --parallel -ctest --test-dir build-cef -L web-integration --output-on-failure +ctest --test-dir build-cef -L web-integration --output-on-failure --parallel 4 ``` Important CMake options: +Tests and the `webfront-embedded-assets` regeneration target require Node.js for all +assets, including uncompressed ones. Normal C++ builds consume versioned headers +and do not require Node.js. + - `WEBFRONT_EMBED_CEF=OFF` (default): CEF is unavailable; this is the normal unit-test build. `ON` downloads/links CEF and enables the automated browser test; it makes `CEFFrontend` available but does not select it: `webfront::WebFront` always uses the system browser. - `WEBFRONT_EMBED_WEBVIEW2=OFF` (default): Windows-only opt-in SDK and static loader for `WebView2Frontend`; requires the separately installed Evergreen runtime. Select it explicitly with `WebFrontWithFrontend`. With tests enabled, `WEBFRONT_WEBTEST_FRONTEND=WebView2` runs the shared Jasmine suite and lifecycle cases. - `WEBFRONT_EMBED_WKWEBVIEW=OFF` (default): macOS 13.3+ opt-in Cocoa/WebKit frontend, with no engine download. Select `WebFrontWithFrontend` on the main thread; `WEBFRONT_WEBTEST_FRONTEND=WKWebView` runs Jasmine and lifecycle coverage. @@ -99,7 +103,7 @@ Exception: a purely C++ change that reuses an existing encoding, introduces no n - Every bug fix needs a failing regression test at the lowest useful level. Bridge changes also need the browser integration test. - Tests must not require user input, a fixed pre-existing browser session, or public network access after dependencies are configured. -Before declaring work complete, run the CEF-off build and CTest suite. Run the CEF/Xvfb test when changing the bridge, browser lifecycle, module serving, Jasmine assets, or CEF frontend. These PRs must also dispatch `BuildAndTest.yml` on the PR head branch before merging (`gh workflow run BuildAndTest.yml --ref `), then wait for both GCC and Clang CEF jobs to pass. Manual dispatch runs the extended CEF/sanitizer checks without repeating the desktop matrix. It is the required per-PR CEF validation for these changes; the weekly run is a backstop, not a substitute. Update README/status documentation when commands, public behavior, or limitations change. The `NewcomerDocsMatchExamples` CTest case fails when the README quick-start commands or snippets drift from the examples, CMake targets, or CI commands, and `AddSubdirectoryConsumer` builds a minimal parent project linking `WebFront::WebFront`. +Before declaring work complete, run the CEF-off build and CTest suite. Run the CEF/Xvfb test when changing the bridge, browser lifecycle, module serving, Jasmine assets, or CEF frontend. These PRs must also dispatch `BuildAndTest.yml` on the PR head branch before merging (`gh workflow run BuildAndTest.yml --ref `), then wait for both GCC and Clang CEF jobs to pass. Manual dispatch runs the extended CEF/sanitizer checks without repeating the desktop matrix by default. To also repeat every desktop CTest case three times for stability validation, dispatch with `-f repeat_desktop_tests=true`. It is the required per-PR CEF validation for these changes; the weekly run is a backstop, not a substitute. Update README/status documentation when commands, public behavior, or limitations change. The `NewcomerDocsMatchExamples` CTest case fails when the README quick-start commands or snippets drift from the examples, CMake targets, or CI commands, and `AddSubdirectoryConsumer` builds a minimal parent project linking `WebFront::WebFront`. ## Git and workspace safety diff --git a/README.md b/README.md index df9e6d26..864a603a 100644 --- a/README.md +++ b/README.md @@ -205,12 +205,15 @@ As a subproject, examples and tests are off by default and compiler settings do cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \ -DWEBFRONT_EMBED_CEF=OFF -DENABLE_TESTING=ON cmake --build build --parallel 2 -ctest --test-dir build --output-on-failure +ctest --test-dir build --output-on-failure --parallel 4 ``` -Tests additionally require Node.js for offline JavaScript checks. Browser tests require an enabled engine; Linux CEF tests use Xvfb. See [AGENTS.md](AGENTS.md) for contributor commands and [developer environment testing](docs/DEVELOPER_ENVIRONMENT.md#environment-distribution-and-offline-tests-maintainers). +Tests and the `webfront-embedded-assets` regeneration target require Node.js, including assets without gzip. Normal C++ builds use versioned headers and do not require Node.js. Browser tests require an enabled engine; Linux CEF tests use Xvfb. See [AGENTS.md](AGENTS.md) for contributor commands and [developer environment testing](docs/DEVELOPER_ENVIRONMENT.md#environment-distribution-and-offline-tests-maintainers). -CI runs one combined C++ / native-browser job per desktop platform on each code change. The Linux job also uploads GCC coverage on each PR. Linux Clang, sanitizers, fuzzing and CEF compatibility run weekly and on demand. Workflow concurrency cancels superseded runs; dependency and compiler caches avoid repeated work. Platform badges above identify the configured matrix; the CI badge reports its aggregate status. Execution times depend on cache state and runner availability. +CTest runs up to four tasks at a time; browser ports remain locked and embedded builds run serially. +See [test timings and parallelism](docs/TEST_PERFORMANCE.md) for measurements and constraints. + +CI runs one combined C++ / native-browser job per desktop platform on each code change. The Linux job also uploads GCC coverage on each PR. Linux Clang, sanitizers, fuzzing and CEF compatibility run weekly and on demand. Manual dispatch with `repeat_desktop_tests=true` also repeats each desktop CTest case three times for stability checks. Workflow concurrency cancels superseded runs; dependency and compiler caches avoid repeated work. Platform badges above identify the configured matrix; the CI badge reports its aggregate status. Execution times depend on cache state and runner availability. ## Contracts and limitations diff --git a/cmake/CheckCEFTestingState.cmake b/cmake/CheckCEFTestingState.cmake index ec10444d..9f8689cb 100644 --- a/cmake/CheckCEFTestingState.cmake +++ b/cmake/CheckCEFTestingState.cmake @@ -3,12 +3,18 @@ cmake_minimum_required(VERSION 3.31) if(NOT ROOT OR NOT EXISTS "${CPM_MODULE}") message(FATAL_ERROR "ROOT and the already-downloaded CPM_MODULE must be supplied") endif() +# This compiler-free fixture needs the generator, but intentionally no -A/-T. +set(generator_args "") +if(TEST_GENERATOR) + list(APPEND generator_args -G "${TEST_GENERATOR}") +endif() foreach(state undefined cache-ON cache-OFF cache-empty normal-ON normal-OFF normal-empty normal-ON-cache-OFF normal-OFF-cache-ON) set(directory "${CMAKE_CURRENT_BINARY_DIR}/cef-testing-state/${state}") file(REMOVE_RECURSE "${directory}") execute_process( COMMAND "${CMAKE_COMMAND}" -S "${ROOT}/test/cef-testing" -B "${directory}" + ${generator_args} -DROOT=${ROOT} -DCPM_MODULE=${CPM_MODULE} -DSTATE=${state} RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE error) if(NOT result EQUAL 0) @@ -22,6 +28,7 @@ foreach(kind static interface missing) file(REMOVE_RECURSE "${directory}") execute_process( COMMAND "${CMAKE_COMMAND}" -S "${ROOT}/test/cef-testing" -B "${directory}" + ${generator_args} -DROOT=${ROOT} -DCPM_MODULE=${CPM_MODULE} -DSTATE=undefined -DSIMULATE_APPLE=ON -DWRAPPER_KIND=${kind} RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE error) diff --git a/cmake/CheckFrontendSelection.cmake b/cmake/CheckFrontendSelection.cmake index a8c541e8..a7e8a2be 100644 --- a/cmake/CheckFrontendSelection.cmake +++ b/cmake/CheckFrontendSelection.cmake @@ -154,6 +154,15 @@ endif() include("${ROOT}/cmake/FrontendTestHelpers.cmake") +# Reuse the outer build's generator instead of repeatedly probing the host default +# (Visual Studio on Windows). The focused multi-config test still switches generators. +# These fixtures enable no language and compile nothing, so -A/-T are intentionally +# omitted: architecture/toolset selection belongs to the real consumer build. +set(generator_args "") +if(TEST_GENERATOR) + list(APPEND generator_args -G "${TEST_GENERATOR}") +endif() + set(failures "") function(run_case name expect_success expected_text) execute_process( @@ -351,6 +360,7 @@ foreach(case webkitgtk-linux cef-linux cef-macos cef-windows cef-disabled missin file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/frontend-tests/${case}") execute_process( COMMAND "${CMAKE_COMMAND}" -S "${ROOT}/test/frontends" -B "${CMAKE_CURRENT_BINARY_DIR}/frontend-tests/${case}" + ${generator_args} -DROOT=${ROOT} -DCASE=${case} RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE error) if(NOT result EQUAL 0) @@ -439,8 +449,10 @@ run_case("WebKitGTK selector" TRUE "TYPE=webfront::frontend::WebKitGTKFrontend") set(CASE_WEBKITGTK OFF) run_case("WebKitGTK tests require support" FALSE "requires WEBFRONT_EMBED_WEBKITGTK=ON") +file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/frontend-tests/webkitgtk-missing-sdk") execute_process(COMMAND "${CMAKE_COMMAND}" -S "${ROOT}/test/frontends" - -B "${CMAKE_CURRENT_BINARY_DIR}/frontend-tests/webkitgtk-missing-sdk" -DROOT=${ROOT} -DCASE=webkitgtk-missing-sdk + -B "${CMAKE_CURRENT_BINARY_DIR}/frontend-tests/webkitgtk-missing-sdk" ${generator_args} + -DROOT=${ROOT} -DCASE=webkitgtk-missing-sdk RESULT_VARIABLE missing_sdk OUTPUT_VARIABLE sdk_output ERROR_VARIABLE sdk_error) if(missing_sdk EQUAL 0 OR NOT "${sdk_output}${sdk_error}" MATCHES "WEBFRONT_EMBED_WEBKITGTK=ON requires") list(APPEND failures "Missing WebKitGTK SDK did not report its enabling option: ${sdk_output}${sdk_error}") diff --git a/cmake/CheckNewcomerDocs.cmake b/cmake/CheckNewcomerDocs.cmake index 36c987d7..b4dc3bfd 100644 --- a/cmake/CheckNewcomerDocs.cmake +++ b/cmake/CheckNewcomerDocs.cmake @@ -101,7 +101,7 @@ foreach(text readme agents ci) _require("${${text}}" "-DWEBFRONT_EMBED_CEF=OFF -DENABLE_TESTING=ON" "${text} baseline configuration") endforeach() foreach(text readme agents) - _require("${${text}}" "ctest --test-dir build --output-on-failure" "${text} test command") + _require("${${text}}" "ctest --test-dir build --output-on-failure --parallel 4" "${text} test command") endforeach() if(failures) list(JOIN failures "\n " joined) diff --git a/cmake/EmbedTextAsset.cmake b/cmake/EmbedTextAsset.cmake index aafecece..f768618f 100644 --- a/cmake/EmbedTextAsset.cmake +++ b/cmake/EmbedTextAsset.cmake @@ -10,65 +10,6 @@ if(NOT DEFINED STRUCT) message(FATAL_ERROR "STRUCT must name the generated struct, e.g. WebFrontJsData") endif() -# Normal assets retain their identity representation. Third-party payloads use the pinned, -# vendored pure-JavaScript compressor, independent of the host's gzip/zlib implementation. -set(encoding "") -if(GZIP) - find_program(NODE_EXECUTABLE NAMES node nodejs REQUIRED) - set(compressed "${CMAKE_CURRENT_BINARY_DIR}/${STRUCT}.gz") - execute_process(COMMAND "${NODE_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../tools/assets/gzip.mjs" - "${INPUT}" "${compressed}" RESULT_VARIABLE result) - if(NOT result EQUAL 0) - message(FATAL_ERROR "gzip generation failed for ${INPUT}") - endif() - file(READ "${compressed}" gzip_hex HEX) - file(REMOVE "${compressed}") - set(encoding "gzip") -else() - file(READ "${INPUT}" gzip_hex HEX) -endif() - -string(LENGTH "${gzip_hex}" hex_length) -math(EXPR data_size "${hex_length} / 2") -math(EXPR word_count "(${data_size} + 7) / 8") - -set(words "") -set(word_index 0) -while(word_index LESS word_count) - math(EXPR offset "${word_index} * 16") - math(EXPR remaining "${hex_length} - ${offset}") - if(remaining GREATER 16) - set(chunk_length 16) - else() - set(chunk_length "${remaining}") - endif() - string(SUBSTRING "${gzip_hex}" "${offset}" "${chunk_length}" word) - string(LENGTH "${word}" word_length) - while(word_length LESS 16) - string(APPEND word "0") - string(LENGTH "${word}" word_length) - endwhile() - math(EXPR line_position "${word_index} % 5") - if(line_position EQUAL 0) - if(word_index GREATER 0) - string(APPEND words ",") - endif() - string(APPEND words "\n ") - elseif(word_index GREATER 0) - string(APPEND words ", ") - endif() - string(APPEND words "0x${word}") - math(EXPR word_index "${word_index} + 1") -endwhile() - -if(encoding) - set(encoding_initializer "{\"${encoding}\"}") -else() - set(encoding_initializer "{}") -endif() - -set(contents "#pragma once\n\n#include \n#include \n#include \n#include \n\nnamespace webfront::fs::generated {\n\nstruct ${STRUCT} {\n static constexpr std::string_view encoding${encoding_initializer};\n static constexpr std::size_t dataSize{${data_size}};\n static constexpr std::array data{${words}\n };\n};\n\n} // namespace webfront::fs::generated\n") - # A Windows checkout converting either file to CRLF would make it look stale, so both must keep # LF through .gitattributes. Checked only in a git work tree, on every platform. if(DEFINED CHECK AND GIT_EXECUTABLE AND NOT INPUT MATCHES "\\.png$") @@ -88,11 +29,20 @@ if(DEFINED CHECK AND GIT_EXECUTABLE AND NOT INPUT MATCHES "\\.png$") endif() endif() +# Render and compare in one process without intermediate gzip/header files. Normal C++ +# builds consume checked-in headers; Node is required only for maintenance and tests. +find_program(NODE_EXECUTABLE NAMES node nodejs REQUIRED) +set(arguments --input "${INPUT}" --struct "${STRUCT}") +if(GZIP) + list(APPEND arguments --gzip) +endif() if(DEFINED CHECK) - file(READ "${CHECK}" expected) - if(NOT contents STREQUAL expected) - message(FATAL_ERROR "${CHECK} is stale; run the webfront-embedded-assets target") - endif() + list(APPEND arguments --check "${CHECK}") else() - file(WRITE "${OUTPUT}" "${contents}") + list(APPEND arguments --output "${OUTPUT}") +endif() +execute_process(COMMAND "${NODE_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../tools/assets/embed.mjs" + ${arguments} RESULT_VARIABLE result) +if(NOT result EQUAL 0) + message(FATAL_ERROR "Embedded asset generation/check failed for ${INPUT}") endif() diff --git a/cmake/WebFrontAssets.cmake b/cmake/WebFrontAssets.cmake index 53623f0b..cef737f0 100644 --- a/cmake/WebFrontAssets.cmake +++ b/cmake/WebFrontAssets.cmake @@ -103,6 +103,10 @@ function(webfront_add_embedded_assets) add_test(NAME DeveloperJavaScript COMMAND "${WEBFRONT_NODE_EXECUTABLE}" --test "${root}/tools/developer/check.mjs" "${root}/tools/developer/distribution-check.mjs") set_tests_properties(DeveloperJavaScript PROPERTIES TIMEOUT 30) + add_test(NAME EmbeddedAssetGenerator COMMAND ${CMAKE_COMMAND} -E env + "WEBFRONT_TEST_CMAKE=${CMAKE_COMMAND}" "${WEBFRONT_NODE_EXECUTABLE}" + --test "${root}/tools/assets/embed.test.mjs") + set_tests_properties(EmbeddedAssetGenerator PROPERTIES TIMEOUT 30) add_test(NAME EmbeddedGzipContents COMMAND "${WEBFRONT_NODE_EXECUTABLE}" "${root}/tools/assets/check.mjs") endif() diff --git a/docs/EMBEDDED_ASSETS.md b/docs/EMBEDDED_ASSETS.md index 23f64bf5..a6dce976 100644 --- a/docs/EMBEDDED_ASSETS.md +++ b/docs/EMBEDDED_ASSETS.md @@ -42,7 +42,7 @@ cmake -DXTERM_VERSION=6.0.0 -DFIT_VERSION=0.11.0 -P cmake/UpdateXterm.cmake # Offline after C++ dependencies are configured; npm/node_modules is not required here. cmake --build build --target webfront-embedded-assets -ctest --test-dir build -R 'Asset.*Fresh|EmbeddedGzipContents' --output-on-failure +ctest --test-dir build -R 'Asset.*Fresh|EmbeddedGzipContents|EmbeddedAssetGenerator' --output-on-failure --parallel 4 ``` `tools/assets/package.json` pins all six library versions and the maintenance tools; @@ -53,6 +53,13 @@ then review sources, routes, tests, version inventory and size measurements toge `third_party/xterm/VERSION`. `tools/assets/update.mjs` records the other versions alongside their distribution files in `third_party/`. +`cmake/EmbedTextAsset.cmake` delegates rendering and exact byte comparison to +`tools/assets/embed.mjs`. It assembles bounded lines of five 64-bit words and joins them +once, avoiding the growing-string CMake loop. Generation and checking use the same +renderer, without intermediate files. `EmbeddedAssetGenerator` covers empty/binary inputs, +word boundaries, padding, line wrapping and nonzero status for stale or missing files; +all per-asset freshness checks and the independent gzip decoder remain enabled. + Compression uses the vendored **fflate 0.8.3** pure JavaScript `gzipSync` implementation (`third_party/fflate/browser.mjs`), with **level 9, mem 8, mtime 0**, no filename and a fixed Unix OS header byte. It never uses the host's gzip or zlib compressor. The compressor and @@ -60,7 +67,7 @@ its license are checked in, so the streams are identical across platforms withou The small bridge, fallback page and component modules remain identity encoded. `.gitattributes` keeps text sources and headers at LF; PNG files retain their binary bytes. -`cmake/EmbedTextAsset.cmake` packs the compressed bytes into big-endian words, with +The renderer packs the compressed bytes into big-endian words, with `encoding = "gzip"` and `dataSize` excluding trailing word padding. CTest regenerates and compares headers offline. `tools/assets/check.mjs` independently decodes the arrays using Node's zlib, checks every decoded byte against the distribution file, validates gzip headers/padding, and diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index ea9bdf27..59a30d03 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -1,5 +1,29 @@ # WebFront project status +## CI test duration (#298, 2026-10-21) + +The maintenance asset renderer generates and compares headers in Node, preserving +all versioned bytes and pinned gzip parameters. Local Babel freshness drops from +14.75 s to 0.30 s. Tests and asset regeneration require Node; ordinary C++ builds do +not. CI uses up to four CTest workers, retains timing reports, locks browser ports +and serializes nested embedded builds against every running test in the same tree. +Frontend fixtures reuse the parent generator, and the consumer inherits the actual +test target's compiler cache launcher at generation time. + +The first PR CI run passes Linux coverage/native-browser tests in 47.63 s versus +130.94 s previously. macOS exposes a default-port collision in a developer unit +test, now corrected to use port 0 and reproduced locally with 9002 occupied. +Filesystem fixtures also atomically claim their temporary directories. The corrected +261-test CEF-off suite passes locally with four workers (18.02 s), and all +14 CEF/Xvfb cases pass with serialized nested builds (63.18 s). +Repeating each of the 261 CEF-off cases three times passes locally (54.16 s). +Manual dispatch with `repeat_desktop_tests=true` additionally repeats each desktop +case three times; successful Windows/macOS qualification and stability results must +be checked on the corrected head before merging. See the +[audit, measurements and remaining costs](TEST_PERFORMANCE.md). + + + ## Release 0.4.0 (#200, 2026-10-21) `webfront::version` and the CMake project version are 0.4.0. The release presents the repository diff --git a/docs/TEST_PERFORMANCE.md b/docs/TEST_PERFORMANCE.md new file mode 100644 index 00000000..92c13a0a --- /dev/null +++ b/docs/TEST_PERFORMANCE.md @@ -0,0 +1,160 @@ +# Test timings and parallelism (#298) + +The CI and contributor commands use `ctest --parallel 4`. This bounds concurrent +test processes independently of `cmake --build --parallel 2`. Desktop, sanitizer +and extended CEF jobs retain JUnit durations and `LastTest.log` even on success, +so subsequent runs can be compared without losing the individual test timings. +Manual dispatch with `repeat_desktop_tests=true` opts into the desktop matrix and +uses `--repeat until-fail:3`; normal PR runs execute each case once, and ordinary +manual dispatch still runs only the extended checks. + +## Starting point + +The [21 October 2026 run](https://github.com/ambroise-leclerc/WebFront/actions/runs/39640036175) +reported these elapsed CTest durations, rather than timeout limits: + +| Test | Windows MSVC / WebView2 | +| --- | ---: | +| BabelAssetFresh | 120.68 s | +| LifeEmbeddedBuild | 39.59 s | +| DeveloperEmbeddedBuild | 39.20 s | +| AddSubdirectoryConsumer | 26.33 s | +| DeveloperBrowserIntegration | 26.01 s | +| CEFTestingState | 25.06 s | +| FrontendSelection | 20.95 s | + +The complete suite took 338.12 s on Windows, 130.94 s on Linux and 108.31 s on +macOS. These suites include different platform tests and build configurations; +their totals should not be compared as a compiler benchmark. + +## Changes + +- The asset renderer assembles bounded lines in Node and joins them once. The + former CMake loop repeatedly processed a growing string for every 64-bit word. + All checked-in headers, compression settings and full byte comparisons remain + the same. No intermediate gzip file is needed. The independent zlib decode + check and every per-asset freshness test still run. +- Compiler-free frontend and CEF fixtures reuse the parent generator, avoiding + repeated host-default Visual Studio discovery in Ninja CI builds on Windows. + The focused Ninja / Ninja Multi-Config / Ninja switching test is retained. +- The consumer build reads the actual test target's compiler cache launcher at + generation time, instead of depending on a configure-time variable or + independently discovering a different cache. It still configures, + cleans, compiles and links the real consumer on every invocation. +- Independent tests overlap under CTest. The two embedded builds retain + `RUN_SERIAL` so a CMake regeneration or shared relink cannot race a running + binary in the same tree, including on Windows. A build-only resource lock was + insufficient for that guarantee. +- The developer bootstrap unit test uses an ephemeral port even without a project + directory. Its former default-port bind collided with browser tests in the first + macOS CI run; reserving port 9002 reproduces that failure deterministically. +- Filesystem fixtures share the atomic temporary-directory owner instead of + picking one of only 9,000 paths without checking exclusive creation. +- Asset generation and checking resolve the entry script's real path, so a checkout + reached through a symbolic link still executes the CLI. A CMake regression covers + stale checks and generation through a directory link (a junction on Windows), for + both identity and gzip assets. +- The attribution regression retains all assertions and parallel scheduling, with + a 180-second timeout. Its many short Git/grep subprocesses exceeded the previous + 60-second budget under contention in the corrected-head + [macOS job](https://github.com/ambroise-leclerc/WebFront/actions/runs/39674764032/job/119481980751) + (61.46 seconds before CTest stopped it). + +## Resource audit + +| Tests | Scheduling constraint | +| --- | --- | +| Catch2 scenarios | Separate processes; mutable globals and current directories are process-local. Filesystem fixtures atomically claim temporary directories; the one relative `test.tmp` is used by one scenario only. Real socket tests use ephemeral ports, including developer bootstrap without a project. | +| Asset checks | Read sources and compare full headers in memory; no shared temporary gzip/header output. | +| JavaScript and attribution regressions | Own temporary directories/repositories. | +| Frontend selection | Its own `frontend-tests` directory; multi-config tests have a separate working directory. Each configure starts with a fresh fixture cache. | +| CEF option scope | Its own `cef-testing-state` directory; each state still configures separately. | +| Consumer | Separate `consumer-build` tree; no browser is opened. | +| Browser integration and lifecycle | Keep `RESOURCE_LOCK webfront_port_9002`, including the shared CEF profile and generated browser resources. | +| Developer/Life embedded builds | Keep `FIXTURES_REQUIRED DeveloperGenerated`, then their individual build/run fixture dependencies. `RUN_SERIAL TRUE` excludes every other test while either build runs, protecting running executables from regeneration/relinking. `PROCESSORS 2` records the nested build's two workers. | + +The browser setup must finish generating headers before either embedded build +starts. Browser tests remain mutually exclusive; embedded builds remain mutually +exclusive. No test runs alongside a nested build. The consumer has a different +build tree; ordinary independent tests can overlap when neither embedded build +is running. + +Linux coverage processes still write GCC's normal `.gcda` files on the runner's +local filesystem, using libgcov's file locking. Do not copy this parallel coverage +command to a filesystem without locking support without isolating and merging +the profiles. Sanitizer test processes retain their existing runtime settings. + +## Local measurements + +Measured on the same Linux workstation with GCC 16.1, CMake 4.2.3, Node 22.22.1 +and Release builds. These are local measurements, not predicted hosted-runner +results. CEF compilation was also active during these measurements. + +| Scope | Before | After | +| --- | ---: | ---: | +| Babel freshness command, original vs new renderer | 14.75 s | 0.30 s | +| Same 22 asset/frontend/CEF checks, serial | 24.73 s | 9.40 s | +| Complete 261-test CEF-off suite, new renderer, serial vs four workers | 36.78 s | 18.13–18.80 s | + +The full-suite row isolates scheduling with the optimized renderer already in +both runs; it is not a measurement of the original full suite. The new generator +regression is included. All runs check actual regenerated bytes and error paths. + +Before review, the 14-test CEF/Xvfb integration suite passed twice (56.28 s and +53.28 s) with the build-only lock. That observation did not establish that shared +relinking was safe on Windows; it has been replaced by whole-tree serialization. +The first run's tests over 20 s were DeveloperEmbeddedBuild (22.25 s) and +LifeEmbeddedBuild (22.38 s): each compiles a different generated provider and +links/copies the real CEF runtime. Local compilation used no compiler cache; +the CI launcher is preserved for these targets. + +After review, all 14 CEF/Xvfb tests pass with restored whole-tree serialization +(63.18 s). No browser or unit process starts alongside either nested build. +The corrected 261-test CEF-off suite passes with four workers in 18.02 s. +Repeating each of those 261 cases three times also passes (54.16 s total). + +The first [PR run at 65817bf](https://github.com/ambroise-leclerc/WebFront/actions/runs/39673110800) +completed Linux's covered native-browser suite in 47.63 s, down from 130.94 s +in the baseline. Coverage collection and upload succeeded. macOS took 77.38 s +versus 108.31 s, but failed the developer bootstrap test because its default port +collided with a browser. That run is not a successful macOS qualification. The +unit test now requests port 0, and nested builds have whole-tree exclusion. + +The Windows target of at least 50% less than 338.12 s, hosted macOS success and +repeated-run stability must be confirmed on the corrected head. Local Linux results +do not qualify those platforms. Use the retained reports to record runner, build +configuration, compiler, cache state and parallelism for each comparison. + +## Remaining costs and reproduction + +Embedded builds compile actual browser-generated headers and link the frontend; +they must remain after browser setup. Their existing compiler cache can reduce +repeated work, but a cold run still pays compilation/linking and runtime copying. +The consumer also deliberately exercises a clean compile. Browser development +integration runs actual dependency resolution, compilation, previews and export; +its dependent stages cannot simply be made independent CTest processes. Future +profiling should distinguish those stages before changing the scenario. + +After configuring and building dependencies, run offline from the checkout: + +```sh +ctest --test-dir build --output-on-failure --parallel 1 --output-junit "$PWD/build/serial.xml" +ctest --test-dir build --output-on-failure --parallel 4 --output-junit "$PWD/build/parallel.xml" +ctest --test-dir build --output-on-failure --parallel 4 --repeat until-fail:3 +ctest --test-dir build-cef -L web-integration --output-on-failure --parallel 4 +``` + +Compare both the total real elapsed time printed by CTest and the individual +JUnit `testcase` durations; summing parallel test times overstates wall time. +For browser/build comparisons, record cold and warm compilation separately. +To repeat every case on the three hosted desktop platforms while also running the +extended CEF/sanitizer checks: + +```sh +gh workflow run BuildAndTest.yml --ref -f repeat_desktop_tests=true +``` + +Use the ordinary PR run (one repetition) for before/after performance comparisons; +the three-repeat run is a stability check and its wall time includes repetitions. +Every remaining test over 20 s should be reviewed against the costs above rather +than disabled or given weaker assertions. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 874cbe39..8470066c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -49,7 +49,9 @@ if(UNIX) add_test(NAME NoAiAttributionRegression COMMAND "${WEBFRONT_TEST_BASH_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/.github/scripts/test-no-ai-attribution.sh") - set_tests_properties(NoAiAttributionRegression PROPERTIES TIMEOUT 60) + # The many short Git/grep subprocesses exceeded 60 seconds on hosted macOS + # with four CTest workers. Allow contention while keeping the test bounded. + set_tests_properties(NoAiAttributionRegression PROPERTIES TIMEOUT 180) endif() endif() @@ -70,7 +72,8 @@ endif() add_test(NAME NewcomerDocsMatchExamples COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/CheckNewcomerDocs.cmake) add_test(NAME FrontendSelection - COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/CheckFrontendSelection.cmake) + COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} "-DTEST_GENERATOR=${CMAKE_GENERATOR}" + -P ${PROJECT_SOURCE_DIR}/cmake/CheckFrontendSelection.cmake) # Exercise configuration-dependent CTest discovery and generator switches on single-config CI hosts. # The fixture configures no compiler and builds nothing; Ninja is optional for contributor builds. find_program(WEBFRONT_TEST_NINJA_EXECUTABLE ninja) @@ -88,6 +91,7 @@ endif() # equivalent module path here so the offline fixture still exercises the same CPM as this build. add_test(NAME CEFTestingState COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -DCPM_MODULE=${CPM_DOWNLOAD_LOCATION} + "-DTEST_GENERATOR=${CMAKE_GENERATOR}" -P ${PROJECT_SOURCE_DIR}/cmake/CheckCEFTestingState.cmake) add_test(NAME WebView2UnsupportedToolchain COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/CheckWebView2Toolchain.cmake) @@ -110,11 +114,14 @@ endif() if(DEFINED CMAKE_CXX_SCAN_FOR_MODULES) list(APPEND _consumer_dependency_args -DCMAKE_CXX_SCAN_FOR_MODULES:BOOL=${CMAKE_CXX_SCAN_FOR_MODULES}) endif() +# Read the actual target's launcher at generation time, including an explicitly +# configured or auto-discovered cache. Do not depend on Cache.cmake's local variable. add_test(NAME AddSubdirectoryConsumer COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test ${CMAKE_CURRENT_SOURCE_DIR}/consumer ${CMAKE_CURRENT_BINARY_DIR}/consumer-build --build-generator ${CMAKE_GENERATOR} --build-config $ --build-options -DWEBFRONT_SOURCE_DIR=${PROJECT_SOURCE_DIR} ${_consumer_dependency_args} + -DENABLE_CACHE=OFF "-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=$" -DCMAKE_BUILD_TYPE=$ -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}) set_tests_properties(AddSubdirectoryConsumer PROPERTIES TIMEOUT 600) diff --git a/test/DefaultFSTests.cpp b/test/DefaultFSTests.cpp index 534cdf49..a4622076 100644 --- a/test/DefaultFSTests.cpp +++ b/test/DefaultFSTests.cpp @@ -1,3 +1,4 @@ +#include "TemporaryDirectory.hpp" #include #include @@ -5,7 +6,6 @@ #include #include #include -#include #include using namespace std; @@ -13,30 +13,18 @@ using namespace webfront; namespace { -// Minimal temp-directory fixture, following the convention used in test/NativeFSTests.cpp. +// Each fixture atomically claims its own temporary directory across CTest processes. class TemporaryRoot { public: - TemporaryRoot() { - random_device rd; - mt19937 gen(rd()); - uniform_int_distribution<> distrib(1000, 9999); - dir = filesystem::temp_directory_path() / ("defaultfs_test_" + to_string(distrib(gen))); - filesystem::create_directories(dir); - } - ~TemporaryRoot() { - error_code ec; - filesystem::remove_all(dir, ec); - } - void write(const string& relativePath, const string& content) const { - ofstream file(dir / relativePath, ios::binary); + ofstream file(root.path() / relativePath, ios::binary); file << content; } - filesystem::path path() const { return dir; } + filesystem::path path() const { return root.path(); } private: - filesystem::path dir; + webfront::test::TemporaryDirectory root; }; string readAll(fs::File& file) { diff --git a/test/DeveloperTests.cpp b/test/DeveloperTests.cpp index 20c0521b..d4c532a6 100644 --- a/test/DeveloperTests.cpp +++ b/test/DeveloperTests.cpp @@ -319,7 +319,7 @@ SCENARIO("The developer application needs an explicit project and a trusted envi using App = BasicDeveloperApp; const DeveloperBootstrapOptions trusted{.environment = "https://example.test/env.tgz", .integrity = "sha512-abc"}; GIVEN("no project directory") { - App app; + App app({}, WebFrontConfig{.port = "0"}); THEN("bootstrap is refused") { REQUIRE_THROWS_AS(app.bootstrap("developer", trusted), std::invalid_argument); } diff --git a/test/NativeFSTests.cpp b/test/NativeFSTests.cpp index 8414295d..32d34fd6 100644 --- a/test/NativeFSTests.cpp +++ b/test/NativeFSTests.cpp @@ -1,4 +1,5 @@ #include +#include "TemporaryDirectory.hpp" #include #include @@ -20,14 +21,7 @@ using DebugFS = fs::NativeDebugFS; // Helper function to create a temporary test directory structure class TemporaryTestEnvironment { public: - TemporaryTestEnvironment() { - // Create a unique test directory - random_device rd; - mt19937 gen(rd()); - uniform_int_distribution<> distrib(1000, 9999); - string uniqueSuffix = to_string(distrib(gen)); - testDir = filesystem::temp_directory_path() / ("nativefs_test_" + uniqueSuffix); - filesystem::create_directories(testDir); + TemporaryTestEnvironment() : testDir(root.path()) { // Create subdirectory subDir = testDir / "subdir"; @@ -81,6 +75,7 @@ class TemporaryTestEnvironment { } private: + webfront::test::TemporaryDirectory root; filesystem::path testDir; filesystem::path subDir; map> binaryData; diff --git a/tools/assets/embed.mjs b/tools/assets/embed.mjs new file mode 100644 index 00000000..222762e2 --- /dev/null +++ b/tools/assets/embed.mjs @@ -0,0 +1,67 @@ +// Keep the checked-in header format and the pinned compressor independent of the host. +import { gzipSync } from '../../third_party/fflate/browser.mjs'; +import { mkdirSync, readFileSync, realpathSync, writeFileSync } from 'node:fs'; +import { dirname, resolve } from 'node:path'; +import { pathToFileURL } from 'node:url'; +import { parseArgs } from 'node:util'; + +export const STALE_ASSET_MESSAGE = 'is stale; run the webfront-embedded-assets target'; + +export function renderAsset(source, name, compressed = false) { + const payload = compressed + ? Buffer.from(gzipSync(source, { level: 9, mem: 8, mtime: 0 })) + : source; + const hex = payload.toString('hex'); + const lines = []; + // Build bounded lines, then join once. Appending every word in CMake repeatedly + // copied a growing string and made large assets particularly expensive on Windows. + for (let offset = 0; offset < hex.length; offset += 80) { + const words = hex.slice(offset, offset + 80).match(/.{1,16}/g); + lines.push(` ${words.map(word => `0x${word.padEnd(16, '0')}`).join(', ')}`); + } + const words = lines.length ? `\n${lines.join(',\n')}` : ''; + return `#pragma once + +#include +#include +#include +#include + +namespace webfront::fs::generated { + +struct ${name} { + static constexpr std::string_view encoding${compressed ? '{"gzip"}' : '{}'}; + static constexpr std::size_t dataSize{${payload.length}}; + static constexpr std::array data{${words} + }; +}; + +} // namespace webfront::fs::generated +`; +} + +function main() { + const { values } = parseArgs({ options: { + input: { type: 'string' }, struct: { type: 'string' }, + output: { type: 'string' }, check: { type: 'string' }, gzip: { type: 'boolean' }, + } }); + if (!values.input || !values.struct || (!values.output && !values.check)) + throw new Error('Supply --input, --struct and --output or --check'); + const contents = renderAsset(readFileSync(values.input), values.struct, values.gzip); + if (values.check) { + if (!readFileSync(values.check).equals(Buffer.from(contents))) + throw new Error(`${values.check} ${STALE_ASSET_MESSAGE}`); + } else { + mkdirSync(dirname(values.output), { recursive: true }); + writeFileSync(values.output, contents); + } +} + +if (process.argv[1] && import.meta.url === pathToFileURL(realpathSync(resolve(process.argv[1]))).href) { + try { + main(); + } catch (error) { + console.error(error.message); + process.exitCode = 1; + } +} diff --git a/tools/assets/embed.test.mjs b/tools/assets/embed.test.mjs new file mode 100644 index 00000000..33bcf661 --- /dev/null +++ b/tools/assets/embed.test.mjs @@ -0,0 +1,147 @@ +import assert from 'node:assert/strict'; +import { mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { spawnSync } from 'node:child_process'; +import { fileURLToPath } from 'node:url'; +import { gunzipSync } from 'node:zlib'; +import { test } from 'node:test'; +import { renderAsset, STALE_ASSET_MESSAGE } from './embed.mjs'; + +test('header preserves word order, padding, line wrapping and empty arrays', () => { + const source = Buffer.from(Array.from({ length: 41 }, (_, i) => i)); + assert.equal(renderAsset(source, 'Fixture'), `#pragma once + +#include +#include +#include +#include + +namespace webfront::fs::generated { + +struct Fixture { + static constexpr std::string_view encoding{}; + static constexpr std::size_t dataSize{41}; + static constexpr std::array data{ + 0x0001020304050607, 0x08090a0b0c0d0e0f, 0x1011121314151617, 0x18191a1b1c1d1e1f, 0x2021222324252627, + 0x2800000000000000 + }; +}; + +} // namespace webfront::fs::generated +`); + for (const size of [0, 1, 7, 8, 9, 39, 40, 41]) { + const header = renderAsset(source.subarray(0, size), 'Fixture'); + assert(header.includes(`dataSize{${size}}`)); + assert(header.includes(`std::array data{`)); + const words = [...header.matchAll(/0x([0-9a-f]{16})/g)].map(match => match[1]); + const decoded = Buffer.from(words.join(''), 'hex'); + assert.deepEqual(decoded.subarray(0, size), source.subarray(0, size)); + assert(decoded.subarray(size).every(byte => byte === 0)); + if (size === 0) assert(header.includes('data{\n };')); + } +}); + +test('gzip is deterministic and decodes independently for binary and empty inputs', () => { + for (const source of [Buffer.alloc(0), Buffer.from(Array.from({ length: 256 }, (_, i) => i))]) { + const header = renderAsset(source, 'Fixture', true); + assert.equal(header, renderAsset(source, 'Fixture', true)); + assert(header.includes('encoding{"gzip"}')); + const size = Number(header.match(/dataSize\{(\d+)\}/)[1]); + const hex = [...header.matchAll(/0x([0-9a-f]{16})/g)].map(match => match[1]).join(''); + const payload = Buffer.from(hex, 'hex').subarray(0, size); + assert.deepEqual([...payload.subarray(0, 10)], [31, 139, 8, 0, 0, 0, 0, 0, 2, 3]); + assert.deepEqual(gunzipSync(payload), source); + } +}); + +test('CMake entry point checks exact bytes and returns nonzero for stale or missing files', () => { + const directory = mkdtempSync(join(tmpdir(), 'webfront-embed-')); + try { + const input = join(directory, 'input with spaces.bin'); + const output = join(directory, 'nested', 'Fixture.hpp'); + const script = fileURLToPath(new URL('../../cmake/EmbedTextAsset.cmake', import.meta.url)); + const source = Buffer.from([0, 128, 255, 13, 10]); + writeFileSync(input, source); + const run = (...args) => spawnSync(process.env.WEBFRONT_TEST_CMAKE || 'cmake', + [`-DINPUT=${input}`, '-DSTRUCT=Fixture', ...args, '-P', script], + { cwd: directory, encoding: 'utf8' }); + for (const compressed of [false, true]) { + const gzip = `-DGZIP=${compressed ? 'ON' : 'OFF'}`; + let result = run(gzip, `-DOUTPUT=${output}`); + assert.equal(result.status, 0, result.stderr); + const expected = renderAsset(source, 'Fixture', compressed); + assert.equal(readFileSync(output, 'utf8'), expected); + result = run(gzip, `-DCHECK=${output}`); + assert.equal(result.status, 0, result.stderr); + writeFileSync(output, expected.replaceAll('\n', '\r\n')); + result = run(gzip, `-DCHECK=${output}`); + assert.equal(result.status, 1, result.stderr); + assert(result.stderr.includes(STALE_ASSET_MESSAGE), result.stderr); + writeFileSync(output, expected); + writeFileSync(input, Buffer.from('changed')); + result = run(gzip, `-DCHECK=${output}`); + assert.equal(result.status, 1, result.stderr); + assert(result.stderr.includes(STALE_ASSET_MESSAGE), result.stderr); + writeFileSync(input, source); + } + rmSync(output); + assert.notEqual(run(`-DCHECK=${output}`).status, 0); + assert.notEqual(run().status, 0); + rmSync(input); + assert.notEqual(run(`-DOUTPUT=${output}`).status, 0); + } finally { + rmSync(directory, { recursive: true, force: true }); + } +}); + +test('CMake generates and checks assets through a symlinked checkout', () => { + const directory = mkdtempSync(join(tmpdir(), 'webfront-embed-symlink-')); + try { + const checkout = join(directory, 'linked checkout'); + symlinkSync(fileURLToPath(new URL('../../', import.meta.url)), checkout, + process.platform === 'win32' ? 'junction' : 'dir'); + const input = join(directory, 'input.bin'); + const output = join(directory, 'Fixture.hpp'); + const source = Buffer.from([0, 128, 255, 13, 10]); + writeFileSync(input, source); + const run = (...args) => spawnSync(process.env.WEBFRONT_TEST_CMAKE || 'cmake', + [`-DINPUT=${input}`, '-DSTRUCT=Fixture', ...args, '-P', + join(checkout, 'cmake', 'EmbedTextAsset.cmake')], + { cwd: directory, encoding: 'utf8' }); + for (const compressed of [false, true]) { + const gzip = `-DGZIP=${compressed ? 'ON' : 'OFF'}`; + writeFileSync(output, 'stale header'); + let result = run(gzip, `-DCHECK=${output}`); + assert.equal(result.status, 1, result.stderr); + assert(result.stderr.includes(STALE_ASSET_MESSAGE), result.stderr); + rmSync(output); + result = run(gzip, `-DOUTPUT=${output}`); + assert.equal(result.status, 0, result.stderr); + assert.equal(readFileSync(output, 'utf8'), renderAsset(source, 'Fixture', compressed)); + result = run(gzip, `-DCHECK=${output}`); + assert.equal(result.status, 0, result.stderr); + } + } finally { + rmSync(directory, { recursive: true, force: true }); + } +}); + +test('CLI reports a stale header on one line without a Node stack trace', () => { + const directory = mkdtempSync(join(tmpdir(), 'webfront-embed-error-')); + try { + const input = join(directory, 'input.bin'); + const output = join(directory, 'Fixture.hpp'); + writeFileSync(input, 'source'); + writeFileSync(output, 'stale header'); + const result = spawnSync(process.execPath, + [fileURLToPath(new URL('./embed.mjs', import.meta.url)), + '--input', input, '--struct', 'Fixture', '--check', output], + { encoding: 'utf8' }); + assert.equal(result.status, 1); + assert.equal(result.stdout, ''); + assert.equal(result.stderr.trimEnd(), `${output} ${STALE_ASSET_MESSAGE}`); + } finally { + rmSync(directory, { recursive: true, force: true }); + } +}); diff --git a/tools/assets/gzip.mjs b/tools/assets/gzip.mjs deleted file mode 100644 index 1f5826ec..00000000 --- a/tools/assets/gzip.mjs +++ /dev/null @@ -1,7 +0,0 @@ -// Pure-JavaScript DEFLATE avoids platform-dependent zlib streams. No npm install needed. -import { gzipSync } from '../../third_party/fflate/browser.mjs'; -import { readFileSync, writeFileSync } from 'node:fs'; -const [input, output] = process.argv.slice(2); -const compressed = gzipSync(readFileSync(input), { level: 9, mem: 8, mtime: 0 }); -// fflate's gzip header is fixed (OS = Unix), with no filename and no timestamp. -writeFileSync(output, compressed); diff --git a/webtest/CMakeLists.txt b/webtest/CMakeLists.txt index ce224f3a..f480c95a 100644 --- a/webtest/CMakeLists.txt +++ b/webtest/CMakeLists.txt @@ -63,8 +63,11 @@ if(WEBFRONT_DEVELOPER_FIXTURES webfront_setup_frontends_for_target(developer_embedded) add_test(NAME DeveloperEmbeddedBuild COMMAND ${CMAKE_COMMAND} --build "${CMAKE_BINARY_DIR}" --config $ --target developer_embedded --parallel 2) + # A nested build can regenerate CMake or relink shared outputs. Exclude every + # running test in this tree, not only the other nested build (Windows locks executables). set_tests_properties(DeveloperEmbeddedBuild PROPERTIES FIXTURES_REQUIRED DeveloperGenerated - FIXTURES_SETUP DeveloperEmbedded LABELS "web-integration" TIMEOUT 180 RUN_SERIAL TRUE) + FIXTURES_SETUP DeveloperEmbedded LABELS "web-integration" TIMEOUT 180 + RUN_SERIAL TRUE PROCESSORS 2) set(_embedded_command "$") if(_developer_xvfb) set(_embedded_command "${_developer_xvfb}" -a ${_embedded_command}) @@ -79,8 +82,10 @@ if(WEBFRONT_DEVELOPER_FIXTURES webfront_setup_frontends_for_target(life_embedded) add_test(NAME LifeEmbeddedBuild COMMAND ${CMAKE_COMMAND} --build "${CMAKE_BINARY_DIR}" --config $ --target life_embedded --parallel 2) + # Keep the same whole-tree exclusion as DeveloperEmbeddedBuild. set_tests_properties(LifeEmbeddedBuild PROPERTIES FIXTURES_REQUIRED DeveloperGenerated - FIXTURES_SETUP LifeEmbedded LABELS "web-integration" TIMEOUT 180 RUN_SERIAL TRUE) + FIXTURES_SETUP LifeEmbedded LABELS "web-integration" TIMEOUT 180 + RUN_SERIAL TRUE PROCESSORS 2) set(_life_command "$") if(_developer_xvfb) set(_life_command "${_developer_xvfb}" -a ${_life_command}) From 180200218c79bd6abf1197cf6d0a738c6b172736 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 10:36:39 +0200 Subject: [PATCH 003/134] Point the WKWebView test bundle at its relocated Info.plist template [#320] --- cmake/WKWebViewSupport.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/WKWebViewSupport.cmake b/cmake/WKWebViewSupport.cmake index 4918e4a6..02a96287 100644 --- a/cmake/WKWebViewSupport.cmake +++ b/cmake/WKWebViewSupport.cmake @@ -43,6 +43,6 @@ function(webfront_add_wkwebview_tests) set_target_properties(${target} PROPERTIES MACOSX_BUNDLE TRUE MACOSX_BUNDLE_GUI_IDENTIFIER "org.webfront.tests.${identifier}" - MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/WKWebViewTestInfo.plist.in") + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../test/cmake/WKWebViewTestInfo.plist.in") endforeach() endfunction() From 2da9a00c91a477a795df08d33d8769fa7124c60c Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 10:47:10 +0200 Subject: [PATCH 004/134] Normalize the relocated WKWebView Info.plist template path [#320] --- cmake/WKWebViewSupport.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/WKWebViewSupport.cmake b/cmake/WKWebViewSupport.cmake index 02a96287..fc7dfa6b 100644 --- a/cmake/WKWebViewSupport.cmake +++ b/cmake/WKWebViewSupport.cmake @@ -38,11 +38,13 @@ function(webfront_add_wkwebview_tests) webfront_set_browser_test_properties("WKWebViewClassImages-${order}" "${webtest_source_dir}" 90) endforeach() # Stable agent bundles avoid one anonymous executable tile per test process in the Dock. + # The path is normalized: a second spelling of the template would be a duplicate Ninja output. + get_filename_component(_wk_plist "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../test/cmake/WKWebViewTestInfo.plist.in" ABSOLUTE) foreach(target webtest frontend_lifecycle wkwebview_lifecycle wkwebview_class_images) string(REPLACE "_" "-" identifier "${target}") set_target_properties(${target} PROPERTIES MACOSX_BUNDLE TRUE MACOSX_BUNDLE_GUI_IDENTIFIER "org.webfront.tests.${identifier}" - MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../test/cmake/WKWebViewTestInfo.plist.in") + MACOSX_BUNDLE_INFO_PLIST "${_wk_plist}") endforeach() endfunction() From 937aa8477273322b5d38fcef36fd69320fa0f1d2 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 11:26:13 +0200 Subject: [PATCH 005/134] Make the repository layout check work on source archives; fix publishing paths [#320] --- js/developer/tools/PUBLISHING.md | 4 ++-- test/cmake/CheckRepositoryLayout.cmake | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/js/developer/tools/PUBLISHING.md b/js/developer/tools/PUBLISHING.md index b6c7cc42..a45a3f68 100644 --- a/js/developer/tools/PUBLISHING.md +++ b/js/developer/tools/PUBLISHING.md @@ -68,8 +68,8 @@ Check the canonical Pages URL, its `Access-Control-Allow-Origin` response and th Then run the optional live smoke test (the ordinary CTest suite remains entirely offline): ```sh -./build-native/webtest/developer_integration \ - "$PWD/build-distribution" "$PWD/build-native/webtest/public-generated" --public +./build-native/test/web/developer_integration \ + "$PWD/build-distribution" "$PWD/build-native/test/web/public-generated" --public ``` This mode downloads the pinned environment and both starters from Pages, fetches exact React/React DOM diff --git a/test/cmake/CheckRepositoryLayout.cmake b/test/cmake/CheckRepositoryLayout.cmake index 979c5f44..612349aa 100644 --- a/test/cmake/CheckRepositoryLayout.cmake +++ b/test/cmake/CheckRepositoryLayout.cmake @@ -27,11 +27,16 @@ if(GIT_EXECUTABLE AND EXISTS "${ROOT}/.git") endif() endif() if(NOT from_git) - # A source archive holds only tracked content. + # A source archive holds tracked content only, minus its export-ignore entries; a local + # checkout without Git metadata may also hold build trees, which are not tracked content. file(GLOB entries LIST_DIRECTORIES true RELATIVE "${ROOT}" "${ROOT}/*" "${ROOT}/.[!.]*") + list(FILTER entries EXCLUDE REGEX "^build") set(actual ${entries}) endif() -list(REMOVE_ITEM actual "") +# .gitattributes and .gitignore are export-ignored, so archives legitimately lack them. +set(archive_optional .gitattributes .gitignore) +list(REMOVE_ITEM actual "" ${archive_optional}) +list(REMOVE_ITEM expected ${archive_optional}) list(REMOVE_DUPLICATES actual) list(SORT actual) list(SORT expected) From f00ddb5062bf231533792c293a0be3522c0a5231 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 11:32:03 +0200 Subject: [PATCH 006/134] Detect Git automatically in the repository layout check and skip .git [#320] --- test/cmake/CheckRepositoryLayout.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/cmake/CheckRepositoryLayout.cmake b/test/cmake/CheckRepositoryLayout.cmake index 612349aa..0ff3c946 100644 --- a/test/cmake/CheckRepositoryLayout.cmake +++ b/test/cmake/CheckRepositoryLayout.cmake @@ -14,6 +14,9 @@ set(expected set(actual "") set(from_git OFF) +if(NOT GIT_EXECUTABLE) + find_program(GIT_EXECUTABLE git) +endif() if(GIT_EXECUTABLE AND EXISTS "${ROOT}/.git") execute_process(COMMAND "${GIT_EXECUTABLE}" ls-files WORKING_DIRECTORY "${ROOT}" OUTPUT_VARIABLE tracked RESULT_VARIABLE git_result ERROR_QUIET) @@ -30,7 +33,7 @@ if(NOT from_git) # A source archive holds tracked content only, minus its export-ignore entries; a local # checkout without Git metadata may also hold build trees, which are not tracked content. file(GLOB entries LIST_DIRECTORIES true RELATIVE "${ROOT}" "${ROOT}/*" "${ROOT}/.[!.]*") - list(FILTER entries EXCLUDE REGEX "^build") + list(FILTER entries EXCLUDE REGEX "^(build|\\.git$)") set(actual ${entries}) endif() # .gitattributes and .gitignore are export-ignored, so archives legitimately lack them. From 690fe68adb895a02aa83b572cbcaf1e0f03c7829 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 11:36:13 +0200 Subject: [PATCH 007/134] Remove the CodeScene configuration [#320] --- .codescene/code-health-rules.json | 60 -------------------------- test/cmake/CheckRepositoryLayout.cmake | 2 +- 2 files changed, 1 insertion(+), 61 deletions(-) delete mode 100644 .codescene/code-health-rules.json diff --git a/.codescene/code-health-rules.json b/.codescene/code-health-rules.json deleted file mode 100644 index a4f7355c..00000000 --- a/.codescene/code-health-rules.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "usage": "CodeScene code health rules for this repository. third_party/ holds pinned upstream distributions (see docs/EMBEDDED_ASSETS.md) that are copied verbatim or reproducibly bundled and never edited here, so function and module size heuristics are disabled for them.", - "rule_sets": [ - { - "matching_content_path": "third_party/**", - "matching_content_path_doc": "Vendored third-party code, refreshed only with cmake/UpdateXterm.cmake or js/developer/vendor/update.mjs.", - "rules": [ - { "name": "Complex Method", "weight": 0.0 }, - { "name": "Bumpy Road Ahead", "weight": 0.0 }, - { "name": "Complex Conditional", "weight": 0.0 }, - { "name": "Excess Number of Function Arguments", "weight": 0.0 }, - { "name": "Deep, Nested Complexity", "weight": 0.0 }, - { "name": "Large Method", "weight": 0.0 }, - { "name": "Brain Method", "weight": 0.0 }, - { "name": "Overall Code Complexity", "weight": 0.0 }, - { "name": "Lines of Code in a Single File", "weight": 0.0 }, - { "name": "Number of Functions in a Single Module", "weight": 0.0 }, - { "name": "Code Duplication", "weight": 0.0 }, - { "name": "Primitive Obsession", "weight": 0.0 }, - { "name": "String Heavy Function Arguments", "weight": 0.0 }, - { "name": "Low Cohesion", "weight": 0.0 } - ] - }, - { - "matching_content_path": "include/webfront/components/Terminal.hpp", - "matching_content_path_doc": "A text command-line interface: its API and helpers take command names, help texts and command lines, which are strings by nature. Wrapping them in structs only to lower the ratio would make the public API (terminal.command(name, help, handler)) harder to read.", - "rules": [ - { "name": "String Heavy Function Arguments", "weight": 0.0 } - ] - }, - { - "matching_content_path": "js/*/**/*.bundle.mjs", - "matching_content_path_doc": "Minified esbuild output of the sources next to it, checked in so that the bootstrap and package resolver need no Node.js at consumption time. It is regenerated by js/developer/tools/build.mjs --refresh-bootstrap and verified against js/developer/environment/bundles.json, never edited by hand; the readable sources are analysed instead.", - "rules": [ - { "name": "Complex Method", "weight": 0.0 }, - { "name": "Bumpy Road Ahead", "weight": 0.0 }, - { "name": "Complex Conditional", "weight": 0.0 }, - { "name": "Excess Number of Function Arguments", "weight": 0.0 }, - { "name": "Deep, Nested Complexity", "weight": 0.0 }, - { "name": "Large Method", "weight": 0.0 }, - { "name": "Brain Method", "weight": 0.0 }, - { "name": "Overall Code Complexity", "weight": 0.0 }, - { "name": "Lines of Code in a Single File", "weight": 0.0 }, - { "name": "Number of Functions in a Single Module", "weight": 0.0 }, - { "name": "Code Duplication", "weight": 0.0 }, - { "name": "Primitive Obsession", "weight": 0.0 }, - { "name": "String Heavy Function Arguments", "weight": 0.0 }, - { "name": "Low Cohesion", "weight": 0.0 } - ] - }, - { - "matching_content_path": "include/webfront/system/DeveloperStore.hpp", - "matching_content_path_doc": "The store implements the webfront.developer.* bridge callbacks, whose identifiers, project paths, offsets and flags arrive as primitives from the browser. Wrapping them in types only to lower the ratio would obscure the bridge contract.", - "rules": [ - { "name": "String Heavy Function Arguments", "weight": 0.0 }, - { "name": "Primitive Obsession", "weight": 0.0 } - ] - } - ] -} diff --git a/test/cmake/CheckRepositoryLayout.cmake b/test/cmake/CheckRepositoryLayout.cmake index 0ff3c946..66c3c2fa 100644 --- a/test/cmake/CheckRepositoryLayout.cmake +++ b/test/cmake/CheckRepositoryLayout.cmake @@ -8,7 +8,7 @@ if(NOT ROOT) endif() set(expected - .clang-format .clang-tidy .codescene .devcontainer .gitattributes .github .gitignore + .clang-format .clang-tidy .devcontainer .gitattributes .github .gitignore AGENTS.md CMakeLists.txt README.md cmake docs examples include js test third_party) From dced52b1d23353e5f393c4583f89ed4043428cee Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 11:40:30 +0200 Subject: [PATCH 008/134] Remove the Codecov upload and configuration [#320] --- .github/codecov.yml | 12 ------------ .github/workflows/BuildAndTest.yml | 7 ------- AGENTS.md | 4 ++-- README.md | 2 +- docs/CHANGELOG.md | 1 + docs/PROJECT_STATUS.md | 2 +- 6 files changed, 5 insertions(+), 23 deletions(-) delete mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml deleted file mode 100644 index a27a2211..00000000 --- a/.github/codecov.yml +++ /dev/null @@ -1,12 +0,0 @@ -coverage: - status: - project: - default: - target: auto - threshold: 0.2% - patch: - default: - target: 95% -ignore: - - "test/web/**" - - "examples/**" diff --git a/.github/workflows/BuildAndTest.yml b/.github/workflows/BuildAndTest.yml index 9c4cc495..311879ae 100644 --- a/.github/workflows/BuildAndTest.yml +++ b/.github/workflows/BuildAndTest.yml @@ -151,13 +151,6 @@ jobs: lcov --ignore-errors inconsistent,inconsistent --gcov-tool gcov-16 --capture --directory . --output-file coverage.info lcov --ignore-errors inconsistent,inconsistent --remove coverage.info '/usr/*' '*/examples/*' --output-file coverage.info lcov --list coverage.info - - name: Upload coverage - if: runner.os == 'Linux' - uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7 - with: - files: build/coverage.info - fail_ci_if_error: true - token: ${{ secrets.CODECOV_TOKEN }} - name: Retain test timings and diagnostics if: always() uses: actions/upload-artifact@v4 diff --git a/AGENTS.md b/AGENTS.md index a7ca1025..8bd25e82 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,7 +22,7 @@ The README introduces WebFront through the Game of Life walkthrough, demonstrati - `js/core/`: readable browser bridge, fallback and bootstrap loader compiled into `include/webfront/`, plus the embedding CMake modules; `js/developer/`: developer environment, terminal/`wf` components, build and vendoring tools. Production C++ remains header-only in `include/webfront/`. - `js/developer/tools/starters/pi/`, `test/fixtures/`, `test/web/fixtures/`: retained package and regression fixtures, not public example applications. - `test/unit/`: Catch2 unit tests; `test/web/`: Jasmine real-browser integration test; `test/fuzz/`, `test/fixtures/`; `test/cmake/`: CMake test scripts and sub-projects. The `RepositoryLayout` CTest case pins the tracked root. -- `cmake/`: build modules (frontends, CEF, CPM, compiler options); `.github/`: workflows, `.github/CONTRIBUTING.md`, `.github/codecov.yml`. +- `cmake/`: build modules (frontends, CEF, CPM, compiler options); `.github/`: workflows, `.github/CONTRIBUTING.md`. - `.devcontainer/`: devcontainer and its Dockerfile; `docs/`: documentation, `docs/CHANGELOG.md`, `docs/Doxyfile.in`. - `third_party/xterm/`: vendored xterm.js distribution embedded by the terminal component; refresh it only with `cmake/UpdateXterm.cmake`. - `docs/PROJECT_STATUS.md`: evidence-based status snapshot and known limitations. @@ -30,7 +30,7 @@ The README introduces WebFront through the Game of Life walkthrough, demonstrati - `docs/UI_COMPONENTS.md`: UI component architecture, the terminal component and the planned `wf` tool manager. - `docs/ISSUE_AUDIT.md`: recommendations for the current GitHub backlog. -The historical `webfront/` prototype and the former top-level `test/web/` are gone: use `test/unit/` for current C++ tests and `test/web/` for browser tests. Do not revive legacy code without a specific issue and regression coverage. +The historical `webfront/` prototype and the former top-level `webtest/` are gone: use `test/unit/` for current C++ tests and `test/web/` for browser tests. Do not revive legacy code without a specific issue and regression coverage. ## Build and test commands diff --git a/README.md b/README.md index 49c01b21..352aaa8f 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ Tests and the `webfront-embedded-assets` regeneration target require Node.js, in CTest runs up to four tasks at a time; browser ports remain locked and embedded builds run serially. See [test timings and parallelism](docs/TEST_PERFORMANCE.md) for measurements and constraints. -CI runs one combined C++ / native-browser job per desktop platform on each code change. The Linux job also uploads GCC coverage on each PR. Linux Clang, sanitizers, fuzzing and CEF compatibility run weekly and on demand. Manual dispatch with `repeat_desktop_tests=true` also repeats each desktop CTest case three times for stability checks. Workflow concurrency cancels superseded runs; dependency and compiler caches avoid repeated work. Platform badges above identify the configured matrix; the CI badge reports its aggregate status. Execution times depend on cache state and runner availability. +CI runs one combined C++ / native-browser job per desktop platform on each code change. The Linux job also collects and prints GCC line coverage (no external upload). Linux Clang, sanitizers, fuzzing and CEF compatibility run weekly and on demand. Manual dispatch with `repeat_desktop_tests=true` also repeats each desktop CTest case three times for stability checks. Workflow concurrency cancels superseded runs; dependency and compiler caches avoid repeated work. Platform badges above identify the configured matrix; the CI badge reports its aggregate status. Execution times depend on cache state and runner availability. ## Contracts and limitations diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 1a8ddb91..6a2260af 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -13,6 +13,7 @@ until #319). `assets/` and `tools/` become `js/core` and `js/developer`; `webtest/` becomes `test/web`, `fuzz/` becomes `test/fuzz`, unit tests move to `test/unit`; `CHANGELOG.md`, `Doxyfile.in` move to `docs/`, `CONTRIBUTING.md` and `codecov.yml` to `.github/`, `Dockerfile` to `.devcontainer/`. Moves keep Git history. +- Remove the CodeScene configuration and the Codecov upload (`.github/codecov.yml`, `CODECOV_TOKEN`); the Linux job still prints an lcov summary. - Developer distribution 0.4.1 (pending `developer-v0.4.1` publication): generated providers include ``. Published 0.4.0 remains immutable. diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index 3d85d146..70a753f9 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -50,7 +50,7 @@ published 0.1.0 to 0.4.0 remain immutable. APIs and packaging remain experimenta - The README starts with Hello World and a linked Life thumbnail, then walks through the native bootstrap, dependency installation, preview and offline embedding. No library feature is added. - Per-change CI combines unit tests and native browser coverage into three desktop jobs, with - npm, CPM and compiler caches. The Linux job uploads GCC coverage on every PR. Sanitizers, fuzzing, + npm, CPM and compiler caches. The Linux job prints GCC line coverage on every PR (no external upload). Sanitizers, fuzzing, both CEF compiler variants and optional mddlog qualification run weekly or manually. Superseded runs are cancelled. - Developer distribution 0.4.0 is published for the revised Life text (`developer-v0.4.0`). - The dated entries below record earlier implementations and their original target names. From 3fc3e914164120ad911df84e85c47d7c8b837b16 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 12:05:51 +0200 Subject: [PATCH 009/134] Record the published developer distribution 0.4.1 [#320] --- docs/CHANGELOG.md | 2 +- docs/DEVELOPER_ENVIRONMENT.md | 2 +- docs/PROJECT_STATUS.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 6a2260af..56a58e78 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -14,7 +14,7 @@ `fuzz/` becomes `test/fuzz`, unit tests move to `test/unit`; `CHANGELOG.md`, `Doxyfile.in` move to `docs/`, `CONTRIBUTING.md` and `codecov.yml` to `.github/`, `Dockerfile` to `.devcontainer/`. Moves keep Git history. - Remove the CodeScene configuration and the Codecov upload (`.github/codecov.yml`, `CODECOV_TOKEN`); the Linux job still prints an lcov summary. -- Developer distribution 0.4.1 (pending `developer-v0.4.1` publication): generated providers include +- Developer distribution 0.4.1 (published as `developer-v0.4.1`): generated providers include ``. Published 0.4.0 remains immutable. ## 0.4.0 - 2026-10-21 diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 08152ec6..44ca9540 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -47,7 +47,7 @@ native tests from empty working directories, with developer callbacks absent. Pa HTTP 200, CORS `*` and the pinned archive bytes. These checks supplement offline CTest fixtures. The default configuration is generated in `include/webfront/system/DeveloperReleaseData.hpp` and targets -`https://ambroise-leclerc.github.io/WebFront/developer/0.4.1/environment.tgz`. This version (generated providers now include ``) is prepared but not yet published until its `developer-v0.4.1` tag is pushed; use local provisioning for now. Published 0.4.0 stays immutable but targets the former include layout. The configuration pins one version and +`https://ambroise-leclerc.github.io/WebFront/developer/0.4.1/environment.tgz`. This version, published and archived as `developer-v0.4.1`, generates providers that include ``. Published 0.4.0 stays immutable but targets the former include layout. The configuration pins one version and its SHA-512 rather than resolving a mutable `latest` channel. An explicit `DeveloperBootstrapOptions{.environment = url, .integrity = trustedHash}` still selects a different HTTPS/CORS repository or a same-origin test fixture. Users install neither npm nor Node.js. diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index 70a753f9..b1f89b7b 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -9,7 +9,7 @@ removed without redirect headers (see `docs/CHANGELOG.md`). Browser sources live (bridge, fallback, bootstrap loader and embedding modules) and `js/developer/` (environment, terminal components, build tools, vendoring tools); tests live in `test/{unit,web,fuzz,fixtures,cmake}`. The CTest case `RepositoryLayout` enforces the root. The generated-provider include changed, so the developer -distribution is bumped to 0.4.1 and awaits its `developer-v0.4.1` publication. +distribution is bumped to 0.4.1, published and archived as `developer-v0.4.1`. ## CI test duration (#298, 2026-10-21) From aea1e1dec27a17fac0525331da084f93628adda4 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 12:18:19 +0200 Subject: [PATCH 010/134] Add ADR-016: the bootstrap environment as WebFront's foundation [#304] --- ...DR-009-modules-et-assets-reproductibles.md | 13 +- ...ADR-010-composants-et-outils-optionnels.md | 13 +- ...-013-bootstrap-developpeur-a-la-demande.md | 9 + ...construction-javascript-dans-le-browser.md | 9 + ...015-ressources-generees-par-application.md | 9 + docs/adr/ADR-016-bootstrap-comme-socle.md | 155 ++++++++++++++++++ docs/adr/README.md | 17 +- 7 files changed, 213 insertions(+), 12 deletions(-) create mode 100644 docs/adr/ADR-016-bootstrap-comme-socle.md diff --git a/docs/adr/ADR-009-modules-et-assets-reproductibles.md b/docs/adr/ADR-009-modules-et-assets-reproductibles.md index 117c4ddc..fe4c033a 100644 --- a/docs/adr/ADR-009-modules-et-assets-reproductibles.md +++ b/docs/adr/ADR-009-modules-et-assets-reproductibles.md @@ -12,11 +12,12 @@ | 1.5 | 2026-10-16 | Acceptée | Ambroise Leclerc | Contrôle des fins de ligne LF des sources et en-têtes embarqués. | [520ca23](https://github.com/ambroise-leclerc/WebFront/commit/520ca23fa694519d9f428ed3661e64dcfdf906a2) | | 1.6 | 2026-10-19 | Acceptée | Ambroise Leclerc | Négociation gzip/identity, décodage validé et budget de sortie. | [4be7358](https://github.com/ambroise-leclerc/WebFront/commit/4be73581ee6b9f569cb6e50aced73e27562aa38c) | | 2.0 | 2026-10-19 | Acceptée | Ambroise Leclerc | Génération gzip reproductible avec compresseur intégré ; distributions actualisées et runtime React ESM local. | [b031ab5](https://github.com/ambroise-leclerc/WebFront/commit/b031ab58ea9cc32290d701094c1333bab455e67f) | +| 2.1 | 2026-10-22 | Acceptée | Ambroise Leclerc | Assets embarqués limités à la liste normative de l'ADR-016 ; trajectoire de retrait de BabelFS, ReactFS, JasmineFS et des sources vendorisées. | À renseigner après fusion de l'issue #304. | ## État et chronologie **Acceptée.** Décision initiale : **2023-03-16** (version 1.0). -Dernière révision : **2026-10-19** (version 2.0). +Dernière révision : **2026-10-22** (version 2.1). Le présent texte expose la décision en vigueur ; le tableau retrace ses états antérieurs. ## Contexte @@ -57,6 +58,14 @@ un échec de décodage ou dépassement du budget donne 500. - **Risque :** gzip→identity décode synchroniquement sur le thread I/O, à chaque requête, sans cache. Le budget borne la sortie, pas le temps ; cache et déplacement du travail restent futurs. +### Révision de l'ADR-016 + +Les assets embarqués dans `include/webfront/` se limitent à la liste normative de +[ADR-016](ADR-016-bootstrap-comme-socle.md). `BabelFS`, `ReactFS`, `JasmineFS`, leurs en-têtes +générés et `third_party/` sont voués au retrait (#312, #319) ; les bibliothèques deviennent des +paquets npm verrouillés fournis par l'environnement. Jusqu'à ce retrait, les règles de génération +ci-dessous restent en vigueur et ne doivent pas être étendues à de nouvelles bibliothèques. + ## Prescriptions d’implémentation et de génération de code - Que les sources soient modifiées avant régénération ; préserver les fins de ligne LF et les @@ -74,4 +83,4 @@ un échec de décodage ou dépassement du budget donne 500. [génération](../../js/core/WebFrontAssets.cmake). - Tests : `Asset.*Fresh`, `EmbeddedGzipContents`, [HTTPEncodingTests](../../test/unit/HTTPEncodingTests.cpp), [React dans le navigateur](../../test/web/js/react-demo-specs.mjs). -- Voir [ADR-002](ADR-002-systemes-de-fichiers-composables.md). +- Voir [ADR-002](ADR-002-systemes-de-fichiers-composables.md) et [ADR-016](ADR-016-bootstrap-comme-socle.md). diff --git a/docs/adr/ADR-010-composants-et-outils-optionnels.md b/docs/adr/ADR-010-composants-et-outils-optionnels.md index bdbe6adf..1f2b7f3b 100644 --- a/docs/adr/ADR-010-composants-et-outils-optionnels.md +++ b/docs/adr/ADR-010-composants-et-outils-optionnels.md @@ -10,11 +10,12 @@ | 1.3 | 2026-10-15 | Acceptée | Ambroise Leclerc | Recherche, installation et ouverture des outils via une extension navigateur. | [18d5bb4](https://github.com/ambroise-leclerc/WebFront/commit/18d5bb4c5db6e4dc5ecf4867378d451887b2c133) | | 1.4 | 2026-10-15 | Acceptée | Ambroise Leclerc | Validation des outils avec un registre local factice. | [d53ffcc](https://github.com/ambroise-leclerc/WebFront/commit/d53ffcc40102c7405eb7060d7021aad366d6d7e9) | | 1.5 | 2026-10-16 | Acceptée | Ambroise Leclerc | Interruption des commandes navigateur et transferts séquentiels par blocs de 256 KiB. | [c81f7f7](https://github.com/ambroise-leclerc/WebFront/commit/c81f7f74728ad24a53c16f907e016eb0fe1b8bce) | +| 1.6 | 2026-10-22 | Acceptée | Ambroise Leclerc | Trajectoire de retrait de Terminal.hpp, ToolManager.hpp, ToolStore et PackageFS au profit de l'environnement bootstrap (ADR-016). | À renseigner après fusion de l'issue #304. | ## État et chronologie **Acceptée.** Décision initiale : **2026-10-14** (version 1.0). -Dernière révision : **2026-10-16** (version 1.5). +Dernière révision : **2026-10-22** (version 1.6). Le présent texte expose la décision en vigueur ; le tableau retrace ses états antérieurs. ## Contexte @@ -64,6 +65,14 @@ l’autorité du bridge de l’application ; c’est une fonction de développem - **Risque :** un outil installé peut appeler tous les callbacks ; ce mécanisme ne remplace pas un système de plugins isolés. Staging et intégrité protègent l’installation, pas son code. +### Révision de l'ADR-016 + +`Terminal.hpp`, `ToolManager.hpp`, `ToolStore`, `PackageFS`, `TerminalFS`, `ToolManagerFS` et xterm +embarqué sont voués au retrait (#313) : le terminal et le `wf` de l'environnement téléchargé +([ADR-016](ADR-016-bootstrap-comme-socle.md)) les remplacent. Ils restent fonctionnels et testés +tant que l'équivalent n'est pas couvert ; aucune nouvelle fonctionnalité ne leur est ajoutée. +Les abonnements UI multiples et l'injection du navigateur appelant demeurent des contrats du cœur. + ## Prescriptions d’implémentation et de génération de code - Que registres et magasins soient possédés conjointement par les callbacks afin que la façade @@ -82,4 +91,4 @@ l’autorité du bridge de l’application ; c’est une fonction de développem [Terminal](../../include/webfront/components/Terminal.hpp), [ToolManager](../../include/webfront/components/ToolManager.hpp). - Tests : [UISubscribersTests](../../test/unit/UISubscribersTests.cpp), [ToolStoreTests](../../test/unit/ToolStoreTests.cpp), [tools-specs](../../test/web/js/tools-specs.mjs). -- Voir [ADR-002](ADR-002-systemes-de-fichiers-composables.md) et [ADR-008](ADR-008-contenu-de-confiance-et-origines.md). +- Voir [ADR-002](ADR-002-systemes-de-fichiers-composables.md), [ADR-008](ADR-008-contenu-de-confiance-et-origines.md) et [ADR-016](ADR-016-bootstrap-comme-socle.md). diff --git a/docs/adr/ADR-013-bootstrap-developpeur-a-la-demande.md b/docs/adr/ADR-013-bootstrap-developpeur-a-la-demande.md index 2b338b4f..13335a62 100644 --- a/docs/adr/ADR-013-bootstrap-developpeur-a-la-demande.md +++ b/docs/adr/ADR-013-bootstrap-developpeur-a-la-demande.md @@ -5,6 +5,7 @@ | Version | Date | État | Auteur | Évolution | Commit | | --- | --- | --- | --- | --- | --- | | 0.1 | 2026-10-20 | Proposée | Ambroise Leclerc | Proposition et première implémentation du bootstrap développeur versionné. | À renseigner après intégration. | +| 0.2 | 2026-10-22 | Proposée | Ambroise Leclerc | Alignement sur ADR-016 : la proposition devient la base de l'architecture ; preuves multiplateformes manquantes listées. | À renseigner après fusion de l'issue #304. | ## Statut et date @@ -44,6 +45,14 @@ séparées de la bibliothèque C++. Les archives gardent des identifiants de paq publication npm ou propriété d'un scope. Le manifeste vérifié épingle aussi un starter PI distinct ; `wf create pi` crée son dossier sans remplacer un projet existant. +## Alignement sur l'ADR-016 + +[ADR-016](ADR-016-bootstrap-comme-socle.md) retient cette proposition comme base de l'architecture. +Elle reste **Proposée** jusqu'aux preuves de #316 : parcours complet validé sous CEF, WebKitGTK, +WebView2 et WKWebView, compatibilité d'un échantillon de paquets npm, restauration hors ligne et +publication vérifiée d'une release. Les providers et composants historiques évoqués ici suivent la +trajectoire de retrait de l'ADR-016. + ## Alternatives et conséquences - Embarquer l'environnement complet : écarté pour conserver une application initiale légère. diff --git a/docs/adr/ADR-014-construction-javascript-dans-le-browser.md b/docs/adr/ADR-014-construction-javascript-dans-le-browser.md index d853972e..df48a045 100644 --- a/docs/adr/ADR-014-construction-javascript-dans-le-browser.md +++ b/docs/adr/ADR-014-construction-javascript-dans-le-browser.md @@ -5,6 +5,7 @@ | Version | Date | État | Auteur | Évolution | Commit | | --- | --- | --- | --- | --- | --- | | 0.1 | 2026-10-20 | Proposée | Ambroise Leclerc | Proposition et première implémentation du résolveur npm et du compilateur navigateur. | À renseigner après intégration. | +| 0.2 | 2026-10-22 | Proposée | Ambroise Leclerc | Alignement sur ADR-016 : la proposition devient la base de l'architecture ; preuves multiplateformes manquantes listées. | À renseigner après fusion de l'issue #304. | ## Statut et date @@ -40,6 +41,14 @@ pour découvrir leurs exports ou lancer leurs scripts d'installation. ordinaire, y compris les erreurs et les Promises. Ctrl+C termine un build navigateur ; aucun processus C++ de compilation ou shell n'est lancé. La transformation TS n'effectue pas de typecheck. +## Alignement sur l'ADR-016 + +[ADR-016](ADR-016-bootstrap-comme-socle.md) retient cette proposition comme base de l'architecture. +Elle reste **Proposée** jusqu'aux preuves de #316 : parcours complet validé sous CEF, WebKitGTK, +WebView2 et WKWebView, compatibilité d'un échantillon de paquets npm, restauration hors ligne et +publication vérifiée d'une release. Les providers et composants historiques évoqués ici suivent la +trajectoire de retrait de l'ADR-016. + ## Alternatives et conséquences - Un service distant de bundling introduirait une dépendance de construction externe et un autre diff --git a/docs/adr/ADR-015-ressources-generees-par-application.md b/docs/adr/ADR-015-ressources-generees-par-application.md index 8eed2ced..c4ba88cf 100644 --- a/docs/adr/ADR-015-ressources-generees-par-application.md +++ b/docs/adr/ADR-015-ressources-generees-par-application.md @@ -5,6 +5,7 @@ | Version | Date | État | Auteur | Évolution | Commit | | --- | --- | --- | --- | --- | --- | | 0.1 | 2026-10-20 | Proposée | Ambroise Leclerc | Proposition et première implémentation de wf embed et du parcours hors ligne. | À renseigner après intégration. | +| 0.2 | 2026-10-22 | Proposée | Ambroise Leclerc | Alignement sur ADR-016 : la proposition devient la base de l'architecture ; preuves multiplateformes manquantes listées. | À renseigner après fusion de l'issue #304. | ## Statut et date @@ -36,6 +37,14 @@ Le bridge embarqué reste celui de WebFront, en priorité sur les providers appl Conserver les providers historiques pour les consommateurs existants ; leur retrait n'est pas une conséquence automatique de cette proposition. +## Alignement sur l'ADR-016 + +[ADR-016](ADR-016-bootstrap-comme-socle.md) retient cette proposition comme base de l'architecture. +Elle reste **Proposée** jusqu'aux preuves de #316 : parcours complet validé sous CEF, WebKitGTK, +WebView2 et WKWebView, compatibilité d'un échantillon de paquets npm, restauration hors ligne et +publication vérifiée d'une release. Les providers et composants historiques évoqués ici suivent la +trajectoire de retrait de l'ADR-016. + ## Alternatives et conséquences - Distribuer le cache et des fichiers locaux maintiendrait une dépendance au poste de développement. diff --git a/docs/adr/ADR-016-bootstrap-comme-socle.md b/docs/adr/ADR-016-bootstrap-comme-socle.md new file mode 100644 index 00000000..c863ec1f --- /dev/null +++ b/docs/adr/ADR-016-bootstrap-comme-socle.md @@ -0,0 +1,155 @@ +# ADR-016 : L'environnement bootstrap comme socle de WebFront + +## Versions + +| Version | Date | État | Auteur | Évolution | Commit | +| --- | --- | --- | --- | --- | --- | +| 1.0 | 2026-10-22 | Acceptée | Ambroise Leclerc | Décision initiale : environnement bootstrap comme architecture de base, liste normative du cœur, scripts autorisés, indépendance vis-à-vis de Node.js. | À renseigner après fusion de l'issue #304. | + +## Statut et date + +**Acceptée le 2026-10-22** (épique #303, issue #304). Cette décision fixe la direction +architecturale et les règles que les issues suivantes de l'épique doivent respecter. Elle ne +déclare **pas** les mécanismes déjà proposés (ADR-013, ADR-014, ADR-015) comme acceptés : leur +passage à « Acceptée » attend les preuves multiplateformes de #316. Aucun code n'est modifié par +cette décision ; les retraits qu'elle annonce sont réalisés par #311 à #319. + +## Contexte + +L'étape développeur du jeu de la vie (`examples/life/LifeDeveloper.cpp`) montre le modèle visé : +`NativeApp::bootstrap("developer")` sert une petite page embarquée, télécharge une archive +d'environnement vérifiée SHA-512, monte un terminal dans le navigateur, installe des paquets npm +sans Node (`wf install`), compile TS/TSX dans un Worker (`wf preview`) et génère un provider +propre à l'application (`wf embed`), compilé ensuite dans un exécutable de distribution. + +Le dépôt livre encore en parallèle environ 2,5 Mo d'en-têtes pré-générés sous +`include/webfront/system/` (dont `BabelData.hpp`, 1,5 Mo), environ 3,4 Mo de sources vendorisées +dans `third_party/`, des providers (`BabelFS`, `ReactFS`, `JasmineFS`) qui ne servent qu'aux tests +et un second système de terminal et d'outils (`Terminal.hpp`, `ToolManager.hpp`, `ToolStore`, +`PackageFS`, `TerminalFS`, `ToolManagerFS`) avec un autre `wf`. Régénérer ou tester exige Node.js. + +## Décision + +L'environnement bootstrap devient l'architecture de base : un outil de développement complet +« à la node.js » (manifeste de projet, install, run, test, build, embed) fourni par une archive +téléchargée et vérifiée, tandis que le code source de WebFront redevient minimaliste. + +### Liste normative des ressources du cœur + +`include/webfront/` ne contient, comme ressources web embarquées, que : + +| Ressource | Rôle | +| --- | --- | +| `WebFrontJsData` | Bridge `WebFront.js` | +| `FallbackIndexHtmlData` | Page de repli | +| `FallbackModuleData` | Module de repli | +| favicon (`WebFrontIco`, servi par `IndexFS`) | Icône par défaut | +| `DeveloperIndexHtmlData` | Page du bootstrap développeur | +| `DeveloperBootstrapData` | Chargeur bootstrap (`bootstrap.bundle.mjs`) | +| `DeveloperReleaseData` | Release épinglée (URL et SHA-512) | + +Toute autre ressource web (bibliothèques, runner de test, pages de test, terminal, providers +applicatifs) est produite par un script autorisé et livrée par l'archive d'environnement ou par un +paquet npm verrouillé par intégrité. Cette liste est normative : un test garde-fou (#314) la +compare aux fichiers de ressources de `include/webfront/system/` et impose un budget de taille ; +ajouter une ressource exige de modifier cette ADR (nouvelle version) et ce test dans le même +changement. Le C++ header-only (filesystems, serveur, bridge, frontends) n'est pas concerné. + +### Script autorisé par WebFront + +Code JS/TS exécuté par l'environnement vérifié, dans un Worker, avec une API WebFront bornée +(`context`) et des permissions déclarées dans le manifeste de projet. Il n'y a ni API Node +implicite, ni shell, ni exécution des scripts d'installation npm. + +### Portée des permissions + +Les permissions du manifeste encadrent **uniquement** les opérations offertes par l'API +`context` : fichiers du projet via le bridge, publication, `context.fetch` vers des origines +listées. Elles ne restreignent pas les capacités propres du Worker (`fetch` global, +`importScripts`, WebSocket…) et ne constituent pas une frontière de sécurité, conformément à +l'[ADR-008](ADR-008-contenu-de-confiance-et-origines.md) : le code téléchargé et les scripts +autorisés ont l'autorité du bridge et du projet désigné. Un durcissement ultérieur (CSP +`connect-src` servie avec le script du Worker) reste possible mais n'est pas promis. + +### Indépendance vis-à-vis de l'environnement + +Aucun usage (utilisateur, contributeur, CI) ne requiert Node.js ou npm : seuls restent un +compilateur C++23, CMake et le moteur du frontend choisi. Les en-têtes du cœur sont régénérés et +vérifiés sans Node (#318) : le pilote C++ non interactif exécute les scripts d'assemblage dans le +navigateur à partir d'une version d'amorçage épinglée (#321), puis compare les octets produits aux +en-têtes versionnés. Les paquets de test viennent d'un registre local alimenté par CMake au +configure ; aucun test ne dépend du réseau public ensuite. Aucune source tierce n'est vendorisée +et `third_party/` disparaît (#319) ; les bibliothèques sont des paquets npm verrouillés, jamais +committés. + +### Sources vendorisées et artefacts générés + +Sont **interdites** les sources tierces copiées dans le dépôt. Sont **permises** les dépendances +incorporées dans un artefact généré autorisé, désigné nominativement. Exception nommée : le bundle +bootstrap (`bootstrap.bundle.mjs` → `DeveloperBootstrapData.hpp`), qui incorpore notamment le +décompresseur. Il est accompagné de son lock, de ses notices de licence et d'une preuve de +reconstruction (#315). Toute autre exception exige une révision de cette ADR. + +### Distribution + +`NativeAppWithAssets` s'exécute sans racine projet, cache, réseau, callbacks +développeur ni outillage. L'outillage de construction n'est jamais embarqué dans l'application. + +## Révision des décisions existantes + +- **[ADR-009](ADR-009-modules-et-assets-reproductibles.md)** (v2.1) : les assets embarqués sont + limités à la liste normative ; `BabelFS`, `ReactFS`, `JasmineFS` et leurs sources vendorisées + sont retirés (#312, #319). Les tests migrent vers `wf test` (#311). +- **[ADR-010](ADR-010-composants-et-outils-optionnels.md)** (v1.6) : `Terminal.hpp`, + `ToolManager.hpp`, `ToolStore`, `PackageFS`, `TerminalFS`, `ToolManagerFS` et xterm embarqué + sont retirés (#313). Le terminal et `wf` de l'environnement téléchargé les remplacent ; les + abonnements UI multiples et l'injection du navigateur appelant restent des contrats du cœur. +- **[ADR-013](ADR-013-bootstrap-developpeur-a-la-demande.md), + [ADR-014](ADR-014-construction-javascript-dans-le-browser.md), + [ADR-015](ADR-015-ressources-generees-par-application.md)** restent **Proposées**. Preuves + manquantes avant acceptation : validation CEF, WebKitGTK, WebView2 et WKWebView du parcours + complet, compatibilité d'un échantillon de paquets npm, restauration hors ligne, publication + vérifiée d'une release (#316). + +### Trajectoire de dépréciation + +1. Les composants historiques restent fonctionnels et testés tant que l'équivalent de + l'environnement n'est pas couvert par `wf test` et le registre local. +2. Les remplaçants sont livrés et documentés (#305 à #310), puis les tests migrent (#311). +3. Retrait des providers de test, puis des composants (#312, #313), documenté dans le CHANGELOG + comme changement incompatible ; le garde-fou (#314) interdit leur retour. + +## Alternatives et conséquences + +- Conserver deux systèmes (composants C++ et environnement) : écarté, double maintenance de + deux terminaux, deux `wf` et deux modèles d'installation. +- Garder Node.js pour la régénération et les tests : écarté, contraire à l'autonomie visée. +- Garder les bibliothèques vendorisées pour les tests : écarté, le poids du dépôt et la + provenance floue ne se justifient pas face à des paquets verrouillés par intégrité. +- **Coût accepté :** le premier lancement du mode développeur nécessite l'accès à la release ou + un provisioning local ; les consommateurs des providers historiques doivent migrer ; le + bootstrap devient un point critique à qualifier sur chaque moteur. +- **Risque :** l'environnement téléchargé porte l'autorité du bridge ; l'intégrité SHA-512 + protège l'origine des octets, pas leur comportement. + +## Règles et vérification + +- Ne pas ajouter de ressource web à `include/webfront/` hors liste normative ; ne pas ajouter + de dépendance Node.js ou npm à configure, build, CTest ou CI. +- Ne pas présenter les permissions du manifeste comme une isolation. +- Conserver les contrats existants : bridge asynchrone, Promises qui rejettent, bornes du + protocole ([ADR-003](ADR-003-protocole-binaire-et-bornes.md)), intégrité SHA-512, publication + transactionnelle via `developer::Store`. +- Vérification : test garde-fou de la liste normative et du budget (#314), régénération des + en-têtes sans Node (#318), absence de `third_party/` (#319), qualification multiplateforme + (#316). + +## Références + +- Épique #303 ; [ADR-008](ADR-008-contenu-de-confiance-et-origines.md), + [ADR-009](ADR-009-modules-et-assets-reproductibles.md), + [ADR-010](ADR-010-composants-et-outils-optionnels.md), + [ADR-013](ADR-013-bootstrap-developpeur-a-la-demande.md), + [ADR-014](ADR-014-construction-javascript-dans-le-browser.md), + [ADR-015](ADR-015-ressources-generees-par-application.md), + [Environnement développeur](../DEVELOPER_ENVIRONMENT.md). diff --git a/docs/adr/README.md b/docs/adr/README.md index 581d622e..b17eee03 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -1,7 +1,7 @@ # WebFront architecture decision records This directory describes WebFront’s architectural choices and the constraints to preserve -when making changes or generating code. It contains **15 ADRs**, with unique numbers (12 accepted decisions and 3 proposals). +when making changes or generating code. It contains **16 ADRs**, with unique numbers (13 accepted decisions and 3 proposals). The accepted baseline corresponds to commit `b031ab5` dated **2026-10-19**; the browser-powered development proposals are dated **2026-10-20**. Each ADR is versioned according to the decision’s creation and its significant changes in the Git history. @@ -48,13 +48,14 @@ verification evidence remain in [PROJECT_STATUS](../PROJECT_STATUS.md). | [ADR-006](ADR-006-taches-structurees-et-arret.md) | Owning, cancelling and joining every task | Accepted | 2026-10-13 | 2.0 — 2026-10-18 | | [ADR-007](ADR-007-frontends-explicites.md) | Explicit frontend selection and a shared lifecycle contract | Accepted | 2026-05-31 | 1.10 — 2026-10-20 | | [ADR-008](ADR-008-contenu-de-confiance-et-origines.md) | Restricting bridge origins without promising a sandbox | Accepted | 2026-10-18 | 1.0 — 2026-10-18 | -| [ADR-009](ADR-009-modules-et-assets-reproductibles.md) | Serving modules locally and regenerating assets reproducibly | Accepted | 2023-03-16 | 2.0 — 2026-10-19 | -| [ADR-010](ADR-010-composants-et-outils-optionnels.md) | Extending WebFront through optional components and development tools | Accepted | 2026-10-14 | 1.5 — 2026-10-16 | +| [ADR-009](ADR-009-modules-et-assets-reproductibles.md) | Serving modules locally and regenerating assets reproducibly | Accepted | 2023-03-16 | 2.1 — 2026-10-22 | +| [ADR-010](ADR-010-composants-et-outils-optionnels.md) | Extending WebFront through optional components and development tools | Accepted | 2026-10-14 | 1.6 — 2026-10-22 | | [ADR-011](ADR-011-diagnostics-optionnels.md) | Confining mddlog behind an optional diagnostics façade | Accepted | 2026-10-01 | 1.2 — 2026-10-02 | | [ADR-012](ADR-012-preuves-et-tests.md) | Demonstrating contracts through deterministic tests and browser integration | Accepted | 2020-04-19 | 1.6 — 2026-10-19 | -| [ADR-013](ADR-013-bootstrap-developpeur-a-la-demande.md) | Bootstrapping a downloaded developer environment | Proposée | 2026-10-20 | 0.1 — 2026-10-20 | -| [ADR-014](ADR-014-construction-javascript-dans-le-browser.md) | Resolving npm dependencies and building inside the browser | Proposée | 2026-10-20 | 0.1 — 2026-10-20 | -| [ADR-015](ADR-015-ressources-generees-par-application.md) | Generating application-owned embedded resources | Proposée | 2026-10-20 | 0.1 — 2026-10-20 | +| [ADR-013](ADR-013-bootstrap-developpeur-a-la-demande.md) | Bootstrapping a downloaded developer environment | Proposée | 2026-10-20 | 0.2 — 2026-10-22 | +| [ADR-014](ADR-014-construction-javascript-dans-le-browser.md) | Resolving npm dependencies and building inside the browser | Proposée | 2026-10-20 | 0.2 — 2026-10-22 | +| [ADR-015](ADR-015-ressources-generees-par-application.md) | Generating application-owned embedded resources | Proposée | 2026-10-20 | 0.2 — 2026-10-22 | +| [ADR-016](ADR-016-bootstrap-comme-socle.md) | The bootstrap environment as WebFront's foundation | Accepted | 2026-10-22 | 1.0 — 2026-10-22 | Numbering follows the reading topics; milestones and individual file histories provide the chronology, which does not follow the numerical order. @@ -78,7 +79,7 @@ the chronology, which does not follow the numerical order. | A new engine or changes to window lifecycle | 006, 007, 008 | | Components, the terminal or installed tools | 004, 006, 008, 010 | | Diagnostics and log transport | 006, 011 | -| Downloaded development environment, npm libraries and generated application assets | 008, 009, 010, 013, 014, 015 | +| Downloaded development environment, npm libraries and generated application assets | 008, 009, 010, 013, 014, 015, 016 | ADRs explain decisions; [AGENTS.md](../../AGENTS.md) sets out working instructions, the [README](../../README.md) provides the user journey, and specialist documents define @@ -96,7 +97,7 @@ Do not replace historical dates with the date of an editorial change to the docu Keep previous rows and update the current version in the index. - Use one `ADR-NNN-description.md` file per decision and one row in this index. The next number - is **ADR-016**. Retain historical numbers and files. + is **ADR-017**. Retain historical numbers and files. - For a new decision that has not been integrated, use **Proposée** (Proposed), its actual proposal date and validation criteria; do not assign an artificial historical commit date. - After integration, record the date and supporting commits, the accepted negative From bf688db97952a3309772c99460d84510c6a7251c Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 13:29:14 +0200 Subject: [PATCH 011/134] Add the project manifest, wf init and a transactional manifest and lock publication [#305] webfront.project.json (format 1) is validated strictly and read by wf install, preview and embed. The lock records the digest of the manifest dependencies and every command reports a desynchronized state. developer::Store::commitGroup publishes both files through a synced intent journal recovered at startup, with a fingerprint precondition against concurrent installations. Fill the commit links of ADR-009, 010, 013, 014, 015 and 016. --- docs/CHANGELOG.md | 10 + docs/DEVELOPER_ENVIRONMENT.md | 52 +++- ...DR-009-modules-et-assets-reproductibles.md | 2 +- ...ADR-010-composants-et-outils-optionnels.md | 2 +- ...-013-bootstrap-developpeur-a-la-demande.md | 2 +- ...construction-javascript-dans-le-browser.md | 2 +- ...015-ressources-generees-par-application.md | 2 +- docs/adr/ADR-016-bootstrap-comme-socle.md | 2 +- include/webfront/DeveloperApp.hpp | 2 + include/webfront/system/DeveloperJournal.hpp | 197 ++++++++++++++ include/webfront/system/DeveloperStore.hpp | 144 ++++++++++- js/core/WebFrontAssets.cmake | 3 +- js/developer/environment/bundles.json | 16 +- js/developer/environment/installer.mjs | 122 +++++++++ js/developer/environment/io.mjs | 2 +- js/developer/environment/manifest.mjs | 177 +++++++++++++ js/developer/environment/packages-entry.mjs | 5 + js/developer/environment/packages.bundle.mjs | 8 +- js/developer/environment/project.mjs | 80 ++++++ js/developer/environment/recipe.mjs | 35 +-- js/developer/environment/runtime.mjs | 81 +++--- js/developer/environment/starter.mjs | 3 +- js/developer/tools/build.mjs | 9 +- js/developer/tools/distribution-check.mjs | 13 +- js/developer/tools/manifest-check.mjs | 244 ++++++++++++++++++ test/unit/DeveloperTests.cpp | 167 ++++++++++++ test/web/developer-specs.mjs | 41 ++- 27 files changed, 1323 insertions(+), 100 deletions(-) create mode 100644 include/webfront/system/DeveloperJournal.hpp create mode 100644 js/developer/environment/installer.mjs create mode 100644 js/developer/environment/manifest.mjs create mode 100644 js/developer/environment/packages-entry.mjs create mode 100644 js/developer/environment/project.mjs create mode 100644 js/developer/tools/manifest-check.mjs diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 56a58e78..4f8b9255 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,6 +2,16 @@ ## Unreleased +### Added + +- Project manifest `webfront.project.json` (format 1: `name`, `version`, `dependencies`, `registry`, `scripts`, + `entries`, `providers`, `test`, `permissions`), strictly validated; `wf init`, `wf install [--update]` and + manifest-driven `wf preview`/`wf embed` in the next developer distribution. The lock records the digest of + the manifest dependencies and reports a desynchronized state. `developer::Store::commitGroup` publishes + manifest and lock through a synced intent journal with crash recovery and a concurrent-install precondition. + New bridge callbacks `webfront.developer.state` and `webfront.developer.commitGroup`. Starters ship a manifest; + `wf install` now needs `wf init` first. + ### Changed - **Breaking:** library headers moved to `include/webfront/`; include them as ``, diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 44ca9540..13dc41e4 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -139,6 +139,54 @@ The PI starter remains available through `wf create pi` for existing projects an coverage. Its sources are maintained under `js/developer/tools/starters/pi/`; the public C++ examples are limited to Hello World and Life. Existing embedded React/Babel providers remain supported. +## Project manifest (`webfront.project.json`) + +Available in the next developer distribution after 0.4.1; the pinned 0.4.1 environment predates it. +A project has one manifest, the equivalent of `package.json`, which every `wf` command reads: + +```json +{ + "format": 1, + "name": "life", + "version": "0.1.0", + "dependencies": {"react": "^19.3.1", "react-dom": "^19.3.1"}, + "registry": "https://registry.npmjs.org/", + "scripts": {}, + "entries": {"main": "ui/main.tsx"}, + "providers": {"LifeUI": {"entry": "main", "output": "generated/LifeUI.hpp"}}, + "test": {"specs": []}, + "permissions": {} +} +``` + +Only `format`, `name` and `version` are required. Validation is strict: an unknown key, a format +newer than the environment reads, a path leaving the project, a non-HTTPS registry or origin and an +unknown permission are errors printed in the terminal, never silently ignored. `scripts`, `test` and +`permissions` are validated here and used by the later commands (#307, #310); permissions will only +frame the operations of the `context` API of authorized scripts, they are not a sandbox. + +- `wf init [directory]` writes a minimal manifest; it never replaces an existing one. +- `wf install [@range]` resolves, downloads and verifies into the cache, then publishes the + manifest (the requested range, or `^version` when none was given) and the lock in a single transaction. +- `wf install` without argument installs exactly the locked graph (like `npm ci`) when the lock agrees + with the manifest, resolves the manifest and creates the lock when there is none, and fails when they + disagree. `wf install --update` resolves the manifest again. +- `wf preview [entry]` and `wf embed ` use `entries` and `providers`; an explicit path still works. + +The manifest holds the intent (roots and ranges), the lock the exact resolution. The lock records a +digest of the manifest's `dependencies` (`manifestDigest`). The project is **consistent** when they +match, **unlocked** without a lock (no installed graph) and **desynchronized** when the dependencies +changed since the lock was written; every command reports that state and none resolves implicitly. + +Both files are published by one all-or-nothing transaction (`developer::Store::commitGroup`): the +staged files are moved under `.webfront/developer/journal/`, a journal naming them is written and +synchronized to disk (the commit point), then each file replaces its target. Opening the project +completes a journal that reached its commit point and abandons the others, so a crash never leaves +a manifest and a lock that belong to different installations. The publication carries a precondition, +the fingerprint of both files as read when the command began: if another browser or command changed +them meanwhile, it is refused with "The project changed since it was read; run the command again" and +nothing is lost. `wf restore` (#306) will fill the cache from a consistent lock without ever writing them. + ## Dependencies, storage and limitations - `wf install` accepts exact versions, registry tags and semver ranges, resolves ordinary @@ -150,8 +198,8 @@ examples are limited to Hello World and Life. Existing embedded React/Babel prov - Browser/production exports, ESM, CommonJS, TS/TSX, JSX, CSS and imported resource files are supported. Private package exports, network imports and unavailable Node built-ins fail. Package-specific build pipelines and automatic polyfills are not supplied. -- `webfront-packages.lock.json` records exact package versions, dependency edges, source integrities - and requested roots. Commit it and the source TSX/CSS; the generated provider can also be committed. +- `webfront-packages.lock.json` records exact package versions, dependency edges, source integrities, + requested roots and the digest of the manifest dependencies it resolved. Commit it and the source TSX/CSS; the generated provider can also be committed. Preview/embed consume the locked local files without resolving versions again. - Unpacked packages are cached by name, version and integrity under `.webfront/developer/packages/`. A failed install can leave unused cached packages, but the lock file remains unchanged. The tools diff --git a/docs/adr/ADR-009-modules-et-assets-reproductibles.md b/docs/adr/ADR-009-modules-et-assets-reproductibles.md index fe4c033a..816c263b 100644 --- a/docs/adr/ADR-009-modules-et-assets-reproductibles.md +++ b/docs/adr/ADR-009-modules-et-assets-reproductibles.md @@ -12,7 +12,7 @@ | 1.5 | 2026-10-16 | Acceptée | Ambroise Leclerc | Contrôle des fins de ligne LF des sources et en-têtes embarqués. | [520ca23](https://github.com/ambroise-leclerc/WebFront/commit/520ca23fa694519d9f428ed3661e64dcfdf906a2) | | 1.6 | 2026-10-19 | Acceptée | Ambroise Leclerc | Négociation gzip/identity, décodage validé et budget de sortie. | [4be7358](https://github.com/ambroise-leclerc/WebFront/commit/4be73581ee6b9f569cb6e50aced73e27562aa38c) | | 2.0 | 2026-10-19 | Acceptée | Ambroise Leclerc | Génération gzip reproductible avec compresseur intégré ; distributions actualisées et runtime React ESM local. | [b031ab5](https://github.com/ambroise-leclerc/WebFront/commit/b031ab58ea9cc32290d701094c1333bab455e67f) | -| 2.1 | 2026-10-22 | Acceptée | Ambroise Leclerc | Assets embarqués limités à la liste normative de l'ADR-016 ; trajectoire de retrait de BabelFS, ReactFS, JasmineFS et des sources vendorisées. | À renseigner après fusion de l'issue #304. | +| 2.1 | 2026-10-22 | Acceptée | Ambroise Leclerc | Assets embarqués limités à la liste normative de l'ADR-016 ; trajectoire de retrait de BabelFS, ReactFS, JasmineFS et des sources vendorisées. | [404fed2](https://github.com/ambroise-leclerc/WebFront/commit/404fed2c2145d4faba8efee035e10522ff87a91f) | ## État et chronologie diff --git a/docs/adr/ADR-010-composants-et-outils-optionnels.md b/docs/adr/ADR-010-composants-et-outils-optionnels.md index 1f2b7f3b..80941db4 100644 --- a/docs/adr/ADR-010-composants-et-outils-optionnels.md +++ b/docs/adr/ADR-010-composants-et-outils-optionnels.md @@ -10,7 +10,7 @@ | 1.3 | 2026-10-15 | Acceptée | Ambroise Leclerc | Recherche, installation et ouverture des outils via une extension navigateur. | [18d5bb4](https://github.com/ambroise-leclerc/WebFront/commit/18d5bb4c5db6e4dc5ecf4867378d451887b2c133) | | 1.4 | 2026-10-15 | Acceptée | Ambroise Leclerc | Validation des outils avec un registre local factice. | [d53ffcc](https://github.com/ambroise-leclerc/WebFront/commit/d53ffcc40102c7405eb7060d7021aad366d6d7e9) | | 1.5 | 2026-10-16 | Acceptée | Ambroise Leclerc | Interruption des commandes navigateur et transferts séquentiels par blocs de 256 KiB. | [c81f7f7](https://github.com/ambroise-leclerc/WebFront/commit/c81f7f74728ad24a53c16f907e016eb0fe1b8bce) | -| 1.6 | 2026-10-22 | Acceptée | Ambroise Leclerc | Trajectoire de retrait de Terminal.hpp, ToolManager.hpp, ToolStore et PackageFS au profit de l'environnement bootstrap (ADR-016). | À renseigner après fusion de l'issue #304. | +| 1.6 | 2026-10-22 | Acceptée | Ambroise Leclerc | Trajectoire de retrait de Terminal.hpp, ToolManager.hpp, ToolStore et PackageFS au profit de l'environnement bootstrap (ADR-016). | [404fed2](https://github.com/ambroise-leclerc/WebFront/commit/404fed2c2145d4faba8efee035e10522ff87a91f) | ## État et chronologie diff --git a/docs/adr/ADR-013-bootstrap-developpeur-a-la-demande.md b/docs/adr/ADR-013-bootstrap-developpeur-a-la-demande.md index 13335a62..89828e89 100644 --- a/docs/adr/ADR-013-bootstrap-developpeur-a-la-demande.md +++ b/docs/adr/ADR-013-bootstrap-developpeur-a-la-demande.md @@ -5,7 +5,7 @@ | Version | Date | État | Auteur | Évolution | Commit | | --- | --- | --- | --- | --- | --- | | 0.1 | 2026-10-20 | Proposée | Ambroise Leclerc | Proposition et première implémentation du bootstrap développeur versionné. | À renseigner après intégration. | -| 0.2 | 2026-10-22 | Proposée | Ambroise Leclerc | Alignement sur ADR-016 : la proposition devient la base de l'architecture ; preuves multiplateformes manquantes listées. | À renseigner après fusion de l'issue #304. | +| 0.2 | 2026-10-22 | Proposée | Ambroise Leclerc | Alignement sur ADR-016 : la proposition devient la base de l'architecture ; preuves multiplateformes manquantes listées. | [404fed2](https://github.com/ambroise-leclerc/WebFront/commit/404fed2c2145d4faba8efee035e10522ff87a91f) | ## Statut et date diff --git a/docs/adr/ADR-014-construction-javascript-dans-le-browser.md b/docs/adr/ADR-014-construction-javascript-dans-le-browser.md index df48a045..d6459a08 100644 --- a/docs/adr/ADR-014-construction-javascript-dans-le-browser.md +++ b/docs/adr/ADR-014-construction-javascript-dans-le-browser.md @@ -5,7 +5,7 @@ | Version | Date | État | Auteur | Évolution | Commit | | --- | --- | --- | --- | --- | --- | | 0.1 | 2026-10-20 | Proposée | Ambroise Leclerc | Proposition et première implémentation du résolveur npm et du compilateur navigateur. | À renseigner après intégration. | -| 0.2 | 2026-10-22 | Proposée | Ambroise Leclerc | Alignement sur ADR-016 : la proposition devient la base de l'architecture ; preuves multiplateformes manquantes listées. | À renseigner après fusion de l'issue #304. | +| 0.2 | 2026-10-22 | Proposée | Ambroise Leclerc | Alignement sur ADR-016 : la proposition devient la base de l'architecture ; preuves multiplateformes manquantes listées. | [404fed2](https://github.com/ambroise-leclerc/WebFront/commit/404fed2c2145d4faba8efee035e10522ff87a91f) | ## Statut et date diff --git a/docs/adr/ADR-015-ressources-generees-par-application.md b/docs/adr/ADR-015-ressources-generees-par-application.md index c4ba88cf..2c949875 100644 --- a/docs/adr/ADR-015-ressources-generees-par-application.md +++ b/docs/adr/ADR-015-ressources-generees-par-application.md @@ -5,7 +5,7 @@ | Version | Date | État | Auteur | Évolution | Commit | | --- | --- | --- | --- | --- | --- | | 0.1 | 2026-10-20 | Proposée | Ambroise Leclerc | Proposition et première implémentation de wf embed et du parcours hors ligne. | À renseigner après intégration. | -| 0.2 | 2026-10-22 | Proposée | Ambroise Leclerc | Alignement sur ADR-016 : la proposition devient la base de l'architecture ; preuves multiplateformes manquantes listées. | À renseigner après fusion de l'issue #304. | +| 0.2 | 2026-10-22 | Proposée | Ambroise Leclerc | Alignement sur ADR-016 : la proposition devient la base de l'architecture ; preuves multiplateformes manquantes listées. | [404fed2](https://github.com/ambroise-leclerc/WebFront/commit/404fed2c2145d4faba8efee035e10522ff87a91f) | ## Statut et date diff --git a/docs/adr/ADR-016-bootstrap-comme-socle.md b/docs/adr/ADR-016-bootstrap-comme-socle.md index c863ec1f..03e75890 100644 --- a/docs/adr/ADR-016-bootstrap-comme-socle.md +++ b/docs/adr/ADR-016-bootstrap-comme-socle.md @@ -4,7 +4,7 @@ | Version | Date | État | Auteur | Évolution | Commit | | --- | --- | --- | --- | --- | --- | -| 1.0 | 2026-10-22 | Acceptée | Ambroise Leclerc | Décision initiale : environnement bootstrap comme architecture de base, liste normative du cœur, scripts autorisés, indépendance vis-à-vis de Node.js. | À renseigner après fusion de l'issue #304. | +| 1.0 | 2026-10-22 | Acceptée | Ambroise Leclerc | Décision initiale : environnement bootstrap comme architecture de base, liste normative du cœur, scripts autorisés, indépendance vis-à-vis de Node.js. | [404fed2](https://github.com/ambroise-leclerc/WebFront/commit/404fed2c2145d4faba8efee035e10522ff87a91f) | ## Statut et date diff --git a/include/webfront/DeveloperApp.hpp b/include/webfront/DeveloperApp.hpp index ff15100f..996d812a 100644 --- a/include/webfront/DeveloperApp.hpp +++ b/include/webfront/DeveloperApp.hpp @@ -72,6 +72,8 @@ class BasicDeveloperApp : public BasicWF("webfront.developer.write"); expose<&Store::commit, void, std::string>("webfront.developer.commit"); expose<&Store::abort, void, std::string>("webfront.developer.abort"); + expose<&Store::stateOfLines, std::string, std::string>("webfront.developer.state"); + expose<&Store::commitGroupLines, void, std::string, std::string, std::string>("webfront.developer.commitGroup"); } /// Registers a store operation as a bridge callback; the store stays alive as long as the callback. diff --git a/include/webfront/system/DeveloperJournal.hpp b/include/webfront/system/DeveloperJournal.hpp new file mode 100644 index 00000000..2420588e --- /dev/null +++ b/include/webfront/system/DeveloperJournal.hpp @@ -0,0 +1,197 @@ +/// @brief Intent journal of the developer store: publishing several files as one all-or-nothing change. +#pragma once + +#include "WindowsCompat.hpp" +#include "DeveloperPaths.hpp" + +#include +#include +#include +#include +#include +#include + +#if !defined(_WIN32) +#include +#include +#endif + +namespace webfront::developer { + +/// Project-relative directory holding the journals of group publications. +inline constexpr std::string_view journalDirectory = ".webfront/developer/journal"; +inline constexpr std::size_t maxGroupFiles = 4; + +/// Called with the name of each step of a group publication and of its recovery. Tests throw +/// InjectedFault from it to stop the process at that step without any cleanup, as a crash would. +using StepHook = std::function; + +/// A simulated crash: the store leaves the disk exactly as it is. +struct InjectedFault : std::runtime_error { + using std::runtime_error::runtime_error; +}; + +/// Flushes a file's content to stable storage. +inline void syncFile(const std::filesystem::path& file) { +#if defined(_WIN32) + HANDLE handle = CreateFileW(file.c_str(), GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, nullptr); + if (handle == INVALID_HANDLE_VALUE) + throw std::runtime_error("Cannot open " + file.string() + " for synchronization"); + const bool flushed = FlushFileBuffers(handle) != 0; + CloseHandle(handle); + if (!flushed) + throw std::runtime_error("Cannot synchronize " + file.string()); +#else + const int descriptor = ::open(file.c_str(), O_RDONLY); + if (descriptor < 0) + throw std::runtime_error("Cannot open " + file.string() + " for synchronization"); +#if defined(__APPLE__) && defined(F_FULLFSYNC) + const bool flushed = ::fcntl(descriptor, F_FULLFSYNC) == 0 || ::fsync(descriptor) == 0; +#else + const bool flushed = ::fsync(descriptor) == 0; +#endif + ::close(descriptor); + if (!flushed) + throw std::runtime_error("Cannot synchronize " + file.string()); +#endif +} + +/// Makes the renames and creations in a directory durable. Windows offers no equivalent. +inline void syncDirectory(const std::filesystem::path& directory) { +#if !defined(_WIN32) + syncFile(directory); +#else + (void)directory; +#endif +} + +/// What a group publication changes: the project file it replaces and the journal-owned file replacing it. +struct JournalEntry { + std::string target; + std::string source; +}; + +inline constexpr std::string_view journalHeader = "webfront-journal 1"; +inline constexpr std::string_view journalEnd = "end"; + +inline std::string serializeJournal(const std::vector& entries) { + std::string text{journalHeader}; + text += '\n'; + for (const auto& [target, source] : entries) + text += target + '\n' + source + '\n'; + text += journalEnd; + text += '\n'; + return text; +} + +/// Returns the entries of a complete journal, nothing for an incomplete or malformed one. +inline std::optional> parseJournal(const std::string& text) { + std::vector lines; + std::istringstream stream{text}; + for (std::string line; std::getline(stream, line);) + lines.push_back(std::move(line)); + if (lines.size() < 4 || lines.size() % 2 != 0 || lines.front() != journalHeader || lines.back() != journalEnd) + return std::nullopt; + std::vector entries; + for (std::size_t i = 1; i + 1 < lines.size(); i += 2) { + const auto& source = lines[i + 1]; + if (source.empty() || !std::ranges::all_of(source, [](unsigned char c) { return std::isdigit(c) != 0; })) + return std::nullopt; + entries.push_back({lines[i], source}); + } + return entries; +} + +/// Identifies the content of project files: a precondition for publications that were prepared +/// from an earlier reading of the project. Not a security measure. +inline std::string fingerprint(const std::filesystem::path& root, const std::vector& paths) { + std::uint64_t hash = 14695981039346656037ULL; + const auto feed = [&hash](const char* data, std::size_t size) { + for (std::size_t i = 0; i < size; ++i) + hash = (hash ^ static_cast(data[i])) * 1099511628211ULL; + }; + for (const auto& path : paths) { + const auto file = projectPath(root, path); + std::ifstream stream(file, std::ios::binary); + const char present = std::filesystem::is_regular_file(file) && stream ? 1 : 0; + feed(&present, 1); + if (!present) + continue; + const auto size = static_cast(std::filesystem::file_size(file)); + feed(reinterpret_cast(&size), sizeof size); + std::vector block(64 * 1024); + while (stream.read(block.data(), static_cast(block.size())) || stream.gcount() > 0) + feed(block.data(), static_cast(stream.gcount())); + } + char text[17]; + std::snprintf(text, sizeof text, "%016llx", static_cast(hash)); + return text; +} + +/// Completes a committed journal: every source still present replaces its target. Safe to repeat +/// after an interruption, including one of this very function. +inline void rollForward(const std::filesystem::path& root, const std::filesystem::path& directory, const std::string& number, + const std::vector& entries, const StepHook& hook) { + const auto owned = directory / (number + ".d"); + int done = 0; + for (const auto& [target, source] : entries) { + const auto staged = owned / source; + if (std::filesystem::is_regular_file(staged)) { + const auto destination = projectPath(root, target); + std::filesystem::create_directories(destination.parent_path()); + std::filesystem::rename(staged, destination); + } + if (hook) + hook("replacement-" + std::to_string(++done)); + } + std::filesystem::remove(directory / (number + ".journal")); + syncDirectory(directory); + std::error_code ignored; + std::filesystem::remove_all(owned, ignored); +} + +/// Completes the journals that reached their commit point and abandons the others. A journal is +/// committed once it is renamed to ".journal"; everything else is the remains of a publication +/// interrupted before that point, where no project file was touched. +inline void recoverJournals(const std::filesystem::path& root, const StepHook& hook = {}) { + std::filesystem::path directory; + try { + directory = projectPath(root, journalDirectory); + } catch (const std::exception&) { + return; + } + std::error_code error; + std::vector found; + for (const auto& entry : std::filesystem::directory_iterator(directory, error)) + found.push_back(entry.path()); + if (error) + return; + std::ranges::sort(found); + std::set committed; + for (const auto& path : found) { + if (path.extension() != ".journal") + continue; + std::ifstream stream(path, std::ios::binary); + std::ostringstream content; + content << stream.rdbuf(); + const auto entries = parseJournal(content.str()); + if (!entries) + continue; + try { + for (const auto& entry : *entries) + projectPath(root, entry.target); + } catch (const std::exception&) { + continue; + } + committed.insert(path.stem().string()); + rollForward(root, directory, path.stem().string(), *entries, hook); + } + for (const auto& path : found) { + const auto name = path.stem().string(); + if (!committed.contains(name)) + std::filesystem::remove_all(path, error); + } +} + +} // namespace webfront::developer diff --git a/include/webfront/system/DeveloperStore.hpp b/include/webfront/system/DeveloperStore.hpp index 56b8346c..e15cbe90 100644 --- a/include/webfront/system/DeveloperStore.hpp +++ b/include/webfront/system/DeveloperStore.hpp @@ -2,6 +2,7 @@ #pragma once #include "DeveloperFiles.hpp" +#include "DeveloperJournal.hpp" #include #include @@ -11,11 +12,15 @@ namespace webfront::developer { class Store { public: - explicit Store(std::filesystem::path project, std::chrono::steady_clock::duration abandoned = defaultAbandonedAfter) - : root(std::filesystem::canonical(project)), abandonedAfter(abandoned) { + /// Opening a project completes the group publications that reached their commit point before + /// the previous process stopped and abandons the others. The hook is for tests only. + explicit Store(std::filesystem::path project, std::chrono::steady_clock::duration abandoned = defaultAbandonedAfter, + StepHook stepHook = {}) + : root(std::filesystem::canonical(project)), abandonedAfter(abandoned), hook(std::move(stepHook)) { if (!std::filesystem::is_directory(root)) throw std::invalid_argument("Developer project must be a directory"); removeStaleStaging(root); + recoverJournals(root, hook); } Store(const Store&) = delete; Store& operator=(const Store&) = delete; @@ -99,6 +104,58 @@ class Store { transactions.erase(id); } + /// Identifies the current content of project files; see commitGroup(). + std::string state(const std::vector& paths) const { + std::scoped_lock lock(mutex); + return fingerprint(root, paths); + } + + /// Publishes several staged files as one change. The change is applied only if the files named by + /// `paths` (which include every destination) still have the content identified by `expected`, as + /// read by state() when the operation began; otherwise nothing changes and the caller runs again. + /// + /// The commit point is the journal, completely written and synchronized after the files are + /// staged and before the first replacement. A crash before it leaves the previous files; a crash + /// after it is completed when the project is next opened. + void commitGroup(const std::vector& ids, const std::vector& paths, const std::string& expected) { + std::scoped_lock lock(mutex); + recoverJournals(root, hook); + auto group = checkedGroup(ids, paths); + if (fingerprint(root, paths) != expected) + throw std::runtime_error("The project changed since it was read; run the command again"); + const auto directory = projectPath(root, journalDirectory); + std::filesystem::create_directories(directory); + const auto number = prepareJournal(directory, group); + try { + writeJournal(directory, number, group); + } catch (const InjectedFault&) { + throw; + } catch (...) { + std::error_code ignored; + std::filesystem::remove_all(directory / (number + ".d"), ignored); + std::filesystem::remove(directory / (number + ".tmp"), ignored); + std::filesystem::remove(directory / (number + ".journal"), ignored); + throw; + } + std::vector entries; + for (std::size_t i = 0; i < group.size(); ++i) + entries.push_back({group[i]->destination, std::to_string(i)}); + for (const auto& id : ids) { + std::error_code ignored; + std::filesystem::remove_all(transactions.at(id).staging, ignored); + transactions.erase(id); + } + rollForward(root, directory, number, entries, hook); + } + + /// Bridge forms of state() and commitGroup(): one path or identifier per line. + std::string stateOfLines(std::string paths) const { + return state(lines(paths)); + } + void commitGroupLines(std::string ids, std::string paths, std::string expected) { + commitGroup(lines(ids), lines(paths), expected); + } + void abort(std::string id) { std::scoped_lock lock(mutex); const auto found = transactions.find(id); @@ -109,6 +166,88 @@ class Store { } private: + static std::vector lines(const std::string& text) { + std::vector result; + std::istringstream stream{text}; + for (std::string line; std::getline(stream, line);) + if (!line.empty()) + result.push_back(std::move(line)); + return result; + } + + struct Transaction; + // The transactions of a group: single files, distinct, each destination covered by the precondition. + std::vector checkedGroup(const std::vector& ids, const std::vector& paths) { + if (ids.empty() || ids.size() > maxGroupFiles || paths.empty() || paths.size() > maxGroupFiles * 2) + throw std::invalid_argument("Invalid group publication"); + std::vector group; + for (const auto& id : ids) { + auto& tx = transaction(id); + if (std::ranges::find(group, &tx) != group.end() || tx.directory) + throw std::invalid_argument("A group publishes distinct single files"); + if (std::ranges::find(paths, tx.destination) == paths.end()) + throw std::invalid_argument("A group precondition must cover every destination"); + if (projectPath(root, tx.destination) != tx.target) + throw std::runtime_error("Project path changed"); + if (!tx.replace && std::filesystem::exists(std::filesystem::symlink_status(tx.target))) + throw std::runtime_error("Starter destination already exists"); + stagedSource(tx); + group.push_back(&tx); + } + return group; + } + + // Moves the staged files into a directory owned by the journal and makes them durable. + std::string prepareJournal(const std::filesystem::path& directory, const std::vector& group) { + for (;;) { + const auto number = std::to_string(++stagingCounter); + if (std::filesystem::exists(directory / (number + ".journal")) || std::filesystem::exists(directory / (number + ".tmp"))) + continue; + if (!std::filesystem::create_directory(directory / (number + ".d"))) + continue; + try { + for (std::size_t i = 0; i < group.size(); ++i) { + const auto owned = directory / (number + ".d") / std::to_string(i); + std::filesystem::rename(stagedSource(*group[i]), owned); + syncFile(owned); + } + syncDirectory(directory / (number + ".d")); + } catch (const InjectedFault&) { + throw; + } catch (...) { + std::error_code ignored; + std::filesystem::remove_all(directory / (number + ".d"), ignored); + throw; + } + return number; + } + } + + void writeJournal(const std::filesystem::path& directory, const std::string& number, const std::vector& group) { + std::vector entries; + for (std::size_t i = 0; i < group.size(); ++i) + entries.push_back({group[i]->destination, std::to_string(i)}); + step("before-journal"); + const auto temporary = directory / (number + ".tmp"); + { + std::ofstream file(temporary, std::ios::binary | std::ios::trunc); + const auto text = serializeJournal(entries); + file.write(text.data(), static_cast(text.size())); + file.close(); + if (!file) + throw std::runtime_error("Cannot write the publication journal"); + } + syncFile(temporary); + std::filesystem::rename(temporary, directory / (number + ".journal")); + syncDirectory(directory); + step("after-journal"); + } + + void step(std::string_view name) const { + if (hook) + hook(name); + } + struct Transaction { std::filesystem::path staging; std::filesystem::path target; @@ -190,6 +329,7 @@ class Store { std::filesystem::path root; std::chrono::steady_clock::duration abandonedAfter; + StepHook hook; mutable std::mutex mutex; std::map transactions; }; diff --git a/js/core/WebFrontAssets.cmake b/js/core/WebFrontAssets.cmake index 9441bc92..03dd8377 100644 --- a/js/core/WebFrontAssets.cmake +++ b/js/core/WebFrontAssets.cmake @@ -101,7 +101,8 @@ function(webfront_add_embedded_assets) if(ENABLE_TESTING) find_program(WEBFRONT_NODE_EXECUTABLE NAMES node nodejs REQUIRED) add_test(NAME DeveloperJavaScript COMMAND "${WEBFRONT_NODE_EXECUTABLE}" - --test "${root}/js/developer/tools/check.mjs" "${root}/js/developer/tools/distribution-check.mjs") + --test "${root}/js/developer/tools/check.mjs" "${root}/js/developer/tools/distribution-check.mjs" + "${root}/js/developer/tools/manifest-check.mjs") set_tests_properties(DeveloperJavaScript PROPERTIES TIMEOUT 30) add_test(NAME EmbeddedAssetGenerator COMMAND ${CMAKE_COMMAND} -E env "WEBFRONT_TEST_CMAKE=${CMAKE_COMMAND}" "${WEBFRONT_NODE_EXECUTABLE}" diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index d20d873d..4099196d 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -1,16 +1,20 @@ { "js/developer/environment/bootstrap.mjs": "534af4b3d07891338c3390e1d5e06c2fb6dd8df11ca6547735565b17f1b9cd70", "js/developer/environment/bootstrap-entry.mjs": "ff8084f23f5acc721f97eb1ed0a454e7bfee1894de17d54f0100fa11f7ef8b77", + "js/developer/environment/manifest.mjs": "248e7cbe44dd71be514a57e3997860fb148d39e5fbf04b133e08f17dbc878a6a", + "js/developer/environment/project.mjs": "d971b2c225179be7798a9c442a48006e1e9b7af56c329f325858dbd665fc351e", + "js/developer/environment/installer.mjs": "235684685d79521dc889346b90076835a269d3d33b9ab74f8c428b52e9c2721a", + "js/developer/environment/packages-entry.mjs": "7b5dc8aac408b741ccd3f9098165fca7645c4e88fd7ca7b8822fe37b7ad21fce", "js/developer/environment/packages.mjs": "faed29500a34c6ce24756d07bd4b47b9168ccec4bd49d12f00096a869637d74d", - "js/developer/environment/starter.mjs": "f8cdef1218ae14f8bbe49eae495d931cc29e33f74444f0e37d61aea416b9d750", + "js/developer/environment/starter.mjs": "048cf2af36b407bc075323f78a1195b4be91ad7da51f6ce941d9fb230f314ff9", "js/developer/environment/paths.mjs": "6ebb626610756143c58762c87af18980802809d7f0f53d3b588e4b20e8db0161", - "js/developer/environment/runtime.mjs": "640896773c533ecc091a44384f0cac5115de346073c5393994073d7ff9d64c1b", + "js/developer/environment/runtime.mjs": "7181d01ece3ab790692165a1c269ef9be9798bc5c6730494d264ec693224149c", "js/developer/environment/compiler.mjs": "3f7e187ca9a4c2645ef3823127457cad655919cbea3c7c0f22fb7ae2cc87e0e5", "js/developer/environment/bundler.mjs": "b0ff79a1b0caa012c25ec7b7f121d7d50af1aa1651231d3dcf2f39470c4ea25c", "js/developer/environment/entry.mjs": "b2b942443e3c74ae2c008392ba244d9b7e91db70ba1b4ebbe1357c455ebf51bb", "js/developer/environment/conditions.mjs": "7f0ecba239480831e38985ccffd4c82309949924f4eb9d938e4ad1b09f5f36ed", - "js/developer/environment/io.mjs": "a155719c612e065c30272c0dfdc456df28b5efa90ca26f8cfcb55c9cb46de690", - "js/developer/environment/recipe.mjs": "809f2091c50ebd13d23f92de9876b584658dc687324f73d48ee9f1271319f1ed", + "js/developer/environment/io.mjs": "21af39f07c7eb863908c1df768e3c31de1c6eb8ff757c2a287c4a47c76855db6", + "js/developer/environment/recipe.mjs": "5e7b80cb9090dce63fafafbb852879fce9f6ed2399ac364bbe5af1cf6f4c1758", "js/developer/environment/registry.mjs": "f566f07ea066155ab7209d925cee2cf12a664ac51b07bc0ca3e3fd8fde49a9c8", "js/developer/environment/archive.mjs": "1fb8b9c3c27219858597801104639bba1104c7a7d33973609cd556b5e5f81d2d", "js/developer/environment/lock.mjs": "60d0ea14d24793cd5e85bbd4bb4bfe90d2c7d76c0d20ffc99f462595a6e57291", @@ -24,11 +28,11 @@ "examples/life/ui/style.css": "9bb55eb0f0a3287e5b7dc78af9d69608b87ff42c4d9c8a653bc83a52fe293c44", "js/developer/components/tools/wf.mjs": "2a8b463b2da223deb8d54d9fdd6037fdd079afeb24e39337693df03cdbcbd0ec", "js/developer/tools/distribution.json": "26bb7dba24546565e38071087ab088727ad2b51fbbdb37afe801a574aff53fb6", - "js/developer/tools/build.mjs": "30999e2a9209966deb2cd486c786ce27d464a93882cca5b272b530837d46b3dd", + "js/developer/tools/build.mjs": "70ae5acdcd08dcde777c042d1b27f384746530ba97f89a81a91d04c5bd4c8e66", "js/developer/tools/site.mjs": "1827d3fd7e1e470336aab25ea8686c912c2b674a10f7be496f2f0077fbc45292", "js/developer/tools/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b", "js/developer/vendor/package-lock.json": "eb545112b672f9dbf520125df1f44a878d62cc8e611f0e33baee36470ded4dec", "js/core/bootstrap/bootstrap.bundle.mjs": "792fe7cf564bd12ac47fef419d8c71e2070925764a17706552e7d3f5d6ba2181", - "js/developer/environment/packages.bundle.mjs": "994c13a8b30a40ecea98414caa72a17927dcea81a1f62d47744b4f55d87005be", + "js/developer/environment/packages.bundle.mjs": "74a1aacab33c638298d140b832b07c8ffb31a02b6cb9931846b365163b5cf00c", "include/webfront/system/DeveloperReleaseData.hpp": "c97a8c3b21df3306c179f7b46d945159b5854f9d2810f135a4ab224c768c75d7" } diff --git a/js/developer/environment/installer.mjs b/js/developer/environment/installer.mjs new file mode 100644 index 00000000..73a2c329 --- /dev/null +++ b/js/developer/environment/installer.mjs @@ -0,0 +1,122 @@ +// wf init and wf install: the manifest states the intent, the lock the exact resolution; both are published together. +import {resolvePackages, downloadPackage} from './packages.mjs'; +import {publish, readProject} from './io.mjs'; +import {safePackagePath} from './paths.mjs'; +import {manifestPath, newManifest, manifestName, serializeManifest, dependenciesDigest} from './manifest.mjs'; +import {loadProject, publishTogether, lockPath, packageRoot, noManifest, desynchronized, textBytes} from './project.mjs'; + +const splitSpec = spec => { + const at = spec.indexOf('@', spec.startsWith('@') ? 1 : 0); + return at < 0 ? [spec, undefined] : [spec.slice(0, at), spec.slice(at + 1) || undefined]; +}; + +/** Creates a minimal manifest without replacing an existing one. */ +export async function initProject(bridge, [directory = '.', ...extra], {signal} = {}) { + if (extra.length) throw new Error('Usage: wf init [directory]'); + const folder = directory === '.' ? '' : safePackagePath(directory.replace(/\/+$/, '')); + const path = folder ? `${folder}/${manifestPath}` : manifestPath; + const files = new Map([['output', textBytes(serializeManifest(newManifest(manifestName(folder))))]]); + await publish(bridge, path, files, {directory: false, replace: false, signal}); + return `Created ${path}. Add libraries with wf install .`; +} + +// The ranges to resolve: the manifest's, with the requested packages added or replaced. +function requestedDependencies(manifest, specs) { + const dependencies = {...manifest.dependencies}; + const explicit = new Set(); + for (const spec of specs) { + const [name, range] = splitSpec(spec); + dependencies[name] = range ?? 'latest'; + if (range && range !== 'latest') explicit.add(name); + } + return {dependencies, explicit}; +} + +// A package installed without a range is recorded as ^version, like npm; an explicit range is kept as typed. +function recordedDependencies({dependencies, explicit}, lock, specs) { + const recorded = {...dependencies}; + for (const spec of specs) { + const name = splitSpec(spec)[0]; + if (!explicit.has(name)) recorded[name] = `^${lock.packages[lock.roots[name].id].version}`; + } + return recorded; +} + +async function resolveLock(dependencies, previous, options) { + const roots = Object.entries(dependencies).map(([name, range]) => `${name}@${range}`); + const {lock, downloads} = await resolvePackages(roots, { + registry: options.registry, signal: options.signal, fetchImpl: options.fetchImpl, previous, + download: async (...args) => { options.progress(`Resolving ${args[0]}@${args[1]}`); return downloadPackage(...args); }, + }); + return {lock, downloads}; +} + +async function storePackages(bridge, lock, downloads, {signal, progress}) { + for (const [id, files] of downloads) { + progress(`Storing ${id}`); + await publish(bridge, `${packageRoot}/${lock.packages[id].key}`, files, {signal}); + } +} + +async function isCached(bridge, node) { + try { await readProject(bridge, `${packageRoot}/${node.key}/package.json`); return true; } + catch { return false; } +} + +// npm ci: exactly the locked graph, every archive checked against the recorded integrity. Nothing is resolved or written +// besides the cache. +async function restoreLocked(bridge, lock, {signal, progress, fetchImpl}) { + let restored = 0; + for (const [id, node] of Object.entries(lock.packages)) { + signal?.throwIfAborted(); + if (await isCached(bridge, node)) continue; + progress(`Restoring ${id}`); + const pkg = await downloadPackage(node.name, node.version, {registry: lock.registry, fetchImpl, signal}); + if (pkg.integrity !== node.integrity) throw new Error(`${id} no longer matches the integrity recorded in the lock`); + await publish(bridge, `${packageRoot}/${node.key}`, pkg.files, {signal}); + restored++; + } + return restored; +} + +function parseOptions(args) { + const update = args.includes('--update'); + const specs = args.filter(arg => arg !== '--update'); + if (specs.some(spec => spec.startsWith('-'))) throw new Error('Usage: wf install [--update] [[@range] ...]'); + return {update, specs}; +} + +async function publishResolution(bridge, project, {manifest, lock}, options) { + const files = new Map([[lockPath, textBytes(JSON.stringify(lock, null, 2) + '\n')]]); + if (manifest) files.set(manifestPath, textBytes(serializeManifest(manifest))); + await publishTogether(bridge, files, project, options); +} + +const withDigest = async (lock, dependencies) => ({format: lock.format, manifestDigest: await dependenciesDigest(dependencies), ...lock}); + +/** + * wf install [@range]: resolve, download and verify, then publish manifest and lock in one change. + * wf install: the locked graph exactly when the lock agrees with the manifest; resolves it when there is no lock. + * wf install --update: resolves the manifest again, keeping nothing from the lock. + */ +export async function install(bridge, args, {registry, signal, progress = () => {}, fetchImpl = fetch}) { + const {update, specs} = parseOptions(args); + const project = await loadProject(bridge); + if (!project.manifest) throw new Error(noManifest); + const options = {registry: project.manifest.registry ?? registry, signal, fetchImpl, progress}; + if (specs.length && update) throw new Error('Usage: wf install --update does not take packages'); + if (specs.length && project.status === 'desynchronized') throw new Error(desynchronized); + if (!specs.length && !update && project.status === 'desynchronized') throw new Error(desynchronized); + if (!specs.length && !update && project.status === 'consistent') + return {lock: project.lock, restored: await restoreLocked(bridge, project.lock, {signal, progress, fetchImpl: options.fetchImpl})}; + const request = requestedDependencies(project.manifest, specs); + const previous = project.status === 'consistent' ? project.lock : undefined; + const resolved = await resolveLock(request.dependencies, previous, options); + const dependencies = recordedDependencies(request, resolved.lock, specs); + await storePackages(bridge, resolved.lock, resolved.downloads, {signal, progress}); + // The journal of the joint publication is the installation commit point. A failed install may leave unused cache files. + const lock = await withDigest(resolved.lock, dependencies); + const manifest = specs.length ? {...project.manifest, dependencies} : null; + await publishResolution(bridge, project, {manifest, lock}, {signal}); + return {lock, restored: 0}; +} diff --git a/js/developer/environment/io.mjs b/js/developer/environment/io.mjs index d0525b10..1240c684 100644 --- a/js/developer/environment/io.mjs +++ b/js/developer/environment/io.mjs @@ -15,7 +15,7 @@ export async function readProject(bridge, path) { return new Uint8Array(await new Blob(chunks).arrayBuffer()); } -async function writeChunks(bridge, {id, path, bytes}, signal) { +export async function writeChunks(bridge, {id, path, bytes}, signal) { for (let offset = 0; offset < bytes.length || offset === 0; offset += blockSize) { signal?.throwIfAborted(); await call(bridge, 'write', id, path, offset, bytes.subarray(offset, offset + blockSize)); diff --git a/js/developer/environment/manifest.mjs b/js/developer/environment/manifest.mjs new file mode 100644 index 00000000..6a3ebaea --- /dev/null +++ b/js/developer/environment/manifest.mjs @@ -0,0 +1,177 @@ +// webfront.project.json, the project manifest every wf command reads: intent (roots and ranges), entries, +// providers and permissions. The lock records the exact resolution. +import {safePackagePath} from './paths.mjs'; +import {isPlainObject} from './entry.mjs'; + +export const manifestPath = 'webfront.project.json'; +export const manifestFormat = 1; + +const npmName = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/; +const exactVersion = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/; +// The shape of an npm range or dist-tag; the registry resolution applies the semver semantics. +const rangeShape = /^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/; +const label = /^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/; +const identifier = /^[A-Za-z_][A-Za-z0-9_]*$/; +const keys = ['format', 'name', 'version', 'dependencies', 'registry', 'scripts', 'entries', 'providers', 'test', 'permissions']; +const permissionKeys = ['files', 'publish', 'fetch']; + +const fail = message => { throw new Error(`${manifestPath}: ${message}`); }; + +function requireObject(value, where) { + if (!isPlainObject(value)) fail(`${where} must be an object`); + return value; +} + +function onlyKeys(object, allowed, where) { + for (const key of Object.keys(object)) + if (!allowed.includes(key)) fail(`unknown key "${key}" in ${where}`); +} + +function projectPath(value, where) { + if (typeof value !== 'string') fail(`${where} must be a project path`); + try { return safePackagePath(value); } catch { return fail(`${where} is not a safe project-relative path: ${value}`); } +} + +function pathList(value, where) { + if (!Array.isArray(value) || value.length > 256) fail(`${where} must be an array of at most 256 paths`); + return value.map((path, index) => projectPath(path, `${where}[${index}]`)); +} + +function checkDependencies(value) { + const dependencies = requireObject(value, 'dependencies'); + for (const [name, range] of Object.entries(dependencies)) { + if (!npmName.test(name)) fail(`invalid npm package name "${name}"`); + if (typeof range !== 'string' || !rangeShape.test(range) || range !== range.trim()) + fail(`invalid version range for "${name}"`); + } + return dependencies; +} + +function checkRegistry(value) { + if (typeof value !== 'string') fail('registry must be a URL'); + if (value.startsWith('/') && !value.startsWith('//')) return value; + let url; + try { url = new URL(value); } catch { return fail('registry must be an https URL or an absolute path'); } + if (url.protocol !== 'https:') fail('registry must use https'); + return value; +} + +function checkScripts(value) { + const scripts = requireObject(value, 'scripts'); + for (const [name, command] of Object.entries(scripts)) + if (!label.test(name) || typeof command !== 'string' || !command || command.length > 1024) fail(`invalid script "${name}"`); + return scripts; +} + +function checkEntries(value) { + const entries = requireObject(value, 'entries'); + for (const [name, path] of Object.entries(entries)) { + if (!label.test(name)) fail(`invalid entry name "${name}"`); + projectPath(path, `entries.${name}`); + } + return entries; +} + +function checkProviders(value, entries) { + const providers = requireObject(value, 'providers'); + for (const [name, provider] of Object.entries(providers)) { + if (!identifier.test(name)) fail(`invalid provider name "${name}"`); + requireObject(provider, `providers.${name}`); + onlyKeys(provider, ['entry', 'output'], `providers.${name}`); + if (typeof provider.entry !== 'string') fail(`providers.${name}.entry must name an entry or a path`); + if (!Object.hasOwn(entries, provider.entry)) projectPath(provider.entry, `providers.${name}.entry`); + if (!projectPath(provider.output, `providers.${name}.output`).endsWith('.hpp')) fail(`providers.${name}.output must be a .hpp file`); + } + return providers; +} + +function checkTest(value) { + const test = requireObject(value, 'test'); + onlyKeys(test, ['specs'], 'test'); + if (test.specs !== undefined) pathList(test.specs, 'test.specs'); + return test; +} + +function checkOrigin(origin, where) { + let url; + try { url = new URL(origin); } catch { return fail(`${where} must be an https origin`); } + if (url.protocol !== 'https:' || url.origin !== origin) fail(`${where} must be an https origin without a path`); + return origin; +} + +function checkPermissions(value) { + const permissions = requireObject(value, 'permissions'); + for (const key of Object.keys(permissions)) + if (!permissionKeys.includes(key)) fail(`unknown permission "${key}"`); + for (const key of ['files', 'publish']) + if (permissions[key] !== undefined) pathList(permissions[key], `permissions.${key}`); + if (permissions.fetch !== undefined) { + if (!Array.isArray(permissions.fetch) || permissions.fetch.length > 64) fail('permissions.fetch must be an array of origins'); + permissions.fetch.forEach((origin, index) => checkOrigin(origin, `permissions.fetch[${index}]`)); + } + return permissions; +} + +function checkIdentity(manifest) { + if (typeof manifest.name !== 'string' || !npmName.test(manifest.name)) fail('name must be a lower-case npm package name'); + if (typeof manifest.version !== 'string' || !exactVersion.test(manifest.version)) fail('version must be a semantic version'); +} + +function checkFormat(manifest) { + if (manifest.format === manifestFormat) return; + if (Number.isInteger(manifest.format) && manifest.format > manifestFormat) + fail(`format ${manifest.format} is not supported by this environment (it reads format ${manifestFormat}); update the environment`); + fail(`format must be ${manifestFormat}`); +} + +/** Validates a parsed manifest; every problem is an explicit error, never a silent fallback. */ +export function validateManifest(manifest) { + requireObject(manifest, 'the manifest'); + checkFormat(manifest); + onlyKeys(manifest, keys, 'the manifest'); + checkIdentity(manifest); + const entries = manifest.entries === undefined ? {} : checkEntries(manifest.entries); + return { + ...manifest, + dependencies: manifest.dependencies === undefined ? {} : checkDependencies(manifest.dependencies), + entries, + providers: manifest.providers === undefined ? {} : checkProviders(manifest.providers, entries), + ...(manifest.registry === undefined ? {} : {registry: checkRegistry(manifest.registry)}), + ...(manifest.scripts === undefined ? {} : {scripts: checkScripts(manifest.scripts)}), + ...(manifest.test === undefined ? {} : {test: checkTest(manifest.test)}), + ...(manifest.permissions === undefined ? {} : {permissions: checkPermissions(manifest.permissions)}), + }; +} + +export function parseManifest(bytes) { + let value; + try { value = JSON.parse(new TextDecoder().decode(bytes)); } catch { return fail('not valid JSON'); } + return validateManifest(value); +} + +/** The text written to disk: the schema's keys in a stable order. */ +export function serializeManifest(manifest) { + const ordered = {}; + for (const key of keys) if (manifest[key] !== undefined) ordered[key] = manifest[key]; + return JSON.stringify(ordered, null, 2) + '\n'; +} + +export function newManifest(name) { + return {format: manifestFormat, name, version: '0.1.0', dependencies: {}}; +} + +/** A package name derived from a directory name, for wf init. */ +export function manifestName(directory) { + const base = String(directory ?? '').split('/').filter(Boolean).pop() ?? ''; + const name = base.toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^[^a-z0-9]+/, '').replace(/-+$/, ''); + return npmName.test(name) ? name : 'webfront-app'; +} + +/** Fingerprint of the manifest's dependency intent, recorded by the lock it produced. */ +export async function dependenciesDigest(dependencies) { + const canonical = JSON.stringify(Object.entries(dependencies).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)); + const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(canonical)); + return [...new Uint8Array(digest)].map(byte => byte.toString(16).padStart(2, '0')).join(''); +} + +export {exactVersion, npmName, identifier}; diff --git a/js/developer/environment/packages-entry.mjs b/js/developer/environment/packages-entry.mjs new file mode 100644 index 00000000..933bbd76 --- /dev/null +++ b/js/developer/environment/packages-entry.mjs @@ -0,0 +1,5 @@ +// Entry of packages.bundle.mjs: the dependency, manifest and installation logic the Node tests run against. +export * from './packages.mjs'; +export * from './manifest.mjs'; +export * from './project.mjs'; +export * from './installer.mjs'; diff --git a/js/developer/environment/packages.bundle.mjs b/js/developer/environment/packages.bundle.mjs index 84e43c3f..1c716596 100644 --- a/js/developer/environment/packages.bundle.mjs +++ b/js/developer/environment/packages.bundle.mjs @@ -1 +1,7 @@ -var Tt=Object.create;var Le=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var xt=Object.getPrototypeOf,qt=Object.prototype.hasOwnProperty;var m=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var bt=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of At(e))!qt.call(r,n)&&n!==t&&Le(r,n,{get:()=>e[n],enumerable:!(s=vt(e,n))||s.enumerable});return r};var F=(r,e,t)=>(t=r!=null?Tt(xt(r)):{},bt(e||!r||!r.__esModule?Le(t,"default",{value:r,enumerable:!0}):t,r));var A=m((co,xe)=>{"use strict";var Ft="2.0.0",Ut=Number.MAX_SAFE_INTEGER||9007199254740991,Gt=16,Xt=250,Vt=["major","premajor","minor","preminor","patch","prepatch","prerelease"];xe.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Gt,MAX_SAFE_BUILD_LENGTH:Xt,MAX_SAFE_INTEGER:Ut,RELEASE_TYPES:Vt,SEMVER_SPEC_VERSION:Ft,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var x=m((lo,qe)=>{"use strict";var zt=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};qe.exports=zt});var T=m((N,be)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:re,MAX_SAFE_BUILD_LENGTH:_t,MAX_LENGTH:Ht}=A(),Bt=x();N=be.exports={};var Mt=N.re=[],Wt=N.safeRe=[],l=N.src=[],Yt=N.safeSrc=[],u=N.t={},Jt=0,te="[a-zA-Z0-9-]",Kt=[["\\s",1],["\\d",Ht],[te,_t]],Zt=r=>{for(let[e,t]of Kt)r=r.split(`${e}*`).join(`${e}{0,${t}}`).split(`${e}+`).join(`${e}{1,${t}}`);return r},d=(r,e,t)=>{let s=Zt(e),n=Jt++;Bt(r,n,e),u[r]=n,l[n]=e,Yt[n]=s,Mt[n]=new RegExp(e,t?"g":void 0),Wt[n]=new RegExp(s,t?"g":void 0)};d("NUMERICIDENTIFIER","0|[1-9]\\d*");d("NUMERICIDENTIFIERLOOSE","\\d+");d("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${te}*`);d("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`);d("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`);d("PRERELEASEIDENTIFIER",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIER]})`);d("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIERLOOSE]})`);d("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`);d("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`);d("BUILDIDENTIFIER",`${te}+`);d("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`);d("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`);d("FULL",`^${l[u.FULLPLAIN]}$`);d("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`);d("LOOSE",`^${l[u.LOOSEPLAIN]}$`);d("GTLT","((?:<|>)?=?)");d("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);d("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`);d("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`);d("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`);d("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`);d("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`);d("COERCEPLAIN",`(^|[^\\d])(\\d{1,${re}})(?:\\.(\\d{1,${re}}))?(?:\\.(\\d{1,${re}}))?`);d("COERCE",`${l[u.COERCEPLAIN]}(?:$|[^\\d])`);d("COERCEFULL",l[u.COERCEPLAIN]+`(?:${l[u.PRERELEASE]})?(?:${l[u.BUILD]})?(?:$|[^\\d])`);d("COERCERTL",l[u.COERCE],!0);d("COERCERTLFULL",l[u.COERCEFULL],!0);d("LONETILDE","(?:~>?)");d("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0);N.tildeTrimReplace="$1~";d("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`);d("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`);d("LONECARET","(?:\\^)");d("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0);N.caretTrimReplace="$1^";d("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`);d("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`);d("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`);d("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`);d("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0);N.comparatorTrimReplace="$1$2$3";d("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`);d("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`);d("STAR","(<|>)?=?\\s*\\*");d("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");d("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var U=m((uo,Pe)=>{"use strict";var Qt=Object.freeze({loose:!0}),es=Object.freeze({}),rs=r=>r?typeof r!="object"?Qt:r:es;Pe.exports=rs});var se=m((fo,De)=>{"use strict";var ke=/^[0-9]+$/,Ce=(r,e)=>{if(typeof r=="number"&&typeof e=="number")return r===e?0:rCe(e,r);De.exports={compareIdentifiers:Ce,rcompareIdentifiers:ts}});var g=m((ho,Fe)=>{"use strict";var G=x(),{MAX_LENGTH:je,MAX_SAFE_INTEGER:X}=A(),{safeRe:V,t:z}=T(),ss=U(),{compareIdentifiers:ne}=se(),ie=class r{constructor(e,t){if(t=ss(t),e instanceof r){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>je)throw new TypeError(`version is longer than ${je} characters`);G("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let s=e.trim().match(t.loose?V[z.LOOSE]:V[z.FULL]);if(!s)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>X||this.major<0)throw new TypeError("Invalid major version");if(this.minor>X||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>X||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&ie.major?1:this.minore.minor?1:this.patche.patch?1:0}comparePre(e){if(e instanceof r||(e=new r(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let s=this.prerelease[t],n=e.prerelease[t];if(G("prerelease compare",t,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return ne(s,n)}while(++t)}compareBuild(e){e instanceof r||(e=new r(e,this.options));let t=0;do{let s=this.build[t],n=e.build[t];if(G("build compare",t,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return ne(s,n)}while(++t)}inc(e,t,s){if(e.startsWith("pre")){if(!t&&s===!1)throw new Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?V[z.PRERELEASELOOSE]:V[z.PRERELEASE]);if(!n||n[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,s);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,s);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,s),this.inc("pre",t,s);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t,s),this.inc("pre",t,s);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let n=Number(s)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(t===this.prerelease.join(".")&&s===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let i=[t,n];s===!1&&(i=[t]),ne(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Fe.exports=ie});var S=m((po,Ge)=>{"use strict";var Ue=g(),ns=(r,e,t=!1)=>{if(r instanceof Ue)return r;try{return new Ue(r,e)}catch(s){if(!t)return null;throw s}};Ge.exports=ns});var Ve=m((Eo,Xe)=>{"use strict";var is=S(),os=(r,e)=>{let t=is(r,e);return t?t.version:null};Xe.exports=os});var _e=m((mo,ze)=>{"use strict";var as=S(),cs=(r,e)=>{let t=as(r.trim().replace(/^[=v]+/,""),e);return t?t.version:null};ze.exports=cs});var Me=m((wo,Be)=>{"use strict";var He=g(),ls=(r,e,t,s,n)=>{typeof t=="string"&&(n=s,s=t,t=void 0);try{return new He(r instanceof He?r.version:r,t).inc(e,s,n).version}catch{return null}};Be.exports=ls});var Je=m(($o,Ye)=>{"use strict";var We=S(),us=(r,e)=>{let t=We(r,null,!0),s=We(e,null,!0),n=t.compare(s);if(n===0)return null;let i=n>0,o=i?t:s,a=i?s:t,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let p=c?"pre":"";return t.major!==s.major?p+"major":t.minor!==s.minor?p+"minor":t.patch!==s.patch?p+"patch":"prerelease"};Ye.exports=us});var Ze=m((go,Ke)=>{"use strict";var fs=g(),hs=(r,e)=>new fs(r,e).major;Ke.exports=hs});var er=m((Ro,Qe)=>{"use strict";var ps=g(),Es=(r,e)=>new ps(r,e).minor;Qe.exports=Es});var tr=m((Io,rr)=>{"use strict";var ms=g(),ds=(r,e)=>new ms(r,e).patch;rr.exports=ds});var nr=m((yo,sr)=>{"use strict";var ws=S(),$s=(r,e)=>{let t=ws(r,e);return t&&t.prerelease.length?t.prerelease:null};sr.exports=$s});var L=m((Lo,or)=>{"use strict";var ir=g(),gs=(r,e,t)=>new ir(r,t).compare(new ir(e,t));or.exports=gs});var cr=m((Oo,ar)=>{"use strict";var Rs=L(),Is=(r,e,t)=>Rs(e,r,t);ar.exports=Is});var ur=m((No,lr)=>{"use strict";var ys=L(),Ls=(r,e)=>ys(r,e,!0);lr.exports=Ls});var _=m((So,hr)=>{"use strict";var fr=g(),Os=(r,e,t)=>{let s=new fr(r,t),n=new fr(e,t);return s.compare(n)||s.compareBuild(n)};hr.exports=Os});var Er=m((To,pr)=>{"use strict";var Ns=_(),Ss=(r,e)=>r.sort((t,s)=>Ns(t,s,e));pr.exports=Ss});var dr=m((vo,mr)=>{"use strict";var Ts=_(),vs=(r,e)=>r.sort((t,s)=>Ts(s,t,e));mr.exports=vs});var q=m((Ao,wr)=>{"use strict";var As=L(),xs=(r,e,t)=>As(r,e,t)>0;wr.exports=xs});var H=m((xo,$r)=>{"use strict";var qs=L(),bs=(r,e,t)=>qs(r,e,t)<0;$r.exports=bs});var oe=m((qo,gr)=>{"use strict";var Ps=L(),ks=(r,e,t)=>Ps(r,e,t)===0;gr.exports=ks});var ae=m((bo,Rr)=>{"use strict";var Cs=L(),Ds=(r,e,t)=>Cs(r,e,t)!==0;Rr.exports=Ds});var B=m((Po,Ir)=>{"use strict";var js=L(),Fs=(r,e,t)=>js(r,e,t)>=0;Ir.exports=Fs});var M=m((ko,yr)=>{"use strict";var Us=L(),Gs=(r,e,t)=>Us(r,e,t)<=0;yr.exports=Gs});var ce=m((Co,Lr)=>{"use strict";var Xs=oe(),Vs=ae(),zs=q(),_s=B(),Hs=H(),Bs=M(),Ms=(r,e,t,s)=>{switch(e){case"===":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r===t;case"!==":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r!==t;case"":case"=":case"==":return Xs(r,t,s);case"!=":return Vs(r,t,s);case">":return zs(r,t,s);case">=":return _s(r,t,s);case"<":return Hs(r,t,s);case"<=":return Bs(r,t,s);default:throw new TypeError(`Invalid operator: ${e}`)}};Lr.exports=Ms});var Nr=m((Do,Or)=>{"use strict";var Ws=g(),Ys=S(),{safeRe:W,t:Y}=T(),Js=(r,e)=>{if(r instanceof Ws)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;e=e||{};let t=null;if(!e.rtl)t=r.match(e.includePrerelease?W[Y.COERCEFULL]:W[Y.COERCE]);else{let c=e.includePrerelease?W[Y.COERCERTLFULL]:W[Y.COERCERTL],f;for(;(f=c.exec(r))&&(!t||t.index+t[0].length!==r.length);)(!t||f.index+f[0].length!==t.index+t[0].length)&&(t=f),c.lastIndex=f.index+f[1].length+f[2].length;c.lastIndex=-1}if(t===null)return null;let s=t[2],n=t[3]||"0",i=t[4]||"0",o=e.includePrerelease&&t[5]?`-${t[5]}`:"",a=e.includePrerelease&&t[6]?`+${t[6]}`:"";return Ys(`${s}.${n}.${i}${o}${a}`,e)};Or.exports=Js});var Tr=m((jo,Sr)=>{"use strict";var le=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}};Sr.exports=le});var O=m((Fo,qr)=>{"use strict";var Ks=/\s+/g,ue=class r{constructor(e,t){if(t=Qs(t),e instanceof r)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new r(e.raw,t);if(e instanceof fe)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(Ks," "),this.set=this.raw.split("||").map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(n=>!Ar(n[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&an(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e0&&(this.formatted+="||");let t=this.set[e];for(let s=0;s0&&(this.formatted+=" "),this.formatted+=t[s].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let s=((this.options.includePrerelease&&nn)|(this.options.loose&&on))+":"+e,n=vr.get(s);if(n)return n;let i=this.options.loose,o=i?I[R.HYPHENRANGELOOSE]:I[R.HYPHENRANGE];e=e.replace(o,wn(this.options.includePrerelease)),w("hyphen replace",e),e=e.replace(I[R.COMPARATORTRIM],rn),w("comparator trim",e),e=e.replace(I[R.TILDETRIM],tn),w("tilde trim",e),e=e.replace(I[R.CARETTRIM],sn),w("caret trim",e);let a=e.split(" ").map(h=>cn(h,this.options)).join(" ").split(/\s+/).map(h=>dn(h,this.options));i&&(a=a.filter(h=>(w("loose invalid filter",h,this.options),!!h.match(I[R.COMPARATORLOOSE])))),w("range list",a);let c=new Map,f=a.map(h=>new fe(h,this.options));for(let h of f){if(Ar(h))return[h];c.set(h.value,h)}c.size>1&&c.has("")&&c.delete("");let p=[...c.values()];return vr.set(s,p),p}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Range is required");return this.set.some(s=>xr(s,t)&&e.set.some(n=>xr(n,t)&&s.every(i=>n.every(o=>i.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new en(e,this.options)}catch{return!1}for(let t=0;tr.value==="<0.0.0-0",an=r=>r.value==="",xr=(r,e)=>{let t=!0,s=r.slice(),n=s.pop();for(;t&&s.length;)t=s.every(i=>n.intersects(i,e)),n=s.pop();return t},cn=(r,e)=>(r=r.replace(I[R.BUILD],""),w("comp",r,e),r=fn(r,e),w("caret",r),r=ln(r,e),w("tildes",r),r=pn(r,e),w("xrange",r),r=mn(r,e),w("stars",r),r),y=r=>!r||r.toLowerCase()==="x"||r==="*",ln=(r,e)=>r.trim().split(/\s+/).map(t=>un(t,e)).join(" "),un=(r,e)=>{let t=e.loose?I[R.TILDELOOSE]:I[R.TILDE];return r.replace(t,(s,n,i,o,a)=>{w("tilde",r,s,n,i,o,a);let c;return y(n)?c="":y(i)?c=`>=${n}.0.0 <${+n+1}.0.0-0`:y(o)?c=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:a?(w("replaceTilde pr",a),c=`>=${n}.${i}.${o}-${a} <${n}.${+i+1}.0-0`):c=`>=${n}.${i}.${o} <${n}.${+i+1}.0-0`,w("tilde return",c),c})},fn=(r,e)=>r.trim().split(/\s+/).map(t=>hn(t,e)).join(" "),hn=(r,e)=>{w("caret",r,e);let t=e.loose?I[R.CARETLOOSE]:I[R.CARET],s=e.includePrerelease?"-0":"";return r.replace(t,(n,i,o,a,c)=>{w("caret",r,n,i,o,a,c);let f;return y(i)?f="":y(o)?f=`>=${i}.0.0${s} <${+i+1}.0.0-0`:y(a)?i==="0"?f=`>=${i}.${o}.0${s} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.0${s} <${+i+1}.0.0-0`:c?(w("replaceCaret pr",c),i==="0"?o==="0"?f=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):(w("no pr"),i==="0"?o==="0"?f=`>=${i}.${o}.${a}${s} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}${s} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),w("caret return",f),f})},pn=(r,e)=>(w("replaceXRanges",r,e),r.split(/\s+/).map(t=>En(t,e)).join(" ")),En=(r,e)=>{r=r.trim();let t=e.loose?I[R.XRANGELOOSE]:I[R.XRANGE];return r.replace(t,(s,n,i,o,a,c)=>{w("xRange",r,s,n,i,o,a,c);let f=y(i),p=f||y(o),h=p||y(a),$=h;return n==="="&&$&&(n=""),c=e.includePrerelease?"-0":"",f?n===">"||n==="<"?s="<0.0.0-0":s="*":n&&$?(p&&(o=0),a=0,n===">"?(n=">=",p?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):n==="<="&&(n="<",p?i=+i+1:o=+o+1),n==="<"&&(c="-0"),s=`${n+i}.${o}.${a}${c}`):p?s=`>=${i}.0.0${c} <${+i+1}.0.0-0`:h&&(s=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),w("xRange return",s),s})},mn=(r,e)=>(w("replaceStars",r,e),r.trim().replace(I[R.STAR],"")),dn=(r,e)=>(w("replaceGTE0",r,e),r.trim().replace(I[e.includePrerelease?R.GTE0PRE:R.GTE0],"")),wn=r=>(e,t,s,n,i,o,a,c,f,p,h,$)=>(y(s)?t="":y(n)?t=`>=${s}.0.0${r?"-0":""}`:y(i)?t=`>=${s}.${n}.0${r?"-0":""}`:o?t=`>=${t}`:t=`>=${t}${r?"-0":""}`,y(f)?c="":y(p)?c=`<${+f+1}.0.0-0`:y(h)?c=`<${f}.${+p+1}.0-0`:$?c=`<=${f}.${p}.${h}-${$}`:r?c=`<${f}.${p}.${+h+1}-0`:c=`<=${c}`,`${t} ${c}`.trim()),$n=(r,e,t)=>{for(let s=0;s0){let n=r[s].semver;if(n.major===e.major&&n.minor===e.minor&&n.patch===e.patch)return!0}return!1}return!0}});var b=m((Uo,jr)=>{"use strict";var P=Symbol("SemVer ANY"),Ee=class r{static get ANY(){return P}constructor(e,t){if(t=br(t),e instanceof r){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),pe("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===P?this.value="":this.value=this.operator+this.semver.version,pe("comp",this)}parse(e){let t=this.options.loose?Pr[kr.COMPARATORLOOSE]:Pr[kr.COMPARATOR],s=e.match(t);if(!s)throw new TypeError(`Invalid comparator: ${e}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new Cr(s[2],this.options.loose):this.semver=P}toString(){return this.value}test(e){if(pe("Comparator.test",e,this.options.loose),this.semver===P||e===P)return!0;if(typeof e=="string")try{e=new Cr(e,this.options)}catch{return!1}return he(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Dr(e.value,t).test(this.value):e.operator===""?e.value===""?!0:new Dr(this.value,t).test(e.semver):(t=br(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||he(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||he(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};jr.exports=Ee;var br=U(),{safeRe:Pr,t:kr}=T(),he=ce(),pe=x(),Cr=g(),Dr=O()});var k=m((Go,Fr)=>{"use strict";var gn=O(),Rn=(r,e,t)=>{try{e=new gn(e,t)}catch{return!1}return e.test(r)};Fr.exports=Rn});var Gr=m((Xo,Ur)=>{"use strict";var In=O(),yn=(r,e)=>new In(r,e).set.map(t=>t.map(s=>s.value).join(" ").trim().split(" "));Ur.exports=yn});var Vr=m((Vo,Xr)=>{"use strict";var Ln=g(),On=O(),Nn=(r,e,t)=>{let s=null,n=null,i=null;try{i=new On(e,t)}catch{return null}return r.forEach(o=>{i.test(o)&&(!s||n.compare(o)===-1)&&(s=o,n=new Ln(s,t))}),s};Xr.exports=Nn});var _r=m((zo,zr)=>{"use strict";var Sn=g(),Tn=O(),vn=(r,e,t)=>{let s=null,n=null,i=null;try{i=new Tn(e,t)}catch{return null}return r.forEach(o=>{i.test(o)&&(!s||n.compare(o)===1)&&(s=o,n=new Sn(s,t))}),s};zr.exports=vn});var Mr=m((_o,Br)=>{"use strict";var me=g(),An=O(),Hr=q(),xn=(r,e)=>{r=new An(r,e);let t=new me("0.0.0");if(r.test(t)||(t=new me("0.0.0-0"),r.test(t)))return t;t=null;for(let s=0;s{let a=new me(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||Hr(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!t||Hr(t,i))&&(t=i)}return t&&r.test(t)?t:null};Br.exports=xn});var Yr=m((Ho,Wr)=>{"use strict";var qn=O(),bn=(r,e)=>{try{return new qn(r,e).range||"*"}catch{return null}};Wr.exports=bn});var J=m((Bo,Qr)=>{"use strict";var Pn=g(),Zr=b(),{ANY:kn}=Zr,Cn=O(),Dn=k(),Jr=q(),Kr=H(),jn=M(),Fn=B(),Un=(r,e,t,s)=>{r=new Pn(r,s),e=new Cn(e,s);let n,i,o,a,c;switch(t){case">":n=Jr,i=jn,o=Kr,a=">",c=">=";break;case"<":n=Kr,i=Fn,o=Jr,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Dn(r,e,s))return!1;for(let f=0;f{E.semver===kn&&(E=new Zr(">=0.0.0")),h=h||E,$=$||E,n(E.semver,h.semver,s)?h=E:o(E.semver,$.semver,s)&&($=E)}),h.operator===a||h.operator===c||(!$.operator||$.operator===a)&&i(r,$.semver))return!1;if($.operator===c&&o(r,$.semver))return!1}return!0};Qr.exports=Un});var rt=m((Mo,et)=>{"use strict";var Gn=J(),Xn=(r,e,t)=>Gn(r,e,">",t);et.exports=Xn});var st=m((Wo,tt)=>{"use strict";var Vn=J(),zn=(r,e,t)=>Vn(r,e,"<",t);tt.exports=zn});var ot=m((Yo,it)=>{"use strict";var nt=O(),_n=(r,e,t)=>(r=new nt(r,t),e=new nt(e,t),r.intersects(e,t));it.exports=_n});var ct=m((Jo,at)=>{"use strict";var Hn=k(),Bn=L();at.exports=(r,e,t)=>{let s=[],n=null,i=null,o=r.sort((p,h)=>Bn(p,h,t));for(let p of o)Hn(p,e,t)?(i=p,n||(n=p)):(i&&s.push([n,i]),i=null,n=null);n&&s.push([n,null]);let a=[];for(let[p,h]of s)p===h?a.push(p):!h&&p===o[0]?a.push("*"):h?p===o[0]?a.push(`<=${h}`):a.push(`${p} - ${h}`):a.push(`>=${p}`);let c=a.join(" || "),f=typeof e.raw=="string"?e.raw:String(e);return c.length{"use strict";var lt=O(),we=b(),{ANY:de}=we,C=k(),$e=L(),Mn=(r,e,t={})=>{if(r===e)return!0;r=new lt(r,t),e=new lt(e,t);let s=!1;e:for(let n of r.set){for(let i of e.set){let o=Yn(n,i,t);if(s=s||o!==null,o)continue e}if(s)return!1}return!0},Wn=[new we(">=0.0.0-0")],ut=[new we(">=0.0.0")],Yn=(r,e,t)=>{if(r===e)return!0;if(r.length===1&&r[0].semver===de){if(e.length===1&&e[0].semver===de)return!0;t.includePrerelease?r=Wn:r=ut}if(e.length===1&&e[0].semver===de){if(t.includePrerelease)return!0;e=ut}let s=new Set,n,i;for(let E of r)E.operator===">"||E.operator===">="?n=ft(n,E,t):E.operator==="<"||E.operator==="<="?i=ht(i,E,t):s.add(E.semver);if(s.size>1)return null;let o;if(n&&i){if(o=$e(n.semver,i.semver,t),o>0)return null;if(o===0&&(n.operator!==">="||i.operator!=="<="))return null}for(let E of s){if(n&&!C(E,String(n),t)||i&&!C(E,String(i),t))return null;for(let St of e)if(!C(E,String(St),t))return!1;return!0}let a,c,f,p,h=i&&!t.includePrerelease&&i.semver.prerelease.length?i.semver:!1,$=n&&!t.includePrerelease&&n.semver.prerelease.length?n.semver:!1;h&&h.prerelease.length===1&&i.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let E of e){if(p=p||E.operator===">"||E.operator===">=",f=f||E.operator==="<"||E.operator==="<=",n){if($&&E.semver.prerelease&&E.semver.prerelease.length&&E.semver.major===$.major&&E.semver.minor===$.minor&&E.semver.patch===$.patch&&($=!1),E.operator===">"||E.operator===">="){if(a=ft(n,E,t),a===E&&a!==n)return!1}else if(n.operator===">="&&!C(n.semver,String(E),t))return!1}if(i){if(h&&E.semver.prerelease&&E.semver.prerelease.length&&E.semver.major===h.major&&E.semver.minor===h.minor&&E.semver.patch===h.patch&&(h=!1),E.operator==="<"||E.operator==="<="){if(c=ht(i,E,t),c===E&&c!==i)return!1}else if(i.operator==="<="&&!C(i.semver,String(E),t))return!1}if(!E.operator&&(i||n)&&o!==0)return!1}return!(n&&f&&!i&&o!==0||i&&p&&!n&&o!==0||$||h)},ft=(r,e,t)=>{if(!r)return e;let s=$e(r.semver,e.semver,t);return s>0?r:s<0||e.operator===">"&&r.operator===">="?e:r},ht=(r,e,t)=>{if(!r)return e;let s=$e(r.semver,e.semver,t);return s<0?r:s>0||e.operator==="<"&&r.operator==="<="?e:r};pt.exports=Mn});var D=m((Zo,wt)=>{"use strict";var ge=T(),mt=A(),Jn=g(),dt=se(),Kn=S(),Zn=Ve(),Qn=_e(),ei=Me(),ri=Je(),ti=Ze(),si=er(),ni=tr(),ii=nr(),oi=L(),ai=cr(),ci=ur(),li=_(),ui=Er(),fi=dr(),hi=q(),pi=H(),Ei=oe(),mi=ae(),di=B(),wi=M(),$i=ce(),gi=Nr(),Ri=b(),Ii=O(),yi=k(),Li=Gr(),Oi=Vr(),Ni=_r(),Si=Mr(),Ti=Yr(),vi=J(),Ai=rt(),xi=st(),qi=ot(),bi=ct(),Pi=Et();wt.exports={parse:Kn,valid:Zn,clean:Qn,inc:ei,diff:ri,major:ti,minor:si,patch:ni,prerelease:ii,compare:oi,rcompare:ai,compareLoose:ci,compareBuild:li,sort:ui,rsort:fi,gt:hi,lt:pi,eq:Ei,neq:mi,gte:di,lte:wi,cmp:$i,coerce:gi,Comparator:Ri,Range:Ii,satisfies:yi,toComparators:Li,maxSatisfying:Oi,minSatisfying:Ni,minVersion:Si,validRange:Ti,outside:vi,gtr:Ai,ltr:xi,intersects:qi,simplifyRange:bi,subset:Pi,SemVer:Jn,re:ge.re,src:ge.src,tokens:ge.t,SEMVER_SPEC_VERSION:mt.SEMVER_SPEC_VERSION,RELEASE_TYPES:mt.RELEASE_TYPES,compareIdentifiers:dt.compareIdentifiers,rcompareIdentifiers:dt.rcompareIdentifiers}});var ee=new TextDecoder;function Ne(r){let e=r.indexOf("@",r.startsWith("@")?1:0);return e<0?{name:r,version:""}:{name:r.slice(0,e),version:r.slice(e+1)}}async function Se(r,e){let t=String(e??"").split(/\s+/).filter(i=>i.startsWith("sha512-")).map(i=>i.split("?")[0]);if(t.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let s=new Uint8Array(await crypto.subtle.digest("SHA-512",r)),n="sha512-"+btoa(Array.from(s,i=>String.fromCharCode(i)).join(""));if(!t.includes(n))throw new Error(`Integrity check failed: expected ${t[0]}, got ${n}`);return n}async function Te(r,e=268435456){let t=new Blob([r]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),s=[],n=0;for(let i=await t.read();!i.done;i=await t.read()){if(n+=i.value.length,n>e)throw await t.cancel(),new Error(`The tarball unpacks to more than ${e} bytes`);s.push(i.value)}return new Uint8Array(await new Blob(s).arrayBuffer())}function v(r,e,t){let s=r.subarray(e,e+t),n=s.indexOf(0);return ee.decode(n<0?s:s.subarray(0,n))}function ve(r,e,t){if(r[e]&128)return r.subarray(e+1,e+t).reduce((n,i)=>n*256+i,r[e]&127);let s=v(r,e,t).trim();if(!/^[0-7]*$/.test(s))throw new Error("Corrupt tar header");return s===""?0:parseInt(s,8)}function Pt(r){let e=0;for(let t=0;t<512;++t)e+=t>=148&&t<156?32:r[t];if(ve(r,148,8)!==e)throw new Error("Corrupt tar header checksum")}function kt(r){let e={},t=0;for(;t0)||t+n>r.length)throw new Error("Corrupt pax header");let i=ee.decode(r.subarray(s+1,t+n-1)),o=i.indexOf("=");e[i.slice(0,o)]=i.slice(o+1),t+=n}return e}function Ct(r,e){let t=r.subarray(e,e+512);Pt(t);let s=ve(t,124,12),n=e+512;if(n+s>r.length)throw new Error("Truncated tar archive");return{header:t,type:t[156]===0?"0":String.fromCharCode(t[156]),data:r.subarray(n,n+s),next:n+Math.ceil(s/512)*512}}function Dt(r,e){return e+512>r.length||r.subarray(e,e+512).every(t=>t===0)}function jt(r){let e=v(r,0,100),t=v(r,257,5)==="ustar"?v(r,345,155):"";return t?`${t}/${e}`:e}var Oe={x:(r,e)=>({...r,pax:kt(e).path}),L:(r,e)=>({...r,long:v(e,0,e.length)}),g:r=>r};function Ae(r){let e=[],t={};for(let s=0;!Dt(r,s);){let{header:n,type:i,data:o,next:a}=Ct(r,s);if(s=a,Object.hasOwn(Oe,i)){t=Oe[i](t,o);continue}(i==="0"||i==="7")&&e.push({path:t.pax??t.long??jt(n),bytes:o}),t={}}return e}var K=F(D(),1);async function ki(r,e){let t=[],s=0;for(;;){let{done:n,value:i}=await r.read();if(n)return t;if(s+=i.length,s>e)throw new Error("Compressed download exceeds its byte limit");t.push(i)}}async function Ci(r,e){try{return await ki(r,e)}catch(t){throw await r.cancel().catch(()=>{}),t}finally{r.releaseLock()}}async function $t(r,e=64*1024*1024){if(!r.ok)throw new Error(`Download: HTTP ${r.status}`);if(Number(r.headers.get("content-length"))>e)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await Ci(r.body.getReader(),e)).arrayBuffer())}var Di=/[\\\0:*?"<>|]/,ji=r=>r.split("/").some(e=>!e||e==="."||e==="..");function Fi(r){return typeof r!="string"||!r||Di.test(r)?!0:ji(r)}function j(r){if(Fi(r))throw new Error(`Unsafe package path: ${r}`);return r}var Ui=new TextDecoder,Gi=["preinstall","install","postinstall"];async function gt(r){let e=new Map;for(let t of Ae(await Te(r))){if(!t.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let s=j(t.path.slice(8));if(e.has(s))throw new Error(`Duplicate package path: ${s}`);e.set(s,t.bytes)}return e}var Xi=r=>Gi.some(e=>r.scripts?.[e]),Vi=r=>r.has("binding.gyp")||[...r.keys()].some(e=>e.endsWith(".node"));function zi(r,e){return Xi(r)||r.gypfile?!0:Vi(e)}function Rt(r,e,t){let s=JSON.parse(Ui.decode(r.get("package.json")));if(s.name!==e||s.version!==t)throw new Error("npm archive identity mismatch");if(zi(s,r))throw new Error(`${e} needs an unsupported install script or native module`);return s}var Re=r=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(r),Z=(r,e)=>`${r.replace("/","+")}@${e}`,Ie=(r,e,t)=>`${Z(r,e)}-${t.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function _i(r,e,{fetchImpl:t,signal:s}){let n=await t(new URL(r.replace("/","%2f"),e),{signal:s});if(!n.ok)throw new Error(`Registry metadata for ${r}: HTTP ${n.status}`);return n.json()}function Hi(r,e){let t=r["dist-tags"]?.[e];return t||(K.default.valid(e)?e:K.default.maxSatisfying(Object.keys(r.versions??{}),e))}function Bi(r,e,t){let s=t||"latest",n=Hi(r,s),i=r.versions?.[n];if(!i||!K.default.valid(n))throw new Error(`Cannot resolve ${e}@${s}`);return{version:n,manifest:i}}async function Mi(r,e,t,{fetchImpl:s,signal:n}){let i=new URL(e.dist?.tarball,t);if(i.protocol!=="https:"&&i.origin!==t.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let o=await s(i,{signal:n});if(!o.ok)throw new Error(`Package download for ${r}: HTTP ${o.status}`);let a=await $t(o);return{bytes:a,integrity:await Se(a,e.dist.integrity)}}function Wi(r){let e=new URL(r,globalThis.location?.href);return e.pathname.endsWith("/")||(e.pathname+="/"),e}async function ye(r,e,{registry:t,fetchImpl:s=fetch,signal:n}){if(!Re(r))throw new Error(`Unsupported npm package name: ${r}`);let i=Wi(t),o={fetchImpl:s,signal:n},{version:a,manifest:c}=Bi(await _i(r,i,o),r,e),{bytes:f,integrity:p}=await Mi(r,c,i,o),h=await gt(f),$=Rt(h,r,a);return{id:Z(r,a),key:Ie(r,a,p),manifest:$,integrity:p,files:h}}var Q=F(D(),1);function Yi(r,e,t){return Q.default.validRange(t)?Object.values(r?.packages??{}).filter(n=>n.name===e&&Q.default.satisfies(n.version,t)).sort((n,i)=>Q.default.rcompare(n.version,i.version))[0]??null:null}function It({registry:r="https://registry.npmjs.org/",fetchImpl:e=fetch,signal:t,download:s=ye,previous:n}){let i=new Map;return async(o,a)=>{let c=`${o}@${a}`;if(i.has(c))return i.get(c);let f=Yi(n,o,a),p=await s(o,f?.version??a,{registry:r,fetchImpl:e,signal:t});if(f&&p.integrity!==f.integrity)throw new Error(`${p.id} no longer matches the integrity recorded in the lock`);return i.set(c,p),p}}var yt=F(D(),1),Lt=(r,e,t)=>new Error(`${r.name}@${r.version} requires peer ${e}@${t}; install a compatible root explicitly`);function Ji(r,e,t){if(r.manifest.peerDependenciesMeta?.[e]?.optional)return null;throw Lt(r,e,t)}function Ki(r,[e,t],{nodes:s,roots:n}){let i=n[e]?.id??r.dependencies[e];if(!i)return Ji(r,e,t);if(!yt.default.satisfies(s[i].version,t))throw Lt(r,e,t);return i}function Zi(r,e){for(let t of Object.entries(r.manifest.peerDependencies??{})){let s=Ki(r,t,e);s&&(r.dependencies[t[0]]=s)}}function Ot(r,e){for(let t of Object.values(r))Zi(t,{nodes:r,roots:e})}var Nt=F(D(),1);function Qi(r,e){return!Re(e.name)||!Nt.default.valid(e.version)?!1:r===Z(e.name,e.version)}function eo(r){return r.integrity?.startsWith("sha512-")?r.key===Ie(r.name,r.version,r.integrity):!1}function ro(r,e,t){if(!Qi(e,t)||!eo(t))throw new Error("Invalid locked package");for(let s of t.files)j(s);if(Object.values(t.dependencies).some(s=>!r.packages[s]))throw new Error("Dangling locked dependency")}function to(r){return r?.format!==1?!1:!!r.roots&&!!r.packages}function so(r){if(!to(r))throw new Error("Unsupported package lock");for(let[e,t]of Object.entries(r.packages))ro(r,e,t);if(Object.values(r.roots).some(e=>!r.packages[e.id]))throw new Error("Dangling locked root");return r}function no(r,e,t){if(Object.keys(r.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let s of t.files.values())r.total+=s.length;if(r.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");r.nodes[t.id]={name:e,version:t.manifest.version,integrity:t.integrity,key:t.key,manifest:t.manifest,files:[...t.files.keys()].sort(),dependencies:{}},r.downloads.set(t.id,t.files)}async function io(r,e){let t={};for(let s of r){let{name:n,version:i}=Ne(s);t[n]={requested:i||"latest",id:await e(n,i||"latest")}}return t}async function Ra(r,e={}){let t=It(e),s={nodes:{},downloads:new Map,total:0},n=async(o,a)=>{e.signal?.throwIfAborted();let c=await t(o,a);if(s.nodes[c.id])return c.id;no(s,o,c);for(let[f,p]of Object.entries(c.manifest.dependencies??{}).sort())s.nodes[c.id].dependencies[f]=await n(f,p);return c.id},i=await io(r,n);return Ot(s.nodes,i),{lock:{format:1,registry:e.registry??"https://registry.npmjs.org/",roots:i,packages:s.nodes},downloads:s.downloads}}export{ye as downloadPackage,Ra as resolvePackages,j as safePackagePath,so as validateLock}; +var on=Object.create;var Ve=Object.defineProperty;var an=Object.getOwnPropertyDescriptor;var cn=Object.getOwnPropertyNames;var ln=Object.getPrototypeOf,un=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var fn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of cn(t))!un.call(e,s)&&s!==r&&Ve(e,s,{get:()=>t[s],enumerable:!(n=an(t,s))||n.enumerable});return e};var B=(e,t,r)=>(r=e!=null?on(ln(e)):{},fn(t||!e||!e.__esModule?Ve(r,"default",{value:e,enumerable:!0}):r,e));var j=m((ha,Je)=>{"use strict";var wn="2.0.0",$n=Number.MAX_SAFE_INTEGER||9007199254740991,gn=16,yn=250,Rn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Je.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:gn,MAX_SAFE_BUILD_LENGTH:yn,MAX_SAFE_INTEGER:$n,RELEASE_TYPES:Rn,SEMVER_SPEC_VERSION:wn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var C=m((da,Ze)=>{"use strict";var In=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Ze.exports=In});var k=m((N,Ke)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Ee,MAX_SAFE_BUILD_LENGTH:On,MAX_LENGTH:Ln}=j(),Sn=C();N=Ke.exports={};var Nn=N.re=[],xn=N.safeRe=[],l=N.src=[],vn=N.safeSrc=[],u=N.t={},An=0,we="[a-zA-Z0-9-]",Tn=[["\\s",1],["\\d",Ln],[we,On]],bn=e=>{for(let[t,r]of Tn)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},E=(e,t,r)=>{let n=bn(t),s=An++;Sn(e,s,t),u[e]=s,l[s]=t,vn[s]=n,Nn[s]=new RegExp(t,r?"g":void 0),xn[s]=new RegExp(n,r?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${we}*`);E("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${we}+`);E("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`);E("FULL",`^${l[u.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`);E("LOOSE",`^${l[u.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`);E("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Ee}})(?:\\.(\\d{1,${Ee}}))?(?:\\.(\\d{1,${Ee}}))?`);E("COERCE",`${l[u.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",l[u.COERCEPLAIN]+`(?:${l[u.PRERELEASE]})?(?:${l[u.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",l[u.COERCE],!0);E("COERCERTLFULL",l[u.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0);N.tildeTrimReplace="$1~";E("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0);N.caretTrimReplace="$1^";E("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0);N.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var H=m((ma,Qe)=>{"use strict";var kn=Object.freeze({loose:!0}),Pn=Object.freeze({}),qn=e=>e?typeof e!="object"?kn:e:Pn;Qe.exports=qn});var $e=m((Ea,rt)=>{"use strict";var et=/^[0-9]+$/,tt=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:ett(t,e);rt.exports={compareIdentifiers:tt,rcompareIdentifiers:jn}});var y=m((wa,st)=>{"use strict";var W=C(),{MAX_LENGTH:nt,MAX_SAFE_INTEGER:Y}=j(),{safeRe:J,t:Z}=k(),Cn=H(),{compareIdentifiers:ge}=$e(),ye=class e{constructor(t,r){if(r=Cn(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>nt)throw new TypeError(`version is longer than ${nt} characters`);W("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?J[Z.LOOSE]:J[Z.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Y||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Y||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Y||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let i=+s;if(i>=0&&it.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(W("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ge(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(W("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ge(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?J[Z.PRERELEASELOOSE]:J[Z.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let i=[r,s];n===!1&&(i=[r]),ge(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};st.exports=ye});var b=m(($a,ot)=>{"use strict";var it=y(),Dn=(e,t,r=!1)=>{if(e instanceof it)return e;try{return new it(e,t)}catch(n){if(!r)return null;throw n}};ot.exports=Dn});var ct=m((ga,at)=>{"use strict";var Un=b(),Fn=(e,t)=>{let r=Un(e,t);return r?r.version:null};at.exports=Fn});var ut=m((ya,lt)=>{"use strict";var Gn=b(),zn=(e,t)=>{let r=Gn(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};lt.exports=zn});var ht=m((Ra,pt)=>{"use strict";var ft=y(),Xn=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new ft(e instanceof ft?e.version:e,r).inc(t,n,s).version}catch{return null}};pt.exports=Xn});var Et=m((Ia,mt)=>{"use strict";var dt=b(),Vn=(e,t)=>{let r=dt(e,null,!0),n=dt(t,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let h=c?"pre":"";return r.major!==n.major?h+"major":r.minor!==n.minor?h+"minor":r.patch!==n.patch?h+"patch":"prerelease"};mt.exports=Vn});var $t=m((Oa,wt)=>{"use strict";var Mn=y(),_n=(e,t)=>new Mn(e,t).major;wt.exports=_n});var yt=m((La,gt)=>{"use strict";var Bn=y(),Hn=(e,t)=>new Bn(e,t).minor;gt.exports=Hn});var It=m((Sa,Rt)=>{"use strict";var Wn=y(),Yn=(e,t)=>new Wn(e,t).patch;Rt.exports=Yn});var Lt=m((Na,Ot)=>{"use strict";var Jn=b(),Zn=(e,t)=>{let r=Jn(e,t);return r&&r.prerelease.length?r.prerelease:null};Ot.exports=Zn});var L=m((xa,Nt)=>{"use strict";var St=y(),Kn=(e,t,r)=>new St(e,r).compare(new St(t,r));Nt.exports=Kn});var vt=m((va,xt)=>{"use strict";var Qn=L(),es=(e,t,r)=>Qn(t,e,r);xt.exports=es});var Tt=m((Aa,At)=>{"use strict";var ts=L(),rs=(e,t)=>ts(e,t,!0);At.exports=rs});var K=m((Ta,kt)=>{"use strict";var bt=y(),ns=(e,t,r)=>{let n=new bt(e,r),s=new bt(t,r);return n.compare(s)||n.compareBuild(s)};kt.exports=ns});var qt=m((ba,Pt)=>{"use strict";var ss=K(),is=(e,t)=>e.sort((r,n)=>ss(r,n,t));Pt.exports=is});var Ct=m((ka,jt)=>{"use strict";var os=K(),as=(e,t)=>e.sort((r,n)=>os(n,r,t));jt.exports=as});var D=m((Pa,Dt)=>{"use strict";var cs=L(),ls=(e,t,r)=>cs(e,t,r)>0;Dt.exports=ls});var Q=m((qa,Ut)=>{"use strict";var us=L(),fs=(e,t,r)=>us(e,t,r)<0;Ut.exports=fs});var Re=m((ja,Ft)=>{"use strict";var ps=L(),hs=(e,t,r)=>ps(e,t,r)===0;Ft.exports=hs});var Ie=m((Ca,Gt)=>{"use strict";var ds=L(),ms=(e,t,r)=>ds(e,t,r)!==0;Gt.exports=ms});var ee=m((Da,zt)=>{"use strict";var Es=L(),ws=(e,t,r)=>Es(e,t,r)>=0;zt.exports=ws});var te=m((Ua,Xt)=>{"use strict";var $s=L(),gs=(e,t,r)=>$s(e,t,r)<=0;Xt.exports=gs});var Oe=m((Fa,Vt)=>{"use strict";var ys=Re(),Rs=Ie(),Is=D(),Os=ee(),Ls=Q(),Ss=te(),Ns=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return ys(e,r,n);case"!=":return Rs(e,r,n);case">":return Is(e,r,n);case">=":return Os(e,r,n);case"<":return Ls(e,r,n);case"<=":return Ss(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};Vt.exports=Ns});var _t=m((Ga,Mt)=>{"use strict";var xs=y(),vs=b(),{safeRe:re,t:ne}=k(),As=(e,t)=>{if(e instanceof xs)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?re[ne.COERCEFULL]:re[ne.COERCE]);else{let c=t.includePrerelease?re[ne.COERCERTLFULL]:re[ne.COERCERTL],f;for(;(f=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||f.index+f[0].length!==r.index+r[0].length)&&(r=f),c.lastIndex=f.index+f[1].length+f[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return vs(`${n}.${s}.${i}${o}${a}`,t)};Mt.exports=As});var Ht=m((za,Bt)=>{"use strict";var Le=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};Bt.exports=Le});var S=m((Xa,Zt)=>{"use strict";var Ts=/\s+/g,Se=class e{constructor(t,r){if(r=ks(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Ne)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(Ts," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!Yt(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&Fs(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&Ds)|(this.options.loose&&Us))+":"+t,s=Wt.get(n);if(s)return s;let i=this.options.loose,o=i?I[R.HYPHENRANGELOOSE]:I[R.HYPHENRANGE];t=t.replace(o,Ys(this.options.includePrerelease)),$("hyphen replace",t),t=t.replace(I[R.COMPARATORTRIM],qs),$("comparator trim",t),t=t.replace(I[R.TILDETRIM],js),$("tilde trim",t),t=t.replace(I[R.CARETTRIM],Cs),$("caret trim",t);let a=t.split(" ").map(p=>Gs(p,this.options)).join(" ").split(/\s+/).map(p=>Ws(p,this.options));i&&(a=a.filter(p=>($("loose invalid filter",p,this.options),!!p.match(I[R.COMPARATORLOOSE])))),$("range list",a);let c=new Map,f=a.map(p=>new Ne(p,this.options));for(let p of f){if(Yt(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let h=[...c.values()];return Wt.set(n,h),h}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>Jt(n,r)&&t.set.some(s=>Jt(s,r)&&n.every(i=>s.every(o=>i.intersects(o,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new Ps(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",Fs=e=>e.value==="",Jt=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(i=>s.intersects(i,t)),s=n.pop();return r},Gs=(e,t)=>(e=e.replace(I[R.BUILD],""),$("comp",e,t),e=Vs(e,t),$("caret",e),e=zs(e,t),$("tildes",e),e=_s(e,t),$("xrange",e),e=Hs(e,t),$("stars",e),e),O=e=>!e||e.toLowerCase()==="x"||e==="*",zs=(e,t)=>e.trim().split(/\s+/).map(r=>Xs(r,t)).join(" "),Xs=(e,t)=>{let r=t.loose?I[R.TILDELOOSE]:I[R.TILDE];return e.replace(r,(n,s,i,o,a)=>{$("tilde",e,n,s,i,o,a);let c;return O(s)?c="":O(i)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:O(o)?c=`>=${s}.${i}.0 <${s}.${+i+1}.0-0`:a?($("replaceTilde pr",a),c=`>=${s}.${i}.${o}-${a} <${s}.${+i+1}.0-0`):c=`>=${s}.${i}.${o} <${s}.${+i+1}.0-0`,$("tilde return",c),c})},Vs=(e,t)=>e.trim().split(/\s+/).map(r=>Ms(r,t)).join(" "),Ms=(e,t)=>{$("caret",e,t);let r=t.loose?I[R.CARETLOOSE]:I[R.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,c)=>{$("caret",e,s,i,o,a,c);let f;return O(i)?f="":O(o)?f=`>=${i}.0.0${n} <${+i+1}.0.0-0`:O(a)?i==="0"?f=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`:c?($("replaceCaret pr",c),i==="0"?o==="0"?f=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):($("no pr"),i==="0"?o==="0"?f=`>=${i}.${o}.${a}${n} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}${n} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),$("caret return",f),f})},_s=(e,t)=>($("replaceXRanges",e,t),e.split(/\s+/).map(r=>Bs(r,t)).join(" ")),Bs=(e,t)=>{e=e.trim();let r=t.loose?I[R.XRANGELOOSE]:I[R.XRANGE];return e.replace(r,(n,s,i,o,a,c)=>{$("xRange",e,n,s,i,o,a,c);let f=O(i),h=f||O(o),p=h||O(a),w=p;return s==="="&&w&&(s=""),c=t.includePrerelease?"-0":"",f?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&w?(h&&(o=0),a=0,s===">"?(s=">=",h?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):s==="<="&&(s="<",h?i=+i+1:o=+o+1),s==="<"&&(c="-0"),n=`${s+i}.${o}.${a}${c}`):h?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:p&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),$("xRange return",n),n})},Hs=(e,t)=>($("replaceStars",e,t),e.trim().replace(I[R.STAR],"")),Ws=(e,t)=>($("replaceGTE0",e,t),e.trim().replace(I[t.includePrerelease?R.GTE0PRE:R.GTE0],"")),Ys=e=>(t,r,n,s,i,o,a,c,f,h,p,w)=>(O(n)?r="":O(s)?r=`>=${n}.0.0${e?"-0":""}`:O(i)?r=`>=${n}.${s}.0${e?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,O(f)?c="":O(h)?c=`<${+f+1}.0.0-0`:O(p)?c=`<${f}.${+h+1}.0-0`:w?c=`<=${f}.${h}.${p}-${w}`:e?c=`<${f}.${h}.${+p+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),Js=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var U=m((Va,nr)=>{"use strict";var F=Symbol("SemVer ANY"),Ae=class e{static get ANY(){return F}constructor(t,r){if(r=Kt(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),ve("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===F?this.value="":this.value=this.operator+this.semver.version,ve("comp",this)}parse(t){let r=this.options.loose?Qt[er.COMPARATORLOOSE]:Qt[er.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new tr(n[2],this.options.loose):this.semver=F}toString(){return this.value}test(t){if(ve("Comparator.test",t,this.options.loose),this.semver===F||t===F)return!0;if(typeof t=="string")try{t=new tr(t,this.options)}catch{return!1}return xe(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new rr(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new rr(this.value,r).test(t.semver):(r=Kt(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||xe(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||xe(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};nr.exports=Ae;var Kt=H(),{safeRe:Qt,t:er}=k(),xe=Oe(),ve=C(),tr=y(),rr=S()});var G=m((Ma,sr)=>{"use strict";var Zs=S(),Ks=(e,t,r)=>{try{t=new Zs(t,r)}catch{return!1}return t.test(e)};sr.exports=Ks});var or=m((_a,ir)=>{"use strict";var Qs=S(),ei=(e,t)=>new Qs(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));ir.exports=ei});var cr=m((Ba,ar)=>{"use strict";var ti=y(),ri=S(),ni=(e,t,r)=>{let n=null,s=null,i=null;try{i=new ri(t,r)}catch{return null}return e.forEach(o=>{i.test(o)&&(!n||s.compare(o)===-1)&&(n=o,s=new ti(n,r))}),n};ar.exports=ni});var ur=m((Ha,lr)=>{"use strict";var si=y(),ii=S(),oi=(e,t,r)=>{let n=null,s=null,i=null;try{i=new ii(t,r)}catch{return null}return e.forEach(o=>{i.test(o)&&(!n||s.compare(o)===1)&&(n=o,s=new si(n,r))}),n};lr.exports=oi});var hr=m((Wa,pr)=>{"use strict";var Te=y(),ai=S(),fr=D(),ci=(e,t)=>{e=new ai(e,t);let r=new Te("0.0.0");if(e.test(r)||(r=new Te("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let a=new Te(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||fr(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||fr(r,i))&&(r=i)}return r&&e.test(r)?r:null};pr.exports=ci});var mr=m((Ya,dr)=>{"use strict";var li=S(),ui=(e,t)=>{try{return new li(e,t).range||"*"}catch{return null}};dr.exports=ui});var se=m((Ja,gr)=>{"use strict";var fi=y(),$r=U(),{ANY:pi}=$r,hi=S(),di=G(),Er=D(),wr=Q(),mi=te(),Ei=ee(),wi=(e,t,r,n)=>{e=new fi(e,n),t=new hi(t,n);let s,i,o,a,c;switch(r){case">":s=Er,i=mi,o=wr,a=">",c=">=";break;case"<":s=wr,i=Ei,o=Er,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(di(e,t,n))return!1;for(let f=0;f{d.semver===pi&&(d=new $r(">=0.0.0")),p=p||d,w=w||d,s(d.semver,p.semver,n)?p=d:o(d.semver,w.semver,n)&&(w=d)}),p.operator===a||p.operator===c||(!w.operator||w.operator===a)&&i(e,w.semver))return!1;if(w.operator===c&&o(e,w.semver))return!1}return!0};gr.exports=wi});var Rr=m((Za,yr)=>{"use strict";var $i=se(),gi=(e,t,r)=>$i(e,t,">",r);yr.exports=gi});var Or=m((Ka,Ir)=>{"use strict";var yi=se(),Ri=(e,t,r)=>yi(e,t,"<",r);Ir.exports=Ri});var Nr=m((Qa,Sr)=>{"use strict";var Lr=S(),Ii=(e,t,r)=>(e=new Lr(e,r),t=new Lr(t,r),e.intersects(t,r));Sr.exports=Ii});var vr=m((ec,xr)=>{"use strict";var Oi=G(),Li=L();xr.exports=(e,t,r)=>{let n=[],s=null,i=null,o=e.sort((h,p)=>Li(h,p,r));for(let h of o)Oi(h,t,r)?(i=h,s||(s=h)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);let a=[];for(let[h,p]of n)h===p?a.push(h):!p&&h===o[0]?a.push("*"):p?h===o[0]?a.push(`<=${p}`):a.push(`${h} - ${p}`):a.push(`>=${h}`);let c=a.join(" || "),f=typeof t.raw=="string"?t.raw:String(t);return c.length{"use strict";var Ar=S(),ke=U(),{ANY:be}=ke,z=G(),Pe=L(),Si=(e,t,r={})=>{if(e===t)return!0;e=new Ar(e,r),t=new Ar(t,r);let n=!1;e:for(let s of e.set){for(let i of t.set){let o=xi(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},Ni=[new ke(">=0.0.0-0")],Tr=[new ke(">=0.0.0")],xi=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===be){if(t.length===1&&t[0].semver===be)return!0;r.includePrerelease?e=Ni:e=Tr}if(t.length===1&&t[0].semver===be){if(r.includePrerelease)return!0;t=Tr}let n=new Set,s,i;for(let d of e)d.operator===">"||d.operator===">="?s=br(s,d,r):d.operator==="<"||d.operator==="<="?i=kr(i,d,r):n.add(d.semver);if(n.size>1)return null;let o;if(s&&i){if(o=Pe(s.semver,i.semver,r),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let d of n){if(s&&!z(d,String(s),r)||i&&!z(d,String(i),r))return null;for(let _ of t)if(!z(d,String(_),r))return!1;return!0}let a,c,f,h,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,w=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let d of t){if(h=h||d.operator===">"||d.operator===">=",f=f||d.operator==="<"||d.operator==="<=",s){if(w&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===w.major&&d.semver.minor===w.minor&&d.semver.patch===w.patch&&(w=!1),d.operator===">"||d.operator===">="){if(a=br(s,d,r),a===d&&a!==s)return!1}else if(s.operator===">="&&!z(s.semver,String(d),r))return!1}if(i){if(p&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===p.major&&d.semver.minor===p.minor&&d.semver.patch===p.patch&&(p=!1),d.operator==="<"||d.operator==="<="){if(c=kr(i,d,r),c===d&&c!==i)return!1}else if(i.operator==="<="&&!z(i.semver,String(d),r))return!1}if(!d.operator&&(i||s)&&o!==0)return!1}return!(s&&f&&!i&&o!==0||i&&h&&!s&&o!==0||w||p)},br=(e,t,r)=>{if(!e)return t;let n=Pe(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},kr=(e,t,r)=>{if(!e)return t;let n=Pe(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};Pr.exports=Si});var X=m((rc,Dr)=>{"use strict";var qe=k(),jr=j(),vi=y(),Cr=$e(),Ai=b(),Ti=ct(),bi=ut(),ki=ht(),Pi=Et(),qi=$t(),ji=yt(),Ci=It(),Di=Lt(),Ui=L(),Fi=vt(),Gi=Tt(),zi=K(),Xi=qt(),Vi=Ct(),Mi=D(),_i=Q(),Bi=Re(),Hi=Ie(),Wi=ee(),Yi=te(),Ji=Oe(),Zi=_t(),Ki=U(),Qi=S(),eo=G(),to=or(),ro=cr(),no=ur(),so=hr(),io=mr(),oo=se(),ao=Rr(),co=Or(),lo=Nr(),uo=vr(),fo=qr();Dr.exports={parse:Ai,valid:Ti,clean:bi,inc:ki,diff:Pi,major:qi,minor:ji,patch:Ci,prerelease:Di,compare:Ui,rcompare:Fi,compareLoose:Gi,compareBuild:zi,sort:Xi,rsort:Vi,gt:Mi,lt:_i,eq:Bi,neq:Hi,gte:Wi,lte:Yi,cmp:Ji,coerce:Zi,Comparator:Ki,Range:Qi,satisfies:eo,toComparators:to,maxSatisfying:ro,minSatisfying:no,minVersion:so,validRange:io,outside:oo,gtr:ao,ltr:co,intersects:lo,simplifyRange:uo,subset:fo,SemVer:vi,re:qe.re,src:qe.src,tokens:qe.t,SEMVER_SPEC_VERSION:jr.SEMVER_SPEC_VERSION,RELEASE_TYPES:jr.RELEASE_TYPES,compareIdentifiers:Cr.compareIdentifiers,rcompareIdentifiers:Cr.rcompareIdentifiers}});var me=new TextDecoder;function _e(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function Be(e,t){let r=String(t??"").split(/\s+/).filter(i=>i.startsWith("sha512-")).map(i=>i.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,i=>String.fromCharCode(i)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function He(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let i=await r.read();!i.done;i=await r.read()){if(s+=i.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(i.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function q(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return me.decode(s<0?n:n.subarray(0,s))}function We(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,i)=>s*256+i,e[t]&127);let n=q(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function pn(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if(We(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function hn(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let i=me.decode(e.subarray(n+1,r+s-1)),o=i.indexOf("=");t[i.slice(0,o)]=i.slice(o+1),r+=s}return t}function dn(e,t){let r=e.subarray(t,t+512);pn(r);let n=We(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function mn(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function En(e){let t=q(e,0,100),r=q(e,257,5)==="ustar"?q(e,345,155):"";return r?`${r}/${t}`:t}var Me={x:(e,t)=>({...e,pax:hn(t).path}),L:(e,t)=>({...e,long:q(t,0,t.length)}),g:e=>e};function Ye(e){let t=[],r={};for(let n=0;!mn(e,n);){let{header:s,type:i,data:o,next:a}=dn(e,n);if(n=a,Object.hasOwn(Me,i)){r=Me[i](r,o);continue}(i==="0"||i==="7")&&t.push({path:r.pax??r.long??En(s),bytes:o}),r={}}return t}var ae=B(X(),1);var x=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function ie(e,t){let r=[],n=0;for(;;){let s=await x(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function je(e,{id:t,path:r,bytes:n},s){for(let i=0;i{}),a}}async function po(e,t){let r=[],n=0;for(;;){let{done:s,value:i}=await e.read();if(s)return r;if(n+=i.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(i)}}async function ho(e,t){try{return await po(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function Ur(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await ho(e.body.getReader(),t)).arrayBuffer())}var mo=/[\\\0:*?"<>|]/,Eo=e=>e.split("/").some(t=>!t||t==="."||t==="..");function wo(e){return typeof e!="string"||!e||mo.test(e)?!0:Eo(e)}function A(e){if(wo(e))throw new Error(`Unsafe package path: ${e}`);return e}var $o=new TextDecoder,go=["preinstall","install","postinstall"];async function Fr(e){let t=new Map;for(let r of Ye(await He(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=A(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var yo=e=>go.some(t=>e.scripts?.[t]),Ro=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function Io(e,t){return yo(e)||e.gypfile?!0:Ro(t)}function Gr(e,t,r){let n=JSON.parse($o.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(Io(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}var Ce=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),ce=(e,t)=>`${e.replace("/","+")}@${t}`,De=(e,t,r)=>`${ce(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function Oo(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function Lo(e,t){let r=e["dist-tags"]?.[t];return r||(ae.default.valid(t)?t:ae.default.maxSatisfying(Object.keys(e.versions??{}),t))}function So(e,t,r){let n=r||"latest",s=Lo(e,n),i=e.versions?.[s];if(!i||!ae.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:i}}async function No(e,t,r,{fetchImpl:n,signal:s}){let i=new URL(t.dist?.tarball,r);if(i.protocol!=="https:"&&i.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let o=await n(i,{signal:s});if(!o.ok)throw new Error(`Package download for ${e}: HTTP ${o.status}`);let a=await Ur(o);return{bytes:a,integrity:await Be(a,t.dist.integrity)}}function xo(e){let t=new URL(e,globalThis.location?.href);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function P(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!Ce(e))throw new Error(`Unsupported npm package name: ${e}`);let i=xo(r),o={fetchImpl:n,signal:s},{version:a,manifest:c}=So(await Oo(e,i,o),e,t),{bytes:f,integrity:h}=await No(e,c,i,o),p=await Fr(f),w=Gr(p,e,a);return{id:ce(e,a),key:De(e,a,h),manifest:w,integrity:h,files:p}}var le=B(X(),1);function vo(e,t,r){return le.default.validRange(r)?Object.values(e?.packages??{}).filter(s=>s.name===t&&le.default.satisfies(s.version,r)).sort((s,i)=>le.default.rcompare(s.version,i.version))[0]??null:null}function zr({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=P,previous:s}){let i=new Map;return async(o,a)=>{let c=`${o}@${a}`;if(i.has(c))return i.get(c);let f=vo(s,o,a),h=await n(o,f?.version??a,{registry:e,fetchImpl:t,signal:r});if(f&&h.integrity!==f.integrity)throw new Error(`${h.id} no longer matches the integrity recorded in the lock`);return i.set(c,h),h}}var Xr=B(X(),1),Vr=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function Ao(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw Vr(e,t,r)}function To(e,[t,r],{nodes:n,roots:s}){let i=s[t]?.id??e.dependencies[t];if(!i)return Ao(e,t,r);if(!Xr.default.satisfies(n[i].version,r))throw Vr(e,t,r);return i}function bo(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=To(e,r,t);n&&(e.dependencies[r[0]]=n)}}function Mr(e,t){for(let r of Object.values(e))bo(r,{nodes:e,roots:t})}var _r=B(X(),1);function ko(e,t){return!Ce(t.name)||!_r.default.valid(t.version)?!1:e===ce(t.name,t.version)}function Po(e){return e.integrity?.startsWith("sha512-")?e.key===De(e.name,e.version,e.integrity):!1}function qo(e,t,r){if(!ko(t,r)||!Po(r))throw new Error("Invalid locked package");for(let n of r.files)A(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function jo(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function Ue(e){if(!jo(e))throw new Error("Unsupported package lock");for(let[t,r]of Object.entries(e.packages))qo(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function Co(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function Do(e,t){let r={};for(let n of e){let{name:s,version:i}=_e(n);r[s]={requested:i||"latest",id:await t(s,i||"latest")}}return r}async function Br(e,t={}){let r=zr(t),n={nodes:{},downloads:new Map,total:0},s=async(o,a)=>{t.signal?.throwIfAborted();let c=await r(o,a);if(n.nodes[c.id])return c.id;Co(n,o,c);for(let[f,h]of Object.entries(c.manifest.dependencies??{}).sort())n.nodes[c.id].dependencies[f]=await s(f,h);return c.id},i=await Do(e,s);return Mr(n.nodes,i),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:i,packages:n.nodes},downloads:n.downloads}}function Fe(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var v="webfront.project.json",V=1,Ge=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,Uo=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,Fo=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,Hr=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,Go=/^[A-Za-z_][A-Za-z0-9_]*$/,Wr=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],zo=["files","publish","fetch"],g=e=>{throw new Error(`${v}: ${e}`)};function T(e,t){return Fe(e)||g(`${t} must be an object`),e}function ze(e,t,r){for(let n of Object.keys(e))t.includes(n)||g(`unknown key "${n}" in ${r}`)}function ue(e,t){typeof e!="string"&&g(`${t} must be a project path`);try{return A(e)}catch{return g(`${t} is not a safe project-relative path: ${e}`)}}function Yr(e,t){return(!Array.isArray(e)||e.length>256)&&g(`${t} must be an array of at most 256 paths`),e.map((r,n)=>ue(r,`${t}[${n}]`))}function Xo(e){let t=T(e,"dependencies");for(let[r,n]of Object.entries(t))Ge.test(r)||g(`invalid npm package name "${r}"`),(typeof n!="string"||!Fo.test(n)||n!==n.trim())&&g(`invalid version range for "${r}"`);return t}function Vo(e){if(typeof e!="string"&&g("registry must be a URL"),e.startsWith("/")&&!e.startsWith("//"))return e;let t;try{t=new URL(e)}catch{return g("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&g("registry must use https"),e}function Mo(e){let t=T(e,"scripts");for(let[r,n]of Object.entries(t))(!Hr.test(r)||typeof n!="string"||!n||n.length>1024)&&g(`invalid script "${r}"`);return t}function _o(e){let t=T(e,"entries");for(let[r,n]of Object.entries(t))Hr.test(r)||g(`invalid entry name "${r}"`),ue(n,`entries.${r}`);return t}function Bo(e,t){let r=T(e,"providers");for(let[n,s]of Object.entries(r))Go.test(n)||g(`invalid provider name "${n}"`),T(s,`providers.${n}`),ze(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&g(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||ue(s.entry,`providers.${n}.entry`),ue(s.output,`providers.${n}.output`).endsWith(".hpp")||g(`providers.${n}.output must be a .hpp file`);return r}function Ho(e){let t=T(e,"test");return ze(t,["specs"],"test"),t.specs!==void 0&&Yr(t.specs,"test.specs"),t}function Wo(e,t){let r;try{r=new URL(e)}catch{return g(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&g(`${t} must be an https origin without a path`),e}function Yo(e){let t=T(e,"permissions");for(let r of Object.keys(t))zo.includes(r)||g(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&Yr(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&g("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>Wo(r,`permissions.fetch[${n}]`))),t}function Jo(e){(typeof e.name!="string"||!Ge.test(e.name))&&g("name must be a lower-case npm package name"),(typeof e.version!="string"||!Uo.test(e.version))&&g("version must be a semantic version")}function Zo(e){e.format!==V&&(Number.isInteger(e.format)&&e.format>V&&g(`format ${e.format} is not supported by this environment (it reads format ${V}); update the environment`),g(`format must be ${V}`))}function Ko(e){T(e,"the manifest"),Zo(e),ze(e,Wr,"the manifest"),Jo(e);let t=e.entries===void 0?{}:_o(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:Xo(e.dependencies),entries:t,providers:e.providers===void 0?{}:Bo(e.providers,t),...e.registry===void 0?{}:{registry:Vo(e.registry)},...e.scripts===void 0?{}:{scripts:Mo(e.scripts)},...e.test===void 0?{}:{test:Ho(e.test)},...e.permissions===void 0?{}:{permissions:Yo(e.permissions)}}}function Jr(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return g("not valid JSON")}return Ko(t)}function Xe(e){let t={};for(let r of Wr)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` +`}function Zr(e){return{format:V,name:e,version:"0.1.0",dependencies:{}}}function Kr(e){let r=(String(e??"").split("/").filter(Boolean).pop()??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"");return Ge.test(r)?r:"webfront-app"}async function fe(e){let t=JSON.stringify(Object.entries(e).sort(([n],[s])=>ns?1:0)),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(r)].map(n=>n.toString(16).padStart(2,"0")).join("")}var M="webfront-packages.lock.json",pe=".webfront/developer/packages",Qo=new TextDecoder,ea=new TextEncoder,en="No webfront.project.json: run wf init",he="The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again";async function Qr(e,t){try{return await ie(e,t)}catch(r){if(r.message.includes("Cannot read project file:"))return null;throw r}}function ta(e,t,r){return e?t?t.manifestDigest===r?"consistent":"desynchronized":"unlocked":"no-manifest"}async function tn(e){let t=await x(e,"state",`${v} +${M}`),r=await Qr(e,v),n=await Qr(e,M),s=r?Jr(r):null,i=n?Ue(JSON.parse(Qo.decode(n))):null,o=s?await fe(s.dependencies):null;return{manifest:s,lock:i,token:t,status:ta(s,i,o),digest:o}}var jc=e=>e.status==="desynchronized"?`Warning: ${he}.\r +`:"";async function rn(e,t,r,{signal:n}={}){let s=[];try{for(let[i,o]of t){n?.throwIfAborted();let a=await x(e,"begin",i,!1);s.push(a),await je(e,{id:a,path:"output",bytes:o},n)}n?.throwIfAborted(),await x(e,"commitGroup",s.join(` +`),`${v} +${M}`,r.token)}catch(i){for(let o of s)await x(e,"abort",o).catch(()=>{});throw i}}function Cc(e,t,r){let n=e?.entries??{};if(t!==void 0)return Object.hasOwn(n,t)?n[t]:t;if(Object.hasOwn(n,"main"))return n.main;let s=Object.keys(n);if(s.length===1)return n[s[0]];throw new Error(`Usage: ${r} (declare entries.main in ${v} to omit the entry)`)}var de=e=>ea.encode(e);var nn=e=>{let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?[e,void 0]:[e.slice(0,t),e.slice(t+1)||void 0]};async function Vc(e,[t=".",...r],{signal:n}={}){if(r.length)throw new Error("Usage: wf init [directory]");let s=t==="."?"":A(t.replace(/\/+$/,"")),i=s?`${s}/${v}`:v,o=new Map([["output",de(Xe(Zr(Kr(s))))]]);return await oe(e,i,o,{directory:!1,replace:!1,signal:n}),`Created ${i}. Add libraries with wf install .`}function ra(e,t){let r={...e.dependencies},n=new Set;for(let s of t){let[i,o]=nn(s);r[i]=o??"latest",o&&o!=="latest"&&n.add(i)}return{dependencies:r,explicit:n}}function na({dependencies:e,explicit:t},r,n){let s={...e};for(let i of n){let o=nn(i)[0];t.has(o)||(s[o]=`^${r.packages[r.roots[o].id].version}`)}return s}async function sa(e,t,r){let n=Object.entries(e).map(([o,a])=>`${o}@${a}`),{lock:s,downloads:i}=await Br(n,{registry:r.registry,signal:r.signal,fetchImpl:r.fetchImpl,previous:t,download:async(...o)=>(r.progress(`Resolving ${o[0]}@${o[1]}`),P(...o))});return{lock:s,downloads:i}}async function ia(e,t,r,{signal:n,progress:s}){for(let[i,o]of r)s(`Storing ${i}`),await oe(e,`${pe}/${t.packages[i].key}`,o,{signal:n})}async function oa(e,t){try{return await ie(e,`${pe}/${t.key}/package.json`),!0}catch{return!1}}async function aa(e,t,{signal:r,progress:n,fetchImpl:s}){let i=0;for(let[o,a]of Object.entries(t.packages)){if(r?.throwIfAborted(),await oa(e,a))continue;n(`Restoring ${o}`);let c=await P(a.name,a.version,{registry:t.registry,fetchImpl:s,signal:r});if(c.integrity!==a.integrity)throw new Error(`${o} no longer matches the integrity recorded in the lock`);await oe(e,`${pe}/${a.key}`,c.files,{signal:r}),i++}return i}function ca(e){let t=e.includes("--update"),r=e.filter(n=>n!=="--update");if(r.some(n=>n.startsWith("-")))throw new Error("Usage: wf install [--update] [[@range] ...]");return{update:t,specs:r}}async function la(e,t,{manifest:r,lock:n},s){let i=new Map([[M,de(JSON.stringify(n,null,2)+` +`)]]);r&&i.set(v,de(Xe(r))),await rn(e,i,t,s)}var ua=async(e,t)=>({format:e.format,manifestDigest:await fe(t),...e});async function Mc(e,t,{registry:r,signal:n,progress:s=()=>{},fetchImpl:i=fetch}){let{update:o,specs:a}=ca(t),c=await tn(e);if(!c.manifest)throw new Error(en);let f={registry:c.manifest.registry??r,signal:n,fetchImpl:i,progress:s};if(a.length&&o)throw new Error("Usage: wf install --update does not take packages");if(a.length&&c.status==="desynchronized")throw new Error(he);if(!a.length&&!o&&c.status==="desynchronized")throw new Error(he);if(!a.length&&!o&&c.status==="consistent")return{lock:c.lock,restored:await aa(e,c.lock,{signal:n,progress:s,fetchImpl:f.fetchImpl})};let h=ra(c.manifest,a),p=c.status==="consistent"?c.lock:void 0,w=await sa(h.dependencies,p,f),d=na(h,w.lock,a);await ia(e,w.lock,w.downloads,{signal:n,progress:s});let _=await ua(w.lock,d),sn=a.length?{...c.manifest,dependencies:d}:null;return await la(e,c,{manifest:sn,lock:_},{signal:n}),{lock:_,restored:0}}export{fe as dependenciesDigest,he as desynchronized,P as downloadPackage,Uo as exactVersion,Go as identifier,Vc as initProject,Mc as install,tn as loadProject,M as lockPath,V as manifestFormat,Kr as manifestName,v as manifestPath,Zr as newManifest,en as noManifest,Ge as npmName,pe as packageRoot,Jr as parseManifest,rn as publishTogether,Cc as resolveEntry,Br as resolvePackages,A as safePackagePath,Xe as serializeManifest,jc as syncNotice,de as textBytes,Ue as validateLock,Ko as validateManifest}; diff --git a/js/developer/environment/project.mjs b/js/developer/environment/project.mjs new file mode 100644 index 00000000..51446a5a --- /dev/null +++ b/js/developer/environment/project.mjs @@ -0,0 +1,80 @@ +// The project as the wf commands see it: manifest, lock, whether they agree, and their joint publication. +import {call, readProject, writeChunks} from './io.mjs'; +import {manifestPath, parseManifest, dependenciesDigest} from './manifest.mjs'; +import {validateLock} from './lock.mjs'; + +export const lockPath = 'webfront-packages.lock.json'; +export const packageRoot = '.webfront/developer/packages'; + +const decoder = new TextDecoder(); +const encoder = new TextEncoder(); + +export const noManifest = 'No webfront.project.json: run wf init'; +export const desynchronized = 'The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again'; + +async function readOptional(bridge, path) { + try { return await readProject(bridge, path); } + catch (error) { + if (error.message.includes('Cannot read project file:')) return null; + throw error; + } +} + +function statusOf(manifest, lock, digest) { + if (!manifest) return 'no-manifest'; + if (!lock) return 'unlocked'; + return lock.manifestDigest === digest ? 'consistent' : 'desynchronized'; +} + +/** + * Reads the manifest and the lock and compares them. `token` identifies the exact state that was read: + * a publication prepared from it is refused if either file changed in the meantime. + * no-manifest: no webfront.project.json; unlocked: no lock, so no installed graph; + * consistent: the lock was resolved from the manifest's current dependencies; + * desynchronized: the dependencies changed since; nothing is resolved implicitly. + */ +export async function loadProject(bridge) { + const token = await call(bridge, 'state', `${manifestPath}\n${lockPath}`); + const manifestBytes = await readOptional(bridge, manifestPath); + const lockBytes = await readOptional(bridge, lockPath); + const manifest = manifestBytes ? parseManifest(manifestBytes) : null; + const lock = lockBytes ? validateLock(JSON.parse(decoder.decode(lockBytes))) : null; + const digest = manifest ? await dependenciesDigest(manifest.dependencies) : null; + return {manifest, lock, token, status: statusOf(manifest, lock, digest), digest}; +} + +/** A line to put before the output of a command that reads a lock which no longer matches its manifest. */ +export const syncNotice = project => project.status === 'desynchronized' ? `Warning: ${desynchronized}.\r\n` : ''; + +/** + * Publishes the given files (path -> bytes) as one change, on condition that the project is still in the + * state `project` was read in. A refusal means another installation finished first: run the command again. + */ +export async function publishTogether(bridge, files, project, {signal} = {}) { + const ids = []; + try { + for (const [path, bytes] of files) { + signal?.throwIfAborted(); + const id = await call(bridge, 'begin', path, false); + ids.push(id); + await writeChunks(bridge, {id, path: 'output', bytes}, signal); + } + signal?.throwIfAborted(); + await call(bridge, 'commitGroup', ids.join('\n'), `${manifestPath}\n${lockPath}`, project.token); + } catch (error) { + for (const id of ids) await call(bridge, 'abort', id).catch(() => {}); + throw error; + } +} + +/** An entry given by its name in the manifest's "entries", or as a project path. */ +export function resolveEntry(manifest, argument, command) { + const entries = manifest?.entries ?? {}; + if (argument !== undefined) return Object.hasOwn(entries, argument) ? entries[argument] : argument; + if (Object.hasOwn(entries, 'main')) return entries.main; + const names = Object.keys(entries); + if (names.length === 1) return entries[names[0]]; + throw new Error(`Usage: ${command} (declare entries.main in ${manifestPath} to omit the entry)`); +} + +export const textBytes = text => encoder.encode(text); diff --git a/js/developer/environment/recipe.mjs b/js/developer/environment/recipe.mjs index 2c1c0b6a..f0570e75 100644 --- a/js/developer/environment/recipe.mjs +++ b/js/developer/environment/recipe.mjs @@ -1,33 +1,20 @@ -// A starter's webfront.project.json: the entry file, exact dependency versions and the provider name. +// A starter's webfront.project.json: the project manifest it ships, with exact dependency versions. import {safePackagePath} from './paths.mjs'; -import {isPlainObject} from './entry.mjs'; - -const decoder = new TextDecoder(); -const npmName = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/; -const exactVersion = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/; +import {parseManifest, manifestPath, exactVersion, npmName} from './manifest.mjs'; function requireExactDependencies(dependencies) { - if (!isPlainObject(dependencies)) throw new Error('Invalid starter project recipe'); for (const [name, version] of Object.entries(dependencies)) - if (!npmName.test(name) || typeof version !== 'string' || !exactVersion.test(version)) + if (!npmName.test(name) || !exactVersion.test(version)) throw new Error('Starter dependencies must name exact npm versions'); } -function validProvider(provider) { - if (typeof provider !== 'string') return false; - return /^[A-Za-z_][A-Za-z0-9_]*$/.test(provider); -} - -function hasEntry(recipe, files) { - if (typeof recipe.entry !== 'string') return false; - return files.has(safePackagePath(recipe.entry)); -} - +// A starter has a main entry present in its files and, optionally, one provider. export function recipeOf(files) { - const recipe = JSON.parse(decoder.decode(files.get('webfront.project.json'))); - if (recipe.format !== 1 || !hasEntry(recipe, files)) throw new Error('Invalid starter project recipe'); - requireExactDependencies(recipe.dependencies); - if (recipe.provider !== undefined && !validProvider(recipe.provider)) - throw new Error('Invalid starter provider name'); - return recipe; + if (!files.has(manifestPath)) throw new Error('Invalid starter project recipe'); + const manifest = parseManifest(files.get(manifestPath)); + if (!Object.hasOwn(manifest.entries, 'main') || !files.has(safePackagePath(manifest.entries.main))) + throw new Error('Invalid starter project recipe'); + requireExactDependencies(manifest.dependencies); + const [provider] = Object.keys(manifest.providers); + return {...manifest, entry: manifest.entries.main, provider, output: manifest.providers[provider]?.output}; } diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index 69228ad8..fb98c710 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -1,15 +1,16 @@ import {Terminal} from '../../../third_party/xterm/xterm.mjs'; import {FitAddon} from '../../../third_party/xterm/addon-fit.mjs'; import {LineEditor, tokenize} from '../components/terminal/terminal.mjs'; -import {resolvePackages, validateLock, downloadPackage} from './packages.mjs'; +import {validateLock} from './packages.mjs'; import {readProject, publish} from './io.mjs'; import {createStarter} from './starter.mjs'; +import {install, initProject} from './installer.mjs'; +import {loadProject, syncNotice, resolveEntry, lockPath, packageRoot} from './project.mjs'; import {generateProvider, applicationPage} from './embed.mjs'; const encoder = new TextEncoder(); const decoder = new TextDecoder(); -const lockPath = 'webfront-packages.lock.json'; -const packageRoot = '.webfront/developer/packages'; +export {lockPath, packageRoot}; export async function readLock(bridge, optional = false) { try { return validateLock(JSON.parse(decoder.decode(await readProject(bridge, lockPath)))); } catch (error) { @@ -19,35 +20,8 @@ export async function readLock(bridge, optional = false) { } } -const splitSpec = spec => { - const at = spec.indexOf('@', spec.startsWith('@') ? 1 : 0); - return at < 0 ? [spec, 'latest'] : [spec.slice(0, at), spec.slice(at + 1)]; -}; - -// The installed roots keep their exact versions unless a requested spec replaces them. -function requestedRoots(previous, specs) { - const requested = new Map(Object.entries(previous.roots).map(([name, root]) => [name, previous.packages[root.id].version])); - for (const spec of specs) requested.set(...splitSpec(spec)); - return [...requested].map(([name, version]) => `${name}@${version}`); -} - const textFile = text => new Map([['output', encoder.encode(text)]]); - -export async function install(bridge, specs, {registry, signal, progress = () => {}, fetchImpl = fetch}) { - if (!specs.length) throw new Error('Usage: wf install [@version] ...'); - const previous = await readLock(bridge, true); - const {lock, downloads} = await resolvePackages(requestedRoots(previous, specs), { - registry, signal, fetchImpl, previous, - download: async (...args) => { progress(`Resolving ${args[0]}@${args[1]}`); return downloadPackage(...args); }, - }); - for (const [id, files] of downloads) { - progress(`Storing ${id}`); - await publish(bridge, `${packageRoot}/${lock.packages[id].key}`, files, {signal}); - } - // The lock file is the installation commit point. A failed install may leave unused cache files. - await publish(bridge, lockPath, textFile(JSON.stringify(lock, null, 2) + '\n'), {directory: false, signal}); - return lock; -} +export {install}; async function readPackages(bridge, lock, signal) { const packages = {}; @@ -117,37 +91,54 @@ async function create([starter, directory, ...extra], {bridge, config, signal}) return createStarter(bridge, config, [starter, directory ?? 'ui'], {signal}); } -async function installCommand(specs, {bridge, config, signal, write = () => {}}) { - const lock = await install(bridge, specs, {registry: config.registry, signal, progress: text => write(text + '\r\n')}); - return `Installed ${Object.keys(lock.packages).length} packages. Lock: ${lockPath}`; +const init = (args, {bridge, signal}) => initProject(bridge, args, {signal}); + +async function installCommand(args, {bridge, config, signal, write = () => {}}) { + const {lock, restored} = await install(bridge, args, {registry: config.registry, signal, progress: text => write(text + '\r\n')}); + const count = Object.keys(lock.packages).length; + return restored || !args.length ? `Installed ${count} packages (${restored} restored). Lock: ${lockPath}` : `Installed ${count} packages. Lock: ${lockPath}`; } -async function preview([entry], {bridge, signal, preview: frame}) { - if (!entry) throw new Error('Usage: wf preview '); +async function preview(args, {bridge, signal, preview: frame}) { + if (args.length > 1) throw new Error('Usage: wf preview [entry.tsx|name]'); + const project = await loadProject(bridge); + const entry = resolveEntry(project.manifest, args[0], 'wf preview '); const result = await compile(bridge, entry, signal); await publish(bridge, '.webfront/developer/preview', result.files, {signal}); frame.hidden = false; // Replace transient builds without accumulating browser session history. frame.contentWindow.location.replace(`/webfront/developer/preview/index.html?build=${Date.now()}`); - return 'Preview ready.'; + return syncNotice(project) + 'Preview ready.'; +} + +// wf embed , or wf embed --output +function embedTarget(manifest, [first, flag, output, ...extra]) { + if (first && Object.hasOwn(manifest?.providers ?? {}, first) && flag === undefined) { + const provider = manifest.providers[first]; + return {entry: resolveEntry(manifest, provider.entry), output: provider.output}; + } + if (!first || flag !== '--output' || extra.length || !output?.endsWith('.hpp')) + throw new Error('wf embed requires or --output '); + return {entry: resolveEntry(manifest, first), output}; } -async function embed([entry, flag, output, ...extra], {bridge, signal}) { - if (!entry) throw new Error('Usage: wf embed --output '); - if (flag !== '--output' || extra.length || !output?.endsWith('.hpp')) throw new Error('wf embed requires --output '); +async function embed(args, {bridge, signal}) { + const project = await loadProject(bridge); + const {entry, output} = embedTarget(project.manifest, args); const result = await compile(bridge, entry, signal); const className = output.split('/').pop().slice(0, -4); await publish(bridge, output, textFile(generateProvider(result.files, className, result.notices)), {directory: false, signal}); - return `Generated ${output}. Use webfront::fs::${className} and recompile the application.`; + return `${syncNotice(project)}Generated ${output}. Use webfront::fs::${className} and recompile the application.`; } async function list(_args, {bridge}) { - const lock = await readLock(bridge, true); - return Object.keys(lock.packages).sort().join('\n') || 'No installed packages.'; + const project = await loadProject(bridge); + const names = Object.keys(project.lock?.packages ?? {}).sort().join('\n'); + return syncNotice(project) + (names || 'No installed packages.'); } -const help = () => 'wf create [directory]\nwf install [@version] ...\nwf list\nwf preview \nwf embed --output \nCtrl+C interrupts a browser command. No system shell is exposed.'; -const commands = {create, install: installCommand, preview, embed, list, help}; +const help = () => 'wf init [directory]\nwf create [directory]\nwf install [--update] [[@range] ...]\nwf list\nwf preview [entry.tsx|name]\nwf embed | --output \nCtrl+C interrupts a browser command. No system shell is exposed.'; +const commands = {init, create, install: installCommand, preview, embed, list, help}; export async function execute(args, context) { const [command = 'help', ...rest] = args; diff --git a/js/developer/environment/starter.mjs b/js/developer/environment/starter.mjs index d59ecb03..056b3da6 100644 --- a/js/developer/environment/starter.mjs +++ b/js/developer/environment/starter.mjs @@ -38,5 +38,6 @@ export async function createStarter(bridge, config, [name, destination = 'ui'], // A starter must never overwrite an existing directory, including a symlink or partial project. await publish(bridge, destination, files, {signal, replace: false}); const install = Object.entries(recipe.dependencies).map(([pkg, version]) => `${pkg}@${version}`).join(' '); - return `Created ${destination}.\nwf install ${install}\nwf preview ${destination}/${recipe.entry}\nwf embed ${destination}/${recipe.entry} --output generated/${recipe.provider ?? 'PiUI'}.hpp`; + const output = recipe.output ?? `generated/${recipe.provider ?? 'PiUI'}.hpp`; + return `Created ${destination}.\nwf init\nwf install ${install}\nwf preview ${destination}/${recipe.entry}\nwf embed ${destination}/${recipe.entry} --output ${output}`; } diff --git a/js/developer/tools/build.mjs b/js/developer/tools/build.mjs index c79d884a..55643a31 100644 --- a/js/developer/tools/build.mjs +++ b/js/developer/tools/build.mjs @@ -47,8 +47,9 @@ for (const [name, provider] of [['pi', 'PiUI'], ['life', 'LifeUI']]) { const starterFiles = new Map(); for (const file of ['main.tsx', 'style.css']) starterFiles.set(`package/${file}`, await readFile(resolve(root, `${name === 'life' ? 'examples/life/ui' : 'js/developer/tools/starters/pi'}/${file}`))); - const recipe = {format: 1, name, provider, entry: 'main.tsx', dependencies: { - react: dependencies.react, 'react-dom': dependencies['react-dom']}}; + const recipe = {format: 1, name: `${name}-starter`, version, dependencies: { + react: dependencies.react, 'react-dom': dependencies['react-dom']}, + entries: {main: 'main.tsx'}, providers: {[provider]: {entry: 'main', output: `generated/${provider}.hpp`}}}; starterFiles.set('package/webfront.project.json', Buffer.from(JSON.stringify(recipe, null, 2) + '\n')); starterFiles.set('package/package.json', Buffer.from(JSON.stringify({name: `@webfront/${name}-starter`, version, private: true, webfront: {kind: 'starter', entry: 'main.tsx'}}, null, 2) + '\n')); @@ -74,11 +75,11 @@ await writeFile(resolve(output, 'DeveloperReleaseData.hpp'), header); if (refresh) { const bootstrap = resolve(root, 'js/core/bootstrap/bootstrap.bundle.mjs'); await build({...options, entryPoints: ['js/developer/environment/bootstrap-entry.mjs'], outfile: bootstrap}); - await build({...options, entryPoints: ['js/developer/environment/packages.mjs'], outfile: resolve(root, 'js/developer/environment/packages.bundle.mjs')}); + await build({...options, entryPoints: ['js/developer/environment/packages-entry.mjs'], outfile: resolve(root, 'js/developer/environment/packages.bundle.mjs')}); await copyFile(resolve(root, 'js/developer/vendor/node_modules/semver/LICENSE'), resolve(root, 'js/developer/environment/PACKAGES-LICENSE.txt')); await writeFile(resolve(root, 'include/webfront/system/DeveloperReleaseData.hpp'), header); const inputs = {}; - for (const path of ['js/developer/environment/bootstrap.mjs', 'js/developer/environment/bootstrap-entry.mjs', 'js/developer/environment/packages.mjs', 'js/developer/environment/starter.mjs', 'js/developer/environment/paths.mjs', 'js/developer/environment/runtime.mjs', 'js/developer/environment/compiler.mjs', 'js/developer/environment/bundler.mjs', 'js/developer/environment/entry.mjs', 'js/developer/environment/conditions.mjs', 'js/developer/environment/io.mjs', 'js/developer/environment/recipe.mjs', 'js/developer/environment/registry.mjs', 'js/developer/environment/archive.mjs', 'js/developer/environment/lock.mjs', 'js/developer/environment/pins.mjs', 'js/developer/environment/peers.mjs', 'js/developer/environment/resolve.mjs', 'js/developer/environment/embed.mjs', 'js/developer/tools/starters/pi/main.tsx', 'js/developer/tools/starters/pi/style.css', 'examples/life/ui/main.tsx', 'examples/life/ui/style.css', 'js/developer/components/tools/wf.mjs', 'js/developer/tools/distribution.json', 'js/developer/tools/build.mjs', 'js/developer/tools/site.mjs', 'js/developer/tools/archive.mjs', 'js/developer/vendor/package-lock.json', 'js/core/bootstrap/bootstrap.bundle.mjs', 'js/developer/environment/packages.bundle.mjs', 'include/webfront/system/DeveloperReleaseData.hpp']) + for (const path of ['js/developer/environment/manifest.mjs', 'js/developer/environment/project.mjs', 'js/developer/environment/installer.mjs', 'js/developer/environment/packages-entry.mjs', 'js/developer/environment/bootstrap.mjs', 'js/developer/environment/bootstrap-entry.mjs', 'js/developer/environment/packages.mjs', 'js/developer/environment/starter.mjs', 'js/developer/environment/paths.mjs', 'js/developer/environment/runtime.mjs', 'js/developer/environment/compiler.mjs', 'js/developer/environment/bundler.mjs', 'js/developer/environment/entry.mjs', 'js/developer/environment/conditions.mjs', 'js/developer/environment/io.mjs', 'js/developer/environment/recipe.mjs', 'js/developer/environment/registry.mjs', 'js/developer/environment/archive.mjs', 'js/developer/environment/lock.mjs', 'js/developer/environment/pins.mjs', 'js/developer/environment/peers.mjs', 'js/developer/environment/resolve.mjs', 'js/developer/environment/embed.mjs', 'js/developer/tools/starters/pi/main.tsx', 'js/developer/tools/starters/pi/style.css', 'examples/life/ui/main.tsx', 'examples/life/ui/style.css', 'js/developer/components/tools/wf.mjs', 'js/developer/tools/distribution.json', 'js/developer/tools/build.mjs', 'js/developer/tools/site.mjs', 'js/developer/tools/archive.mjs', 'js/developer/vendor/package-lock.json', 'js/core/bootstrap/bootstrap.bundle.mjs', 'js/developer/environment/packages.bundle.mjs', 'include/webfront/system/DeveloperReleaseData.hpp']) inputs[path] = createHash('sha256').update(await readFile(resolve(root, path))).digest('hex'); await writeFile(resolve(root, 'js/developer/environment/bundles.json'), JSON.stringify(inputs, null, 2) + '\n'); for (const [source, name] of [['js/core/bootstrap/index.html', 'DeveloperIndexHtmlData'], ['js/core/bootstrap/bootstrap.bundle.mjs', 'DeveloperBootstrapData']]) diff --git a/js/developer/tools/distribution-check.mjs b/js/developer/tools/distribution-check.mjs index 35d90b8a..52f24f9b 100644 --- a/js/developer/tools/distribution-check.mjs +++ b/js/developer/tools/distribution-check.mjs @@ -11,10 +11,13 @@ import {createStarter} from '../environment/starter.mjs'; const encode = value => new TextEncoder().encode(typeof value === 'string' ? value : JSON.stringify(value)); const integrity = bytes => 'sha512-' + createHash('sha512').update(bytes).digest('base64'); +const recipe = (fields = {}) => ({format: 1, name: 'pi-starter', version: '0.1.0', dependencies: {react: '19.3.1'}, + entries: {main: 'main.tsx'}, ...fields}); + function starter(overrides = {}) { return compress(tar(new Map(Object.entries({ 'package/main.tsx': encode('export default function Pi() {}'), - 'package/webfront.project.json': encode({format: 1, entry: 'main.tsx', dependencies: {react: '19.3.1'}}), + 'package/webfront.project.json': encode(recipe()), ...overrides, })))); } @@ -27,14 +30,14 @@ test('starter integrity, recipes and archive paths are checked before any projec const config = {starters: {pi: {url: 'https://pages.test/developer/0.1.0/pi-starter.tgz', integrity: integrity(bytes)}}}; const fetchImpl = async () => new Response(bytes); const help = await createStarter(bridge, config, ['pi', 'ui'], {fetchImpl}); - assert.match(help, /wf install react@19.3.1/); + assert.match(help, /wf init\nwf install react@19.3.1/); assert.match(help, /wf preview ui\/main.tsx/); assert.equal(calls[0][0], 'webfront.developer.beginNew'); assert.equal(calls.at(-1)[0], 'webfront.developer.commit'); calls.length = 0; await assert.rejects(createStarter(bridge, {starters: {pi: {...config.starters.pi, integrity: integrity(encode('bad'))}}}, ['pi', 'ui'], {fetchImpl}), /Integrity check/); assert.equal(calls.length, 0); - for (const bytes of [starter({'package/../escape': encode('bad')}), starter({'package/webfront.project.json': encode({format: 1, entry: 'main.tsx', dependencies: {react: 'latest'}})})]) { + for (const bytes of [starter({'package/../escape': encode('bad')}), starter({'package/webfront.project.json': encode(recipe({dependencies: {react: 'latest'}}))})]) { await assert.rejects(createStarter(bridge, {starters: {pi: {...config.starters.pi, integrity: integrity(bytes)}}}, ['pi', 'ui'], {fetchImpl: async () => new Response(bytes)})); assert.equal(calls.length, 0); } @@ -107,8 +110,8 @@ test('bootstrap configuration is pinned and rejects unsafe version/base inputs', test('Life recipes select their generated provider and reject invalid provider names', async () => { globalThis.location = new URL('http://localhost:9002/'); try { - for (const provider of ['LifeUI', '../escape', ['LifeUI']]) { - const bytes = starter({'package/webfront.project.json': encode({format: 1, provider, entry: 'main.tsx', dependencies: {react: '19.3.1'}})}); + for (const provider of ['LifeUI', '../escape']) { + const bytes = starter({'package/webfront.project.json': encode(recipe({providers: {[provider]: {entry: 'main', output: `generated/${provider}.hpp`}}}))}); let writes = 0; const bridge = {cppFunction: () => async () => { writes++; return 'transaction'; }}; const config = {starters: {life: {url: '/life-starter.tgz', integrity: integrity(bytes)}}}; diff --git a/js/developer/tools/manifest-check.mjs b/js/developer/tools/manifest-check.mjs new file mode 100644 index 00000000..a502d0c0 --- /dev/null +++ b/js/developer/tools/manifest-check.mjs @@ -0,0 +1,244 @@ +// Node tests of the project manifest, its agreement with the lock and the joint publication of both. +import {test} from 'node:test'; +import assert from 'node:assert/strict'; +import {createHash} from 'node:crypto'; +import {validateManifest, parseManifest, serializeManifest, manifestName, dependenciesDigest} from '../environment/manifest.mjs'; +import {install, initProject, loadProject, syncNotice, resolveEntry, lockPath, manifestPath} from '../environment/packages.bundle.mjs'; +import {compress} from '../environment/embed.mjs'; +import {tar} from './archive.mjs'; + +const encoder = new TextEncoder(); +const decoder = new TextDecoder(); +const encode = value => encoder.encode(typeof value === 'string' ? value : JSON.stringify(value)); +const integrity = bytes => 'sha512-' + createHash('sha512').update(bytes).digest('base64'); +const minimal = {format: 1, name: 'app', version: '0.1.0'}; + +test('a valid manifest receives its defaults and keeps a stable serialization', () => { + const manifest = validateManifest(minimal); + assert.deepEqual(manifest.dependencies, {}); + assert.deepEqual(manifest.entries, {}); + const full = {...minimal, dependencies: {react: '^19.0.0', '@scope/lib': '>=1.2.0 <2', tool: 'latest'}, registry: 'https://registry.test/', + scripts: {build: 'wf embed main'}, entries: {main: 'ui/main.tsx'}, + providers: {PiUI: {entry: 'main', output: 'generated/PiUI.hpp'}}, test: {specs: ['spec/a.mjs']}, + permissions: {files: ['ui'], publish: ['generated'], fetch: ['https://registry.npmjs.org']}}; + const text = serializeManifest(validateManifest(full)); + assert.deepEqual(JSON.parse(text), full); + assert.equal(serializeManifest(parseManifest(encode(text))), text); + assert.equal(manifestName('apps/My App'), 'my-app'); + assert.equal(manifestName(''), 'webfront-app'); +}); + +test('invalid manifests are explicit errors, never silent fallbacks', () => { + const cases = [ + [{...minimal, extra: 1}, /unknown key "extra"/], + [{name: 'app', version: '1.0.0'}, /format must be 1/], + [{...minimal, format: 2}, /format 2 is not supported/], + [{...minimal, name: 'Bad Name'}, /name must be/], + [{...minimal, version: 'one'}, /version must be/], + [{...minimal, dependencies: {react: 3}}, /invalid version range/], + [{...minimal, dependencies: {'../x': '1.0.0'}}, /invalid npm package name/], + [{...minimal, dependencies: {react: 'file:../react'}}, /invalid version range/], + [{...minimal, registry: 'http://insecure.test/'}, /registry must use https/], + [{...minimal, entries: {main: '../outside.tsx'}}, /safe project-relative path/], + [{...minimal, entries: {main: '/etc/passwd'}}, /safe project-relative path/], + [{...minimal, providers: {'not valid': {entry: 'a.tsx', output: 'a.hpp'}}}, /invalid provider name/], + [{...minimal, providers: {P: {entry: 'a.tsx', output: 'a.js'}}}, /\.hpp file/], + [{...minimal, providers: {P: {entry: 'a.tsx', output: 'a.hpp', more: 1}}}, /unknown key "more"/], + [{...minimal, test: {specs: ['../spec.mjs']}}, /safe project-relative path/], + [{...minimal, test: {runner: 'x'}}, /unknown key "runner"/], + [{...minimal, permissions: {shell: true}}, /unknown permission "shell"/], + [{...minimal, permissions: {files: ['a/../../b']}}, /safe project-relative path/], + [{...minimal, permissions: {fetch: ['http://plain.test']}}, /https origin/], + [{...minimal, permissions: {fetch: ['https://registry.test/path']}}, /without a path/], + [[], /must be an object/], + ]; + for (const [value, message] of cases) assert.throws(() => validateManifest(value), message); + assert.throws(() => parseManifest(encode('{')), /not valid JSON/); +}); + +test('the dependency digest ignores key order and changes with any range', async () => { + const first = await dependenciesDigest({a: '^1.0.0', b: '2.0.0'}); + assert.equal(first, await dependenciesDigest({b: '2.0.0', a: '^1.0.0'})); + assert.notEqual(first, await dependenciesDigest({a: '^1.0.0', b: '^2.0.0'})); + assert.match(first, /^[0-9a-f]{64}$/); +}); + +test('entries are named in the manifest or given as paths', () => { + const manifest = validateManifest({...minimal, entries: {main: 'ui/main.tsx', other: 'ui/other.tsx'}}); + assert.equal(resolveEntry(manifest, undefined, 'wf preview'), 'ui/main.tsx'); + assert.equal(resolveEntry(manifest, 'other', 'wf preview'), 'ui/other.tsx'); + assert.equal(resolveEntry(manifest, 'free/path.tsx', 'wf preview'), 'free/path.tsx'); + assert.throws(() => resolveEntry(validateManifest(minimal), undefined, 'wf preview'), /entries.main/); +}); + +// An in-memory project behind the webfront.developer.* callbacks, with the store's group publication and precondition. +function memoryBridge(storage = new Map()) { + const transactions = new Map(); + let next = 0; + const stateOf = paths => paths.map(path => storage.has(path) ? createHash('sha256').update(storage.get(path)).digest('hex') : '-').join(','); + const operations = { + read: (path, offset) => { + if (!storage.has(path)) throw new Error('Cannot read project file: ' + path); + return storage.get(path).subarray(offset, offset + 256 * 1024); + }, + begin: (destination, directory) => { transactions.set(String(++next), {destination, directory, files: new Map(), replace: true}); return String(next); }, + beginNew: (destination, directory) => { transactions.set(String(++next), {destination, directory, files: new Map(), replace: false}); return String(next); }, + write: (id, path, offset, bytes) => { + const files = transactions.get(id).files; + const previous = files.get(path) ?? new Uint8Array(); + assert.equal(previous.length, offset); + files.set(path, new Uint8Array([...previous, ...bytes])); + }, + commit: id => { + const {destination, directory, files, replace} = transactions.get(id); + if (!replace && (storage.has(destination) || [...storage.keys()].some(key => key.startsWith(destination + '/')))) + throw new Error('Starter destination already exists'); + for (const [path, bytes] of files) storage.set(directory ? `${destination}/${path}` : destination, bytes); + transactions.delete(id); + }, + abort: id => { transactions.delete(id); }, + state: paths => stateOf(paths.split('\n')), + commitGroup: (ids, paths, expected) => { + if (stateOf(paths.split('\n')) !== expected) throw new Error('The project changed since it was read; run the command again'); + for (const id of ids.split('\n')) { + const {destination, files} = transactions.get(id); + storage.set(destination, files.get('output')); + transactions.delete(id); + } + }, + }; + const bridge = {cppFunction: name => async (...args) => operations[name.replace('webfront.developer.', '')](...args)}; + return {bridge, storage, pending: () => transactions.size}; +} + +const pkg = (name, version, fields = {}) => compress(tar(new Map([['package/package.json', encode({name, version, ...fields})]]))); +function registry(packages) { + const requests = []; + const fetchImpl = async url => { + requests.push(String(url)); + const path = new URL(url).pathname.slice(1); + if (path.endsWith('.tgz')) return new Response(packages[path.slice(0, -4)].bytes); + const entry = packages[path]; + if (!entry) return new Response('', {status: 404}); + const manifest = {dist: {tarball: `https://registry.test/${path}.tgz`, integrity: integrity(entry.bytes)}}; + return Response.json({'dist-tags': {latest: entry.version}, versions: {[entry.version]: manifest}}); + }; + return {fetchImpl, requests}; +} +const source = () => ({ + a: {version: '1.2.0', bytes: pkg('a', '1.2.0')}, + b: {version: '2.0.0', bytes: pkg('b', '2.0.0')}, + c: {version: '3.1.0', bytes: pkg('c', '3.1.0')}, +}); +const options = fetchImpl => ({registry: 'https://registry.test/', fetchImpl}); +const json = (storage, path) => JSON.parse(decoder.decode(storage.get(path))); + +async function project(...files) { + const memory = memoryBridge(); + await initProject(memory.bridge, [], {}); + for (const spec of files) await install(memory.bridge, [spec], options(registry(source()).fetchImpl)); + return memory; +} + +test('wf init creates a minimal manifest and never replaces an existing one', async () => { + const {bridge, storage} = memoryBridge(); + assert.match(await initProject(bridge, [], {}), /Created webfront.project.json/); + assert.deepEqual(json(storage, manifestPath), {format: 1, name: 'webfront-app', version: '0.1.0', dependencies: {}}); + await assert.rejects(initProject(bridge, [], {}), /already exists/); + await initProject(bridge, ['apps/Ui'], {}); + assert.equal(json(storage, 'apps/Ui/webfront.project.json').name, 'ui'); + await assert.rejects(initProject(bridge, ['../escape'], {}), /Unsafe package path/); + await assert.rejects(initProject(bridge, ['a', 'b'], {}), /Usage/); +}); + +test('wf install needs a manifest, then publishes manifest and lock together', async () => { + const {bridge, storage} = memoryBridge(); + const {fetchImpl} = registry(source()); + await assert.rejects(install(bridge, ['a'], options(fetchImpl)), /run wf init/); + await initProject(bridge, [], {}); + assert.equal((await loadProject(bridge)).status, 'unlocked'); + await install(bridge, ['a'], options(fetchImpl)); + const afterFirst = await loadProject(bridge); + assert.equal(afterFirst.status, 'consistent'); + assert.deepEqual(afterFirst.manifest.dependencies, {a: '^1.2.0'}); + assert.equal(afterFirst.lock.manifestDigest, await dependenciesDigest({a: '^1.2.0'})); + await install(bridge, ['b@2.0.0', 'c@^3'], options(fetchImpl)); + assert.deepEqual(json(storage, manifestPath).dependencies, {a: '^1.2.0', b: '2.0.0', c: '^3'}); + assert.deepEqual(Object.keys(json(storage, lockPath).roots), ['a', 'b', 'c']); + assert.equal((await loadProject(bridge)).status, 'consistent'); +}); + +test('the three states of manifest and lock for install, install and install --update', async () => { + const {bridge, storage, pending} = await project('a'); + const {fetchImpl, requests} = registry(source()); + // consistent: install restores the locked graph, resolving and writing nothing. + const manifestBefore = storage.get(manifestPath); + const lockBefore = storage.get(lockPath); + const cache = [...storage.keys()].filter(key => key.startsWith('.webfront/developer/packages/')); + cache.forEach(key => storage.delete(key)); + const restored = await install(bridge, [], options(fetchImpl)); + assert.equal(restored.restored, 1); + assert.ok(cache.every(key => storage.has(key))); + assert.equal(storage.get(manifestPath), manifestBefore); + assert.equal(storage.get(lockPath), lockBefore); + assert.equal(requests.filter(url => !url.endsWith('.tgz')).length, 1, 'only the locked package is fetched, not a new resolution'); + // no lock: install resolves the manifest and creates the lock, leaving the manifest alone. + storage.delete(lockPath); + assert.equal((await loadProject(bridge)).status, 'unlocked'); + await install(bridge, [], options(fetchImpl)); + assert.equal((await loadProject(bridge)).status, 'consistent'); + assert.deepEqual(storage.get(manifestPath), manifestBefore); + // desynchronized: every command says so and nothing is resolved implicitly. + const edited = json(storage, manifestPath); + edited.dependencies.b = '2.0.0'; + storage.set(manifestPath, encode(serializeManifest(edited))); + const stale = await loadProject(bridge); + assert.equal(stale.status, 'desynchronized'); + assert.match(syncNotice(stale), /wf install --update/); + const lockStale = storage.get(lockPath); + requests.length = 0; + await assert.rejects(install(bridge, [], options(fetchImpl)), /wf install --update/); + await assert.rejects(install(bridge, ['c'], options(fetchImpl)), /wf install --update/); + assert.equal(requests.length, 0); + assert.equal(storage.get(lockPath), lockStale); + await install(bridge, ['--update'], options(fetchImpl)); + assert.equal((await loadProject(bridge)).status, 'consistent'); + assert.deepEqual(Object.keys(json(storage, lockPath).roots), ['a', 'b']); + assert.equal(pending(), 0); +}); + +test('a changed archive is refused when restoring a locked graph', async () => { + const {bridge, storage} = await project('a'); + [...storage.keys()].filter(key => key.startsWith('.webfront/developer/packages/')).forEach(key => storage.delete(key)); + const tampered = {a: {version: '1.2.0', bytes: pkg('a', '1.2.0', {description: 'changed'})}}; + await assert.rejects(install(bridge, [], options(registry(tampered).fetchImpl)), /Integrity check|integrity/); +}); + +test('two installations that read the same state cannot overwrite each other', async () => { + const {bridge, storage, pending} = await project(); + const {fetchImpl} = registry(source()); + const results = await Promise.allSettled([install(bridge, ['a'], options(fetchImpl)), install(bridge, ['b'], options(fetchImpl))]); + const refused = results.filter(result => result.status === 'rejected'); + assert.equal(refused.length, 1, 'exactly one publication is refused by the precondition'); + assert.match(refused[0].reason.message, /changed since it was read; run the command again/); + assert.equal(pending(), 0, 'the refused installation leaves no staged transaction'); + assert.equal((await loadProject(bridge)).status, 'consistent'); + const winner = Object.keys(json(storage, manifestPath).dependencies); + assert.equal(winner.length, 1); + await install(bridge, [winner[0] === 'a' ? 'b' : 'a'], options(fetchImpl)); + assert.deepEqual(Object.keys(json(storage, manifestPath).dependencies).sort(), ['a', 'b']); + assert.deepEqual(Object.keys(json(storage, lockPath).roots).sort(), ['a', 'b']); + assert.equal((await loadProject(bridge)).status, 'consistent'); +}); + +test('an invalid manifest or a lock without its digest is reported before anything is resolved', async () => { + const {bridge, storage} = await project('a'); + const lock = json(storage, lockPath); + delete lock.manifestDigest; + storage.set(lockPath, encode(lock)); + assert.equal((await loadProject(bridge)).status, 'desynchronized'); + storage.set(manifestPath, encode({...minimal, format: 3})); + await assert.rejects(loadProject(bridge), /format 3 is not supported/); + storage.set(manifestPath, encode({...minimal, permissions: {network: true}})); + await assert.rejects(install(bridge, [], options(registry(source()).fetchImpl)), /unknown permission/); +}); diff --git a/test/unit/DeveloperTests.cpp b/test/unit/DeveloperTests.cpp index 38450888..1da61ee2 100644 --- a/test/unit/DeveloperTests.cpp +++ b/test/unit/DeveloperTests.cpp @@ -1,6 +1,7 @@ #include "../fixtures/Pi.hpp" #include "TemporaryDirectory.hpp" #include +#include #include #include @@ -338,3 +339,169 @@ SCENARIO("The developer application needs an explicit project and a trusted envi } } } + +namespace { +constexpr auto manifestPath = "webfront.project.json"; +constexpr auto lockPath = "webfront-packages.lock.json"; +const std::vector pair{manifestPath, lockPath}; + +void publishFile(developer::Store& store, const std::string& path, std::string_view text) { + const auto id = store.begin(path, false); + store.write(id, "output", 0, bytes(text)); + store.commit(id); +} + +// Stages new contents for the manifest and the lock, then publishes them together. +void publishPair(developer::Store& store, std::string_view manifest, std::string_view lock, const std::string& expected) { + const auto first = store.begin(manifestPath, false); + const auto second = store.begin(lockPath, false); + store.write(first, "output", 0, bytes(manifest)); + store.write(second, "output", 0, bytes(lock)); + store.commitGroup({first, second}, pair, expected); +} + +[[nodiscard]] std::string projectState(developer::Store& store) { + return read(store, manifestPath) + "|" + read(store, lockPath); +} + +// Stops the process at one step of a group publication, then reopens the project. +[[nodiscard]] std::string crashAt(const std::string& step, const std::filesystem::path& project) { + { + developer::Store store{project, developer::defaultAbandonedAfter, [&step](std::string_view name) { + if (name == step) + throw developer::InjectedFault{"crash at " + step}; + }}; + const auto expected = store.state(pair); + REQUIRE_THROWS_AS(publishPair(store, "manifest-2", "lock-2", expected), developer::InjectedFault); + } + developer::Store reopened{project}; + return projectState(reopened); +} +} // namespace + +SCENARIO("A manifest and its lock are published together or not at all") { + TemporaryDirectory project; + { + developer::Store store{project.path()}; + publishFile(store, manifestPath, "manifest-1"); + publishFile(store, lockPath, "lock-1"); + } + GIVEN("an installed manifest and lock") { + developer::Store store{project.path()}; + WHEN("both files are published after an uninterrupted install") { + publishPair(store, "manifest-2", "lock-2", store.state(pair)); + THEN("both are replaced and no journal remains") { + REQUIRE(projectState(store) == "manifest-2|lock-2"); + REQUIRE(std::filesystem::is_empty(project.path() / ".webfront/developer/journal")); + } + } + WHEN("the process stops before the journal is committed") { + store.state(pair); + THEN("the previous state is intact after restart") { + REQUIRE(crashAt("before-journal", project.path()) == "manifest-1|lock-1"); + } + } + WHEN("the process stops right after the journal is committed") { + THEN("restart completes the publication") { + REQUIRE(crashAt("after-journal", project.path()) == "manifest-2|lock-2"); + } + } + WHEN("the process stops between the two replacements") { + THEN("restart completes the publication") { + REQUIRE(crashAt("replacement-1", project.path()) == "manifest-2|lock-2"); + } + } + WHEN("the process stops after the second replacement") { + THEN("restart completes the publication") { + REQUIRE(crashAt("replacement-2", project.path()) == "manifest-2|lock-2"); + } + } + } + GIVEN("a publication committed but interrupted between its replacements") { + { + developer::Store store{project.path(), developer::defaultAbandonedAfter, [](std::string_view name) { + if (name == "replacement-1") + throw developer::InjectedFault{"crash"}; + }}; + REQUIRE_THROWS_AS(publishPair(store, "manifest-2", "lock-2", store.state(pair)), developer::InjectedFault); + } + WHEN("the recovery itself is interrupted, once at each of its steps") { + for (const char* step : {"replacement-1", "replacement-2"}) { + REQUIRE_THROWS_AS(developer::Store(project.path(), developer::defaultAbandonedAfter, + [step](std::string_view name) { + if (name == step) + throw developer::InjectedFault{"crash"}; + }), + developer::InjectedFault); + } + THEN("a later restart still reaches the new state") { + developer::Store store{project.path()}; + REQUIRE(projectState(store) == "manifest-2|lock-2"); + REQUIRE(std::filesystem::is_empty(project.path() / ".webfront/developer/journal")); + } + } + } + GIVEN("leftovers of a publication that never reached its commit point") { + const auto journal = project.path() / ".webfront/developer/journal"; + std::filesystem::create_directories(journal / "7.d"); + std::ofstream{journal / "7.d" / "0"} << "orphan"; + std::ofstream{journal / "7.tmp"} << "webfront-journal 1\nwebfront.project.json\n0\n"; + std::ofstream{journal / "8.journal"} << "webfront-journal 1\nwebfront.project.json\n0\n"; + WHEN("the project is opened") { + developer::Store store{project.path()}; + THEN("they are abandoned and the project keeps its files") { + REQUIRE(std::filesystem::is_empty(journal)); + REQUIRE(projectState(store) == "manifest-1|lock-1"); + } + } + } +} + +SCENARIO("A publication prepared from stale state is refused") { + TemporaryDirectory project; + developer::Store store{project.path()}; + publishFile(store, manifestPath, "manifest-1"); + publishFile(store, lockPath, "lock-1"); + GIVEN("two browsers reading the same state") { + const auto firstBrowser = store.state(pair); + const auto secondBrowser = store.state(pair); + REQUIRE(firstBrowser == secondBrowser); + WHEN("the first publishes, then the second does with what it read") { + publishPair(store, "manifest-a", "lock-a", firstBrowser); + THEN("the second is refused and nothing is lost") { + REQUIRE_THROWS_WITH(publishPair(store, "manifest-b", "lock-b", secondBrowser), Catch::Matchers::ContainsSubstring("changed since it was read")); + REQUIRE(projectState(store) == "manifest-a|lock-a"); + } + AND_THEN("it succeeds after reading the new state again") { + publishPair(store, "manifest-ab", "lock-ab", store.state(pair)); + REQUIRE(projectState(store) == "manifest-ab|lock-ab"); + } + } + WHEN("a file changes outside the store") { + publishFile(store, lockPath, "lock-c"); + THEN("the state differs and the group is refused") { + REQUIRE(store.state(pair) != firstBrowser); + REQUIRE_THROWS(publishPair(store, "manifest-b", "lock-b", firstBrowser)); + } + } + } + GIVEN("a missing lock") { + std::filesystem::remove(project.path() / lockPath); + THEN("its absence is part of the state") { + const auto absent = store.state(pair); + publishFile(store, lockPath, ""); + REQUIRE(store.state(pair) != absent); + } + } + GIVEN("malformed groups") { + const auto first = store.begin(manifestPath, false); + store.write(first, "output", 0, bytes("x")); + THEN("they are refused without changing the project") { + REQUIRE_THROWS(store.commitGroup({}, pair, store.state(pair))); + REQUIRE_THROWS(store.commitGroup({first, first}, pair, store.state(pair))); + REQUIRE_THROWS(store.commitGroup({first}, {lockPath}, store.state({lockPath}))); + REQUIRE(projectState(store) == "manifest-1|lock-1"); + store.abort(first); + } + } +} diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index 810d8506..84b6d947 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -1,6 +1,21 @@ // Autonomous real-engine test: compiled WASM, npm graph, PI bridge, preview, cache and embedding. const delay = ms => new Promise(resolve => setTimeout(resolve, ms)); const assert = (condition, message) => { if (!condition) throw new Error(message); }; +const call = (name, ...args) => webFront.cppFunction(`webfront.developer.${name}`)(...args); +async function readFile(path) { + const chunks = []; + for (let offset = 0;;) { + const chunk = await call('read', path, offset); + chunks.push(chunk); + offset += chunk.length; + if (chunk.length < 256 * 1024) return new Uint8Array(await new Blob(chunks).arrayBuffer()); + } +} +async function writeFile(path, text) { + const id = await call('begin', path, false); + await call('write', id, 'output', 0, new TextEncoder().encode(text)); + await call('commit', id); +} try { await webFront.ready; for (let attempt = 0; attempt < 300; ++attempt) { @@ -19,13 +34,26 @@ try { await runtime.execute(['create', 'pi'], context); const overwriteRefused = await runtime.execute(['create', 'pi'], context).then(() => false, () => true); assert(overwriteRefused, 'A starter must not replace an existing project'); + const noManifest = await runtime.execute(['install', 'react@19.3.1'], context).then(() => false, error => /run wf init/.test(error.message)); + assert(noManifest, 'wf install must ask for a manifest first'); + await runtime.execute(['init'], context); + const initRefused = await runtime.execute(['init'], context).then(() => false, () => true); + assert(initRefused, 'wf init must not replace an existing manifest'); await runtime.execute(['install', 'react@19.3.1', 'react-dom@19.3.1'], context); const lock = await runtime.readLock(webFront); + assert(lock.manifestDigest?.length === 64, 'The lock must record the digest of the manifest dependencies'); + const manifest = JSON.parse(new TextDecoder().decode(await readFile('webfront.project.json'))); + assert(manifest.dependencies.react === '19.3.1' && manifest.dependencies['react-dom'] === '19.3.1', 'The manifest must record the requested ranges'); + // Entries and providers declared in the manifest drive wf preview and wf embed. + manifest.entries = {main: 'ui/main.tsx'}; + manifest.providers = {PiUI: {entry: 'main', output: 'generated/PiUI.hpp'}}; + await writeFile('webfront.project.json', JSON.stringify(manifest, null, 2)); + assert(!(await runtime.execute(['list'], context)).includes('Warning'), 'Editing entries must not desynchronize the lock'); assert(Object.keys(lock.packages).length === 3, 'React, React DOM and scheduler must be resolved'); const listed = await runtime.execute(['list'], context); assert(listed.split('\n').length === 3 && listed.includes('react@19.3.1'), 'wf list must name the installed packages'); const historyLength = history.length; - await runtime.execute(['preview', 'ui/main.tsx'], context); + await runtime.execute(['preview'], context); const frame = context.preview; for (let attempt = 0; attempt < 300; ++attempt) { if (frame.contentDocument?.querySelector('button')) break; @@ -38,7 +66,7 @@ try { if (attempt === 99) throw new Error('React preview did not display C++ PI'); await delay(50); } - await runtime.execute(['embed', 'ui/main.tsx', '--output', 'generated/PiUI.hpp'], context); + await runtime.execute(['embed', 'PiUI'], context); // Repeat the browser build to prove reproducibility, including licenses and packed gzip bytes. const first = await webFront.cppFunction('test.header')('PiUI'); await runtime.execute(['embed', 'ui/main.tsx', '--output', 'generated/PiUI.hpp'], context); @@ -116,6 +144,15 @@ try { const lifeHeader = await webFront.cppFunction('test.header')('LifeUI'); await runtime.execute(['embed', 'life-ui/main.tsx', '--output', 'generated/LifeUI.hpp'], context); assert(await webFront.cppFunction('test.header')('LifeUI') === lifeHeader, 'Life header must be deterministic'); + // A dependency added by hand desynchronizes the lock: commands say so and nothing is resolved implicitly. + manifest.dependencies.scheduler = '*'; + await writeFile('webfront.project.json', JSON.stringify(manifest, null, 2)); + assert((await runtime.execute(['list'], context)).startsWith('Warning'), 'A desynchronized lock must be reported'); + const refused = await runtime.execute(['install'], context).then(() => false, error => /wf install --update/.test(error.message)); + assert(refused, 'wf install must not resolve a desynchronized manifest'); + delete manifest.dependencies.scheduler; + await writeFile('webfront.project.json', JSON.stringify(manifest, null, 2)); + assert(/Installed 3 packages/.test(await runtime.execute(['install'], context)), 'A consistent lock must install its exact graph'); const failed = await runtime.execute(['install', 'INVALID-NPM-NAME'], context).then(() => false, () => true); assert(failed, 'Missing packages must reject'); assert(JSON.stringify(await runtime.readLock(webFront)) === JSON.stringify(lock), 'A failed install must preserve the lock'); From 5e5577475a92ef5a8cf57d0fd8c763dc74a0a131 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 14:15:57 +0200 Subject: [PATCH 012/134] Make group replacements durable before removing the journal, honor --update and bump the developer distribution to 0.5.0 [#305] --- .github/workflows/DeveloperDistribution.yml | 2 +- docs/CHANGELOG.md | 3 ++- docs/DEVELOPER_ENVIRONMENT.md | 4 +-- docs/PROJECT_STATUS.md | 3 ++- include/webfront/system/DeveloperJournal.hpp | 12 +++++++-- .../webfront/system/DeveloperReleaseData.hpp | 6 ++--- js/developer/environment/bundles.json | 12 ++++----- js/developer/environment/installer.mjs | 3 ++- js/developer/environment/packages.bundle.mjs | 2 +- js/developer/tools/RELEASE_NOTES.md | 2 ++ js/developer/tools/distribution.json | 2 +- js/developer/tools/manifest-check.mjs | 25 ++++++++++++++++--- test/unit/DeveloperTests.cpp | 21 ++++++++++++++++ 13 files changed, 75 insertions(+), 22 deletions(-) diff --git a/.github/workflows/DeveloperDistribution.yml b/.github/workflows/DeveloperDistribution.yml index 8789fdcf..90ebe823 100644 --- a/.github/workflows/DeveloperDistribution.yml +++ b/.github/workflows/DeveloperDistribution.yml @@ -58,7 +58,7 @@ jobs: cmp build-distribution/pi-starter.tgz build-distribution-repeat/pi-starter.tgz cmp build-distribution/life-starter.tgz build-distribution-repeat/life-starter.tgz cmp include/webfront/system/DeveloperReleaseData.hpp build-distribution/DeveloperReleaseData.hpp - node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs + node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs js/developer/tools/manifest-check.mjs - name: Check the dedicated release tag if: startsWith(github.ref, 'refs/tags/developer-v') env: diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4f8b9255..e7e54e95 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,7 +6,8 @@ - Project manifest `webfront.project.json` (format 1: `name`, `version`, `dependencies`, `registry`, `scripts`, `entries`, `providers`, `test`, `permissions`), strictly validated; `wf init`, `wf install [--update]` and - manifest-driven `wf preview`/`wf embed` in the next developer distribution. The lock records the digest of + manifest-driven `wf preview`/`wf embed` in developer distribution 0.5.0 (to be published as `developer-v0.5.0`; + until then the pinned release URL does not resolve). The lock records the digest of the manifest dependencies and reports a desynchronized state. `developer::Store::commitGroup` publishes manifest and lock through a synced intent journal with crash recovery and a concurrent-install precondition. New bridge callbacks `webfront.developer.state` and `webfront.developer.commitGroup`. Starters ship a manifest; diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 13dc41e4..73861af5 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -47,7 +47,7 @@ native tests from empty working directories, with developer callbacks absent. Pa HTTP 200, CORS `*` and the pinned archive bytes. These checks supplement offline CTest fixtures. The default configuration is generated in `include/webfront/system/DeveloperReleaseData.hpp` and targets -`https://ambroise-leclerc.github.io/WebFront/developer/0.4.1/environment.tgz`. This version, published and archived as `developer-v0.4.1`, generates providers that include ``. Published 0.4.0 stays immutable but targets the former include layout. The configuration pins one version and +`https://ambroise-leclerc.github.io/WebFront/developer/0.5.0/environment.tgz`. Version 0.5.0 adds the project manifest; it is pending publication as `developer-v0.5.0`, and until then this URL does not resolve (tests use the offline fixtures). Published 0.4.1 generates providers that include ``; published 0.4.0 and 0.4.1 stay immutable. The configuration pins one version and its SHA-512 rather than resolving a mutable `latest` channel. An explicit `DeveloperBootstrapOptions{.environment = url, .integrity = trustedHash}` still selects a different HTTPS/CORS repository or a same-origin test fixture. Users install neither npm nor Node.js. @@ -141,7 +141,7 @@ examples are limited to Hello World and Life. Existing embedded React/Babel prov ## Project manifest (`webfront.project.json`) -Available in the next developer distribution after 0.4.1; the pinned 0.4.1 environment predates it. +Available from developer distribution 0.5.0 (pinned by `DeveloperReleaseData.hpp`; tag `developer-v0.5.0` publishes it, the published 0.4.1 environment predates the manifest). A project has one manifest, the equivalent of `package.json`, which every `wf` command reads: ```json diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index b1f89b7b..3cac5419 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -9,7 +9,8 @@ removed without redirect headers (see `docs/CHANGELOG.md`). Browser sources live (bridge, fallback, bootstrap loader and embedding modules) and `js/developer/` (environment, terminal components, build tools, vendoring tools); tests live in `test/{unit,web,fuzz,fixtures,cmake}`. The CTest case `RepositoryLayout` enforces the root. The generated-provider include changed, so the developer -distribution is bumped to 0.4.1, published and archived as `developer-v0.4.1`. +distribution is bumped to 0.4.1, published and archived as `developer-v0.4.1`. Version 0.5.0 (project manifest, #305) is +pinned by `DeveloperReleaseData.hpp` and awaits publication as `developer-v0.5.0`. ## CI test duration (#298, 2026-10-21) diff --git a/include/webfront/system/DeveloperJournal.hpp b/include/webfront/system/DeveloperJournal.hpp index 2420588e..0d5f2b1c 100644 --- a/include/webfront/system/DeveloperJournal.hpp +++ b/include/webfront/system/DeveloperJournal.hpp @@ -135,16 +135,24 @@ inline void rollForward(const std::filesystem::path& root, const std::filesystem const std::vector& entries, const StepHook& hook) { const auto owned = directory / (number + ".d"); int done = 0; + std::set directories{owned}; for (const auto& [target, source] : entries) { - const auto staged = owned / source; + const auto staged = owned / source; + const auto destination = projectPath(root, target); if (std::filesystem::is_regular_file(staged)) { - const auto destination = projectPath(root, target); std::filesystem::create_directories(destination.parent_path()); std::filesystem::rename(staged, destination); } + directories.insert(destination.parent_path()); if (hook) hook("replacement-" + std::to_string(++done)); } + // The journal is the only record of what remains to be done: it must outlive every replacement, so + // make the renames durable (the directories holding the targets and the emptied source) first. + for (const auto& changed : directories) + syncDirectory(changed); + if (hook) + hook("replacements-synced"); std::filesystem::remove(directory / (number + ".journal")); syncDirectory(directory); std::error_code ignored; diff --git a/include/webfront/system/DeveloperReleaseData.hpp b/include/webfront/system/DeveloperReleaseData.hpp index eed7156a..5f489aaf 100644 --- a/include/webfront/system/DeveloperReleaseData.hpp +++ b/include/webfront/system/DeveloperReleaseData.hpp @@ -4,7 +4,7 @@ #include namespace webfront::developer::release { -inline constexpr std::string_view version{"0.4.1"}; -inline constexpr std::string_view environment{"https://ambroise-leclerc.github.io/WebFront/developer/0.4.1/environment.tgz"}; -inline constexpr std::string_view integrity{"sha512-GFvk1FWIVWBWAXLzJUEmaKo1CIMS82FZdhZyd/q8qE3/FA8CcxFN7G/u4gpQJNMJ9R1PKKLV0UXd2uuk08y0AA=="}; +inline constexpr std::string_view version{"0.5.0"}; +inline constexpr std::string_view environment{"https://ambroise-leclerc.github.io/WebFront/developer/0.5.0/environment.tgz"}; +inline constexpr std::string_view integrity{"sha512-of5wrocjRCMxRk673v/KYRHHYjfLqNNKDvLUZB2CVI9xp7Kpj1W55Ch8gYSLRbnBJvprtwF3+mS9aCtmaGXpwQ=="}; } // namespace webfront::developer::release diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 4099196d..0fb5db2c 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -1,10 +1,10 @@ { - "js/developer/environment/bootstrap.mjs": "534af4b3d07891338c3390e1d5e06c2fb6dd8df11ca6547735565b17f1b9cd70", - "js/developer/environment/bootstrap-entry.mjs": "ff8084f23f5acc721f97eb1ed0a454e7bfee1894de17d54f0100fa11f7ef8b77", "js/developer/environment/manifest.mjs": "248e7cbe44dd71be514a57e3997860fb148d39e5fbf04b133e08f17dbc878a6a", "js/developer/environment/project.mjs": "d971b2c225179be7798a9c442a48006e1e9b7af56c329f325858dbd665fc351e", - "js/developer/environment/installer.mjs": "235684685d79521dc889346b90076835a269d3d33b9ab74f8c428b52e9c2721a", + "js/developer/environment/installer.mjs": "bfe47a54b65e7fbe37df2a21da8722f3d40ddaa903a25636bc51692a51b393ea", "js/developer/environment/packages-entry.mjs": "7b5dc8aac408b741ccd3f9098165fca7645c4e88fd7ca7b8822fe37b7ad21fce", + "js/developer/environment/bootstrap.mjs": "534af4b3d07891338c3390e1d5e06c2fb6dd8df11ca6547735565b17f1b9cd70", + "js/developer/environment/bootstrap-entry.mjs": "ff8084f23f5acc721f97eb1ed0a454e7bfee1894de17d54f0100fa11f7ef8b77", "js/developer/environment/packages.mjs": "faed29500a34c6ce24756d07bd4b47b9168ccec4bd49d12f00096a869637d74d", "js/developer/environment/starter.mjs": "048cf2af36b407bc075323f78a1195b4be91ad7da51f6ce941d9fb230f314ff9", "js/developer/environment/paths.mjs": "6ebb626610756143c58762c87af18980802809d7f0f53d3b588e4b20e8db0161", @@ -27,12 +27,12 @@ "examples/life/ui/main.tsx": "ed11a82aad1639eb6997af8b0fca4d5c5ed4c36422c22a74ac49ae73078d0a91", "examples/life/ui/style.css": "9bb55eb0f0a3287e5b7dc78af9d69608b87ff42c4d9c8a653bc83a52fe293c44", "js/developer/components/tools/wf.mjs": "2a8b463b2da223deb8d54d9fdd6037fdd079afeb24e39337693df03cdbcbd0ec", - "js/developer/tools/distribution.json": "26bb7dba24546565e38071087ab088727ad2b51fbbdb37afe801a574aff53fb6", + "js/developer/tools/distribution.json": "12b40657d1bc34c4093cd5f793d772bf3fa6fd8615ab7b766ad1756092438f83", "js/developer/tools/build.mjs": "70ae5acdcd08dcde777c042d1b27f384746530ba97f89a81a91d04c5bd4c8e66", "js/developer/tools/site.mjs": "1827d3fd7e1e470336aab25ea8686c912c2b674a10f7be496f2f0077fbc45292", "js/developer/tools/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b", "js/developer/vendor/package-lock.json": "eb545112b672f9dbf520125df1f44a878d62cc8e611f0e33baee36470ded4dec", "js/core/bootstrap/bootstrap.bundle.mjs": "792fe7cf564bd12ac47fef419d8c71e2070925764a17706552e7d3f5d6ba2181", - "js/developer/environment/packages.bundle.mjs": "74a1aacab33c638298d140b832b07c8ffb31a02b6cb9931846b365163b5cf00c", - "include/webfront/system/DeveloperReleaseData.hpp": "c97a8c3b21df3306c179f7b46d945159b5854f9d2810f135a4ab224c768c75d7" + "js/developer/environment/packages.bundle.mjs": "d4fbca82a9fbf758848ec898af1b4cd0dad460df84f184639db8b005aaaa2d2a", + "include/webfront/system/DeveloperReleaseData.hpp": "c63f8b51b210714fad62866ccc5bc97e3f700ebc8e811d5a8c80a0cea9f7e3e2" } diff --git a/js/developer/environment/installer.mjs b/js/developer/environment/installer.mjs index 73a2c329..2a2bb736 100644 --- a/js/developer/environment/installer.mjs +++ b/js/developer/environment/installer.mjs @@ -110,7 +110,8 @@ export async function install(bridge, args, {registry, signal, progress = () => if (!specs.length && !update && project.status === 'consistent') return {lock: project.lock, restored: await restoreLocked(bridge, project.lock, {signal, progress, fetchImpl: options.fetchImpl})}; const request = requestedDependencies(project.manifest, specs); - const previous = project.status === 'consistent' ? project.lock : undefined; + // --update ignores the locked versions; installing a package keeps the others where they are. + const previous = project.status === 'consistent' && !update ? project.lock : undefined; const resolved = await resolveLock(request.dependencies, previous, options); const dependencies = recordedDependencies(request, resolved.lock, specs); await storePackages(bridge, resolved.lock, resolved.downloads, {signal, progress}); diff --git a/js/developer/environment/packages.bundle.mjs b/js/developer/environment/packages.bundle.mjs index 1c716596..186186ce 100644 --- a/js/developer/environment/packages.bundle.mjs +++ b/js/developer/environment/packages.bundle.mjs @@ -4,4 +4,4 @@ ${M}`),r=await Qr(e,v),n=await Qr(e,M),s=r?Jr(r):null,i=n?Ue(JSON.parse(Qo.decod `:"";async function rn(e,t,r,{signal:n}={}){let s=[];try{for(let[i,o]of t){n?.throwIfAborted();let a=await x(e,"begin",i,!1);s.push(a),await je(e,{id:a,path:"output",bytes:o},n)}n?.throwIfAborted(),await x(e,"commitGroup",s.join(` `),`${v} ${M}`,r.token)}catch(i){for(let o of s)await x(e,"abort",o).catch(()=>{});throw i}}function Cc(e,t,r){let n=e?.entries??{};if(t!==void 0)return Object.hasOwn(n,t)?n[t]:t;if(Object.hasOwn(n,"main"))return n.main;let s=Object.keys(n);if(s.length===1)return n[s[0]];throw new Error(`Usage: ${r} (declare entries.main in ${v} to omit the entry)`)}var de=e=>ea.encode(e);var nn=e=>{let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?[e,void 0]:[e.slice(0,t),e.slice(t+1)||void 0]};async function Vc(e,[t=".",...r],{signal:n}={}){if(r.length)throw new Error("Usage: wf init [directory]");let s=t==="."?"":A(t.replace(/\/+$/,"")),i=s?`${s}/${v}`:v,o=new Map([["output",de(Xe(Zr(Kr(s))))]]);return await oe(e,i,o,{directory:!1,replace:!1,signal:n}),`Created ${i}. Add libraries with wf install .`}function ra(e,t){let r={...e.dependencies},n=new Set;for(let s of t){let[i,o]=nn(s);r[i]=o??"latest",o&&o!=="latest"&&n.add(i)}return{dependencies:r,explicit:n}}function na({dependencies:e,explicit:t},r,n){let s={...e};for(let i of n){let o=nn(i)[0];t.has(o)||(s[o]=`^${r.packages[r.roots[o].id].version}`)}return s}async function sa(e,t,r){let n=Object.entries(e).map(([o,a])=>`${o}@${a}`),{lock:s,downloads:i}=await Br(n,{registry:r.registry,signal:r.signal,fetchImpl:r.fetchImpl,previous:t,download:async(...o)=>(r.progress(`Resolving ${o[0]}@${o[1]}`),P(...o))});return{lock:s,downloads:i}}async function ia(e,t,r,{signal:n,progress:s}){for(let[i,o]of r)s(`Storing ${i}`),await oe(e,`${pe}/${t.packages[i].key}`,o,{signal:n})}async function oa(e,t){try{return await ie(e,`${pe}/${t.key}/package.json`),!0}catch{return!1}}async function aa(e,t,{signal:r,progress:n,fetchImpl:s}){let i=0;for(let[o,a]of Object.entries(t.packages)){if(r?.throwIfAborted(),await oa(e,a))continue;n(`Restoring ${o}`);let c=await P(a.name,a.version,{registry:t.registry,fetchImpl:s,signal:r});if(c.integrity!==a.integrity)throw new Error(`${o} no longer matches the integrity recorded in the lock`);await oe(e,`${pe}/${a.key}`,c.files,{signal:r}),i++}return i}function ca(e){let t=e.includes("--update"),r=e.filter(n=>n!=="--update");if(r.some(n=>n.startsWith("-")))throw new Error("Usage: wf install [--update] [[@range] ...]");return{update:t,specs:r}}async function la(e,t,{manifest:r,lock:n},s){let i=new Map([[M,de(JSON.stringify(n,null,2)+` -`)]]);r&&i.set(v,de(Xe(r))),await rn(e,i,t,s)}var ua=async(e,t)=>({format:e.format,manifestDigest:await fe(t),...e});async function Mc(e,t,{registry:r,signal:n,progress:s=()=>{},fetchImpl:i=fetch}){let{update:o,specs:a}=ca(t),c=await tn(e);if(!c.manifest)throw new Error(en);let f={registry:c.manifest.registry??r,signal:n,fetchImpl:i,progress:s};if(a.length&&o)throw new Error("Usage: wf install --update does not take packages");if(a.length&&c.status==="desynchronized")throw new Error(he);if(!a.length&&!o&&c.status==="desynchronized")throw new Error(he);if(!a.length&&!o&&c.status==="consistent")return{lock:c.lock,restored:await aa(e,c.lock,{signal:n,progress:s,fetchImpl:f.fetchImpl})};let h=ra(c.manifest,a),p=c.status==="consistent"?c.lock:void 0,w=await sa(h.dependencies,p,f),d=na(h,w.lock,a);await ia(e,w.lock,w.downloads,{signal:n,progress:s});let _=await ua(w.lock,d),sn=a.length?{...c.manifest,dependencies:d}:null;return await la(e,c,{manifest:sn,lock:_},{signal:n}),{lock:_,restored:0}}export{fe as dependenciesDigest,he as desynchronized,P as downloadPackage,Uo as exactVersion,Go as identifier,Vc as initProject,Mc as install,tn as loadProject,M as lockPath,V as manifestFormat,Kr as manifestName,v as manifestPath,Zr as newManifest,en as noManifest,Ge as npmName,pe as packageRoot,Jr as parseManifest,rn as publishTogether,Cc as resolveEntry,Br as resolvePackages,A as safePackagePath,Xe as serializeManifest,jc as syncNotice,de as textBytes,Ue as validateLock,Ko as validateManifest}; +`)]]);r&&i.set(v,de(Xe(r))),await rn(e,i,t,s)}var ua=async(e,t)=>({format:e.format,manifestDigest:await fe(t),...e});async function Mc(e,t,{registry:r,signal:n,progress:s=()=>{},fetchImpl:i=fetch}){let{update:o,specs:a}=ca(t),c=await tn(e);if(!c.manifest)throw new Error(en);let f={registry:c.manifest.registry??r,signal:n,fetchImpl:i,progress:s};if(a.length&&o)throw new Error("Usage: wf install --update does not take packages");if(a.length&&c.status==="desynchronized")throw new Error(he);if(!a.length&&!o&&c.status==="desynchronized")throw new Error(he);if(!a.length&&!o&&c.status==="consistent")return{lock:c.lock,restored:await aa(e,c.lock,{signal:n,progress:s,fetchImpl:f.fetchImpl})};let h=ra(c.manifest,a),p=c.status==="consistent"&&!o?c.lock:void 0,w=await sa(h.dependencies,p,f),d=na(h,w.lock,a);await ia(e,w.lock,w.downloads,{signal:n,progress:s});let _=await ua(w.lock,d),sn=a.length?{...c.manifest,dependencies:d}:null;return await la(e,c,{manifest:sn,lock:_},{signal:n}),{lock:_,restored:0}}export{fe as dependenciesDigest,he as desynchronized,P as downloadPackage,Uo as exactVersion,Go as identifier,Vc as initProject,Mc as install,tn as loadProject,M as lockPath,V as manifestFormat,Kr as manifestName,v as manifestPath,Zr as newManifest,en as noManifest,Ge as npmName,pe as packageRoot,Jr as parseManifest,rn as publishTogether,Cc as resolveEntry,Br as resolvePackages,A as safePackagePath,Xe as serializeManifest,jc as syncNotice,de as textBytes,Ue as validateLock,Ko as validateManifest}; diff --git a/js/developer/tools/RELEASE_NOTES.md b/js/developer/tools/RELEASE_NOTES.md index 9186e3b1..2fbad3be 100644 --- a/js/developer/tools/RELEASE_NOTES.md +++ b/js/developer/tools/RELEASE_NOTES.md @@ -7,3 +7,5 @@ Download through the version-pinned GitHub Pages URLs in the bootstrap configura The environment includes the terminal, npm resolver, esbuild/WASM compiler, embedding tools and dependency notices. These packages are experimental; browser packages only, without installation scripts, native modules or Node API shims. Version 0.4.0 updates the Life starter text for a developer audience. The simulation and bridge contract are unchanged. + +Version 0.5.0 introduces the project manifest `webfront.project.json`: `wf init`, manifest-driven `wf install` (with `--update`), `wf preview` and `wf embed`, and a lock that records the digest of the manifest dependencies. `wf install` now requires a manifest. The starters ship their own manifest. diff --git a/js/developer/tools/distribution.json b/js/developer/tools/distribution.json index 05e7397d..090ea9b8 100644 --- a/js/developer/tools/distribution.json +++ b/js/developer/tools/distribution.json @@ -1,4 +1,4 @@ { - "version": "0.4.1", + "version": "0.5.0", "baseUrl": "https://ambroise-leclerc.github.io/WebFront/" } diff --git a/js/developer/tools/manifest-check.mjs b/js/developer/tools/manifest-check.mjs index a502d0c0..7ea440d9 100644 --- a/js/developer/tools/manifest-check.mjs +++ b/js/developer/tools/manifest-check.mjs @@ -117,11 +117,17 @@ function registry(packages) { const fetchImpl = async url => { requests.push(String(url)); const path = new URL(url).pathname.slice(1); - if (path.endsWith('.tgz')) return new Response(packages[path.slice(0, -4)].bytes); + if (path.endsWith('.tgz')) { + const [name, version] = path.slice(0, -4).split('@'); + const entry = packages[name]; + return new Response(entry.older?.[version] ?? entry.bytes); + } const entry = packages[path]; if (!entry) return new Response('', {status: 404}); - const manifest = {dist: {tarball: `https://registry.test/${path}.tgz`, integrity: integrity(entry.bytes)}}; - return Response.json({'dist-tags': {latest: entry.version}, versions: {[entry.version]: manifest}}); + const versions = {[entry.version]: entry.bytes, ...entry.older}; + const described = Object.fromEntries(Object.entries(versions).map(([version, bytes]) => + [version, {dist: {tarball: `https://registry.test/${path}@${version}.tgz`, integrity: integrity(bytes)}}])); + return Response.json({'dist-tags': {latest: entry.version}, versions: described}); }; return {fetchImpl, requests}; } @@ -242,3 +248,16 @@ test('an invalid manifest or a lock without its digest is reported before anythi storage.set(manifestPath, encode({...minimal, permissions: {network: true}})); await assert.rejects(install(bridge, [], options(registry(source()).fetchImpl)), /unknown permission/); }); + +test('wf install --update takes the newest version within the ranges while installing a package keeps the others', async () => { + const {bridge, storage} = await project('a'); + assert.equal(json(storage, lockPath).packages['a@1.2.0'].version, '1.2.0'); + const newer = {...source(), a: {version: '1.3.0', bytes: pkg('a', '1.3.0'), older: {'1.2.0': pkg('a', '1.2.0')}}}; + await install(bridge, ['b'], options(registry(newer).fetchImpl)); + assert.ok(json(storage, lockPath).packages['a@1.2.0'], 'installing another package leaves a at its locked version'); + assert.equal(json(storage, lockPath).packages['a@1.3.0'], undefined); + await install(bridge, ['--update'], options(registry(newer).fetchImpl)); + assert.deepEqual(Object.keys(json(storage, lockPath).packages).sort(), ['a@1.3.0', 'b@2.0.0']); + assert.deepEqual(json(storage, manifestPath).dependencies, {a: '^1.2.0', b: '^2.0.0'}); + assert.equal((await loadProject(bridge)).status, 'consistent'); +}); diff --git a/test/unit/DeveloperTests.cpp b/test/unit/DeveloperTests.cpp index 1da61ee2..29402f41 100644 --- a/test/unit/DeveloperTests.cpp +++ b/test/unit/DeveloperTests.cpp @@ -411,6 +411,27 @@ SCENARIO("A manifest and its lock are published together or not at all") { REQUIRE(crashAt("replacement-1", project.path()) == "manifest-2|lock-2"); } } + WHEN("the process stops once the replacements are durable but the journal is still there") { + THEN("restart completes the publication") { + REQUIRE(crashAt("replacements-synced", project.path()) == "manifest-2|lock-2"); + } + } + WHEN("the journal is removed") { + std::vector steps; + std::vector journalPresent; + { + developer::Store observed{project.path(), developer::defaultAbandonedAfter, [&](std::string_view name) { + steps.emplace_back(name); + if (name == "replacements-synced") + journalPresent.push_back(!std::filesystem::is_empty(project.path() / ".webfront/developer/journal")); + }}; + publishPair(observed, "manifest-2", "lock-2", observed.state(pair)); + } + THEN("it is only after both replacements, and the journal was still present until then") { + REQUIRE(steps == std::vector{"before-journal", "after-journal", "replacement-1", "replacement-2", "replacements-synced"}); + REQUIRE(journalPresent == std::vector{true}); + } + } WHEN("the process stops after the second replacement") { THEN("restart completes the publication") { REQUIRE(crashAt("replacement-2", project.path()) == "manifest-2|lock-2"); From 5ed2629f242532a7be014c5a09c59d3f9787208e Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 14:25:33 +0200 Subject: [PATCH 013/134] Keep the pin on the published distribution, keep tagged roots locked and sync new journal directories [#305] --- .github/workflows/DeveloperDistribution.yml | 11 +++++++- docs/CHANGELOG.md | 4 +-- docs/DEVELOPER_ENVIRONMENT.md | 4 +-- docs/PROJECT_STATUS.md | 2 +- include/webfront/system/DeveloperJournal.hpp | 18 ++++++++++++- .../webfront/system/DeveloperReleaseData.hpp | 6 ++--- include/webfront/system/DeveloperStore.hpp | 3 ++- js/developer/environment/bundles.json | 6 ++--- js/developer/environment/packages.bundle.mjs | 2 +- js/developer/environment/pins.mjs | 3 +++ js/developer/tools/PUBLISHING.md | 16 +++++++++-- js/developer/tools/manifest-check.mjs | 18 +++++++++++++ test/unit/DeveloperTests.cpp | 27 +++++++++++++++++++ 13 files changed, 103 insertions(+), 17 deletions(-) diff --git a/.github/workflows/DeveloperDistribution.yml b/.github/workflows/DeveloperDistribution.yml index 90ebe823..013c942e 100644 --- a/.github/workflows/DeveloperDistribution.yml +++ b/.github/workflows/DeveloperDistribution.yml @@ -51,13 +51,22 @@ jobs: - name: Install pinned maintenance dependencies run: npm ci --prefix js/developer/vendor --ignore-scripts - name: Build and verify the environment and starter packages + env: + PUBLISHING: ${{ startsWith(github.ref, 'refs/tags/developer-v') || (github.event_name == 'workflow_dispatch' && inputs.publish) }} run: | node js/developer/tools/build.mjs build-distribution node js/developer/tools/build.mjs build-distribution-repeat cmp build-distribution/environment.tgz build-distribution-repeat/environment.tgz cmp build-distribution/pi-starter.tgz build-distribution-repeat/pi-starter.tgz cmp build-distribution/life-starter.tgz build-distribution-repeat/life-starter.tgz - cmp include/webfront/system/DeveloperReleaseData.hpp build-distribution/DeveloperReleaseData.hpp + # The pin names the last published version; sources ahead of it are checked again when they are pinned. + pinned=$(sed -n 's/.*version{"\([^"]*\)"}.*/\1/p' include/webfront/system/DeveloperReleaseData.hpp) + building=$(node -p "require('./js/developer/tools/distribution.json').version") + if [ "$pinned" = "$building" ] || [ "$PUBLISHING" = true ]; then + cmp include/webfront/system/DeveloperReleaseData.hpp build-distribution/DeveloperReleaseData.hpp + else + echo "::notice::Sources build $building; DeveloperReleaseData.hpp still pins the published $pinned." + fi node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs js/developer/tools/manifest-check.mjs - name: Check the dedicated release tag if: startsWith(github.ref, 'refs/tags/developer-v') diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index e7e54e95..9349b036 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,8 +6,8 @@ - Project manifest `webfront.project.json` (format 1: `name`, `version`, `dependencies`, `registry`, `scripts`, `entries`, `providers`, `test`, `permissions`), strictly validated; `wf init`, `wf install [--update]` and - manifest-driven `wf preview`/`wf embed` in developer distribution 0.5.0 (to be published as `developer-v0.5.0`; - until then the pinned release URL does not resolve). The lock records the digest of + manifest-driven `wf preview`/`wf embed` in developer distribution 0.5.0 (not published yet; the pin in + `DeveloperReleaseData.hpp` stays on 0.4.1 until 0.5.0 is published and verified). The lock records the digest of the manifest dependencies and reports a desynchronized state. `developer::Store::commitGroup` publishes manifest and lock through a synced intent journal with crash recovery and a concurrent-install precondition. New bridge callbacks `webfront.developer.state` and `webfront.developer.commitGroup`. Starters ship a manifest; diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 73861af5..27f3b43e 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -47,7 +47,7 @@ native tests from empty working directories, with developer callbacks absent. Pa HTTP 200, CORS `*` and the pinned archive bytes. These checks supplement offline CTest fixtures. The default configuration is generated in `include/webfront/system/DeveloperReleaseData.hpp` and targets -`https://ambroise-leclerc.github.io/WebFront/developer/0.5.0/environment.tgz`. Version 0.5.0 adds the project manifest; it is pending publication as `developer-v0.5.0`, and until then this URL does not resolve (tests use the offline fixtures). Published 0.4.1 generates providers that include ``; published 0.4.0 and 0.4.1 stay immutable. The configuration pins one version and +`https://ambroise-leclerc.github.io/WebFront/developer/0.4.1/environment.tgz`. This version, published and archived as `developer-v0.4.1`, generates providers that include ``. Published 0.4.0 stays immutable but targets the former include layout. The sources are ahead of that pin: `distribution.json` names 0.5.0 (the project manifest), which is not pinned until it has been published and verified (see `js/developer/tools/PUBLISHING.md`). The configuration pins one version and its SHA-512 rather than resolving a mutable `latest` channel. An explicit `DeveloperBootstrapOptions{.environment = url, .integrity = trustedHash}` still selects a different HTTPS/CORS repository or a same-origin test fixture. Users install neither npm nor Node.js. @@ -141,7 +141,7 @@ examples are limited to Hello World and Life. Existing embedded React/Babel prov ## Project manifest (`webfront.project.json`) -Available from developer distribution 0.5.0 (pinned by `DeveloperReleaseData.hpp`; tag `developer-v0.5.0` publishes it, the published 0.4.1 environment predates the manifest). +Available from developer distribution 0.5.0, which is not published yet: the default configuration still pins 0.4.1, whose environment predates the manifest. A project has one manifest, the equivalent of `package.json`, which every `wf` command reads: ```json diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index 3cac5419..e0b230ee 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -10,7 +10,7 @@ removed without redirect headers (see `docs/CHANGELOG.md`). Browser sources live components, build tools, vendoring tools); tests live in `test/{unit,web,fuzz,fixtures,cmake}`. The CTest case `RepositoryLayout` enforces the root. The generated-provider include changed, so the developer distribution is bumped to 0.4.1, published and archived as `developer-v0.4.1`. Version 0.5.0 (project manifest, #305) is -pinned by `DeveloperReleaseData.hpp` and awaits publication as `developer-v0.5.0`. +built from the sources but not pinned: `DeveloperReleaseData.hpp` moves to it only after `developer-v0.5.0` is published and verified. ## CI test duration (#298, 2026-10-21) diff --git a/include/webfront/system/DeveloperJournal.hpp b/include/webfront/system/DeveloperJournal.hpp index 0d5f2b1c..f6651405 100644 --- a/include/webfront/system/DeveloperJournal.hpp +++ b/include/webfront/system/DeveloperJournal.hpp @@ -66,6 +66,22 @@ inline void syncDirectory(const std::filesystem::path& directory) { #endif } +/// Creates the missing directories between the project root and `directory`, synchronizing the parent +/// of each one it creates: the entry of a new directory is only durable once its parent is. +inline void createDirectoriesDurably(const std::filesystem::path& root, const std::filesystem::path& directory, + const std::function& sync = syncDirectory) { + auto current = root; + for (const auto& part : directory.lexically_relative(root)) { + if (part == ".") + continue; + current /= part; + if (!std::filesystem::exists(current)) { + std::filesystem::create_directory(current); + sync(current.parent_path()); + } + } +} + /// What a group publication changes: the project file it replaces and the journal-owned file replacing it. struct JournalEntry { std::string target; @@ -140,7 +156,7 @@ inline void rollForward(const std::filesystem::path& root, const std::filesystem const auto staged = owned / source; const auto destination = projectPath(root, target); if (std::filesystem::is_regular_file(staged)) { - std::filesystem::create_directories(destination.parent_path()); + createDirectoriesDurably(root, destination.parent_path()); std::filesystem::rename(staged, destination); } directories.insert(destination.parent_path()); diff --git a/include/webfront/system/DeveloperReleaseData.hpp b/include/webfront/system/DeveloperReleaseData.hpp index 5f489aaf..eed7156a 100644 --- a/include/webfront/system/DeveloperReleaseData.hpp +++ b/include/webfront/system/DeveloperReleaseData.hpp @@ -4,7 +4,7 @@ #include namespace webfront::developer::release { -inline constexpr std::string_view version{"0.5.0"}; -inline constexpr std::string_view environment{"https://ambroise-leclerc.github.io/WebFront/developer/0.5.0/environment.tgz"}; -inline constexpr std::string_view integrity{"sha512-of5wrocjRCMxRk673v/KYRHHYjfLqNNKDvLUZB2CVI9xp7Kpj1W55Ch8gYSLRbnBJvprtwF3+mS9aCtmaGXpwQ=="}; +inline constexpr std::string_view version{"0.4.1"}; +inline constexpr std::string_view environment{"https://ambroise-leclerc.github.io/WebFront/developer/0.4.1/environment.tgz"}; +inline constexpr std::string_view integrity{"sha512-GFvk1FWIVWBWAXLzJUEmaKo1CIMS82FZdhZyd/q8qE3/FA8CcxFN7G/u4gpQJNMJ9R1PKKLV0UXd2uuk08y0AA=="}; } // namespace webfront::developer::release diff --git a/include/webfront/system/DeveloperStore.hpp b/include/webfront/system/DeveloperStore.hpp index e15cbe90..dd1e221d 100644 --- a/include/webfront/system/DeveloperStore.hpp +++ b/include/webfront/system/DeveloperStore.hpp @@ -124,7 +124,8 @@ class Store { if (fingerprint(root, paths) != expected) throw std::runtime_error("The project changed since it was read; run the command again"); const auto directory = projectPath(root, journalDirectory); - std::filesystem::create_directories(directory); + // Before the commit point: the journal directory must itself survive a power cut. + createDirectoriesDurably(root, directory); const auto number = prepareJournal(directory, group); try { writeJournal(directory, number, group); diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 0fb5db2c..0ea3f01e 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -18,7 +18,7 @@ "js/developer/environment/registry.mjs": "f566f07ea066155ab7209d925cee2cf12a664ac51b07bc0ca3e3fd8fde49a9c8", "js/developer/environment/archive.mjs": "1fb8b9c3c27219858597801104639bba1104c7a7d33973609cd556b5e5f81d2d", "js/developer/environment/lock.mjs": "60d0ea14d24793cd5e85bbd4bb4bfe90d2c7d76c0d20ffc99f462595a6e57291", - "js/developer/environment/pins.mjs": "ddb2214a2e906cb117dc1bac0b5b056decd4f6c6e3d4713615176c1876db3534", + "js/developer/environment/pins.mjs": "df07f6f01edaf86a1052d0e76f6c6745cb6e7a3309bbd256ac720ee8adc85297", "js/developer/environment/peers.mjs": "e1d999892138682fc0134ef1f4d4b19b9a9ad8d7fb16e37fc9c6c684bd853896", "js/developer/environment/resolve.mjs": "8b96b850af215be51f5cb85cc9c69e057afa04dfb8a57e572620c07059c17fa3", "js/developer/environment/embed.mjs": "c370fd05b1629d630a3d504f65f6411df3a73c0f6deabf484654bddae52857a2", @@ -33,6 +33,6 @@ "js/developer/tools/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b", "js/developer/vendor/package-lock.json": "eb545112b672f9dbf520125df1f44a878d62cc8e611f0e33baee36470ded4dec", "js/core/bootstrap/bootstrap.bundle.mjs": "792fe7cf564bd12ac47fef419d8c71e2070925764a17706552e7d3f5d6ba2181", - "js/developer/environment/packages.bundle.mjs": "d4fbca82a9fbf758848ec898af1b4cd0dad460df84f184639db8b005aaaa2d2a", - "include/webfront/system/DeveloperReleaseData.hpp": "c63f8b51b210714fad62866ccc5bc97e3f700ebc8e811d5a8c80a0cea9f7e3e2" + "js/developer/environment/packages.bundle.mjs": "b15d96e360d6bc10f6d94c549c6e8f121d4196c87be8236937be0be11257b564", + "include/webfront/system/DeveloperReleaseData.hpp": "c97a8c3b21df3306c179f7b46d945159b5854f9d2810f135a4ab224c768c75d7" } diff --git a/js/developer/environment/packages.bundle.mjs b/js/developer/environment/packages.bundle.mjs index 186186ce..ab176f1c 100644 --- a/js/developer/environment/packages.bundle.mjs +++ b/js/developer/environment/packages.bundle.mjs @@ -1,4 +1,4 @@ -var on=Object.create;var Ve=Object.defineProperty;var an=Object.getOwnPropertyDescriptor;var cn=Object.getOwnPropertyNames;var ln=Object.getPrototypeOf,un=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var fn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of cn(t))!un.call(e,s)&&s!==r&&Ve(e,s,{get:()=>t[s],enumerable:!(n=an(t,s))||n.enumerable});return e};var B=(e,t,r)=>(r=e!=null?on(ln(e)):{},fn(t||!e||!e.__esModule?Ve(r,"default",{value:e,enumerable:!0}):r,e));var j=m((ha,Je)=>{"use strict";var wn="2.0.0",$n=Number.MAX_SAFE_INTEGER||9007199254740991,gn=16,yn=250,Rn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Je.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:gn,MAX_SAFE_BUILD_LENGTH:yn,MAX_SAFE_INTEGER:$n,RELEASE_TYPES:Rn,SEMVER_SPEC_VERSION:wn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var C=m((da,Ze)=>{"use strict";var In=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Ze.exports=In});var k=m((N,Ke)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Ee,MAX_SAFE_BUILD_LENGTH:On,MAX_LENGTH:Ln}=j(),Sn=C();N=Ke.exports={};var Nn=N.re=[],xn=N.safeRe=[],l=N.src=[],vn=N.safeSrc=[],u=N.t={},An=0,we="[a-zA-Z0-9-]",Tn=[["\\s",1],["\\d",Ln],[we,On]],bn=e=>{for(let[t,r]of Tn)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},E=(e,t,r)=>{let n=bn(t),s=An++;Sn(e,s,t),u[e]=s,l[s]=t,vn[s]=n,Nn[s]=new RegExp(t,r?"g":void 0),xn[s]=new RegExp(n,r?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${we}*`);E("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${we}+`);E("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`);E("FULL",`^${l[u.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`);E("LOOSE",`^${l[u.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`);E("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Ee}})(?:\\.(\\d{1,${Ee}}))?(?:\\.(\\d{1,${Ee}}))?`);E("COERCE",`${l[u.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",l[u.COERCEPLAIN]+`(?:${l[u.PRERELEASE]})?(?:${l[u.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",l[u.COERCE],!0);E("COERCERTLFULL",l[u.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0);N.tildeTrimReplace="$1~";E("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0);N.caretTrimReplace="$1^";E("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0);N.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var H=m((ma,Qe)=>{"use strict";var kn=Object.freeze({loose:!0}),Pn=Object.freeze({}),qn=e=>e?typeof e!="object"?kn:e:Pn;Qe.exports=qn});var $e=m((Ea,rt)=>{"use strict";var et=/^[0-9]+$/,tt=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:ett(t,e);rt.exports={compareIdentifiers:tt,rcompareIdentifiers:jn}});var y=m((wa,st)=>{"use strict";var W=C(),{MAX_LENGTH:nt,MAX_SAFE_INTEGER:Y}=j(),{safeRe:J,t:Z}=k(),Cn=H(),{compareIdentifiers:ge}=$e(),ye=class e{constructor(t,r){if(r=Cn(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>nt)throw new TypeError(`version is longer than ${nt} characters`);W("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?J[Z.LOOSE]:J[Z.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Y||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Y||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Y||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let i=+s;if(i>=0&&it.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(W("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ge(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(W("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ge(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?J[Z.PRERELEASELOOSE]:J[Z.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let i=[r,s];n===!1&&(i=[r]),ge(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};st.exports=ye});var b=m(($a,ot)=>{"use strict";var it=y(),Dn=(e,t,r=!1)=>{if(e instanceof it)return e;try{return new it(e,t)}catch(n){if(!r)return null;throw n}};ot.exports=Dn});var ct=m((ga,at)=>{"use strict";var Un=b(),Fn=(e,t)=>{let r=Un(e,t);return r?r.version:null};at.exports=Fn});var ut=m((ya,lt)=>{"use strict";var Gn=b(),zn=(e,t)=>{let r=Gn(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};lt.exports=zn});var ht=m((Ra,pt)=>{"use strict";var ft=y(),Xn=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new ft(e instanceof ft?e.version:e,r).inc(t,n,s).version}catch{return null}};pt.exports=Xn});var Et=m((Ia,mt)=>{"use strict";var dt=b(),Vn=(e,t)=>{let r=dt(e,null,!0),n=dt(t,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let h=c?"pre":"";return r.major!==n.major?h+"major":r.minor!==n.minor?h+"minor":r.patch!==n.patch?h+"patch":"prerelease"};mt.exports=Vn});var $t=m((Oa,wt)=>{"use strict";var Mn=y(),_n=(e,t)=>new Mn(e,t).major;wt.exports=_n});var yt=m((La,gt)=>{"use strict";var Bn=y(),Hn=(e,t)=>new Bn(e,t).minor;gt.exports=Hn});var It=m((Sa,Rt)=>{"use strict";var Wn=y(),Yn=(e,t)=>new Wn(e,t).patch;Rt.exports=Yn});var Lt=m((Na,Ot)=>{"use strict";var Jn=b(),Zn=(e,t)=>{let r=Jn(e,t);return r&&r.prerelease.length?r.prerelease:null};Ot.exports=Zn});var L=m((xa,Nt)=>{"use strict";var St=y(),Kn=(e,t,r)=>new St(e,r).compare(new St(t,r));Nt.exports=Kn});var vt=m((va,xt)=>{"use strict";var Qn=L(),es=(e,t,r)=>Qn(t,e,r);xt.exports=es});var Tt=m((Aa,At)=>{"use strict";var ts=L(),rs=(e,t)=>ts(e,t,!0);At.exports=rs});var K=m((Ta,kt)=>{"use strict";var bt=y(),ns=(e,t,r)=>{let n=new bt(e,r),s=new bt(t,r);return n.compare(s)||n.compareBuild(s)};kt.exports=ns});var qt=m((ba,Pt)=>{"use strict";var ss=K(),is=(e,t)=>e.sort((r,n)=>ss(r,n,t));Pt.exports=is});var Ct=m((ka,jt)=>{"use strict";var os=K(),as=(e,t)=>e.sort((r,n)=>os(n,r,t));jt.exports=as});var D=m((Pa,Dt)=>{"use strict";var cs=L(),ls=(e,t,r)=>cs(e,t,r)>0;Dt.exports=ls});var Q=m((qa,Ut)=>{"use strict";var us=L(),fs=(e,t,r)=>us(e,t,r)<0;Ut.exports=fs});var Re=m((ja,Ft)=>{"use strict";var ps=L(),hs=(e,t,r)=>ps(e,t,r)===0;Ft.exports=hs});var Ie=m((Ca,Gt)=>{"use strict";var ds=L(),ms=(e,t,r)=>ds(e,t,r)!==0;Gt.exports=ms});var ee=m((Da,zt)=>{"use strict";var Es=L(),ws=(e,t,r)=>Es(e,t,r)>=0;zt.exports=ws});var te=m((Ua,Xt)=>{"use strict";var $s=L(),gs=(e,t,r)=>$s(e,t,r)<=0;Xt.exports=gs});var Oe=m((Fa,Vt)=>{"use strict";var ys=Re(),Rs=Ie(),Is=D(),Os=ee(),Ls=Q(),Ss=te(),Ns=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return ys(e,r,n);case"!=":return Rs(e,r,n);case">":return Is(e,r,n);case">=":return Os(e,r,n);case"<":return Ls(e,r,n);case"<=":return Ss(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};Vt.exports=Ns});var _t=m((Ga,Mt)=>{"use strict";var xs=y(),vs=b(),{safeRe:re,t:ne}=k(),As=(e,t)=>{if(e instanceof xs)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?re[ne.COERCEFULL]:re[ne.COERCE]);else{let c=t.includePrerelease?re[ne.COERCERTLFULL]:re[ne.COERCERTL],f;for(;(f=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||f.index+f[0].length!==r.index+r[0].length)&&(r=f),c.lastIndex=f.index+f[1].length+f[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return vs(`${n}.${s}.${i}${o}${a}`,t)};Mt.exports=As});var Ht=m((za,Bt)=>{"use strict";var Le=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};Bt.exports=Le});var S=m((Xa,Zt)=>{"use strict";var Ts=/\s+/g,Se=class e{constructor(t,r){if(r=ks(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Ne)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(Ts," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!Yt(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&Fs(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&Ds)|(this.options.loose&&Us))+":"+t,s=Wt.get(n);if(s)return s;let i=this.options.loose,o=i?I[R.HYPHENRANGELOOSE]:I[R.HYPHENRANGE];t=t.replace(o,Ys(this.options.includePrerelease)),$("hyphen replace",t),t=t.replace(I[R.COMPARATORTRIM],qs),$("comparator trim",t),t=t.replace(I[R.TILDETRIM],js),$("tilde trim",t),t=t.replace(I[R.CARETTRIM],Cs),$("caret trim",t);let a=t.split(" ").map(p=>Gs(p,this.options)).join(" ").split(/\s+/).map(p=>Ws(p,this.options));i&&(a=a.filter(p=>($("loose invalid filter",p,this.options),!!p.match(I[R.COMPARATORLOOSE])))),$("range list",a);let c=new Map,f=a.map(p=>new Ne(p,this.options));for(let p of f){if(Yt(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let h=[...c.values()];return Wt.set(n,h),h}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>Jt(n,r)&&t.set.some(s=>Jt(s,r)&&n.every(i=>s.every(o=>i.intersects(o,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new Ps(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",Fs=e=>e.value==="",Jt=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(i=>s.intersects(i,t)),s=n.pop();return r},Gs=(e,t)=>(e=e.replace(I[R.BUILD],""),$("comp",e,t),e=Vs(e,t),$("caret",e),e=zs(e,t),$("tildes",e),e=_s(e,t),$("xrange",e),e=Hs(e,t),$("stars",e),e),O=e=>!e||e.toLowerCase()==="x"||e==="*",zs=(e,t)=>e.trim().split(/\s+/).map(r=>Xs(r,t)).join(" "),Xs=(e,t)=>{let r=t.loose?I[R.TILDELOOSE]:I[R.TILDE];return e.replace(r,(n,s,i,o,a)=>{$("tilde",e,n,s,i,o,a);let c;return O(s)?c="":O(i)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:O(o)?c=`>=${s}.${i}.0 <${s}.${+i+1}.0-0`:a?($("replaceTilde pr",a),c=`>=${s}.${i}.${o}-${a} <${s}.${+i+1}.0-0`):c=`>=${s}.${i}.${o} <${s}.${+i+1}.0-0`,$("tilde return",c),c})},Vs=(e,t)=>e.trim().split(/\s+/).map(r=>Ms(r,t)).join(" "),Ms=(e,t)=>{$("caret",e,t);let r=t.loose?I[R.CARETLOOSE]:I[R.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,c)=>{$("caret",e,s,i,o,a,c);let f;return O(i)?f="":O(o)?f=`>=${i}.0.0${n} <${+i+1}.0.0-0`:O(a)?i==="0"?f=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`:c?($("replaceCaret pr",c),i==="0"?o==="0"?f=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):($("no pr"),i==="0"?o==="0"?f=`>=${i}.${o}.${a}${n} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}${n} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),$("caret return",f),f})},_s=(e,t)=>($("replaceXRanges",e,t),e.split(/\s+/).map(r=>Bs(r,t)).join(" ")),Bs=(e,t)=>{e=e.trim();let r=t.loose?I[R.XRANGELOOSE]:I[R.XRANGE];return e.replace(r,(n,s,i,o,a,c)=>{$("xRange",e,n,s,i,o,a,c);let f=O(i),h=f||O(o),p=h||O(a),w=p;return s==="="&&w&&(s=""),c=t.includePrerelease?"-0":"",f?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&w?(h&&(o=0),a=0,s===">"?(s=">=",h?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):s==="<="&&(s="<",h?i=+i+1:o=+o+1),s==="<"&&(c="-0"),n=`${s+i}.${o}.${a}${c}`):h?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:p&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),$("xRange return",n),n})},Hs=(e,t)=>($("replaceStars",e,t),e.trim().replace(I[R.STAR],"")),Ws=(e,t)=>($("replaceGTE0",e,t),e.trim().replace(I[t.includePrerelease?R.GTE0PRE:R.GTE0],"")),Ys=e=>(t,r,n,s,i,o,a,c,f,h,p,w)=>(O(n)?r="":O(s)?r=`>=${n}.0.0${e?"-0":""}`:O(i)?r=`>=${n}.${s}.0${e?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,O(f)?c="":O(h)?c=`<${+f+1}.0.0-0`:O(p)?c=`<${f}.${+h+1}.0-0`:w?c=`<=${f}.${h}.${p}-${w}`:e?c=`<${f}.${h}.${+p+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),Js=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var U=m((Va,nr)=>{"use strict";var F=Symbol("SemVer ANY"),Ae=class e{static get ANY(){return F}constructor(t,r){if(r=Kt(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),ve("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===F?this.value="":this.value=this.operator+this.semver.version,ve("comp",this)}parse(t){let r=this.options.loose?Qt[er.COMPARATORLOOSE]:Qt[er.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new tr(n[2],this.options.loose):this.semver=F}toString(){return this.value}test(t){if(ve("Comparator.test",t,this.options.loose),this.semver===F||t===F)return!0;if(typeof t=="string")try{t=new tr(t,this.options)}catch{return!1}return xe(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new rr(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new rr(this.value,r).test(t.semver):(r=Kt(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||xe(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||xe(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};nr.exports=Ae;var Kt=H(),{safeRe:Qt,t:er}=k(),xe=Oe(),ve=C(),tr=y(),rr=S()});var G=m((Ma,sr)=>{"use strict";var Zs=S(),Ks=(e,t,r)=>{try{t=new Zs(t,r)}catch{return!1}return t.test(e)};sr.exports=Ks});var or=m((_a,ir)=>{"use strict";var Qs=S(),ei=(e,t)=>new Qs(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));ir.exports=ei});var cr=m((Ba,ar)=>{"use strict";var ti=y(),ri=S(),ni=(e,t,r)=>{let n=null,s=null,i=null;try{i=new ri(t,r)}catch{return null}return e.forEach(o=>{i.test(o)&&(!n||s.compare(o)===-1)&&(n=o,s=new ti(n,r))}),n};ar.exports=ni});var ur=m((Ha,lr)=>{"use strict";var si=y(),ii=S(),oi=(e,t,r)=>{let n=null,s=null,i=null;try{i=new ii(t,r)}catch{return null}return e.forEach(o=>{i.test(o)&&(!n||s.compare(o)===1)&&(n=o,s=new si(n,r))}),n};lr.exports=oi});var hr=m((Wa,pr)=>{"use strict";var Te=y(),ai=S(),fr=D(),ci=(e,t)=>{e=new ai(e,t);let r=new Te("0.0.0");if(e.test(r)||(r=new Te("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let a=new Te(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||fr(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||fr(r,i))&&(r=i)}return r&&e.test(r)?r:null};pr.exports=ci});var mr=m((Ya,dr)=>{"use strict";var li=S(),ui=(e,t)=>{try{return new li(e,t).range||"*"}catch{return null}};dr.exports=ui});var se=m((Ja,gr)=>{"use strict";var fi=y(),$r=U(),{ANY:pi}=$r,hi=S(),di=G(),Er=D(),wr=Q(),mi=te(),Ei=ee(),wi=(e,t,r,n)=>{e=new fi(e,n),t=new hi(t,n);let s,i,o,a,c;switch(r){case">":s=Er,i=mi,o=wr,a=">",c=">=";break;case"<":s=wr,i=Ei,o=Er,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(di(e,t,n))return!1;for(let f=0;f{d.semver===pi&&(d=new $r(">=0.0.0")),p=p||d,w=w||d,s(d.semver,p.semver,n)?p=d:o(d.semver,w.semver,n)&&(w=d)}),p.operator===a||p.operator===c||(!w.operator||w.operator===a)&&i(e,w.semver))return!1;if(w.operator===c&&o(e,w.semver))return!1}return!0};gr.exports=wi});var Rr=m((Za,yr)=>{"use strict";var $i=se(),gi=(e,t,r)=>$i(e,t,">",r);yr.exports=gi});var Or=m((Ka,Ir)=>{"use strict";var yi=se(),Ri=(e,t,r)=>yi(e,t,"<",r);Ir.exports=Ri});var Nr=m((Qa,Sr)=>{"use strict";var Lr=S(),Ii=(e,t,r)=>(e=new Lr(e,r),t=new Lr(t,r),e.intersects(t,r));Sr.exports=Ii});var vr=m((ec,xr)=>{"use strict";var Oi=G(),Li=L();xr.exports=(e,t,r)=>{let n=[],s=null,i=null,o=e.sort((h,p)=>Li(h,p,r));for(let h of o)Oi(h,t,r)?(i=h,s||(s=h)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);let a=[];for(let[h,p]of n)h===p?a.push(h):!p&&h===o[0]?a.push("*"):p?h===o[0]?a.push(`<=${p}`):a.push(`${h} - ${p}`):a.push(`>=${h}`);let c=a.join(" || "),f=typeof t.raw=="string"?t.raw:String(t);return c.length{"use strict";var Ar=S(),ke=U(),{ANY:be}=ke,z=G(),Pe=L(),Si=(e,t,r={})=>{if(e===t)return!0;e=new Ar(e,r),t=new Ar(t,r);let n=!1;e:for(let s of e.set){for(let i of t.set){let o=xi(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},Ni=[new ke(">=0.0.0-0")],Tr=[new ke(">=0.0.0")],xi=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===be){if(t.length===1&&t[0].semver===be)return!0;r.includePrerelease?e=Ni:e=Tr}if(t.length===1&&t[0].semver===be){if(r.includePrerelease)return!0;t=Tr}let n=new Set,s,i;for(let d of e)d.operator===">"||d.operator===">="?s=br(s,d,r):d.operator==="<"||d.operator==="<="?i=kr(i,d,r):n.add(d.semver);if(n.size>1)return null;let o;if(s&&i){if(o=Pe(s.semver,i.semver,r),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let d of n){if(s&&!z(d,String(s),r)||i&&!z(d,String(i),r))return null;for(let _ of t)if(!z(d,String(_),r))return!1;return!0}let a,c,f,h,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,w=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let d of t){if(h=h||d.operator===">"||d.operator===">=",f=f||d.operator==="<"||d.operator==="<=",s){if(w&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===w.major&&d.semver.minor===w.minor&&d.semver.patch===w.patch&&(w=!1),d.operator===">"||d.operator===">="){if(a=br(s,d,r),a===d&&a!==s)return!1}else if(s.operator===">="&&!z(s.semver,String(d),r))return!1}if(i){if(p&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===p.major&&d.semver.minor===p.minor&&d.semver.patch===p.patch&&(p=!1),d.operator==="<"||d.operator==="<="){if(c=kr(i,d,r),c===d&&c!==i)return!1}else if(i.operator==="<="&&!z(i.semver,String(d),r))return!1}if(!d.operator&&(i||s)&&o!==0)return!1}return!(s&&f&&!i&&o!==0||i&&h&&!s&&o!==0||w||p)},br=(e,t,r)=>{if(!e)return t;let n=Pe(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},kr=(e,t,r)=>{if(!e)return t;let n=Pe(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};Pr.exports=Si});var X=m((rc,Dr)=>{"use strict";var qe=k(),jr=j(),vi=y(),Cr=$e(),Ai=b(),Ti=ct(),bi=ut(),ki=ht(),Pi=Et(),qi=$t(),ji=yt(),Ci=It(),Di=Lt(),Ui=L(),Fi=vt(),Gi=Tt(),zi=K(),Xi=qt(),Vi=Ct(),Mi=D(),_i=Q(),Bi=Re(),Hi=Ie(),Wi=ee(),Yi=te(),Ji=Oe(),Zi=_t(),Ki=U(),Qi=S(),eo=G(),to=or(),ro=cr(),no=ur(),so=hr(),io=mr(),oo=se(),ao=Rr(),co=Or(),lo=Nr(),uo=vr(),fo=qr();Dr.exports={parse:Ai,valid:Ti,clean:bi,inc:ki,diff:Pi,major:qi,minor:ji,patch:Ci,prerelease:Di,compare:Ui,rcompare:Fi,compareLoose:Gi,compareBuild:zi,sort:Xi,rsort:Vi,gt:Mi,lt:_i,eq:Bi,neq:Hi,gte:Wi,lte:Yi,cmp:Ji,coerce:Zi,Comparator:Ki,Range:Qi,satisfies:eo,toComparators:to,maxSatisfying:ro,minSatisfying:no,minVersion:so,validRange:io,outside:oo,gtr:ao,ltr:co,intersects:lo,simplifyRange:uo,subset:fo,SemVer:vi,re:qe.re,src:qe.src,tokens:qe.t,SEMVER_SPEC_VERSION:jr.SEMVER_SPEC_VERSION,RELEASE_TYPES:jr.RELEASE_TYPES,compareIdentifiers:Cr.compareIdentifiers,rcompareIdentifiers:Cr.rcompareIdentifiers}});var me=new TextDecoder;function _e(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function Be(e,t){let r=String(t??"").split(/\s+/).filter(i=>i.startsWith("sha512-")).map(i=>i.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,i=>String.fromCharCode(i)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function He(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let i=await r.read();!i.done;i=await r.read()){if(s+=i.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(i.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function q(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return me.decode(s<0?n:n.subarray(0,s))}function We(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,i)=>s*256+i,e[t]&127);let n=q(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function pn(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if(We(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function hn(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let i=me.decode(e.subarray(n+1,r+s-1)),o=i.indexOf("=");t[i.slice(0,o)]=i.slice(o+1),r+=s}return t}function dn(e,t){let r=e.subarray(t,t+512);pn(r);let n=We(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function mn(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function En(e){let t=q(e,0,100),r=q(e,257,5)==="ustar"?q(e,345,155):"";return r?`${r}/${t}`:t}var Me={x:(e,t)=>({...e,pax:hn(t).path}),L:(e,t)=>({...e,long:q(t,0,t.length)}),g:e=>e};function Ye(e){let t=[],r={};for(let n=0;!mn(e,n);){let{header:s,type:i,data:o,next:a}=dn(e,n);if(n=a,Object.hasOwn(Me,i)){r=Me[i](r,o);continue}(i==="0"||i==="7")&&t.push({path:r.pax??r.long??En(s),bytes:o}),r={}}return t}var ae=B(X(),1);var x=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function ie(e,t){let r=[],n=0;for(;;){let s=await x(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function je(e,{id:t,path:r,bytes:n},s){for(let i=0;i{}),a}}async function po(e,t){let r=[],n=0;for(;;){let{done:s,value:i}=await e.read();if(s)return r;if(n+=i.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(i)}}async function ho(e,t){try{return await po(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function Ur(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await ho(e.body.getReader(),t)).arrayBuffer())}var mo=/[\\\0:*?"<>|]/,Eo=e=>e.split("/").some(t=>!t||t==="."||t==="..");function wo(e){return typeof e!="string"||!e||mo.test(e)?!0:Eo(e)}function A(e){if(wo(e))throw new Error(`Unsafe package path: ${e}`);return e}var $o=new TextDecoder,go=["preinstall","install","postinstall"];async function Fr(e){let t=new Map;for(let r of Ye(await He(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=A(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var yo=e=>go.some(t=>e.scripts?.[t]),Ro=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function Io(e,t){return yo(e)||e.gypfile?!0:Ro(t)}function Gr(e,t,r){let n=JSON.parse($o.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(Io(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}var Ce=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),ce=(e,t)=>`${e.replace("/","+")}@${t}`,De=(e,t,r)=>`${ce(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function Oo(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function Lo(e,t){let r=e["dist-tags"]?.[t];return r||(ae.default.valid(t)?t:ae.default.maxSatisfying(Object.keys(e.versions??{}),t))}function So(e,t,r){let n=r||"latest",s=Lo(e,n),i=e.versions?.[s];if(!i||!ae.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:i}}async function No(e,t,r,{fetchImpl:n,signal:s}){let i=new URL(t.dist?.tarball,r);if(i.protocol!=="https:"&&i.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let o=await n(i,{signal:s});if(!o.ok)throw new Error(`Package download for ${e}: HTTP ${o.status}`);let a=await Ur(o);return{bytes:a,integrity:await Be(a,t.dist.integrity)}}function xo(e){let t=new URL(e,globalThis.location?.href);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function P(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!Ce(e))throw new Error(`Unsupported npm package name: ${e}`);let i=xo(r),o={fetchImpl:n,signal:s},{version:a,manifest:c}=So(await Oo(e,i,o),e,t),{bytes:f,integrity:h}=await No(e,c,i,o),p=await Fr(f),w=Gr(p,e,a);return{id:ce(e,a),key:De(e,a,h),manifest:w,integrity:h,files:p}}var le=B(X(),1);function vo(e,t,r){return le.default.validRange(r)?Object.values(e?.packages??{}).filter(s=>s.name===t&&le.default.satisfies(s.version,r)).sort((s,i)=>le.default.rcompare(s.version,i.version))[0]??null:null}function zr({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=P,previous:s}){let i=new Map;return async(o,a)=>{let c=`${o}@${a}`;if(i.has(c))return i.get(c);let f=vo(s,o,a),h=await n(o,f?.version??a,{registry:e,fetchImpl:t,signal:r});if(f&&h.integrity!==f.integrity)throw new Error(`${h.id} no longer matches the integrity recorded in the lock`);return i.set(c,h),h}}var Xr=B(X(),1),Vr=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function Ao(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw Vr(e,t,r)}function To(e,[t,r],{nodes:n,roots:s}){let i=s[t]?.id??e.dependencies[t];if(!i)return Ao(e,t,r);if(!Xr.default.satisfies(n[i].version,r))throw Vr(e,t,r);return i}function bo(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=To(e,r,t);n&&(e.dependencies[r[0]]=n)}}function Mr(e,t){for(let r of Object.values(e))bo(r,{nodes:e,roots:t})}var _r=B(X(),1);function ko(e,t){return!Ce(t.name)||!_r.default.valid(t.version)?!1:e===ce(t.name,t.version)}function Po(e){return e.integrity?.startsWith("sha512-")?e.key===De(e.name,e.version,e.integrity):!1}function qo(e,t,r){if(!ko(t,r)||!Po(r))throw new Error("Invalid locked package");for(let n of r.files)A(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function jo(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function Ue(e){if(!jo(e))throw new Error("Unsupported package lock");for(let[t,r]of Object.entries(e.packages))qo(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function Co(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function Do(e,t){let r={};for(let n of e){let{name:s,version:i}=_e(n);r[s]={requested:i||"latest",id:await t(s,i||"latest")}}return r}async function Br(e,t={}){let r=zr(t),n={nodes:{},downloads:new Map,total:0},s=async(o,a)=>{t.signal?.throwIfAborted();let c=await r(o,a);if(n.nodes[c.id])return c.id;Co(n,o,c);for(let[f,h]of Object.entries(c.manifest.dependencies??{}).sort())n.nodes[c.id].dependencies[f]=await s(f,h);return c.id},i=await Do(e,s);return Mr(n.nodes,i),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:i,packages:n.nodes},downloads:n.downloads}}function Fe(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var v="webfront.project.json",V=1,Ge=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,Uo=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,Fo=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,Hr=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,Go=/^[A-Za-z_][A-Za-z0-9_]*$/,Wr=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],zo=["files","publish","fetch"],g=e=>{throw new Error(`${v}: ${e}`)};function T(e,t){return Fe(e)||g(`${t} must be an object`),e}function ze(e,t,r){for(let n of Object.keys(e))t.includes(n)||g(`unknown key "${n}" in ${r}`)}function ue(e,t){typeof e!="string"&&g(`${t} must be a project path`);try{return A(e)}catch{return g(`${t} is not a safe project-relative path: ${e}`)}}function Yr(e,t){return(!Array.isArray(e)||e.length>256)&&g(`${t} must be an array of at most 256 paths`),e.map((r,n)=>ue(r,`${t}[${n}]`))}function Xo(e){let t=T(e,"dependencies");for(let[r,n]of Object.entries(t))Ge.test(r)||g(`invalid npm package name "${r}"`),(typeof n!="string"||!Fo.test(n)||n!==n.trim())&&g(`invalid version range for "${r}"`);return t}function Vo(e){if(typeof e!="string"&&g("registry must be a URL"),e.startsWith("/")&&!e.startsWith("//"))return e;let t;try{t=new URL(e)}catch{return g("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&g("registry must use https"),e}function Mo(e){let t=T(e,"scripts");for(let[r,n]of Object.entries(t))(!Hr.test(r)||typeof n!="string"||!n||n.length>1024)&&g(`invalid script "${r}"`);return t}function _o(e){let t=T(e,"entries");for(let[r,n]of Object.entries(t))Hr.test(r)||g(`invalid entry name "${r}"`),ue(n,`entries.${r}`);return t}function Bo(e,t){let r=T(e,"providers");for(let[n,s]of Object.entries(r))Go.test(n)||g(`invalid provider name "${n}"`),T(s,`providers.${n}`),ze(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&g(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||ue(s.entry,`providers.${n}.entry`),ue(s.output,`providers.${n}.output`).endsWith(".hpp")||g(`providers.${n}.output must be a .hpp file`);return r}function Ho(e){let t=T(e,"test");return ze(t,["specs"],"test"),t.specs!==void 0&&Yr(t.specs,"test.specs"),t}function Wo(e,t){let r;try{r=new URL(e)}catch{return g(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&g(`${t} must be an https origin without a path`),e}function Yo(e){let t=T(e,"permissions");for(let r of Object.keys(t))zo.includes(r)||g(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&Yr(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&g("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>Wo(r,`permissions.fetch[${n}]`))),t}function Jo(e){(typeof e.name!="string"||!Ge.test(e.name))&&g("name must be a lower-case npm package name"),(typeof e.version!="string"||!Uo.test(e.version))&&g("version must be a semantic version")}function Zo(e){e.format!==V&&(Number.isInteger(e.format)&&e.format>V&&g(`format ${e.format} is not supported by this environment (it reads format ${V}); update the environment`),g(`format must be ${V}`))}function Ko(e){T(e,"the manifest"),Zo(e),ze(e,Wr,"the manifest"),Jo(e);let t=e.entries===void 0?{}:_o(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:Xo(e.dependencies),entries:t,providers:e.providers===void 0?{}:Bo(e.providers,t),...e.registry===void 0?{}:{registry:Vo(e.registry)},...e.scripts===void 0?{}:{scripts:Mo(e.scripts)},...e.test===void 0?{}:{test:Ho(e.test)},...e.permissions===void 0?{}:{permissions:Yo(e.permissions)}}}function Jr(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return g("not valid JSON")}return Ko(t)}function Xe(e){let t={};for(let r of Wr)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` +var on=Object.create;var Ve=Object.defineProperty;var an=Object.getOwnPropertyDescriptor;var cn=Object.getOwnPropertyNames;var ln=Object.getPrototypeOf,un=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var fn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of cn(t))!un.call(e,s)&&s!==r&&Ve(e,s,{get:()=>t[s],enumerable:!(n=an(t,s))||n.enumerable});return e};var B=(e,t,r)=>(r=e!=null?on(ln(e)):{},fn(t||!e||!e.__esModule?Ve(r,"default",{value:e,enumerable:!0}):r,e));var j=m((ha,Je)=>{"use strict";var wn="2.0.0",$n=Number.MAX_SAFE_INTEGER||9007199254740991,gn=16,yn=250,Rn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Je.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:gn,MAX_SAFE_BUILD_LENGTH:yn,MAX_SAFE_INTEGER:$n,RELEASE_TYPES:Rn,SEMVER_SPEC_VERSION:wn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var C=m((da,Ze)=>{"use strict";var In=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Ze.exports=In});var k=m((N,Ke)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Ee,MAX_SAFE_BUILD_LENGTH:On,MAX_LENGTH:Ln}=j(),Sn=C();N=Ke.exports={};var Nn=N.re=[],xn=N.safeRe=[],l=N.src=[],vn=N.safeSrc=[],u=N.t={},An=0,we="[a-zA-Z0-9-]",Tn=[["\\s",1],["\\d",Ln],[we,On]],bn=e=>{for(let[t,r]of Tn)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},E=(e,t,r)=>{let n=bn(t),s=An++;Sn(e,s,t),u[e]=s,l[s]=t,vn[s]=n,Nn[s]=new RegExp(t,r?"g":void 0),xn[s]=new RegExp(n,r?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${we}*`);E("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${we}+`);E("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`);E("FULL",`^${l[u.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`);E("LOOSE",`^${l[u.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`);E("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Ee}})(?:\\.(\\d{1,${Ee}}))?(?:\\.(\\d{1,${Ee}}))?`);E("COERCE",`${l[u.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",l[u.COERCEPLAIN]+`(?:${l[u.PRERELEASE]})?(?:${l[u.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",l[u.COERCE],!0);E("COERCERTLFULL",l[u.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0);N.tildeTrimReplace="$1~";E("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0);N.caretTrimReplace="$1^";E("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0);N.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var H=m((ma,Qe)=>{"use strict";var kn=Object.freeze({loose:!0}),Pn=Object.freeze({}),qn=e=>e?typeof e!="object"?kn:e:Pn;Qe.exports=qn});var $e=m((Ea,rt)=>{"use strict";var et=/^[0-9]+$/,tt=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:ett(t,e);rt.exports={compareIdentifiers:tt,rcompareIdentifiers:jn}});var y=m((wa,st)=>{"use strict";var W=C(),{MAX_LENGTH:nt,MAX_SAFE_INTEGER:Y}=j(),{safeRe:J,t:Z}=k(),Cn=H(),{compareIdentifiers:ge}=$e(),ye=class e{constructor(t,r){if(r=Cn(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>nt)throw new TypeError(`version is longer than ${nt} characters`);W("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?J[Z.LOOSE]:J[Z.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Y||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Y||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Y||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let i=+s;if(i>=0&&it.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(W("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ge(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(W("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ge(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?J[Z.PRERELEASELOOSE]:J[Z.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let i=[r,s];n===!1&&(i=[r]),ge(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};st.exports=ye});var b=m(($a,ot)=>{"use strict";var it=y(),Dn=(e,t,r=!1)=>{if(e instanceof it)return e;try{return new it(e,t)}catch(n){if(!r)return null;throw n}};ot.exports=Dn});var ct=m((ga,at)=>{"use strict";var Un=b(),Fn=(e,t)=>{let r=Un(e,t);return r?r.version:null};at.exports=Fn});var ut=m((ya,lt)=>{"use strict";var Gn=b(),zn=(e,t)=>{let r=Gn(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};lt.exports=zn});var ht=m((Ra,pt)=>{"use strict";var ft=y(),Xn=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new ft(e instanceof ft?e.version:e,r).inc(t,n,s).version}catch{return null}};pt.exports=Xn});var Et=m((Ia,mt)=>{"use strict";var dt=b(),Vn=(e,t)=>{let r=dt(e,null,!0),n=dt(t,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let h=c?"pre":"";return r.major!==n.major?h+"major":r.minor!==n.minor?h+"minor":r.patch!==n.patch?h+"patch":"prerelease"};mt.exports=Vn});var $t=m((Oa,wt)=>{"use strict";var Mn=y(),_n=(e,t)=>new Mn(e,t).major;wt.exports=_n});var yt=m((La,gt)=>{"use strict";var Bn=y(),Hn=(e,t)=>new Bn(e,t).minor;gt.exports=Hn});var It=m((Sa,Rt)=>{"use strict";var Wn=y(),Yn=(e,t)=>new Wn(e,t).patch;Rt.exports=Yn});var Lt=m((Na,Ot)=>{"use strict";var Jn=b(),Zn=(e,t)=>{let r=Jn(e,t);return r&&r.prerelease.length?r.prerelease:null};Ot.exports=Zn});var L=m((xa,Nt)=>{"use strict";var St=y(),Kn=(e,t,r)=>new St(e,r).compare(new St(t,r));Nt.exports=Kn});var vt=m((va,xt)=>{"use strict";var Qn=L(),es=(e,t,r)=>Qn(t,e,r);xt.exports=es});var Tt=m((Aa,At)=>{"use strict";var ts=L(),rs=(e,t)=>ts(e,t,!0);At.exports=rs});var K=m((Ta,kt)=>{"use strict";var bt=y(),ns=(e,t,r)=>{let n=new bt(e,r),s=new bt(t,r);return n.compare(s)||n.compareBuild(s)};kt.exports=ns});var qt=m((ba,Pt)=>{"use strict";var ss=K(),is=(e,t)=>e.sort((r,n)=>ss(r,n,t));Pt.exports=is});var Ct=m((ka,jt)=>{"use strict";var os=K(),as=(e,t)=>e.sort((r,n)=>os(n,r,t));jt.exports=as});var D=m((Pa,Dt)=>{"use strict";var cs=L(),ls=(e,t,r)=>cs(e,t,r)>0;Dt.exports=ls});var Q=m((qa,Ut)=>{"use strict";var us=L(),fs=(e,t,r)=>us(e,t,r)<0;Ut.exports=fs});var Re=m((ja,Ft)=>{"use strict";var ps=L(),hs=(e,t,r)=>ps(e,t,r)===0;Ft.exports=hs});var Ie=m((Ca,Gt)=>{"use strict";var ds=L(),ms=(e,t,r)=>ds(e,t,r)!==0;Gt.exports=ms});var ee=m((Da,zt)=>{"use strict";var Es=L(),ws=(e,t,r)=>Es(e,t,r)>=0;zt.exports=ws});var te=m((Ua,Xt)=>{"use strict";var $s=L(),gs=(e,t,r)=>$s(e,t,r)<=0;Xt.exports=gs});var Oe=m((Fa,Vt)=>{"use strict";var ys=Re(),Rs=Ie(),Is=D(),Os=ee(),Ls=Q(),Ss=te(),Ns=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return ys(e,r,n);case"!=":return Rs(e,r,n);case">":return Is(e,r,n);case">=":return Os(e,r,n);case"<":return Ls(e,r,n);case"<=":return Ss(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};Vt.exports=Ns});var _t=m((Ga,Mt)=>{"use strict";var xs=y(),vs=b(),{safeRe:re,t:ne}=k(),As=(e,t)=>{if(e instanceof xs)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?re[ne.COERCEFULL]:re[ne.COERCE]);else{let c=t.includePrerelease?re[ne.COERCERTLFULL]:re[ne.COERCERTL],f;for(;(f=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||f.index+f[0].length!==r.index+r[0].length)&&(r=f),c.lastIndex=f.index+f[1].length+f[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return vs(`${n}.${s}.${i}${o}${a}`,t)};Mt.exports=As});var Ht=m((za,Bt)=>{"use strict";var Le=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};Bt.exports=Le});var S=m((Xa,Zt)=>{"use strict";var Ts=/\s+/g,Se=class e{constructor(t,r){if(r=ks(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Ne)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(Ts," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!Yt(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&Fs(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&Ds)|(this.options.loose&&Us))+":"+t,s=Wt.get(n);if(s)return s;let i=this.options.loose,o=i?I[R.HYPHENRANGELOOSE]:I[R.HYPHENRANGE];t=t.replace(o,Ys(this.options.includePrerelease)),$("hyphen replace",t),t=t.replace(I[R.COMPARATORTRIM],qs),$("comparator trim",t),t=t.replace(I[R.TILDETRIM],js),$("tilde trim",t),t=t.replace(I[R.CARETTRIM],Cs),$("caret trim",t);let a=t.split(" ").map(p=>Gs(p,this.options)).join(" ").split(/\s+/).map(p=>Ws(p,this.options));i&&(a=a.filter(p=>($("loose invalid filter",p,this.options),!!p.match(I[R.COMPARATORLOOSE])))),$("range list",a);let c=new Map,f=a.map(p=>new Ne(p,this.options));for(let p of f){if(Yt(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let h=[...c.values()];return Wt.set(n,h),h}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>Jt(n,r)&&t.set.some(s=>Jt(s,r)&&n.every(i=>s.every(o=>i.intersects(o,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new Ps(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",Fs=e=>e.value==="",Jt=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(i=>s.intersects(i,t)),s=n.pop();return r},Gs=(e,t)=>(e=e.replace(I[R.BUILD],""),$("comp",e,t),e=Vs(e,t),$("caret",e),e=zs(e,t),$("tildes",e),e=_s(e,t),$("xrange",e),e=Hs(e,t),$("stars",e),e),O=e=>!e||e.toLowerCase()==="x"||e==="*",zs=(e,t)=>e.trim().split(/\s+/).map(r=>Xs(r,t)).join(" "),Xs=(e,t)=>{let r=t.loose?I[R.TILDELOOSE]:I[R.TILDE];return e.replace(r,(n,s,i,o,a)=>{$("tilde",e,n,s,i,o,a);let c;return O(s)?c="":O(i)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:O(o)?c=`>=${s}.${i}.0 <${s}.${+i+1}.0-0`:a?($("replaceTilde pr",a),c=`>=${s}.${i}.${o}-${a} <${s}.${+i+1}.0-0`):c=`>=${s}.${i}.${o} <${s}.${+i+1}.0-0`,$("tilde return",c),c})},Vs=(e,t)=>e.trim().split(/\s+/).map(r=>Ms(r,t)).join(" "),Ms=(e,t)=>{$("caret",e,t);let r=t.loose?I[R.CARETLOOSE]:I[R.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,c)=>{$("caret",e,s,i,o,a,c);let f;return O(i)?f="":O(o)?f=`>=${i}.0.0${n} <${+i+1}.0.0-0`:O(a)?i==="0"?f=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`:c?($("replaceCaret pr",c),i==="0"?o==="0"?f=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):($("no pr"),i==="0"?o==="0"?f=`>=${i}.${o}.${a}${n} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}${n} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),$("caret return",f),f})},_s=(e,t)=>($("replaceXRanges",e,t),e.split(/\s+/).map(r=>Bs(r,t)).join(" ")),Bs=(e,t)=>{e=e.trim();let r=t.loose?I[R.XRANGELOOSE]:I[R.XRANGE];return e.replace(r,(n,s,i,o,a,c)=>{$("xRange",e,n,s,i,o,a,c);let f=O(i),h=f||O(o),p=h||O(a),w=p;return s==="="&&w&&(s=""),c=t.includePrerelease?"-0":"",f?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&w?(h&&(o=0),a=0,s===">"?(s=">=",h?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):s==="<="&&(s="<",h?i=+i+1:o=+o+1),s==="<"&&(c="-0"),n=`${s+i}.${o}.${a}${c}`):h?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:p&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),$("xRange return",n),n})},Hs=(e,t)=>($("replaceStars",e,t),e.trim().replace(I[R.STAR],"")),Ws=(e,t)=>($("replaceGTE0",e,t),e.trim().replace(I[t.includePrerelease?R.GTE0PRE:R.GTE0],"")),Ys=e=>(t,r,n,s,i,o,a,c,f,h,p,w)=>(O(n)?r="":O(s)?r=`>=${n}.0.0${e?"-0":""}`:O(i)?r=`>=${n}.${s}.0${e?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,O(f)?c="":O(h)?c=`<${+f+1}.0.0-0`:O(p)?c=`<${f}.${+h+1}.0-0`:w?c=`<=${f}.${h}.${p}-${w}`:e?c=`<${f}.${h}.${+p+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),Js=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var U=m((Va,nr)=>{"use strict";var F=Symbol("SemVer ANY"),Ae=class e{static get ANY(){return F}constructor(t,r){if(r=Kt(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),ve("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===F?this.value="":this.value=this.operator+this.semver.version,ve("comp",this)}parse(t){let r=this.options.loose?Qt[er.COMPARATORLOOSE]:Qt[er.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new tr(n[2],this.options.loose):this.semver=F}toString(){return this.value}test(t){if(ve("Comparator.test",t,this.options.loose),this.semver===F||t===F)return!0;if(typeof t=="string")try{t=new tr(t,this.options)}catch{return!1}return xe(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new rr(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new rr(this.value,r).test(t.semver):(r=Kt(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||xe(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||xe(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};nr.exports=Ae;var Kt=H(),{safeRe:Qt,t:er}=k(),xe=Oe(),ve=C(),tr=y(),rr=S()});var G=m((Ma,sr)=>{"use strict";var Zs=S(),Ks=(e,t,r)=>{try{t=new Zs(t,r)}catch{return!1}return t.test(e)};sr.exports=Ks});var or=m((_a,ir)=>{"use strict";var Qs=S(),ei=(e,t)=>new Qs(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));ir.exports=ei});var cr=m((Ba,ar)=>{"use strict";var ti=y(),ri=S(),ni=(e,t,r)=>{let n=null,s=null,i=null;try{i=new ri(t,r)}catch{return null}return e.forEach(o=>{i.test(o)&&(!n||s.compare(o)===-1)&&(n=o,s=new ti(n,r))}),n};ar.exports=ni});var ur=m((Ha,lr)=>{"use strict";var si=y(),ii=S(),oi=(e,t,r)=>{let n=null,s=null,i=null;try{i=new ii(t,r)}catch{return null}return e.forEach(o=>{i.test(o)&&(!n||s.compare(o)===1)&&(n=o,s=new si(n,r))}),n};lr.exports=oi});var hr=m((Wa,pr)=>{"use strict";var Te=y(),ai=S(),fr=D(),ci=(e,t)=>{e=new ai(e,t);let r=new Te("0.0.0");if(e.test(r)||(r=new Te("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let a=new Te(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||fr(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||fr(r,i))&&(r=i)}return r&&e.test(r)?r:null};pr.exports=ci});var mr=m((Ya,dr)=>{"use strict";var li=S(),ui=(e,t)=>{try{return new li(e,t).range||"*"}catch{return null}};dr.exports=ui});var se=m((Ja,gr)=>{"use strict";var fi=y(),$r=U(),{ANY:pi}=$r,hi=S(),di=G(),Er=D(),wr=Q(),mi=te(),Ei=ee(),wi=(e,t,r,n)=>{e=new fi(e,n),t=new hi(t,n);let s,i,o,a,c;switch(r){case">":s=Er,i=mi,o=wr,a=">",c=">=";break;case"<":s=wr,i=Ei,o=Er,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(di(e,t,n))return!1;for(let f=0;f{d.semver===pi&&(d=new $r(">=0.0.0")),p=p||d,w=w||d,s(d.semver,p.semver,n)?p=d:o(d.semver,w.semver,n)&&(w=d)}),p.operator===a||p.operator===c||(!w.operator||w.operator===a)&&i(e,w.semver))return!1;if(w.operator===c&&o(e,w.semver))return!1}return!0};gr.exports=wi});var Rr=m((Za,yr)=>{"use strict";var $i=se(),gi=(e,t,r)=>$i(e,t,">",r);yr.exports=gi});var Or=m((Ka,Ir)=>{"use strict";var yi=se(),Ri=(e,t,r)=>yi(e,t,"<",r);Ir.exports=Ri});var Nr=m((Qa,Sr)=>{"use strict";var Lr=S(),Ii=(e,t,r)=>(e=new Lr(e,r),t=new Lr(t,r),e.intersects(t,r));Sr.exports=Ii});var vr=m((ec,xr)=>{"use strict";var Oi=G(),Li=L();xr.exports=(e,t,r)=>{let n=[],s=null,i=null,o=e.sort((h,p)=>Li(h,p,r));for(let h of o)Oi(h,t,r)?(i=h,s||(s=h)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);let a=[];for(let[h,p]of n)h===p?a.push(h):!p&&h===o[0]?a.push("*"):p?h===o[0]?a.push(`<=${p}`):a.push(`${h} - ${p}`):a.push(`>=${h}`);let c=a.join(" || "),f=typeof t.raw=="string"?t.raw:String(t);return c.length{"use strict";var Ar=S(),ke=U(),{ANY:be}=ke,z=G(),Pe=L(),Si=(e,t,r={})=>{if(e===t)return!0;e=new Ar(e,r),t=new Ar(t,r);let n=!1;e:for(let s of e.set){for(let i of t.set){let o=xi(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},Ni=[new ke(">=0.0.0-0")],Tr=[new ke(">=0.0.0")],xi=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===be){if(t.length===1&&t[0].semver===be)return!0;r.includePrerelease?e=Ni:e=Tr}if(t.length===1&&t[0].semver===be){if(r.includePrerelease)return!0;t=Tr}let n=new Set,s,i;for(let d of e)d.operator===">"||d.operator===">="?s=br(s,d,r):d.operator==="<"||d.operator==="<="?i=kr(i,d,r):n.add(d.semver);if(n.size>1)return null;let o;if(s&&i){if(o=Pe(s.semver,i.semver,r),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let d of n){if(s&&!z(d,String(s),r)||i&&!z(d,String(i),r))return null;for(let _ of t)if(!z(d,String(_),r))return!1;return!0}let a,c,f,h,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,w=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let d of t){if(h=h||d.operator===">"||d.operator===">=",f=f||d.operator==="<"||d.operator==="<=",s){if(w&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===w.major&&d.semver.minor===w.minor&&d.semver.patch===w.patch&&(w=!1),d.operator===">"||d.operator===">="){if(a=br(s,d,r),a===d&&a!==s)return!1}else if(s.operator===">="&&!z(s.semver,String(d),r))return!1}if(i){if(p&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===p.major&&d.semver.minor===p.minor&&d.semver.patch===p.patch&&(p=!1),d.operator==="<"||d.operator==="<="){if(c=kr(i,d,r),c===d&&c!==i)return!1}else if(i.operator==="<="&&!z(i.semver,String(d),r))return!1}if(!d.operator&&(i||s)&&o!==0)return!1}return!(s&&f&&!i&&o!==0||i&&h&&!s&&o!==0||w||p)},br=(e,t,r)=>{if(!e)return t;let n=Pe(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},kr=(e,t,r)=>{if(!e)return t;let n=Pe(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};Pr.exports=Si});var X=m((rc,Dr)=>{"use strict";var qe=k(),jr=j(),vi=y(),Cr=$e(),Ai=b(),Ti=ct(),bi=ut(),ki=ht(),Pi=Et(),qi=$t(),ji=yt(),Ci=It(),Di=Lt(),Ui=L(),Fi=vt(),Gi=Tt(),zi=K(),Xi=qt(),Vi=Ct(),Mi=D(),_i=Q(),Bi=Re(),Hi=Ie(),Wi=ee(),Yi=te(),Ji=Oe(),Zi=_t(),Ki=U(),Qi=S(),eo=G(),to=or(),ro=cr(),no=ur(),so=hr(),io=mr(),oo=se(),ao=Rr(),co=Or(),lo=Nr(),uo=vr(),fo=qr();Dr.exports={parse:Ai,valid:Ti,clean:bi,inc:ki,diff:Pi,major:qi,minor:ji,patch:Ci,prerelease:Di,compare:Ui,rcompare:Fi,compareLoose:Gi,compareBuild:zi,sort:Xi,rsort:Vi,gt:Mi,lt:_i,eq:Bi,neq:Hi,gte:Wi,lte:Yi,cmp:Ji,coerce:Zi,Comparator:Ki,Range:Qi,satisfies:eo,toComparators:to,maxSatisfying:ro,minSatisfying:no,minVersion:so,validRange:io,outside:oo,gtr:ao,ltr:co,intersects:lo,simplifyRange:uo,subset:fo,SemVer:vi,re:qe.re,src:qe.src,tokens:qe.t,SEMVER_SPEC_VERSION:jr.SEMVER_SPEC_VERSION,RELEASE_TYPES:jr.RELEASE_TYPES,compareIdentifiers:Cr.compareIdentifiers,rcompareIdentifiers:Cr.rcompareIdentifiers}});var me=new TextDecoder;function _e(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function Be(e,t){let r=String(t??"").split(/\s+/).filter(i=>i.startsWith("sha512-")).map(i=>i.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,i=>String.fromCharCode(i)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function He(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let i=await r.read();!i.done;i=await r.read()){if(s+=i.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(i.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function q(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return me.decode(s<0?n:n.subarray(0,s))}function We(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,i)=>s*256+i,e[t]&127);let n=q(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function pn(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if(We(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function hn(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let i=me.decode(e.subarray(n+1,r+s-1)),o=i.indexOf("=");t[i.slice(0,o)]=i.slice(o+1),r+=s}return t}function dn(e,t){let r=e.subarray(t,t+512);pn(r);let n=We(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function mn(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function En(e){let t=q(e,0,100),r=q(e,257,5)==="ustar"?q(e,345,155):"";return r?`${r}/${t}`:t}var Me={x:(e,t)=>({...e,pax:hn(t).path}),L:(e,t)=>({...e,long:q(t,0,t.length)}),g:e=>e};function Ye(e){let t=[],r={};for(let n=0;!mn(e,n);){let{header:s,type:i,data:o,next:a}=dn(e,n);if(n=a,Object.hasOwn(Me,i)){r=Me[i](r,o);continue}(i==="0"||i==="7")&&t.push({path:r.pax??r.long??En(s),bytes:o}),r={}}return t}var ae=B(X(),1);var x=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function ie(e,t){let r=[],n=0;for(;;){let s=await x(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function je(e,{id:t,path:r,bytes:n},s){for(let i=0;i{}),a}}async function po(e,t){let r=[],n=0;for(;;){let{done:s,value:i}=await e.read();if(s)return r;if(n+=i.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(i)}}async function ho(e,t){try{return await po(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function Ur(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await ho(e.body.getReader(),t)).arrayBuffer())}var mo=/[\\\0:*?"<>|]/,Eo=e=>e.split("/").some(t=>!t||t==="."||t==="..");function wo(e){return typeof e!="string"||!e||mo.test(e)?!0:Eo(e)}function A(e){if(wo(e))throw new Error(`Unsafe package path: ${e}`);return e}var $o=new TextDecoder,go=["preinstall","install","postinstall"];async function Fr(e){let t=new Map;for(let r of Ye(await He(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=A(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var yo=e=>go.some(t=>e.scripts?.[t]),Ro=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function Io(e,t){return yo(e)||e.gypfile?!0:Ro(t)}function Gr(e,t,r){let n=JSON.parse($o.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(Io(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}var Ce=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),ce=(e,t)=>`${e.replace("/","+")}@${t}`,De=(e,t,r)=>`${ce(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function Oo(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function Lo(e,t){let r=e["dist-tags"]?.[t];return r||(ae.default.valid(t)?t:ae.default.maxSatisfying(Object.keys(e.versions??{}),t))}function So(e,t,r){let n=r||"latest",s=Lo(e,n),i=e.versions?.[s];if(!i||!ae.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:i}}async function No(e,t,r,{fetchImpl:n,signal:s}){let i=new URL(t.dist?.tarball,r);if(i.protocol!=="https:"&&i.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let o=await n(i,{signal:s});if(!o.ok)throw new Error(`Package download for ${e}: HTTP ${o.status}`);let a=await Ur(o);return{bytes:a,integrity:await Be(a,t.dist.integrity)}}function xo(e){let t=new URL(e,globalThis.location?.href);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function P(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!Ce(e))throw new Error(`Unsupported npm package name: ${e}`);let i=xo(r),o={fetchImpl:n,signal:s},{version:a,manifest:c}=So(await Oo(e,i,o),e,t),{bytes:f,integrity:h}=await No(e,c,i,o),p=await Fr(f),w=Gr(p,e,a);return{id:ce(e,a),key:De(e,a,h),manifest:w,integrity:h,files:p}}var le=B(X(),1);function vo(e,t,r){let n=e?.roots?.[t];return n?.requested===r&&e.packages[n.id]?e.packages[n.id]:le.default.validRange(r)?Object.values(e?.packages??{}).filter(i=>i.name===t&&le.default.satisfies(i.version,r)).sort((i,o)=>le.default.rcompare(i.version,o.version))[0]??null:null}function zr({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=P,previous:s}){let i=new Map;return async(o,a)=>{let c=`${o}@${a}`;if(i.has(c))return i.get(c);let f=vo(s,o,a),h=await n(o,f?.version??a,{registry:e,fetchImpl:t,signal:r});if(f&&h.integrity!==f.integrity)throw new Error(`${h.id} no longer matches the integrity recorded in the lock`);return i.set(c,h),h}}var Xr=B(X(),1),Vr=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function Ao(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw Vr(e,t,r)}function To(e,[t,r],{nodes:n,roots:s}){let i=s[t]?.id??e.dependencies[t];if(!i)return Ao(e,t,r);if(!Xr.default.satisfies(n[i].version,r))throw Vr(e,t,r);return i}function bo(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=To(e,r,t);n&&(e.dependencies[r[0]]=n)}}function Mr(e,t){for(let r of Object.values(e))bo(r,{nodes:e,roots:t})}var _r=B(X(),1);function ko(e,t){return!Ce(t.name)||!_r.default.valid(t.version)?!1:e===ce(t.name,t.version)}function Po(e){return e.integrity?.startsWith("sha512-")?e.key===De(e.name,e.version,e.integrity):!1}function qo(e,t,r){if(!ko(t,r)||!Po(r))throw new Error("Invalid locked package");for(let n of r.files)A(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function jo(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function Ue(e){if(!jo(e))throw new Error("Unsupported package lock");for(let[t,r]of Object.entries(e.packages))qo(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function Co(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function Do(e,t){let r={};for(let n of e){let{name:s,version:i}=_e(n);r[s]={requested:i||"latest",id:await t(s,i||"latest")}}return r}async function Br(e,t={}){let r=zr(t),n={nodes:{},downloads:new Map,total:0},s=async(o,a)=>{t.signal?.throwIfAborted();let c=await r(o,a);if(n.nodes[c.id])return c.id;Co(n,o,c);for(let[f,h]of Object.entries(c.manifest.dependencies??{}).sort())n.nodes[c.id].dependencies[f]=await s(f,h);return c.id},i=await Do(e,s);return Mr(n.nodes,i),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:i,packages:n.nodes},downloads:n.downloads}}function Fe(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var v="webfront.project.json",V=1,Ge=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,Uo=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,Fo=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,Hr=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,Go=/^[A-Za-z_][A-Za-z0-9_]*$/,Wr=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],zo=["files","publish","fetch"],g=e=>{throw new Error(`${v}: ${e}`)};function T(e,t){return Fe(e)||g(`${t} must be an object`),e}function ze(e,t,r){for(let n of Object.keys(e))t.includes(n)||g(`unknown key "${n}" in ${r}`)}function ue(e,t){typeof e!="string"&&g(`${t} must be a project path`);try{return A(e)}catch{return g(`${t} is not a safe project-relative path: ${e}`)}}function Yr(e,t){return(!Array.isArray(e)||e.length>256)&&g(`${t} must be an array of at most 256 paths`),e.map((r,n)=>ue(r,`${t}[${n}]`))}function Xo(e){let t=T(e,"dependencies");for(let[r,n]of Object.entries(t))Ge.test(r)||g(`invalid npm package name "${r}"`),(typeof n!="string"||!Fo.test(n)||n!==n.trim())&&g(`invalid version range for "${r}"`);return t}function Vo(e){if(typeof e!="string"&&g("registry must be a URL"),e.startsWith("/")&&!e.startsWith("//"))return e;let t;try{t=new URL(e)}catch{return g("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&g("registry must use https"),e}function Mo(e){let t=T(e,"scripts");for(let[r,n]of Object.entries(t))(!Hr.test(r)||typeof n!="string"||!n||n.length>1024)&&g(`invalid script "${r}"`);return t}function _o(e){let t=T(e,"entries");for(let[r,n]of Object.entries(t))Hr.test(r)||g(`invalid entry name "${r}"`),ue(n,`entries.${r}`);return t}function Bo(e,t){let r=T(e,"providers");for(let[n,s]of Object.entries(r))Go.test(n)||g(`invalid provider name "${n}"`),T(s,`providers.${n}`),ze(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&g(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||ue(s.entry,`providers.${n}.entry`),ue(s.output,`providers.${n}.output`).endsWith(".hpp")||g(`providers.${n}.output must be a .hpp file`);return r}function Ho(e){let t=T(e,"test");return ze(t,["specs"],"test"),t.specs!==void 0&&Yr(t.specs,"test.specs"),t}function Wo(e,t){let r;try{r=new URL(e)}catch{return g(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&g(`${t} must be an https origin without a path`),e}function Yo(e){let t=T(e,"permissions");for(let r of Object.keys(t))zo.includes(r)||g(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&Yr(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&g("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>Wo(r,`permissions.fetch[${n}]`))),t}function Jo(e){(typeof e.name!="string"||!Ge.test(e.name))&&g("name must be a lower-case npm package name"),(typeof e.version!="string"||!Uo.test(e.version))&&g("version must be a semantic version")}function Zo(e){e.format!==V&&(Number.isInteger(e.format)&&e.format>V&&g(`format ${e.format} is not supported by this environment (it reads format ${V}); update the environment`),g(`format must be ${V}`))}function Ko(e){T(e,"the manifest"),Zo(e),ze(e,Wr,"the manifest"),Jo(e);let t=e.entries===void 0?{}:_o(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:Xo(e.dependencies),entries:t,providers:e.providers===void 0?{}:Bo(e.providers,t),...e.registry===void 0?{}:{registry:Vo(e.registry)},...e.scripts===void 0?{}:{scripts:Mo(e.scripts)},...e.test===void 0?{}:{test:Ho(e.test)},...e.permissions===void 0?{}:{permissions:Yo(e.permissions)}}}function Jr(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return g("not valid JSON")}return Ko(t)}function Xe(e){let t={};for(let r of Wr)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` `}function Zr(e){return{format:V,name:e,version:"0.1.0",dependencies:{}}}function Kr(e){let r=(String(e??"").split("/").filter(Boolean).pop()??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"");return Ge.test(r)?r:"webfront-app"}async function fe(e){let t=JSON.stringify(Object.entries(e).sort(([n],[s])=>ns?1:0)),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(r)].map(n=>n.toString(16).padStart(2,"0")).join("")}var M="webfront-packages.lock.json",pe=".webfront/developer/packages",Qo=new TextDecoder,ea=new TextEncoder,en="No webfront.project.json: run wf init",he="The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again";async function Qr(e,t){try{return await ie(e,t)}catch(r){if(r.message.includes("Cannot read project file:"))return null;throw r}}function ta(e,t,r){return e?t?t.manifestDigest===r?"consistent":"desynchronized":"unlocked":"no-manifest"}async function tn(e){let t=await x(e,"state",`${v} ${M}`),r=await Qr(e,v),n=await Qr(e,M),s=r?Jr(r):null,i=n?Ue(JSON.parse(Qo.decode(n))):null,o=s?await fe(s.dependencies):null;return{manifest:s,lock:i,token:t,status:ta(s,i,o),digest:o}}var jc=e=>e.status==="desynchronized"?`Warning: ${he}.\r `:"";async function rn(e,t,r,{signal:n}={}){let s=[];try{for(let[i,o]of t){n?.throwIfAborted();let a=await x(e,"begin",i,!1);s.push(a),await je(e,{id:a,path:"output",bytes:o},n)}n?.throwIfAborted(),await x(e,"commitGroup",s.join(` diff --git a/js/developer/environment/pins.mjs b/js/developer/environment/pins.mjs index 34c73ea0..b2941935 100644 --- a/js/developer/environment/pins.mjs +++ b/js/developer/environment/pins.mjs @@ -3,7 +3,10 @@ import semver from 'semver'; import {downloadPackage} from './registry.mjs'; // The installed version satisfying a range, so that a later install never moves or replaces it silently. +// A root requested by a dist-tag (a@beta) keeps the version the tag had when it was resolved. function lockedNode(previous, name, range) { + const root = previous?.roots?.[name]; + if (root?.requested === range && previous.packages[root.id]) return previous.packages[root.id]; if (!semver.validRange(range)) return null; const candidates = Object.values(previous?.packages ?? {}).filter(node => node.name === name && semver.satisfies(node.version, range)); return candidates.sort((a, b) => semver.rcompare(a.version, b.version))[0] ?? null; diff --git a/js/developer/tools/PUBLISHING.md b/js/developer/tools/PUBLISHING.md index a45a3f68..52b2dee3 100644 --- a/js/developer/tools/PUBLISHING.md +++ b/js/developer/tools/PUBLISHING.md @@ -15,8 +15,9 @@ node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.m node js/developer/tools/site.mjs build-distribution build-developer-site ``` -Review and commit the updated checked-in bootstrap bundles, checksums and -`include/webfront/system/DeveloperReleaseData.hpp`. The header pins the exact environment archive and URL. +Review and commit the updated checked-in bootstrap bundles and checksums. +`include/webfront/system/DeveloperReleaseData.hpp` is committed only for a version that is already published +and verified (see "Pinning a new version"), so that the default bootstrap never names an archive that is unavailable. The header pins the exact environment archive and URL. The environment pins the starter archive in turn. `provision.json` is informational; applications do not discover a replacement trust hash from that remote file or follow `latest` at startup. @@ -24,6 +25,17 @@ The static branch preserves every version. Republishing identical bytes is allow published version with different bytes fails. Increment `distribution.json` before publishing any changed environment, starter, public URL or provisioning configuration. +## Pinning a new version + +`distribution.json` names the version under development; `DeveloperReleaseData.hpp` pins the last version that is +published. Pull requests and branch pushes therefore require the header to match a fresh build only when both name +the same version; a publication (a `developer-v*` tag or a dispatch with `publish=true`) always requires it. + +1. Merge the changes with the header still on the previous version. +2. On a release branch, run `build.mjs build-distribution --refresh-bootstrap` and commit the new header. +3. Tag `developer-v` on that commit; the workflow publishes the site. +4. Verify the deployed files (below), then merge the release branch so the default bootstrap points to the new version. + ## One-time Pages configuration The repository's Pages source must be the **gh-pages branch, root directory**, with branch-based diff --git a/js/developer/tools/manifest-check.mjs b/js/developer/tools/manifest-check.mjs index 7ea440d9..926209c9 100644 --- a/js/developer/tools/manifest-check.mjs +++ b/js/developer/tools/manifest-check.mjs @@ -111,6 +111,12 @@ function memoryBridge(storage = new Map()) { return {bridge, storage, pending: () => transactions.size}; } +const tagged = (packages, tags) => async url => { + const response = await packages(url); + const body = response.headers.get('content-type')?.includes('json') ? await response.json() : null; + if (!body) return response; + return Response.json({...body, 'dist-tags': {...body['dist-tags'], ...tags}}); +}; const pkg = (name, version, fields = {}) => compress(tar(new Map([['package/package.json', encode({name, version, ...fields})]]))); function registry(packages) { const requests = []; @@ -261,3 +267,15 @@ test('wf install --update takes the newest version within the ranges while insta assert.deepEqual(json(storage, manifestPath).dependencies, {a: '^1.2.0', b: '^2.0.0'}); assert.equal((await loadProject(bridge)).status, 'consistent'); }); + +test('a package installed by dist-tag keeps its version when another package is installed', async () => { + const {bridge, storage} = await project(); + const old = {...source(), a: {version: '1.2.0', bytes: pkg('a', '1.2.0'), older: {'1.3.0': pkg('a', '1.3.0')}}}; + const beta = tags => options(tagged(registry(old).fetchImpl, tags)); + await install(bridge, ['a@beta'], beta({beta: '1.2.0'})); + assert.deepEqual(json(storage, manifestPath).dependencies, {a: 'beta'}); + await install(bridge, ['b'], beta({beta: '1.3.0'})); + assert.deepEqual(Object.keys(json(storage, lockPath).packages).sort(), ['a@1.2.0', 'b@2.0.0'], 'the tag moved but the lock did not'); + await install(bridge, ['--update'], beta({beta: '1.3.0'})); + assert.deepEqual(Object.keys(json(storage, lockPath).packages).sort(), ['a@1.3.0', 'b@2.0.0']); +}); diff --git a/test/unit/DeveloperTests.cpp b/test/unit/DeveloperTests.cpp index 29402f41..49bd0f93 100644 --- a/test/unit/DeveloperTests.cpp +++ b/test/unit/DeveloperTests.cpp @@ -526,3 +526,30 @@ SCENARIO("A publication prepared from stale state is refused") { } } } + +SCENARIO("New directories are durable once their parents are synchronized") { + TemporaryDirectory project; + const auto root = std::filesystem::canonical(project.path()); + GIVEN("a project without the journal directory") { + std::vector synced; + WHEN("the directories are created") { + developer::createDirectoriesDurably(root, root / ".webfront/developer/journal", + [&](const std::filesystem::path& directory) { + // The directory just created must exist when its parent is synchronized. + REQUIRE(std::filesystem::exists(directory / (synced.empty() ? ".webfront" : synced.size() == 1 ? "developer" : "journal"))); + synced.push_back(directory); + }); + THEN("each created directory has its parent synchronized, outermost first") { + REQUIRE(synced == std::vector{root, root / ".webfront", root / ".webfront/developer"}); + } + } + WHEN("some of them already exist") { + std::filesystem::create_directories(root / ".webfront/developer"); + developer::createDirectoriesDurably(root, root / ".webfront/developer/journal", + [&](const std::filesystem::path& directory) { synced.push_back(directory); }); + THEN("only the missing one is created and synchronized") { + REQUIRE(synced == std::vector{root / ".webfront/developer"}); + } + } + } +} From a6dbc82d5db5bff1343116e69df056efc776e1ab Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 14:35:22 +0200 Subject: [PATCH 014/134] Serialize journal recovery and group publication between processes [#305] --- docs/DEVELOPER_ENVIRONMENT.md | 4 +- include/webfront/system/DeveloperJournal.hpp | 77 +++++++++++++++++++- include/webfront/system/DeveloperStore.hpp | 10 ++- test/unit/DeveloperTests.cpp | 58 ++++++++++++++- 4 files changed, 137 insertions(+), 12 deletions(-) diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 27f3b43e..771b6ad7 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -185,7 +185,9 @@ completes a journal that reached its commit point and abandons the others, so a a manifest and a lock that belong to different installations. The publication carries a precondition, the fingerprint of both files as read when the command began: if another browser or command changed them meanwhile, it is refused with "The project changed since it was read; run the command again" and -nothing is lost. `wf restore` (#306) will fill the cache from a consistent lock without ever writing them. +nothing is lost. Recovery and group publications also hold an advisory lock on `.webfront/developer/journal/.lock`, so +several processes sharing a project (or several stores of one process) are serialized rather than abandoning one +another's publication; other project files stay unprotected against concurrent local modification. `wf restore` (#306) will fill the cache from a consistent lock without ever writing them. ## Dependencies, storage and limitations diff --git a/include/webfront/system/DeveloperJournal.hpp b/include/webfront/system/DeveloperJournal.hpp index f6651405..f76d6620 100644 --- a/include/webfront/system/DeveloperJournal.hpp +++ b/include/webfront/system/DeveloperJournal.hpp @@ -13,6 +13,7 @@ #if !defined(_WIN32) #include +#include #include #endif @@ -82,6 +83,56 @@ inline void createDirectoriesDurably(const std::filesystem::path& root, const st } } +/// Serializes the publications and the recoveries of every process sharing a project: an advisory lock on a +/// file of the journal directory, released when the object dies, whatever the way out. The mutex of a Store +/// only protects that store; without this a second process could take a publication still being prepared +/// for the remains of an interrupted one. +class ProjectLock { +public: + explicit ProjectLock(const std::filesystem::path& file) { +#if defined(_WIN32) + handle = CreateFileW(file.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL, nullptr); + OVERLAPPED region{}; + if (handle == INVALID_HANDLE_VALUE || !LockFileEx(handle, LOCKFILE_EXCLUSIVE_LOCK, 0, 1, 0, ®ion)) { + release(); + throw std::runtime_error("Cannot lock the project journal"); + } +#else + descriptor = ::open(file.c_str(), O_RDWR | O_CREAT | O_CLOEXEC, 0600); + if (descriptor < 0 || ::flock(descriptor, LOCK_EX) != 0) { + release(); + throw std::runtime_error("Cannot lock the project journal"); + } +#endif + } + ProjectLock(const ProjectLock&) = delete; + ProjectLock& operator=(const ProjectLock&) = delete; + ~ProjectLock() { + release(); + } + +private: + void release() noexcept { +#if defined(_WIN32) + if (handle != INVALID_HANDLE_VALUE) + CloseHandle(handle); + handle = INVALID_HANDLE_VALUE; +#else + if (descriptor >= 0) + ::close(descriptor); + descriptor = -1; +#endif + } +#if defined(_WIN32) + HANDLE handle = INVALID_HANDLE_VALUE; +#else + int descriptor = -1; +#endif +}; + +inline constexpr std::string_view lockName = ".lock"; + /// What a group publication changes: the project file it replaces and the journal-owned file replacing it. struct JournalEntry { std::string target; @@ -146,7 +197,9 @@ inline std::string fingerprint(const std::filesystem::path& root, const std::vec } /// Completes a committed journal: every source still present replaces its target. Safe to repeat -/// after an interruption, including one of this very function. +/// after an interruption, including one of this very function. A source that is gone was already +/// renamed: sources are only removed after the journal, and a publication that never reached its +/// journal is never rolled forward. inline void rollForward(const std::filesystem::path& root, const std::filesystem::path& directory, const std::string& number, const std::vector& entries, const StepHook& hook) { const auto owned = directory / (number + ".d"); @@ -178,7 +231,7 @@ inline void rollForward(const std::filesystem::path& root, const std::filesystem /// Completes the journals that reached their commit point and abandons the others. A journal is /// committed once it is renamed to ".journal"; everything else is the remains of a publication /// interrupted before that point, where no project file was touched. -inline void recoverJournals(const std::filesystem::path& root, const StepHook& hook = {}) { +inline void recoverLocked(const std::filesystem::path& root, const StepHook& hook) { std::filesystem::path directory; try { directory = projectPath(root, journalDirectory); @@ -186,9 +239,12 @@ inline void recoverJournals(const std::filesystem::path& root, const StepHook& h return; } std::error_code error; + if (!std::filesystem::is_directory(directory, error)) + return; std::vector found; for (const auto& entry : std::filesystem::directory_iterator(directory, error)) - found.push_back(entry.path()); + if (entry.path().filename() != lockName) + found.push_back(entry.path()); if (error) return; std::ranges::sort(found); @@ -218,4 +274,19 @@ inline void recoverJournals(const std::filesystem::path& root, const StepHook& h } } +/// recoverLocked() for a caller that does not hold the project lock. +inline void recoverJournals(const std::filesystem::path& root, const StepHook& hook = {}) { + std::filesystem::path directory; + try { + directory = projectPath(root, journalDirectory); + } catch (const std::exception&) { + return; + } + std::error_code error; + if (!std::filesystem::is_directory(directory, error)) + return; + ProjectLock lock{directory / lockName}; + recoverLocked(root, hook); +} + } // namespace webfront::developer diff --git a/include/webfront/system/DeveloperStore.hpp b/include/webfront/system/DeveloperStore.hpp index dd1e221d..45063608 100644 --- a/include/webfront/system/DeveloperStore.hpp +++ b/include/webfront/system/DeveloperStore.hpp @@ -119,13 +119,15 @@ class Store { /// after it is completed when the project is next opened. void commitGroup(const std::vector& ids, const std::vector& paths, const std::string& expected) { std::scoped_lock lock(mutex); - recoverJournals(root, hook); - auto group = checkedGroup(ids, paths); - if (fingerprint(root, paths) != expected) - throw std::runtime_error("The project changed since it was read; run the command again"); const auto directory = projectPath(root, journalDirectory); // Before the commit point: the journal directory must itself survive a power cut. createDirectoriesDurably(root, directory); + // From here to the end, no other process recovers, checks the precondition or publishes. + ProjectLock processLock{directory / lockName}; + recoverLocked(root, hook); + auto group = checkedGroup(ids, paths); + if (fingerprint(root, paths) != expected) + throw std::runtime_error("The project changed since it was read; run the command again"); const auto number = prepareJournal(directory, group); try { writeJournal(directory, number, group); diff --git a/test/unit/DeveloperTests.cpp b/test/unit/DeveloperTests.cpp index 49bd0f93..766eaf5a 100644 --- a/test/unit/DeveloperTests.cpp +++ b/test/unit/DeveloperTests.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -360,6 +361,12 @@ void publishPair(developer::Store& store, std::string_view manifest, std::string store.commitGroup({first, second}, pair, expected); } +// The lock file stays in the journal directory; anything else is a journal or its remains. +[[nodiscard]] bool journalsRemain(const std::filesystem::path& directory) { + return std::ranges::any_of(std::filesystem::directory_iterator(directory), + [](const auto& entry) { return entry.path().filename() != developer::lockName; }); +} + [[nodiscard]] std::string projectState(developer::Store& store) { return read(store, manifestPath) + "|" + read(store, lockPath); } @@ -392,7 +399,7 @@ SCENARIO("A manifest and its lock are published together or not at all") { publishPair(store, "manifest-2", "lock-2", store.state(pair)); THEN("both are replaced and no journal remains") { REQUIRE(projectState(store) == "manifest-2|lock-2"); - REQUIRE(std::filesystem::is_empty(project.path() / ".webfront/developer/journal")); + REQUIRE_FALSE(journalsRemain(project.path() / ".webfront/developer/journal")); } } WHEN("the process stops before the journal is committed") { @@ -423,7 +430,7 @@ SCENARIO("A manifest and its lock are published together or not at all") { developer::Store observed{project.path(), developer::defaultAbandonedAfter, [&](std::string_view name) { steps.emplace_back(name); if (name == "replacements-synced") - journalPresent.push_back(!std::filesystem::is_empty(project.path() / ".webfront/developer/journal")); + journalPresent.push_back(journalsRemain(project.path() / ".webfront/developer/journal")); }}; publishPair(observed, "manifest-2", "lock-2", observed.state(pair)); } @@ -458,7 +465,7 @@ SCENARIO("A manifest and its lock are published together or not at all") { THEN("a later restart still reaches the new state") { developer::Store store{project.path()}; REQUIRE(projectState(store) == "manifest-2|lock-2"); - REQUIRE(std::filesystem::is_empty(project.path() / ".webfront/developer/journal")); + REQUIRE_FALSE(journalsRemain(project.path() / ".webfront/developer/journal")); } } } @@ -471,7 +478,7 @@ SCENARIO("A manifest and its lock are published together or not at all") { WHEN("the project is opened") { developer::Store store{project.path()}; THEN("they are abandoned and the project keeps its files") { - REQUIRE(std::filesystem::is_empty(journal)); + REQUIRE_FALSE(journalsRemain(journal)); REQUIRE(projectState(store) == "manifest-1|lock-1"); } } @@ -553,3 +560,46 @@ SCENARIO("New directories are durable once their parents are synchronized") { } } } + +SCENARIO("A second opener of the project waits for a publication in progress instead of abandoning it") { + TemporaryDirectory project; + { + developer::Store store{project.path()}; + publishFile(store, manifestPath, "manifest-1"); + publishFile(store, lockPath, "lock-1"); + } + GIVEN("a publication stopped between staging its files and writing its journal") { + std::promise reached; + std::promise release; + auto released = release.get_future().share(); + developer::Store publisher{project.path(), developer::defaultAbandonedAfter, [&](std::string_view name) { + if (name == "before-journal") { + reached.set_value(); + released.wait(); + } + }}; + auto publication = std::async(std::launch::async, [&] { publishPair(publisher, "manifest-2", "lock-2", publisher.state(pair)); }); + reached.get_future().wait(); + WHEN("another store, as another process would, opens the project meanwhile") { + auto opening = std::async(std::launch::async, [&] { developer::Store other{project.path()}; return projectState(other); }); + THEN("it waits, then sees the completed publication") { + REQUIRE(opening.wait_for(std::chrono::milliseconds(300)) == std::future_status::timeout); + release.set_value(); + publication.get(); + REQUIRE(opening.get() == "manifest-2|lock-2"); + } + } + WHEN("another store tries to publish from the same state") { + auto competing = std::async(std::launch::async, [&] { + developer::Store other{project.path()}; + publishPair(other, "manifest-3", "lock-3", other.state(pair)); + }); + THEN("its precondition is checked after the first publication, which wins") { + REQUIRE(competing.wait_for(std::chrono::milliseconds(300)) == std::future_status::timeout); + release.set_value(); + publication.get(); + REQUIRE_NOTHROW(competing.get()); + } + } + } +} From b59f8c44c4db33d44a4b3a66e426cfb82c0f546d Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 14:50:05 +0200 Subject: [PATCH 015/134] Clarify when the release pin is committed and make the lock test unable to hang [#305] --- js/developer/tools/PUBLISHING.md | 10 +++-- test/unit/DeveloperTests.cpp | 71 ++++++++++++++++++++++++-------- 2 files changed, 59 insertions(+), 22 deletions(-) diff --git a/js/developer/tools/PUBLISHING.md b/js/developer/tools/PUBLISHING.md index 52b2dee3..593d28c1 100644 --- a/js/developer/tools/PUBLISHING.md +++ b/js/developer/tools/PUBLISHING.md @@ -11,13 +11,15 @@ The package names in their manifests are identifiers, not a requirement to own o npm ci --prefix js/developer/vendor --ignore-scripts node js/developer/tools/build.mjs build-distribution --refresh-bootstrap node js/developer/tools/fixtures.mjs build-distribution -node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs +node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs js/developer/tools/manifest-check.mjs node js/developer/tools/site.mjs build-distribution build-developer-site ``` -Review and commit the updated checked-in bootstrap bundles and checksums. -`include/webfront/system/DeveloperReleaseData.hpp` is committed only for a version that is already published -and verified (see "Pinning a new version"), so that the default bootstrap never names an archive that is unavailable. The header pins the exact environment archive and URL. +Review and commit the updated checked-in bootstrap bundles and checksums. Regenerating +`include/webfront/system/DeveloperReleaseData.hpp` is part of the release procedure ("Pinning a new version"): the header +is committed on a release branch before the tag, because the publication workflow requires it to match the build, and it +reaches the default branch only after the deployed files are verified, so that the default bootstrap never names an +archive that is unavailable. The header pins the exact environment archive and URL. The environment pins the starter archive in turn. `provision.json` is informational; applications do not discover a replacement trust hash from that remote file or follow `latest` at startup. diff --git a/test/unit/DeveloperTests.cpp b/test/unit/DeveloperTests.cpp index 766eaf5a..6af81c35 100644 --- a/test/unit/DeveloperTests.cpp +++ b/test/unit/DeveloperTests.cpp @@ -561,6 +561,31 @@ SCENARIO("New directories are durable once their parents are synchronized") { } } +namespace { +// Holds a thread at a step until opened. Opening is idempotent and also happens on destruction, so a failed +// assertion never leaves a thread blocked behind a future that waits for it. +class Gate { +public: + void open() { + std::call_once(once, [this] { opened.set_value(); }); + } + void wait() const { + future.wait(); + } + +private: + std::once_flag once; + std::promise opened; + std::shared_future future{opened.get_future().share()}; +}; +struct OpenOnExit { + Gate& gate; + ~OpenOnExit() { + gate.open(); + } +}; +} // namespace + SCENARIO("A second opener of the project waits for a publication in progress instead of abandoning it") { TemporaryDirectory project; { @@ -569,36 +594,46 @@ SCENARIO("A second opener of the project waits for a publication in progress ins publishFile(store, lockPath, "lock-1"); } GIVEN("a publication stopped between staging its files and writing its journal") { - std::promise reached; - std::promise release; - auto released = release.get_future().share(); + Gate reached; + Gate release; developer::Store publisher{project.path(), developer::defaultAbandonedAfter, [&](std::string_view name) { if (name == "before-journal") { - reached.set_value(); - released.wait(); + reached.open(); + release.wait(); } }}; - auto publication = std::async(std::launch::async, [&] { publishPair(publisher, "manifest-2", "lock-2", publisher.state(pair)); }); - reached.get_future().wait(); + const auto before = publisher.state(pair); + auto publication = std::async(std::launch::async, [&] { + try { + publishPair(publisher, "manifest-2", "lock-2", before); + } catch (...) { + reached.open(); // do not leave the test waiting for a step that is never reached + throw; + } + }); + const OpenOnExit unblock{release}; + reached.wait(); WHEN("another store, as another process would, opens the project meanwhile") { - auto opening = std::async(std::launch::async, [&] { developer::Store other{project.path()}; return projectState(other); }); - THEN("it waits, then sees the completed publication") { - REQUIRE(opening.wait_for(std::chrono::milliseconds(300)) == std::future_status::timeout); - release.set_value(); - publication.get(); + auto opening = std::async(std::launch::async, [&] { developer::Store other{project.path()}; return projectState(other); }); + const auto waiting = opening.wait_for(std::chrono::milliseconds(300)); + release.open(); + publication.get(); + THEN("it waited, then sees the completed publication") { + CHECK(waiting == std::future_status::timeout); REQUIRE(opening.get() == "manifest-2|lock-2"); } } - WHEN("another store tries to publish from the same state") { + WHEN("another store tries to publish from the state read before the first publication") { auto competing = std::async(std::launch::async, [&] { developer::Store other{project.path()}; - publishPair(other, "manifest-3", "lock-3", other.state(pair)); + publishPair(other, "manifest-3", "lock-3", before); }); + const auto waiting = competing.wait_for(std::chrono::milliseconds(300)); + release.open(); + publication.get(); THEN("its precondition is checked after the first publication, which wins") { - REQUIRE(competing.wait_for(std::chrono::milliseconds(300)) == std::future_status::timeout); - release.set_value(); - publication.get(); - REQUIRE_NOTHROW(competing.get()); + CHECK(waiting == std::future_status::timeout); + REQUIRE_THROWS_WITH(competing.get(), Catch::Matchers::ContainsSubstring("changed since it was read")); } } } From 2699fb2848e9e72bbdd5b013a4b64d4c6bcc071f Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 15:25:37 +0200 Subject: [PATCH 016/134] Add wf restore, the application registry precedence and the local npm registry fixture [#306] wf restore rebuilds the package cache from the lock alone, at the locked versions and SHA-512 integrities; --offline only checks the cache and lists missing or corrupted packages. Each cached package is followed by a record of its files' digests, written last. DeveloperBootstrapOptions::registry becomes optional and takes precedence over the manifest's registry; install and restore print the registry in use. The tests' local registry is generated reproducibly from pinned and synthetic packages. --- .github/workflows/DeveloperDistribution.yml | 2 +- docs/CHANGELOG.md | 10 + docs/DEVELOPER_ENVIRONMENT.md | 54 ++++- docs/PROJECT_STATUS.md | 3 +- ...-013-bootstrap-developpeur-a-la-demande.md | 5 + include/webfront/DeveloperApp.hpp | 23 ++- js/core/WebFrontAssets.cmake | 2 +- js/developer/environment/bundles.json | 16 +- js/developer/environment/cache.mjs | 53 +++++ js/developer/environment/installer.mjs | 44 ++-- js/developer/environment/lock.mjs | 1 + js/developer/environment/packages-entry.mjs | 2 + js/developer/environment/packages.bundle.mjs | 18 +- js/developer/environment/registry.mjs | 5 +- js/developer/environment/restore.mjs | 82 ++++++++ js/developer/environment/runtime.mjs | 18 +- js/developer/tools/build.mjs | 2 +- js/developer/tools/fixtures.mjs | 31 +-- js/developer/tools/manifest-check.mjs | 41 +--- js/developer/tools/memory-bridge.mjs | 45 +++++ js/developer/tools/registry-fixture-node.mjs | 28 +++ js/developer/tools/registry-fixture.mjs | 72 +++++++ js/developer/tools/restore-check.mjs | 188 ++++++++++++++++++ test/unit/DeveloperTests.cpp | 24 +++ test/web/developer-specs.mjs | 32 +++ 25 files changed, 677 insertions(+), 124 deletions(-) create mode 100644 js/developer/environment/cache.mjs create mode 100644 js/developer/environment/restore.mjs create mode 100644 js/developer/tools/memory-bridge.mjs create mode 100644 js/developer/tools/registry-fixture-node.mjs create mode 100644 js/developer/tools/registry-fixture.mjs create mode 100644 js/developer/tools/restore-check.mjs diff --git a/.github/workflows/DeveloperDistribution.yml b/.github/workflows/DeveloperDistribution.yml index 013c942e..d5ecebeb 100644 --- a/.github/workflows/DeveloperDistribution.yml +++ b/.github/workflows/DeveloperDistribution.yml @@ -67,7 +67,7 @@ jobs: else echo "::notice::Sources build $building; DeveloperReleaseData.hpp still pins the published $pinned." fi - node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs js/developer/tools/manifest-check.mjs + node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs js/developer/tools/manifest-check.mjs js/developer/tools/restore-check.mjs - name: Check the dedicated release tag if: startsWith(github.ref, 'refs/tags/developer-v') env: diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9349b036..f581825f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -12,9 +12,19 @@ manifest and lock through a synced intent journal with crash recovery and a concurrent-install precondition. New bridge callbacks `webfront.developer.state` and `webfront.developer.commitGroup`. Starters ship a manifest; `wf install` now needs `wf init` first. +- `wf restore [--offline]` (developer distribution 0.5.0): rebuilds the package cache from the lock alone, at the + locked versions and integrities, idempotent and interruptible; `--offline` only checks the cache and lists the + missing or corrupted packages. Cached packages carry a record of their files' digests. The registry is the + application's option, else the manifest's `registry`, else registry.npmjs.org; `wf install` and `wf restore` + print it with its origin. A reproducible local npm registry fixture (`js/developer/tools/registry-fixture.mjs`) + serves the tests. ### Changed +- `DeveloperBootstrapOptions::registry` is now `std::optional`: unset, the manifest's registry + applies; set, it must be HTTPS or a same-origin path and takes precedence over the manifest. The environment + configuration gains `registryExplicit`; earlier environments keep reading `registry`. + - **Breaking:** library headers moved to `include/webfront/`; include them as ``, ``, `` and so on. The former spellings (``, ``, ``) are removed with no redirect headers, so these generic names no longer diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 771b6ad7..c7a66f10 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -187,7 +187,42 @@ the fingerprint of both files as read when the command began: if another browser them meanwhile, it is refused with "The project changed since it was read; run the command again" and nothing is lost. Recovery and group publications also hold an advisory lock on `.webfront/developer/journal/.lock`, so several processes sharing a project (or several stores of one process) are serialized rather than abandoning one -another's publication; other project files stay unprotected against concurrent local modification. `wf restore` (#306) will fill the cache from a consistent lock without ever writing them. +another's publication; other project files stay unprotected against concurrent local modification. `wf restore` fills the cache from the lock without ever writing them. + +## Restoring the cache and choosing the registry (`wf restore`) + +The cache under `.webfront/developer/packages/` is not committed. On a new machine, after a clone, or +when it is damaged, `wf restore` rebuilds it from the lock alone: + +- each locked package is downloaded at its exact locked version (no range is resolved again) and checked + against the lock's SHA-512 integrity; packages already valid in the cache are not downloaded again, so the + command is idempotent; +- every package is published on its own: Ctrl+C or an error (changed archive, package absent from the + registry) keeps the packages already restored and never writes the manifest or the lock; run the command again; +- `wf restore --offline` contacts no registry at all: it checks the cache against the lock and fails with the + list of missing or corrupted packages, without downloading anything. + +Each cached package directory `/` is followed by a record `.json` naming the archive's integrity and the +SHA-256 of every file; the record is written last, so an interrupted copy is *missing*, and a file that differs +from its record is *corrupted*. `wf install` with a consistent lock performs the same restoration. + +The registry used by `wf install` and `wf restore` is, in order of precedence: + +1. the application's `DeveloperBootstrapOptions::registry` (the distributor's trusted channel; a test driver + uses it to impose its local registry), +2. the manifest's `registry`, +3. `https://registry.npmjs.org/`. + +Both commands print the registry in use and where it comes from, for example +`Registry: /mirror/ (application option)`. A registry must use HTTPS or be a path on the application's own +origin, like the environment archive; tarballs must use HTTPS or the registry's origin. The lock's `registry` +field records where the graph was resolved and is not used to restore it, so a mirror can serve a lock resolved +from the public registry. + +Offline provisioning, extending ADR-013's explicit local provisioning: serve a directory of packuments (``) +and tarballs from the application (`fs::NativeDebugFS` or an application provider) and pass its path as +`registry`, then run `wf restore`; or copy `.webfront/developer/packages/` from another machine and check it with +`wf restore --offline`. The environment archive is provisioned the same way (see below). ## Dependencies, storage and limitations @@ -203,8 +238,9 @@ another's publication; other project files stay unprotected against concurrent l - `webfront-packages.lock.json` records exact package versions, dependency edges, source integrities, requested roots and the digest of the manifest dependencies it resolved. Commit it and the source TSX/CSS; the generated provider can also be committed. Preview/embed consume the locked local files without resolving versions again. -- Unpacked packages are cached by name, version and integrity under `.webfront/developer/packages/`. - A failed install can leave unused cached packages, but the lock file remains unchanged. The tools +- Unpacked packages are cached by name, version and integrity under `.webfront/developer/packages/`, + each with a record of its files' digests. A failed install can leave unused cached packages, but the lock + file remains unchanged. A lock naming more than 512 packages is refused. The tools installed by the existing `ToolManager` keep their separate store and `webfront-tools.lock.json`. - Published environment/preview resources are served under `/webfront/developer/`. The protected `/WebFront.js` remains the library's version. Sources, staging and cached archives are not HTTP @@ -216,7 +252,7 @@ another's publication; other project files stay unprotected against concurrent l abandoned, and staging left by a crashed process is removed after an hour. Browser builds time out after 120 seconds. - Installing another package keeps every locked version that still satisfies a requested range and fails if its archive no longer matches the recorded integrity; only new ranges are resolved. Review the resulting lock - changes. Restoring packages from a lockfile on a fresh machine is not yet a separate command. + changes. `wf restore` rebuilds the cache of a lock on a fresh machine (see above). ## Environment distribution and offline tests (maintainers) @@ -252,8 +288,14 @@ The preview command later replaces that directory, but the verified archive is a independently for subsequent launches. These are maintainer provisioning commands; the application's terminal still installs and builds browser dependencies without a local Node/npm installation. -Fixture provisioning packs the pinned React, React DOM and scheduler sources from the maintainer's -npm installation into a fake local registry. No CTest case downloads from the public registry. +Fixture provisioning writes the tests' local npm registry (`js/developer/tools/registry-fixture.mjs`): +packuments and tarballs packed reproducibly from the pinned `jasmine-core`, React, React DOM and scheduler of the +maintainer's npm installation, plus synthetic packages for the edge cases (a newer version under a locked range, +an archive that no longer matches its integrity). The test application serves it from its own origin and imposes +it through the `registry` option. The CEF-off `DeveloperJavaScript` case generates the synthetic part in memory to +test `wf restore`. No CTest case downloads from the public registry. Generating the fixture and the packages' +logic use only browser APIs; reading `node_modules` and writing files (`registry-fixture-node.mjs`) are the +Node-only part, so that `wf` can take the fixture over (#318). ```sh cmake -S . -B build-native -DCMAKE_BUILD_TYPE=Release \ diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index e0b230ee..ec7f4ae2 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -126,7 +126,8 @@ Status snapshot: 2026-07-19. Optional mddlog integration note: 2026-10-02. Newco Pages returned HTTP 200, CORS `*` and byte-identical pinned environment data on 2026-10-20. - Browser packages only: no installation scripts, native modules, Node API shims, optional dependencies or TypeScript type checking. Peers require explicit compatible roots/direct - dependencies. Lockfile restore on a fresh machine and automatic rebuild/watch are future work. + dependencies. Automatic rebuild/watch is future work. `wf restore [--offline]` (0.5.0, #306) rebuilds or checks + the cache from the lock, from the application's registry option, else the manifest's, else npmjs. See [DEVELOPER_ENVIRONMENT](DEVELOPER_ENVIRONMENT.md) for exact commands and limits. ## Embedded dependency refresh (#284, 2026-10-19) diff --git a/docs/adr/ADR-013-bootstrap-developpeur-a-la-demande.md b/docs/adr/ADR-013-bootstrap-developpeur-a-la-demande.md index 89828e89..b5a04ee4 100644 --- a/docs/adr/ADR-013-bootstrap-developpeur-a-la-demande.md +++ b/docs/adr/ADR-013-bootstrap-developpeur-a-la-demande.md @@ -6,6 +6,7 @@ | --- | --- | --- | --- | --- | --- | | 0.1 | 2026-10-20 | Proposée | Ambroise Leclerc | Proposition et première implémentation du bootstrap développeur versionné. | À renseigner après intégration. | | 0.2 | 2026-10-22 | Proposée | Ambroise Leclerc | Alignement sur ADR-016 : la proposition devient la base de l'architecture ; preuves multiplateformes manquantes listées. | [404fed2](https://github.com/ambroise-leclerc/WebFront/commit/404fed2c2145d4faba8efee035e10522ff87a91f) | +| 0.3 | 2026-10-22 | Proposée | Ambroise Leclerc | Provisioning local des paquets (#306) : `wf restore [--offline]`, priorité du registre de l'application sur celui du manifeste. | À renseigner après intégration. | ## Statut et date @@ -60,6 +61,10 @@ trajectoire de retrait de l'ADR-016. - Exécuter une page distante avec le bridge : écarté ; l'environnement validé est servi localement. - Le premier lancement nécessite l'accès au dépôt ou un provisioning local explicite. Le cache vérifié autorise ensuite un lancement hors ligne. +- Les paquets suivent la même règle : `wf restore` reconstruit leur cache depuis le lock, depuis le + registre fixé par l'application (canal de confiance du distributeur), sinon celui du manifeste, sinon + registry.npmjs.org, toujours en HTTPS ou sur l'origine de l'application. Un registre servi par + l'application est leur provisioning local explicite ; `wf restore --offline` vérifie le cache sans réseau. - Le code téléchargé possède l'autorité du bridge et du projet autorisé ; ce n'est pas un sandbox. Le mode distribution n'active pas ces callbacks. Aucun accès au shell n'est ajouté. diff --git a/include/webfront/DeveloperApp.hpp b/include/webfront/DeveloperApp.hpp index 996d812a..3c7fbda7 100644 --- a/include/webfront/DeveloperApp.hpp +++ b/include/webfront/DeveloperApp.hpp @@ -5,6 +5,8 @@ #include "system/DeveloperReleaseData.hpp" #include "WebFront.hpp" +#include + namespace webfront { struct DeveloperBootstrapOptions { @@ -12,7 +14,10 @@ struct DeveloperBootstrapOptions { std::string environment; /// Trusted SHA-512 SRI of that exact tarball, supplied independently of its download. std::string integrity; - std::string registry{"https://registry.npmjs.org/"}; + /// npm registry chosen by the application: HTTPS, or a same-origin path such as "/registry/" for a + /// local mirror. It takes precedence over the project manifest's "registry"; unset, the manifest's + /// registry applies, else registry.npmjs.org. + std::optional registry{}; }; namespace developer { @@ -31,6 +36,19 @@ inline void validateBootstrap(std::string_view mode, const std::filesystem::path throw std::invalid_argument("Developer bootstrap requires an explicit project directory"); if (options.environment.empty() || !options.integrity.starts_with("sha512-")) throw std::invalid_argument("Developer bootstrap requires an environment URL and trusted SHA-512 integrity"); + if (options.registry && !options.registry->starts_with("https://") + && !(options.registry->starts_with('/') && !options.registry->starts_with("//"))) + throw std::invalid_argument("The developer registry must be an HTTPS URL or a same-origin path"); +} + +inline constexpr std::string_view defaultRegistry{"https://registry.npmjs.org/"}; + +/// The configuration the environment reads. "registry" always names a usable registry, for environments +/// that predate "registryExplicit"; the latter tells whether the application chose it. +inline std::string bootstrapConfig(const DeveloperBootstrapOptions& options) { + return "{\"environment\":" + json::quote(options.environment) + ",\"integrity\":" + json::quote(options.integrity) + + ",\"registry\":" + json::quote(options.registry.value_or(std::string(defaultRegistry))) + + ",\"registryExplicit\":" + (options.registry ? "true" : "false") + "}"; } } // namespace developer @@ -51,8 +69,7 @@ class BasicDeveloperApp : public BasicWF(project); - registerBridge("{\"environment\":" + json::quote(options.environment) + ",\"integrity\":" + json::quote(options.integrity) - + ",\"registry\":" + json::quote(options.registry) + "}"); + registerBridge(developer::bootstrapConfig(options)); } void show(std::string_view page = {}) { diff --git a/js/core/WebFrontAssets.cmake b/js/core/WebFrontAssets.cmake index 03dd8377..ac5ec6bb 100644 --- a/js/core/WebFrontAssets.cmake +++ b/js/core/WebFrontAssets.cmake @@ -102,7 +102,7 @@ function(webfront_add_embedded_assets) find_program(WEBFRONT_NODE_EXECUTABLE NAMES node nodejs REQUIRED) add_test(NAME DeveloperJavaScript COMMAND "${WEBFRONT_NODE_EXECUTABLE}" --test "${root}/js/developer/tools/check.mjs" "${root}/js/developer/tools/distribution-check.mjs" - "${root}/js/developer/tools/manifest-check.mjs") + "${root}/js/developer/tools/manifest-check.mjs" "${root}/js/developer/tools/restore-check.mjs") set_tests_properties(DeveloperJavaScript PROPERTIES TIMEOUT 30) add_test(NAME EmbeddedAssetGenerator COMMAND ${CMAKE_COMMAND} -E env "WEBFRONT_TEST_CMAKE=${CMAKE_COMMAND}" "${WEBFRONT_NODE_EXECUTABLE}" diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 0ea3f01e..b88dc483 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -1,23 +1,25 @@ { "js/developer/environment/manifest.mjs": "248e7cbe44dd71be514a57e3997860fb148d39e5fbf04b133e08f17dbc878a6a", "js/developer/environment/project.mjs": "d971b2c225179be7798a9c442a48006e1e9b7af56c329f325858dbd665fc351e", - "js/developer/environment/installer.mjs": "bfe47a54b65e7fbe37df2a21da8722f3d40ddaa903a25636bc51692a51b393ea", - "js/developer/environment/packages-entry.mjs": "7b5dc8aac408b741ccd3f9098165fca7645c4e88fd7ca7b8822fe37b7ad21fce", + "js/developer/environment/installer.mjs": "2b210c8c04e50cf5b96aa5621208f13a8b0238b1c65e34f7f700e1f6edd78044", + "js/developer/environment/restore.mjs": "bc5d8f576b83868df44d0b870fa7498a7346694a9e991ba2546862975bc4db56", + "js/developer/environment/cache.mjs": "8dd4f39926a2ce1195f1a0e0c418fd41e00a3091a6809929e69983f3cf33f860", + "js/developer/environment/packages-entry.mjs": "edf47d25099428ea8d33f9fe4552f239035715b98fd2bff6be0f9143ab0cfe8a", "js/developer/environment/bootstrap.mjs": "534af4b3d07891338c3390e1d5e06c2fb6dd8df11ca6547735565b17f1b9cd70", "js/developer/environment/bootstrap-entry.mjs": "ff8084f23f5acc721f97eb1ed0a454e7bfee1894de17d54f0100fa11f7ef8b77", "js/developer/environment/packages.mjs": "faed29500a34c6ce24756d07bd4b47b9168ccec4bd49d12f00096a869637d74d", "js/developer/environment/starter.mjs": "048cf2af36b407bc075323f78a1195b4be91ad7da51f6ce941d9fb230f314ff9", "js/developer/environment/paths.mjs": "6ebb626610756143c58762c87af18980802809d7f0f53d3b588e4b20e8db0161", - "js/developer/environment/runtime.mjs": "7181d01ece3ab790692165a1c269ef9be9798bc5c6730494d264ec693224149c", + "js/developer/environment/runtime.mjs": "114affccdfbe48eb2adebf60b9113ed6c4d22969299fd2484d07939483ed1ece", "js/developer/environment/compiler.mjs": "3f7e187ca9a4c2645ef3823127457cad655919cbea3c7c0f22fb7ae2cc87e0e5", "js/developer/environment/bundler.mjs": "b0ff79a1b0caa012c25ec7b7f121d7d50af1aa1651231d3dcf2f39470c4ea25c", "js/developer/environment/entry.mjs": "b2b942443e3c74ae2c008392ba244d9b7e91db70ba1b4ebbe1357c455ebf51bb", "js/developer/environment/conditions.mjs": "7f0ecba239480831e38985ccffd4c82309949924f4eb9d938e4ad1b09f5f36ed", "js/developer/environment/io.mjs": "21af39f07c7eb863908c1df768e3c31de1c6eb8ff757c2a287c4a47c76855db6", "js/developer/environment/recipe.mjs": "5e7b80cb9090dce63fafafbb852879fce9f6ed2399ac364bbe5af1cf6f4c1758", - "js/developer/environment/registry.mjs": "f566f07ea066155ab7209d925cee2cf12a664ac51b07bc0ca3e3fd8fde49a9c8", + "js/developer/environment/registry.mjs": "31ce38b38ba3e48a31d5ef87dda7f169fd272a11eafff45d5277ae8ed59569fe", "js/developer/environment/archive.mjs": "1fb8b9c3c27219858597801104639bba1104c7a7d33973609cd556b5e5f81d2d", - "js/developer/environment/lock.mjs": "60d0ea14d24793cd5e85bbd4bb4bfe90d2c7d76c0d20ffc99f462595a6e57291", + "js/developer/environment/lock.mjs": "d69a3a877b92da52b21dcc78877345015ac31b7dec1c484ee1ff1f97f154d51f", "js/developer/environment/pins.mjs": "df07f6f01edaf86a1052d0e76f6c6745cb6e7a3309bbd256ac720ee8adc85297", "js/developer/environment/peers.mjs": "e1d999892138682fc0134ef1f4d4b19b9a9ad8d7fb16e37fc9c6c684bd853896", "js/developer/environment/resolve.mjs": "8b96b850af215be51f5cb85cc9c69e057afa04dfb8a57e572620c07059c17fa3", @@ -28,11 +30,11 @@ "examples/life/ui/style.css": "9bb55eb0f0a3287e5b7dc78af9d69608b87ff42c4d9c8a653bc83a52fe293c44", "js/developer/components/tools/wf.mjs": "2a8b463b2da223deb8d54d9fdd6037fdd079afeb24e39337693df03cdbcbd0ec", "js/developer/tools/distribution.json": "12b40657d1bc34c4093cd5f793d772bf3fa6fd8615ab7b766ad1756092438f83", - "js/developer/tools/build.mjs": "70ae5acdcd08dcde777c042d1b27f384746530ba97f89a81a91d04c5bd4c8e66", + "js/developer/tools/build.mjs": "3579b0adb2dd92f2cf06874697efa5cf44e1fe80782633b923e9b2a06a8d2123", "js/developer/tools/site.mjs": "1827d3fd7e1e470336aab25ea8686c912c2b674a10f7be496f2f0077fbc45292", "js/developer/tools/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b", "js/developer/vendor/package-lock.json": "eb545112b672f9dbf520125df1f44a878d62cc8e611f0e33baee36470ded4dec", "js/core/bootstrap/bootstrap.bundle.mjs": "792fe7cf564bd12ac47fef419d8c71e2070925764a17706552e7d3f5d6ba2181", - "js/developer/environment/packages.bundle.mjs": "b15d96e360d6bc10f6d94c549c6e8f121d4196c87be8236937be0be11257b564", + "js/developer/environment/packages.bundle.mjs": "d5e74654b7e0eaf8e2392ffa967782bc014182805e88499c1d85a104eb9801b2", "include/webfront/system/DeveloperReleaseData.hpp": "c97a8c3b21df3306c179f7b46d945159b5854f9d2810f135a4ab224c768c75d7" } diff --git a/js/developer/environment/cache.mjs b/js/developer/environment/cache.mjs new file mode 100644 index 00000000..a6d952a4 --- /dev/null +++ b/js/developer/environment/cache.mjs @@ -0,0 +1,53 @@ +// The package cache: one directory per locked archive, then a record of its files' digests. The record is written +// last, so a package without one (an interrupted store) is missing, and files differing from it are corrupted. +import {publish, readProject} from './io.mjs'; +import {isPlainObject} from './entry.mjs'; +import {packageRoot} from './project.mjs'; + +export const packageDirectory = node => `${packageRoot}/${node.key}`; +export const recordPath = node => `${packageRoot}/${node.key}.json`; + +const encoder = new TextEncoder(); +const decoder = new TextDecoder(); +const unreadable = error => error.message.includes('Cannot read project file:'); + +async function sha256(bytes) { + const digest = new Uint8Array(await crypto.subtle.digest('SHA-256', bytes)); + return [...digest].map(byte => byte.toString(16).padStart(2, '0')).join(''); +} + +/** Publishes a verified archive's files, then the record that makes them a cached package. */ +export async function storePackage(bridge, node, files, {signal} = {}) { + const digests = {}; + for (const path of [...files.keys()].sort()) digests[path] = await sha256(files.get(path)); + await publish(bridge, packageDirectory(node), files, {signal}); + const record = JSON.stringify({format: 1, integrity: node.integrity, files: digests}, null, 2) + '\n'; + await publish(bridge, recordPath(node), new Map([['output', encoder.encode(record)]]), {directory: false, signal}); +} + +async function readRecord(bridge, node) { + try { return JSON.parse(decoder.decode(await readProject(bridge, recordPath(node)))); } + catch (error) { return unreadable(error) ? null : {}; } +} + +const sameFiles = (record, node) => Object.keys(record.files).sort().join('\n') === [...node.files].sort().join('\n'); + +async function fileMatches(bridge, node, path, digest) { + try { return await sha256(await readProject(bridge, `${packageDirectory(node)}/${path}`)) === digest; } + catch (error) { + if (unreadable(error)) return false; + throw error; + } +} + +/** 'valid', 'missing' or 'corrupted': the cached files of a locked package, checked against its record. */ +export async function cacheState(bridge, node, {signal} = {}) { + const record = await readRecord(bridge, node); + if (!record) return 'missing'; + if (record.integrity !== node.integrity || !isPlainObject(record.files) || !sameFiles(record, node)) return 'corrupted'; + for (const path of node.files) { + signal?.throwIfAborted(); + if (!await fileMatches(bridge, node, path, record.files[path])) return 'corrupted'; + } + return 'valid'; +} diff --git a/js/developer/environment/installer.mjs b/js/developer/environment/installer.mjs index 2a2bb736..f790d350 100644 --- a/js/developer/environment/installer.mjs +++ b/js/developer/environment/installer.mjs @@ -1,9 +1,11 @@ // wf init and wf install: the manifest states the intent, the lock the exact resolution; both are published together. import {resolvePackages, downloadPackage} from './packages.mjs'; -import {publish, readProject} from './io.mjs'; +import {publish} from './io.mjs'; import {safePackagePath} from './paths.mjs'; import {manifestPath, newManifest, manifestName, serializeManifest, dependenciesDigest} from './manifest.mjs'; -import {loadProject, publishTogether, lockPath, packageRoot, noManifest, desynchronized, textBytes} from './project.mjs'; +import {loadProject, publishTogether, lockPath, noManifest, desynchronized, textBytes} from './project.mjs'; +import {storePackage} from './cache.mjs'; +import {restorePackages, usableRegistry, describeRegistry} from './restore.mjs'; const splitSpec = spec => { const at = spec.indexOf('@', spec.startsWith('@') ? 1 : 0); @@ -54,31 +56,10 @@ async function resolveLock(dependencies, previous, options) { async function storePackages(bridge, lock, downloads, {signal, progress}) { for (const [id, files] of downloads) { progress(`Storing ${id}`); - await publish(bridge, `${packageRoot}/${lock.packages[id].key}`, files, {signal}); + await storePackage(bridge, lock.packages[id], files, {signal}); } } -async function isCached(bridge, node) { - try { await readProject(bridge, `${packageRoot}/${node.key}/package.json`); return true; } - catch { return false; } -} - -// npm ci: exactly the locked graph, every archive checked against the recorded integrity. Nothing is resolved or written -// besides the cache. -async function restoreLocked(bridge, lock, {signal, progress, fetchImpl}) { - let restored = 0; - for (const [id, node] of Object.entries(lock.packages)) { - signal?.throwIfAborted(); - if (await isCached(bridge, node)) continue; - progress(`Restoring ${id}`); - const pkg = await downloadPackage(node.name, node.version, {registry: lock.registry, fetchImpl, signal}); - if (pkg.integrity !== node.integrity) throw new Error(`${id} no longer matches the integrity recorded in the lock`); - await publish(bridge, `${packageRoot}/${node.key}`, pkg.files, {signal}); - restored++; - } - return restored; -} - function parseOptions(args) { const update = args.includes('--update'); const specs = args.filter(arg => arg !== '--update'); @@ -99,16 +80,21 @@ const withDigest = async (lock, dependencies) => ({format: lock.format, manifest * wf install: the locked graph exactly when the lock agrees with the manifest; resolves it when there is no lock. * wf install --update: resolves the manifest again, keeping nothing from the lock. */ -export async function install(bridge, args, {registry, signal, progress = () => {}, fetchImpl = fetch}) { +export async function install(bridge, args, {registry, registryExplicit, signal, progress = () => {}, fetchImpl = fetch}) { const {update, specs} = parseOptions(args); const project = await loadProject(bridge); if (!project.manifest) throw new Error(noManifest); - const options = {registry: project.manifest.registry ?? registry, signal, fetchImpl, progress}; + const effective = usableRegistry({registry, registryExplicit}, project.manifest); + const options = {registry: effective.url, signal, fetchImpl, progress}; if (specs.length && update) throw new Error('Usage: wf install --update does not take packages'); if (specs.length && project.status === 'desynchronized') throw new Error(desynchronized); if (!specs.length && !update && project.status === 'desynchronized') throw new Error(desynchronized); - if (!specs.length && !update && project.status === 'consistent') - return {lock: project.lock, restored: await restoreLocked(bridge, project.lock, {signal, progress, fetchImpl: options.fetchImpl})}; + progress(describeRegistry(effective)); + // npm ci: exactly the locked graph, every archive checked against the recorded integrity. + if (!specs.length && !update && project.status === 'consistent') { + const {restored} = await restorePackages(bridge, project.lock, options); + return {lock: project.lock, restored, registry: effective}; + } const request = requestedDependencies(project.manifest, specs); // --update ignores the locked versions; installing a package keeps the others where they are. const previous = project.status === 'consistent' && !update ? project.lock : undefined; @@ -119,5 +105,5 @@ export async function install(bridge, args, {registry, signal, progress = () => const lock = await withDigest(resolved.lock, dependencies); const manifest = specs.length ? {...project.manifest, dependencies} : null; await publishResolution(bridge, project, {manifest, lock}, {signal}); - return {lock, restored: 0}; + return {lock, restored: 0, registry: effective}; } diff --git a/js/developer/environment/lock.mjs b/js/developer/environment/lock.mjs index 6b06f858..dcacafec 100644 --- a/js/developer/environment/lock.mjs +++ b/js/developer/environment/lock.mjs @@ -28,6 +28,7 @@ function hasLockShape(lock) { export function validateLock(lock) { if (!hasLockShape(lock)) throw new Error('Unsupported package lock'); + if (Object.keys(lock.packages).length > 512) throw new Error('The package lock exceeds 512 packages'); for (const [id, node] of Object.entries(lock.packages)) validateNode(lock, id, node); if (Object.values(lock.roots).some(root => !lock.packages[root.id])) throw new Error('Dangling locked root'); return lock; diff --git a/js/developer/environment/packages-entry.mjs b/js/developer/environment/packages-entry.mjs index 933bbd76..60120139 100644 --- a/js/developer/environment/packages-entry.mjs +++ b/js/developer/environment/packages-entry.mjs @@ -3,3 +3,5 @@ export * from './packages.mjs'; export * from './manifest.mjs'; export * from './project.mjs'; export * from './installer.mjs'; +export * from './restore.mjs'; +export * from './cache.mjs'; diff --git a/js/developer/environment/packages.bundle.mjs b/js/developer/environment/packages.bundle.mjs index ab176f1c..15ff9ae9 100644 --- a/js/developer/environment/packages.bundle.mjs +++ b/js/developer/environment/packages.bundle.mjs @@ -1,7 +1,13 @@ -var on=Object.create;var Ve=Object.defineProperty;var an=Object.getOwnPropertyDescriptor;var cn=Object.getOwnPropertyNames;var ln=Object.getPrototypeOf,un=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var fn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of cn(t))!un.call(e,s)&&s!==r&&Ve(e,s,{get:()=>t[s],enumerable:!(n=an(t,s))||n.enumerable});return e};var B=(e,t,r)=>(r=e!=null?on(ln(e)):{},fn(t||!e||!e.__esModule?Ve(r,"default",{value:e,enumerable:!0}):r,e));var j=m((ha,Je)=>{"use strict";var wn="2.0.0",$n=Number.MAX_SAFE_INTEGER||9007199254740991,gn=16,yn=250,Rn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Je.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:gn,MAX_SAFE_BUILD_LENGTH:yn,MAX_SAFE_INTEGER:$n,RELEASE_TYPES:Rn,SEMVER_SPEC_VERSION:wn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var C=m((da,Ze)=>{"use strict";var In=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Ze.exports=In});var k=m((N,Ke)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Ee,MAX_SAFE_BUILD_LENGTH:On,MAX_LENGTH:Ln}=j(),Sn=C();N=Ke.exports={};var Nn=N.re=[],xn=N.safeRe=[],l=N.src=[],vn=N.safeSrc=[],u=N.t={},An=0,we="[a-zA-Z0-9-]",Tn=[["\\s",1],["\\d",Ln],[we,On]],bn=e=>{for(let[t,r]of Tn)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},E=(e,t,r)=>{let n=bn(t),s=An++;Sn(e,s,t),u[e]=s,l[s]=t,vn[s]=n,Nn[s]=new RegExp(t,r?"g":void 0),xn[s]=new RegExp(n,r?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${we}*`);E("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${we}+`);E("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`);E("FULL",`^${l[u.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`);E("LOOSE",`^${l[u.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`);E("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Ee}})(?:\\.(\\d{1,${Ee}}))?(?:\\.(\\d{1,${Ee}}))?`);E("COERCE",`${l[u.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",l[u.COERCEPLAIN]+`(?:${l[u.PRERELEASE]})?(?:${l[u.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",l[u.COERCE],!0);E("COERCERTLFULL",l[u.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0);N.tildeTrimReplace="$1~";E("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0);N.caretTrimReplace="$1^";E("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0);N.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var H=m((ma,Qe)=>{"use strict";var kn=Object.freeze({loose:!0}),Pn=Object.freeze({}),qn=e=>e?typeof e!="object"?kn:e:Pn;Qe.exports=qn});var $e=m((Ea,rt)=>{"use strict";var et=/^[0-9]+$/,tt=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:ett(t,e);rt.exports={compareIdentifiers:tt,rcompareIdentifiers:jn}});var y=m((wa,st)=>{"use strict";var W=C(),{MAX_LENGTH:nt,MAX_SAFE_INTEGER:Y}=j(),{safeRe:J,t:Z}=k(),Cn=H(),{compareIdentifiers:ge}=$e(),ye=class e{constructor(t,r){if(r=Cn(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>nt)throw new TypeError(`version is longer than ${nt} characters`);W("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?J[Z.LOOSE]:J[Z.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Y||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Y||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Y||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let i=+s;if(i>=0&&it.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(W("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ge(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(W("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ge(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?J[Z.PRERELEASELOOSE]:J[Z.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let i=[r,s];n===!1&&(i=[r]),ge(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};st.exports=ye});var b=m(($a,ot)=>{"use strict";var it=y(),Dn=(e,t,r=!1)=>{if(e instanceof it)return e;try{return new it(e,t)}catch(n){if(!r)return null;throw n}};ot.exports=Dn});var ct=m((ga,at)=>{"use strict";var Un=b(),Fn=(e,t)=>{let r=Un(e,t);return r?r.version:null};at.exports=Fn});var ut=m((ya,lt)=>{"use strict";var Gn=b(),zn=(e,t)=>{let r=Gn(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};lt.exports=zn});var ht=m((Ra,pt)=>{"use strict";var ft=y(),Xn=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new ft(e instanceof ft?e.version:e,r).inc(t,n,s).version}catch{return null}};pt.exports=Xn});var Et=m((Ia,mt)=>{"use strict";var dt=b(),Vn=(e,t)=>{let r=dt(e,null,!0),n=dt(t,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let h=c?"pre":"";return r.major!==n.major?h+"major":r.minor!==n.minor?h+"minor":r.patch!==n.patch?h+"patch":"prerelease"};mt.exports=Vn});var $t=m((Oa,wt)=>{"use strict";var Mn=y(),_n=(e,t)=>new Mn(e,t).major;wt.exports=_n});var yt=m((La,gt)=>{"use strict";var Bn=y(),Hn=(e,t)=>new Bn(e,t).minor;gt.exports=Hn});var It=m((Sa,Rt)=>{"use strict";var Wn=y(),Yn=(e,t)=>new Wn(e,t).patch;Rt.exports=Yn});var Lt=m((Na,Ot)=>{"use strict";var Jn=b(),Zn=(e,t)=>{let r=Jn(e,t);return r&&r.prerelease.length?r.prerelease:null};Ot.exports=Zn});var L=m((xa,Nt)=>{"use strict";var St=y(),Kn=(e,t,r)=>new St(e,r).compare(new St(t,r));Nt.exports=Kn});var vt=m((va,xt)=>{"use strict";var Qn=L(),es=(e,t,r)=>Qn(t,e,r);xt.exports=es});var Tt=m((Aa,At)=>{"use strict";var ts=L(),rs=(e,t)=>ts(e,t,!0);At.exports=rs});var K=m((Ta,kt)=>{"use strict";var bt=y(),ns=(e,t,r)=>{let n=new bt(e,r),s=new bt(t,r);return n.compare(s)||n.compareBuild(s)};kt.exports=ns});var qt=m((ba,Pt)=>{"use strict";var ss=K(),is=(e,t)=>e.sort((r,n)=>ss(r,n,t));Pt.exports=is});var Ct=m((ka,jt)=>{"use strict";var os=K(),as=(e,t)=>e.sort((r,n)=>os(n,r,t));jt.exports=as});var D=m((Pa,Dt)=>{"use strict";var cs=L(),ls=(e,t,r)=>cs(e,t,r)>0;Dt.exports=ls});var Q=m((qa,Ut)=>{"use strict";var us=L(),fs=(e,t,r)=>us(e,t,r)<0;Ut.exports=fs});var Re=m((ja,Ft)=>{"use strict";var ps=L(),hs=(e,t,r)=>ps(e,t,r)===0;Ft.exports=hs});var Ie=m((Ca,Gt)=>{"use strict";var ds=L(),ms=(e,t,r)=>ds(e,t,r)!==0;Gt.exports=ms});var ee=m((Da,zt)=>{"use strict";var Es=L(),ws=(e,t,r)=>Es(e,t,r)>=0;zt.exports=ws});var te=m((Ua,Xt)=>{"use strict";var $s=L(),gs=(e,t,r)=>$s(e,t,r)<=0;Xt.exports=gs});var Oe=m((Fa,Vt)=>{"use strict";var ys=Re(),Rs=Ie(),Is=D(),Os=ee(),Ls=Q(),Ss=te(),Ns=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return ys(e,r,n);case"!=":return Rs(e,r,n);case">":return Is(e,r,n);case">=":return Os(e,r,n);case"<":return Ls(e,r,n);case"<=":return Ss(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};Vt.exports=Ns});var _t=m((Ga,Mt)=>{"use strict";var xs=y(),vs=b(),{safeRe:re,t:ne}=k(),As=(e,t)=>{if(e instanceof xs)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?re[ne.COERCEFULL]:re[ne.COERCE]);else{let c=t.includePrerelease?re[ne.COERCERTLFULL]:re[ne.COERCERTL],f;for(;(f=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||f.index+f[0].length!==r.index+r[0].length)&&(r=f),c.lastIndex=f.index+f[1].length+f[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return vs(`${n}.${s}.${i}${o}${a}`,t)};Mt.exports=As});var Ht=m((za,Bt)=>{"use strict";var Le=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};Bt.exports=Le});var S=m((Xa,Zt)=>{"use strict";var Ts=/\s+/g,Se=class e{constructor(t,r){if(r=ks(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Ne)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(Ts," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!Yt(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&Fs(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&Ds)|(this.options.loose&&Us))+":"+t,s=Wt.get(n);if(s)return s;let i=this.options.loose,o=i?I[R.HYPHENRANGELOOSE]:I[R.HYPHENRANGE];t=t.replace(o,Ys(this.options.includePrerelease)),$("hyphen replace",t),t=t.replace(I[R.COMPARATORTRIM],qs),$("comparator trim",t),t=t.replace(I[R.TILDETRIM],js),$("tilde trim",t),t=t.replace(I[R.CARETTRIM],Cs),$("caret trim",t);let a=t.split(" ").map(p=>Gs(p,this.options)).join(" ").split(/\s+/).map(p=>Ws(p,this.options));i&&(a=a.filter(p=>($("loose invalid filter",p,this.options),!!p.match(I[R.COMPARATORLOOSE])))),$("range list",a);let c=new Map,f=a.map(p=>new Ne(p,this.options));for(let p of f){if(Yt(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let h=[...c.values()];return Wt.set(n,h),h}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>Jt(n,r)&&t.set.some(s=>Jt(s,r)&&n.every(i=>s.every(o=>i.intersects(o,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new Ps(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",Fs=e=>e.value==="",Jt=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(i=>s.intersects(i,t)),s=n.pop();return r},Gs=(e,t)=>(e=e.replace(I[R.BUILD],""),$("comp",e,t),e=Vs(e,t),$("caret",e),e=zs(e,t),$("tildes",e),e=_s(e,t),$("xrange",e),e=Hs(e,t),$("stars",e),e),O=e=>!e||e.toLowerCase()==="x"||e==="*",zs=(e,t)=>e.trim().split(/\s+/).map(r=>Xs(r,t)).join(" "),Xs=(e,t)=>{let r=t.loose?I[R.TILDELOOSE]:I[R.TILDE];return e.replace(r,(n,s,i,o,a)=>{$("tilde",e,n,s,i,o,a);let c;return O(s)?c="":O(i)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:O(o)?c=`>=${s}.${i}.0 <${s}.${+i+1}.0-0`:a?($("replaceTilde pr",a),c=`>=${s}.${i}.${o}-${a} <${s}.${+i+1}.0-0`):c=`>=${s}.${i}.${o} <${s}.${+i+1}.0-0`,$("tilde return",c),c})},Vs=(e,t)=>e.trim().split(/\s+/).map(r=>Ms(r,t)).join(" "),Ms=(e,t)=>{$("caret",e,t);let r=t.loose?I[R.CARETLOOSE]:I[R.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,c)=>{$("caret",e,s,i,o,a,c);let f;return O(i)?f="":O(o)?f=`>=${i}.0.0${n} <${+i+1}.0.0-0`:O(a)?i==="0"?f=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`:c?($("replaceCaret pr",c),i==="0"?o==="0"?f=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):($("no pr"),i==="0"?o==="0"?f=`>=${i}.${o}.${a}${n} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}${n} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),$("caret return",f),f})},_s=(e,t)=>($("replaceXRanges",e,t),e.split(/\s+/).map(r=>Bs(r,t)).join(" ")),Bs=(e,t)=>{e=e.trim();let r=t.loose?I[R.XRANGELOOSE]:I[R.XRANGE];return e.replace(r,(n,s,i,o,a,c)=>{$("xRange",e,n,s,i,o,a,c);let f=O(i),h=f||O(o),p=h||O(a),w=p;return s==="="&&w&&(s=""),c=t.includePrerelease?"-0":"",f?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&w?(h&&(o=0),a=0,s===">"?(s=">=",h?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):s==="<="&&(s="<",h?i=+i+1:o=+o+1),s==="<"&&(c="-0"),n=`${s+i}.${o}.${a}${c}`):h?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:p&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),$("xRange return",n),n})},Hs=(e,t)=>($("replaceStars",e,t),e.trim().replace(I[R.STAR],"")),Ws=(e,t)=>($("replaceGTE0",e,t),e.trim().replace(I[t.includePrerelease?R.GTE0PRE:R.GTE0],"")),Ys=e=>(t,r,n,s,i,o,a,c,f,h,p,w)=>(O(n)?r="":O(s)?r=`>=${n}.0.0${e?"-0":""}`:O(i)?r=`>=${n}.${s}.0${e?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,O(f)?c="":O(h)?c=`<${+f+1}.0.0-0`:O(p)?c=`<${f}.${+h+1}.0-0`:w?c=`<=${f}.${h}.${p}-${w}`:e?c=`<${f}.${h}.${+p+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),Js=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var U=m((Va,nr)=>{"use strict";var F=Symbol("SemVer ANY"),Ae=class e{static get ANY(){return F}constructor(t,r){if(r=Kt(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),ve("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===F?this.value="":this.value=this.operator+this.semver.version,ve("comp",this)}parse(t){let r=this.options.loose?Qt[er.COMPARATORLOOSE]:Qt[er.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new tr(n[2],this.options.loose):this.semver=F}toString(){return this.value}test(t){if(ve("Comparator.test",t,this.options.loose),this.semver===F||t===F)return!0;if(typeof t=="string")try{t=new tr(t,this.options)}catch{return!1}return xe(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new rr(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new rr(this.value,r).test(t.semver):(r=Kt(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||xe(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||xe(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};nr.exports=Ae;var Kt=H(),{safeRe:Qt,t:er}=k(),xe=Oe(),ve=C(),tr=y(),rr=S()});var G=m((Ma,sr)=>{"use strict";var Zs=S(),Ks=(e,t,r)=>{try{t=new Zs(t,r)}catch{return!1}return t.test(e)};sr.exports=Ks});var or=m((_a,ir)=>{"use strict";var Qs=S(),ei=(e,t)=>new Qs(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));ir.exports=ei});var cr=m((Ba,ar)=>{"use strict";var ti=y(),ri=S(),ni=(e,t,r)=>{let n=null,s=null,i=null;try{i=new ri(t,r)}catch{return null}return e.forEach(o=>{i.test(o)&&(!n||s.compare(o)===-1)&&(n=o,s=new ti(n,r))}),n};ar.exports=ni});var ur=m((Ha,lr)=>{"use strict";var si=y(),ii=S(),oi=(e,t,r)=>{let n=null,s=null,i=null;try{i=new ii(t,r)}catch{return null}return e.forEach(o=>{i.test(o)&&(!n||s.compare(o)===1)&&(n=o,s=new si(n,r))}),n};lr.exports=oi});var hr=m((Wa,pr)=>{"use strict";var Te=y(),ai=S(),fr=D(),ci=(e,t)=>{e=new ai(e,t);let r=new Te("0.0.0");if(e.test(r)||(r=new Te("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let a=new Te(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||fr(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||fr(r,i))&&(r=i)}return r&&e.test(r)?r:null};pr.exports=ci});var mr=m((Ya,dr)=>{"use strict";var li=S(),ui=(e,t)=>{try{return new li(e,t).range||"*"}catch{return null}};dr.exports=ui});var se=m((Ja,gr)=>{"use strict";var fi=y(),$r=U(),{ANY:pi}=$r,hi=S(),di=G(),Er=D(),wr=Q(),mi=te(),Ei=ee(),wi=(e,t,r,n)=>{e=new fi(e,n),t=new hi(t,n);let s,i,o,a,c;switch(r){case">":s=Er,i=mi,o=wr,a=">",c=">=";break;case"<":s=wr,i=Ei,o=Er,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(di(e,t,n))return!1;for(let f=0;f{d.semver===pi&&(d=new $r(">=0.0.0")),p=p||d,w=w||d,s(d.semver,p.semver,n)?p=d:o(d.semver,w.semver,n)&&(w=d)}),p.operator===a||p.operator===c||(!w.operator||w.operator===a)&&i(e,w.semver))return!1;if(w.operator===c&&o(e,w.semver))return!1}return!0};gr.exports=wi});var Rr=m((Za,yr)=>{"use strict";var $i=se(),gi=(e,t,r)=>$i(e,t,">",r);yr.exports=gi});var Or=m((Ka,Ir)=>{"use strict";var yi=se(),Ri=(e,t,r)=>yi(e,t,"<",r);Ir.exports=Ri});var Nr=m((Qa,Sr)=>{"use strict";var Lr=S(),Ii=(e,t,r)=>(e=new Lr(e,r),t=new Lr(t,r),e.intersects(t,r));Sr.exports=Ii});var vr=m((ec,xr)=>{"use strict";var Oi=G(),Li=L();xr.exports=(e,t,r)=>{let n=[],s=null,i=null,o=e.sort((h,p)=>Li(h,p,r));for(let h of o)Oi(h,t,r)?(i=h,s||(s=h)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);let a=[];for(let[h,p]of n)h===p?a.push(h):!p&&h===o[0]?a.push("*"):p?h===o[0]?a.push(`<=${p}`):a.push(`${h} - ${p}`):a.push(`>=${h}`);let c=a.join(" || "),f=typeof t.raw=="string"?t.raw:String(t);return c.length{"use strict";var Ar=S(),ke=U(),{ANY:be}=ke,z=G(),Pe=L(),Si=(e,t,r={})=>{if(e===t)return!0;e=new Ar(e,r),t=new Ar(t,r);let n=!1;e:for(let s of e.set){for(let i of t.set){let o=xi(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},Ni=[new ke(">=0.0.0-0")],Tr=[new ke(">=0.0.0")],xi=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===be){if(t.length===1&&t[0].semver===be)return!0;r.includePrerelease?e=Ni:e=Tr}if(t.length===1&&t[0].semver===be){if(r.includePrerelease)return!0;t=Tr}let n=new Set,s,i;for(let d of e)d.operator===">"||d.operator===">="?s=br(s,d,r):d.operator==="<"||d.operator==="<="?i=kr(i,d,r):n.add(d.semver);if(n.size>1)return null;let o;if(s&&i){if(o=Pe(s.semver,i.semver,r),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let d of n){if(s&&!z(d,String(s),r)||i&&!z(d,String(i),r))return null;for(let _ of t)if(!z(d,String(_),r))return!1;return!0}let a,c,f,h,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,w=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let d of t){if(h=h||d.operator===">"||d.operator===">=",f=f||d.operator==="<"||d.operator==="<=",s){if(w&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===w.major&&d.semver.minor===w.minor&&d.semver.patch===w.patch&&(w=!1),d.operator===">"||d.operator===">="){if(a=br(s,d,r),a===d&&a!==s)return!1}else if(s.operator===">="&&!z(s.semver,String(d),r))return!1}if(i){if(p&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===p.major&&d.semver.minor===p.minor&&d.semver.patch===p.patch&&(p=!1),d.operator==="<"||d.operator==="<="){if(c=kr(i,d,r),c===d&&c!==i)return!1}else if(i.operator==="<="&&!z(i.semver,String(d),r))return!1}if(!d.operator&&(i||s)&&o!==0)return!1}return!(s&&f&&!i&&o!==0||i&&h&&!s&&o!==0||w||p)},br=(e,t,r)=>{if(!e)return t;let n=Pe(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},kr=(e,t,r)=>{if(!e)return t;let n=Pe(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};Pr.exports=Si});var X=m((rc,Dr)=>{"use strict";var qe=k(),jr=j(),vi=y(),Cr=$e(),Ai=b(),Ti=ct(),bi=ut(),ki=ht(),Pi=Et(),qi=$t(),ji=yt(),Ci=It(),Di=Lt(),Ui=L(),Fi=vt(),Gi=Tt(),zi=K(),Xi=qt(),Vi=Ct(),Mi=D(),_i=Q(),Bi=Re(),Hi=Ie(),Wi=ee(),Yi=te(),Ji=Oe(),Zi=_t(),Ki=U(),Qi=S(),eo=G(),to=or(),ro=cr(),no=ur(),so=hr(),io=mr(),oo=se(),ao=Rr(),co=Or(),lo=Nr(),uo=vr(),fo=qr();Dr.exports={parse:Ai,valid:Ti,clean:bi,inc:ki,diff:Pi,major:qi,minor:ji,patch:Ci,prerelease:Di,compare:Ui,rcompare:Fi,compareLoose:Gi,compareBuild:zi,sort:Xi,rsort:Vi,gt:Mi,lt:_i,eq:Bi,neq:Hi,gte:Wi,lte:Yi,cmp:Ji,coerce:Zi,Comparator:Ki,Range:Qi,satisfies:eo,toComparators:to,maxSatisfying:ro,minSatisfying:no,minVersion:so,validRange:io,outside:oo,gtr:ao,ltr:co,intersects:lo,simplifyRange:uo,subset:fo,SemVer:vi,re:qe.re,src:qe.src,tokens:qe.t,SEMVER_SPEC_VERSION:jr.SEMVER_SPEC_VERSION,RELEASE_TYPES:jr.RELEASE_TYPES,compareIdentifiers:Cr.compareIdentifiers,rcompareIdentifiers:Cr.rcompareIdentifiers}});var me=new TextDecoder;function _e(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function Be(e,t){let r=String(t??"").split(/\s+/).filter(i=>i.startsWith("sha512-")).map(i=>i.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,i=>String.fromCharCode(i)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function He(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let i=await r.read();!i.done;i=await r.read()){if(s+=i.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(i.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function q(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return me.decode(s<0?n:n.subarray(0,s))}function We(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,i)=>s*256+i,e[t]&127);let n=q(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function pn(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if(We(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function hn(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let i=me.decode(e.subarray(n+1,r+s-1)),o=i.indexOf("=");t[i.slice(0,o)]=i.slice(o+1),r+=s}return t}function dn(e,t){let r=e.subarray(t,t+512);pn(r);let n=We(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function mn(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function En(e){let t=q(e,0,100),r=q(e,257,5)==="ustar"?q(e,345,155):"";return r?`${r}/${t}`:t}var Me={x:(e,t)=>({...e,pax:hn(t).path}),L:(e,t)=>({...e,long:q(t,0,t.length)}),g:e=>e};function Ye(e){let t=[],r={};for(let n=0;!mn(e,n);){let{header:s,type:i,data:o,next:a}=dn(e,n);if(n=a,Object.hasOwn(Me,i)){r=Me[i](r,o);continue}(i==="0"||i==="7")&&t.push({path:r.pax??r.long??En(s),bytes:o}),r={}}return t}var ae=B(X(),1);var x=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function ie(e,t){let r=[],n=0;for(;;){let s=await x(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function je(e,{id:t,path:r,bytes:n},s){for(let i=0;i{}),a}}async function po(e,t){let r=[],n=0;for(;;){let{done:s,value:i}=await e.read();if(s)return r;if(n+=i.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(i)}}async function ho(e,t){try{return await po(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function Ur(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await ho(e.body.getReader(),t)).arrayBuffer())}var mo=/[\\\0:*?"<>|]/,Eo=e=>e.split("/").some(t=>!t||t==="."||t==="..");function wo(e){return typeof e!="string"||!e||mo.test(e)?!0:Eo(e)}function A(e){if(wo(e))throw new Error(`Unsafe package path: ${e}`);return e}var $o=new TextDecoder,go=["preinstall","install","postinstall"];async function Fr(e){let t=new Map;for(let r of Ye(await He(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=A(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var yo=e=>go.some(t=>e.scripts?.[t]),Ro=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function Io(e,t){return yo(e)||e.gypfile?!0:Ro(t)}function Gr(e,t,r){let n=JSON.parse($o.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(Io(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}var Ce=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),ce=(e,t)=>`${e.replace("/","+")}@${t}`,De=(e,t,r)=>`${ce(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function Oo(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function Lo(e,t){let r=e["dist-tags"]?.[t];return r||(ae.default.valid(t)?t:ae.default.maxSatisfying(Object.keys(e.versions??{}),t))}function So(e,t,r){let n=r||"latest",s=Lo(e,n),i=e.versions?.[s];if(!i||!ae.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:i}}async function No(e,t,r,{fetchImpl:n,signal:s}){let i=new URL(t.dist?.tarball,r);if(i.protocol!=="https:"&&i.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let o=await n(i,{signal:s});if(!o.ok)throw new Error(`Package download for ${e}: HTTP ${o.status}`);let a=await Ur(o);return{bytes:a,integrity:await Be(a,t.dist.integrity)}}function xo(e){let t=new URL(e,globalThis.location?.href);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function P(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!Ce(e))throw new Error(`Unsupported npm package name: ${e}`);let i=xo(r),o={fetchImpl:n,signal:s},{version:a,manifest:c}=So(await Oo(e,i,o),e,t),{bytes:f,integrity:h}=await No(e,c,i,o),p=await Fr(f),w=Gr(p,e,a);return{id:ce(e,a),key:De(e,a,h),manifest:w,integrity:h,files:p}}var le=B(X(),1);function vo(e,t,r){let n=e?.roots?.[t];return n?.requested===r&&e.packages[n.id]?e.packages[n.id]:le.default.validRange(r)?Object.values(e?.packages??{}).filter(i=>i.name===t&&le.default.satisfies(i.version,r)).sort((i,o)=>le.default.rcompare(i.version,o.version))[0]??null:null}function zr({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=P,previous:s}){let i=new Map;return async(o,a)=>{let c=`${o}@${a}`;if(i.has(c))return i.get(c);let f=vo(s,o,a),h=await n(o,f?.version??a,{registry:e,fetchImpl:t,signal:r});if(f&&h.integrity!==f.integrity)throw new Error(`${h.id} no longer matches the integrity recorded in the lock`);return i.set(c,h),h}}var Xr=B(X(),1),Vr=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function Ao(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw Vr(e,t,r)}function To(e,[t,r],{nodes:n,roots:s}){let i=s[t]?.id??e.dependencies[t];if(!i)return Ao(e,t,r);if(!Xr.default.satisfies(n[i].version,r))throw Vr(e,t,r);return i}function bo(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=To(e,r,t);n&&(e.dependencies[r[0]]=n)}}function Mr(e,t){for(let r of Object.values(e))bo(r,{nodes:e,roots:t})}var _r=B(X(),1);function ko(e,t){return!Ce(t.name)||!_r.default.valid(t.version)?!1:e===ce(t.name,t.version)}function Po(e){return e.integrity?.startsWith("sha512-")?e.key===De(e.name,e.version,e.integrity):!1}function qo(e,t,r){if(!ko(t,r)||!Po(r))throw new Error("Invalid locked package");for(let n of r.files)A(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function jo(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function Ue(e){if(!jo(e))throw new Error("Unsupported package lock");for(let[t,r]of Object.entries(e.packages))qo(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function Co(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function Do(e,t){let r={};for(let n of e){let{name:s,version:i}=_e(n);r[s]={requested:i||"latest",id:await t(s,i||"latest")}}return r}async function Br(e,t={}){let r=zr(t),n={nodes:{},downloads:new Map,total:0},s=async(o,a)=>{t.signal?.throwIfAborted();let c=await r(o,a);if(n.nodes[c.id])return c.id;Co(n,o,c);for(let[f,h]of Object.entries(c.manifest.dependencies??{}).sort())n.nodes[c.id].dependencies[f]=await s(f,h);return c.id},i=await Do(e,s);return Mr(n.nodes,i),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:i,packages:n.nodes},downloads:n.downloads}}function Fe(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var v="webfront.project.json",V=1,Ge=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,Uo=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,Fo=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,Hr=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,Go=/^[A-Za-z_][A-Za-z0-9_]*$/,Wr=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],zo=["files","publish","fetch"],g=e=>{throw new Error(`${v}: ${e}`)};function T(e,t){return Fe(e)||g(`${t} must be an object`),e}function ze(e,t,r){for(let n of Object.keys(e))t.includes(n)||g(`unknown key "${n}" in ${r}`)}function ue(e,t){typeof e!="string"&&g(`${t} must be a project path`);try{return A(e)}catch{return g(`${t} is not a safe project-relative path: ${e}`)}}function Yr(e,t){return(!Array.isArray(e)||e.length>256)&&g(`${t} must be an array of at most 256 paths`),e.map((r,n)=>ue(r,`${t}[${n}]`))}function Xo(e){let t=T(e,"dependencies");for(let[r,n]of Object.entries(t))Ge.test(r)||g(`invalid npm package name "${r}"`),(typeof n!="string"||!Fo.test(n)||n!==n.trim())&&g(`invalid version range for "${r}"`);return t}function Vo(e){if(typeof e!="string"&&g("registry must be a URL"),e.startsWith("/")&&!e.startsWith("//"))return e;let t;try{t=new URL(e)}catch{return g("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&g("registry must use https"),e}function Mo(e){let t=T(e,"scripts");for(let[r,n]of Object.entries(t))(!Hr.test(r)||typeof n!="string"||!n||n.length>1024)&&g(`invalid script "${r}"`);return t}function _o(e){let t=T(e,"entries");for(let[r,n]of Object.entries(t))Hr.test(r)||g(`invalid entry name "${r}"`),ue(n,`entries.${r}`);return t}function Bo(e,t){let r=T(e,"providers");for(let[n,s]of Object.entries(r))Go.test(n)||g(`invalid provider name "${n}"`),T(s,`providers.${n}`),ze(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&g(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||ue(s.entry,`providers.${n}.entry`),ue(s.output,`providers.${n}.output`).endsWith(".hpp")||g(`providers.${n}.output must be a .hpp file`);return r}function Ho(e){let t=T(e,"test");return ze(t,["specs"],"test"),t.specs!==void 0&&Yr(t.specs,"test.specs"),t}function Wo(e,t){let r;try{r=new URL(e)}catch{return g(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&g(`${t} must be an https origin without a path`),e}function Yo(e){let t=T(e,"permissions");for(let r of Object.keys(t))zo.includes(r)||g(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&Yr(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&g("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>Wo(r,`permissions.fetch[${n}]`))),t}function Jo(e){(typeof e.name!="string"||!Ge.test(e.name))&&g("name must be a lower-case npm package name"),(typeof e.version!="string"||!Uo.test(e.version))&&g("version must be a semantic version")}function Zo(e){e.format!==V&&(Number.isInteger(e.format)&&e.format>V&&g(`format ${e.format} is not supported by this environment (it reads format ${V}); update the environment`),g(`format must be ${V}`))}function Ko(e){T(e,"the manifest"),Zo(e),ze(e,Wr,"the manifest"),Jo(e);let t=e.entries===void 0?{}:_o(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:Xo(e.dependencies),entries:t,providers:e.providers===void 0?{}:Bo(e.providers,t),...e.registry===void 0?{}:{registry:Vo(e.registry)},...e.scripts===void 0?{}:{scripts:Mo(e.scripts)},...e.test===void 0?{}:{test:Ho(e.test)},...e.permissions===void 0?{}:{permissions:Yo(e.permissions)}}}function Jr(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return g("not valid JSON")}return Ko(t)}function Xe(e){let t={};for(let r of Wr)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` -`}function Zr(e){return{format:V,name:e,version:"0.1.0",dependencies:{}}}function Kr(e){let r=(String(e??"").split("/").filter(Boolean).pop()??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"");return Ge.test(r)?r:"webfront-app"}async function fe(e){let t=JSON.stringify(Object.entries(e).sort(([n],[s])=>ns?1:0)),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(r)].map(n=>n.toString(16).padStart(2,"0")).join("")}var M="webfront-packages.lock.json",pe=".webfront/developer/packages",Qo=new TextDecoder,ea=new TextEncoder,en="No webfront.project.json: run wf init",he="The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again";async function Qr(e,t){try{return await ie(e,t)}catch(r){if(r.message.includes("Cannot read project file:"))return null;throw r}}function ta(e,t,r){return e?t?t.manifestDigest===r?"consistent":"desynchronized":"unlocked":"no-manifest"}async function tn(e){let t=await x(e,"state",`${v} -${M}`),r=await Qr(e,v),n=await Qr(e,M),s=r?Jr(r):null,i=n?Ue(JSON.parse(Qo.decode(n))):null,o=s?await fe(s.dependencies):null;return{manifest:s,lock:i,token:t,status:ta(s,i,o),digest:o}}var jc=e=>e.status==="desynchronized"?`Warning: ${he}.\r -`:"";async function rn(e,t,r,{signal:n}={}){let s=[];try{for(let[i,o]of t){n?.throwIfAborted();let a=await x(e,"begin",i,!1);s.push(a),await je(e,{id:a,path:"output",bytes:o},n)}n?.throwIfAborted(),await x(e,"commitGroup",s.join(` +var yn=Object.create;var Ke=Object.defineProperty;var Rn=Object.getOwnPropertyDescriptor;var In=Object.getOwnPropertyNames;var On=Object.getPrototypeOf,xn=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var Sn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of In(t))!xn.call(e,s)&&s!==r&&Ke(e,s,{get:()=>t[s],enumerable:!(n=Rn(t,s))||n.enumerable});return e};var Y=(e,t,r)=>(r=e!=null?yn(On(e)):{},Sn(t||!e||!e.__esModule?Ke(r,"default",{value:e,enumerable:!0}):r,e));var D=m((ja,ot)=>{"use strict";var Tn="2.0.0",An=Number.MAX_SAFE_INTEGER||9007199254740991,Pn=16,qn=250,jn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];ot.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Pn,MAX_SAFE_BUILD_LENGTH:qn,MAX_SAFE_INTEGER:An,RELEASE_TYPES:jn,SEMVER_SPEC_VERSION:Tn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var U=m((Ca,it)=>{"use strict";var Cn=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};it.exports=Cn});var j=m((L,at)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:$e,MAX_SAFE_BUILD_LENGTH:Dn,MAX_LENGTH:Un}=D(),Fn=U();L=at.exports={};var Gn=L.re=[],zn=L.safeRe=[],u=L.src=[],Xn=L.safeSrc=[],f=L.t={},Mn=0,ye="[a-zA-Z0-9-]",Vn=[["\\s",1],["\\d",Un],[ye,Dn]],_n=e=>{for(let[t,r]of Vn)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},E=(e,t,r)=>{let n=_n(t),s=Mn++;Fn(e,s,t),f[e]=s,u[s]=t,Xn[s]=n,Gn[s]=new RegExp(t,r?"g":void 0),zn[s]=new RegExp(n,r?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${ye}*`);E("MAINVERSION",`(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASE",`(?:-(${u[f.PRERELEASEIDENTIFIER]}(?:\\.${u[f.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${u[f.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[f.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${ye}+`);E("BUILD",`(?:\\+(${u[f.BUILDIDENTIFIER]}(?:\\.${u[f.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${u[f.MAINVERSION]}${u[f.PRERELEASE]}?${u[f.BUILD]}?`);E("FULL",`^${u[f.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${u[f.MAINVERSIONLOOSE]}${u[f.PRERELEASELOOSE]}?${u[f.BUILD]}?`);E("LOOSE",`^${u[f.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${u[f.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${u[f.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:${u[f.PRERELEASE]})?${u[f.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:${u[f.PRERELEASELOOSE]})?${u[f.BUILD]}?)?)?`);E("XRANGE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${$e}})(?:\\.(\\d{1,${$e}}))?(?:\\.(\\d{1,${$e}}))?`);E("COERCE",`${u[f.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",u[f.COERCEPLAIN]+`(?:${u[f.PRERELEASE]})?(?:${u[f.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",u[f.COERCE],!0);E("COERCERTLFULL",u[f.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${u[f.LONETILDE]}\\s+`,!0);L.tildeTrimReplace="$1~";E("TILDE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${u[f.LONECARET]}\\s+`,!0);L.caretTrimReplace="$1^";E("CARET",`^${u[f.LONECARET]}${u[f.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${u[f.LONECARET]}${u[f.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${u[f.GTLT]}\\s*(${u[f.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]}|${u[f.XRANGEPLAIN]})`,!0);L.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${u[f.XRANGEPLAIN]})\\s+-\\s+(${u[f.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${u[f.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[f.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var J=m((Da,ct)=>{"use strict";var Bn=Object.freeze({loose:!0}),Hn=Object.freeze({}),Wn=e=>e?typeof e!="object"?Bn:e:Hn;ct.exports=Wn});var Re=m((Ua,ft)=>{"use strict";var lt=/^[0-9]+$/,ut=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:eut(t,e);ft.exports={compareIdentifiers:ut,rcompareIdentifiers:Yn}});var y=m((Fa,ht)=>{"use strict";var Z=U(),{MAX_LENGTH:pt,MAX_SAFE_INTEGER:K}=D(),{safeRe:Q,t:ee}=j(),Jn=J(),{compareIdentifiers:Ie}=Re(),Oe=class e{constructor(t,r){if(r=Jn(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>pt)throw new TypeError(`version is longer than ${pt} characters`);Z("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?Q[ee.LOOSE]:Q[ee.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>K||this.major<0)throw new TypeError("Invalid major version");if(this.minor>K||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>K||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let o=+s;if(o>=0&&ot.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(Z("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return Ie(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(Z("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return Ie(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?Q[ee.PRERELEASELOOSE]:Q[ee.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let o=[r,s];n===!1&&(o=[r]),Ie(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};ht.exports=Oe});var A=m((Ga,mt)=>{"use strict";var dt=y(),Zn=(e,t,r=!1)=>{if(e instanceof dt)return e;try{return new dt(e,t)}catch(n){if(!r)return null;throw n}};mt.exports=Zn});var wt=m((za,Et)=>{"use strict";var Kn=A(),Qn=(e,t)=>{let r=Kn(e,t);return r?r.version:null};Et.exports=Qn});var $t=m((Xa,gt)=>{"use strict";var es=A(),ts=(e,t)=>{let r=es(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};gt.exports=ts});var It=m((Ma,Rt)=>{"use strict";var yt=y(),rs=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new yt(e instanceof yt?e.version:e,r).inc(t,n,s).version}catch{return null}};Rt.exports=rs});var St=m((Va,xt)=>{"use strict";var Ot=A(),ns=(e,t)=>{let r=Ot(e,null,!0),n=Ot(t,null,!0),s=r.compare(n);if(s===0)return null;let o=s>0,i=o?r:n,a=o?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0)return a.minor&&!a.patch?"minor":"patch"}let p=c?"pre":"";return r.major!==n.major?p+"major":r.minor!==n.minor?p+"minor":r.patch!==n.patch?p+"patch":"prerelease"};xt.exports=ns});var Lt=m((_a,vt)=>{"use strict";var ss=y(),os=(e,t)=>new ss(e,t).major;vt.exports=os});var bt=m((Ba,Nt)=>{"use strict";var is=y(),as=(e,t)=>new is(e,t).minor;Nt.exports=as});var Tt=m((Ha,kt)=>{"use strict";var cs=y(),ls=(e,t)=>new cs(e,t).patch;kt.exports=ls});var Pt=m((Wa,At)=>{"use strict";var us=A(),fs=(e,t)=>{let r=us(e,t);return r&&r.prerelease.length?r.prerelease:null};At.exports=fs});var x=m((Ya,jt)=>{"use strict";var qt=y(),ps=(e,t,r)=>new qt(e,r).compare(new qt(t,r));jt.exports=ps});var Dt=m((Ja,Ct)=>{"use strict";var hs=x(),ds=(e,t,r)=>hs(t,e,r);Ct.exports=ds});var Ft=m((Za,Ut)=>{"use strict";var ms=x(),Es=(e,t)=>ms(e,t,!0);Ut.exports=Es});var te=m((Ka,zt)=>{"use strict";var Gt=y(),ws=(e,t,r)=>{let n=new Gt(e,r),s=new Gt(t,r);return n.compare(s)||n.compareBuild(s)};zt.exports=ws});var Mt=m((Qa,Xt)=>{"use strict";var gs=te(),$s=(e,t)=>e.sort((r,n)=>gs(r,n,t));Xt.exports=$s});var _t=m((ec,Vt)=>{"use strict";var ys=te(),Rs=(e,t)=>e.sort((r,n)=>ys(n,r,t));Vt.exports=Rs});var F=m((tc,Bt)=>{"use strict";var Is=x(),Os=(e,t,r)=>Is(e,t,r)>0;Bt.exports=Os});var re=m((rc,Ht)=>{"use strict";var xs=x(),Ss=(e,t,r)=>xs(e,t,r)<0;Ht.exports=Ss});var xe=m((nc,Wt)=>{"use strict";var vs=x(),Ls=(e,t,r)=>vs(e,t,r)===0;Wt.exports=Ls});var Se=m((sc,Yt)=>{"use strict";var Ns=x(),bs=(e,t,r)=>Ns(e,t,r)!==0;Yt.exports=bs});var ne=m((oc,Jt)=>{"use strict";var ks=x(),Ts=(e,t,r)=>ks(e,t,r)>=0;Jt.exports=Ts});var se=m((ic,Zt)=>{"use strict";var As=x(),Ps=(e,t,r)=>As(e,t,r)<=0;Zt.exports=Ps});var ve=m((ac,Kt)=>{"use strict";var qs=xe(),js=Se(),Cs=F(),Ds=ne(),Us=re(),Fs=se(),Gs=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return qs(e,r,n);case"!=":return js(e,r,n);case">":return Cs(e,r,n);case">=":return Ds(e,r,n);case"<":return Us(e,r,n);case"<=":return Fs(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};Kt.exports=Gs});var er=m((cc,Qt)=>{"use strict";var zs=y(),Xs=A(),{safeRe:oe,t:ie}=j(),Ms=(e,t)=>{if(e instanceof zs)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?oe[ie.COERCEFULL]:oe[ie.COERCE]);else{let c=t.includePrerelease?oe[ie.COERCERTLFULL]:oe[ie.COERCERTL],l;for(;(l=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||l.index+l[0].length!==r.index+r[0].length)&&(r=l),c.lastIndex=l.index+l[1].length+l[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",o=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Xs(`${n}.${s}.${o}${i}${a}`,t)};Qt.exports=Ms});var rr=m((lc,tr)=>{"use strict";var Le=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};tr.exports=Le});var S=m((uc,ir)=>{"use strict";var Vs=/\s+/g,Ne=class e{constructor(t,r){if(r=Bs(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof be)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(Vs," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!sr(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&Qs(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&Zs)|(this.options.loose&&Ks))+":"+t,s=nr.get(n);if(s)return s;let o=this.options.loose,i=o?I[R.HYPHENRANGELOOSE]:I[R.HYPHENRANGE];t=t.replace(i,lo(this.options.includePrerelease)),g("hyphen replace",t),t=t.replace(I[R.COMPARATORTRIM],Ws),g("comparator trim",t),t=t.replace(I[R.TILDETRIM],Ys),g("tilde trim",t),t=t.replace(I[R.CARETTRIM],Js),g("caret trim",t);let a=t.split(" ").map(h=>eo(h,this.options)).join(" ").split(/\s+/).map(h=>co(h,this.options));o&&(a=a.filter(h=>(g("loose invalid filter",h,this.options),!!h.match(I[R.COMPARATORLOOSE])))),g("range list",a);let c=new Map,l=a.map(h=>new be(h,this.options));for(let h of l){if(sr(h))return[h];c.set(h.value,h)}c.size>1&&c.has("")&&c.delete("");let p=[...c.values()];return nr.set(n,p),p}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>or(n,r)&&t.set.some(s=>or(s,r)&&n.every(o=>s.every(i=>o.intersects(i,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new Hs(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",Qs=e=>e.value==="",or=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(o=>s.intersects(o,t)),s=n.pop();return r},eo=(e,t)=>(e=e.replace(I[R.BUILD],""),g("comp",e,t),e=no(e,t),g("caret",e),e=to(e,t),g("tildes",e),e=oo(e,t),g("xrange",e),e=ao(e,t),g("stars",e),e),O=e=>!e||e.toLowerCase()==="x"||e==="*",to=(e,t)=>e.trim().split(/\s+/).map(r=>ro(r,t)).join(" "),ro=(e,t)=>{let r=t.loose?I[R.TILDELOOSE]:I[R.TILDE];return e.replace(r,(n,s,o,i,a)=>{g("tilde",e,n,s,o,i,a);let c;return O(s)?c="":O(o)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:O(i)?c=`>=${s}.${o}.0 <${s}.${+o+1}.0-0`:a?(g("replaceTilde pr",a),c=`>=${s}.${o}.${i}-${a} <${s}.${+o+1}.0-0`):c=`>=${s}.${o}.${i} <${s}.${+o+1}.0-0`,g("tilde return",c),c})},no=(e,t)=>e.trim().split(/\s+/).map(r=>so(r,t)).join(" "),so=(e,t)=>{g("caret",e,t);let r=t.loose?I[R.CARETLOOSE]:I[R.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,o,i,a,c)=>{g("caret",e,s,o,i,a,c);let l;return O(o)?l="":O(i)?l=`>=${o}.0.0${n} <${+o+1}.0.0-0`:O(a)?o==="0"?l=`>=${o}.${i}.0${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.0${n} <${+o+1}.0.0-0`:c?(g("replaceCaret pr",c),o==="0"?i==="0"?l=`>=${o}.${i}.${a}-${c} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}-${c} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a}-${c} <${+o+1}.0.0-0`):(g("no pr"),o==="0"?i==="0"?l=`>=${o}.${i}.${a}${n} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a} <${+o+1}.0.0-0`),g("caret return",l),l})},oo=(e,t)=>(g("replaceXRanges",e,t),e.split(/\s+/).map(r=>io(r,t)).join(" ")),io=(e,t)=>{e=e.trim();let r=t.loose?I[R.XRANGELOOSE]:I[R.XRANGE];return e.replace(r,(n,s,o,i,a,c)=>{g("xRange",e,n,s,o,i,a,c);let l=O(o),p=l||O(i),h=p||O(a),w=h;return s==="="&&w&&(s=""),c=t.includePrerelease?"-0":"",l?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&w?(p&&(i=0),a=0,s===">"?(s=">=",p?(o=+o+1,i=0,a=0):(i=+i+1,a=0)):s==="<="&&(s="<",p?o=+o+1:i=+i+1),s==="<"&&(c="-0"),n=`${s+o}.${i}.${a}${c}`):p?n=`>=${o}.0.0${c} <${+o+1}.0.0-0`:h&&(n=`>=${o}.${i}.0${c} <${o}.${+i+1}.0-0`),g("xRange return",n),n})},ao=(e,t)=>(g("replaceStars",e,t),e.trim().replace(I[R.STAR],"")),co=(e,t)=>(g("replaceGTE0",e,t),e.trim().replace(I[t.includePrerelease?R.GTE0PRE:R.GTE0],"")),lo=e=>(t,r,n,s,o,i,a,c,l,p,h,w)=>(O(n)?r="":O(s)?r=`>=${n}.0.0${e?"-0":""}`:O(o)?r=`>=${n}.${s}.0${e?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,O(l)?c="":O(p)?c=`<${+l+1}.0.0-0`:O(h)?c=`<${l}.${+p+1}.0-0`:w?c=`<=${l}.${p}.${h}-${w}`:e?c=`<${l}.${p}.${+h+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),uo=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var G=m((fc,pr)=>{"use strict";var z=Symbol("SemVer ANY"),Ae=class e{static get ANY(){return z}constructor(t,r){if(r=ar(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),Te("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===z?this.value="":this.value=this.operator+this.semver.version,Te("comp",this)}parse(t){let r=this.options.loose?cr[lr.COMPARATORLOOSE]:cr[lr.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new ur(n[2],this.options.loose):this.semver=z}toString(){return this.value}test(t){if(Te("Comparator.test",t,this.options.loose),this.semver===z||t===z)return!0;if(typeof t=="string")try{t=new ur(t,this.options)}catch{return!1}return ke(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new fr(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new fr(this.value,r).test(t.semver):(r=ar(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||ke(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||ke(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};pr.exports=Ae;var ar=J(),{safeRe:cr,t:lr}=j(),ke=ve(),Te=U(),ur=y(),fr=S()});var X=m((pc,hr)=>{"use strict";var fo=S(),po=(e,t,r)=>{try{t=new fo(t,r)}catch{return!1}return t.test(e)};hr.exports=po});var mr=m((hc,dr)=>{"use strict";var ho=S(),mo=(e,t)=>new ho(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));dr.exports=mo});var wr=m((dc,Er)=>{"use strict";var Eo=y(),wo=S(),go=(e,t,r)=>{let n=null,s=null,o=null;try{o=new wo(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===-1)&&(n=i,s=new Eo(n,r))}),n};Er.exports=go});var $r=m((mc,gr)=>{"use strict";var $o=y(),yo=S(),Ro=(e,t,r)=>{let n=null,s=null,o=null;try{o=new yo(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===1)&&(n=i,s=new $o(n,r))}),n};gr.exports=Ro});var Ir=m((Ec,Rr)=>{"use strict";var Pe=y(),Io=S(),yr=F(),Oo=(e,t)=>{e=new Io(e,t);let r=new Pe("0.0.0");if(e.test(r)||(r=new Pe("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let a=new Pe(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||yr(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||yr(r,o))&&(r=o)}return r&&e.test(r)?r:null};Rr.exports=Oo});var xr=m((wc,Or)=>{"use strict";var xo=S(),So=(e,t)=>{try{return new xo(e,t).range||"*"}catch{return null}};Or.exports=So});var ae=m((gc,Nr)=>{"use strict";var vo=y(),Lr=G(),{ANY:Lo}=Lr,No=S(),bo=X(),Sr=F(),vr=re(),ko=se(),To=ne(),Ao=(e,t,r,n)=>{e=new vo(e,n),t=new No(t,n);let s,o,i,a,c;switch(r){case">":s=Sr,o=ko,i=vr,a=">",c=">=";break;case"<":s=vr,o=To,i=Sr,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(bo(e,t,n))return!1;for(let l=0;l{d.semver===Lo&&(d=new Lr(">=0.0.0")),h=h||d,w=w||d,s(d.semver,h.semver,n)?h=d:i(d.semver,w.semver,n)&&(w=d)}),h.operator===a||h.operator===c||(!w.operator||w.operator===a)&&o(e,w.semver))return!1;if(w.operator===c&&i(e,w.semver))return!1}return!0};Nr.exports=Ao});var kr=m(($c,br)=>{"use strict";var Po=ae(),qo=(e,t,r)=>Po(e,t,">",r);br.exports=qo});var Ar=m((yc,Tr)=>{"use strict";var jo=ae(),Co=(e,t,r)=>jo(e,t,"<",r);Tr.exports=Co});var jr=m((Rc,qr)=>{"use strict";var Pr=S(),Do=(e,t,r)=>(e=new Pr(e,r),t=new Pr(t,r),e.intersects(t,r));qr.exports=Do});var Dr=m((Ic,Cr)=>{"use strict";var Uo=X(),Fo=x();Cr.exports=(e,t,r)=>{let n=[],s=null,o=null,i=e.sort((p,h)=>Fo(p,h,r));for(let p of i)Uo(p,t,r)?(o=p,s||(s=p)):(o&&n.push([s,o]),o=null,s=null);s&&n.push([s,null]);let a=[];for(let[p,h]of n)p===h?a.push(p):!h&&p===i[0]?a.push("*"):h?p===i[0]?a.push(`<=${h}`):a.push(`${p} - ${h}`):a.push(`>=${p}`);let c=a.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return c.length{"use strict";var Ur=S(),je=G(),{ANY:qe}=je,M=X(),Ce=x(),Go=(e,t,r={})=>{if(e===t)return!0;e=new Ur(e,r),t=new Ur(t,r);let n=!1;e:for(let s of e.set){for(let o of t.set){let i=Xo(s,o,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},zo=[new je(">=0.0.0-0")],Fr=[new je(">=0.0.0")],Xo=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===qe){if(t.length===1&&t[0].semver===qe)return!0;r.includePrerelease?e=zo:e=Fr}if(t.length===1&&t[0].semver===qe){if(r.includePrerelease)return!0;t=Fr}let n=new Set,s,o;for(let d of e)d.operator===">"||d.operator===">="?s=Gr(s,d,r):d.operator==="<"||d.operator==="<="?o=zr(o,d,r):n.add(d.semver);if(n.size>1)return null;let i;if(s&&o){if(i=Ce(s.semver,o.semver,r),i>0)return null;if(i===0&&(s.operator!==">="||o.operator!=="<="))return null}for(let d of n){if(s&&!M(d,String(s),r)||o&&!M(d,String(o),r))return null;for(let q of t)if(!M(d,String(q),r))return!1;return!0}let a,c,l,p,h=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,w=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;h&&h.prerelease.length===1&&o.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let d of t){if(p=p||d.operator===">"||d.operator===">=",l=l||d.operator==="<"||d.operator==="<=",s){if(w&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===w.major&&d.semver.minor===w.minor&&d.semver.patch===w.patch&&(w=!1),d.operator===">"||d.operator===">="){if(a=Gr(s,d,r),a===d&&a!==s)return!1}else if(s.operator===">="&&!M(s.semver,String(d),r))return!1}if(o){if(h&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===h.major&&d.semver.minor===h.minor&&d.semver.patch===h.patch&&(h=!1),d.operator==="<"||d.operator==="<="){if(c=zr(o,d,r),c===d&&c!==o)return!1}else if(o.operator==="<="&&!M(o.semver,String(d),r))return!1}if(!d.operator&&(o||s)&&i!==0)return!1}return!(s&&l&&!o&&i!==0||o&&p&&!s&&i!==0||w||h)},Gr=(e,t,r)=>{if(!e)return t;let n=Ce(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},zr=(e,t,r)=>{if(!e)return t;let n=Ce(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};Xr.exports=Go});var V=m((xc,Br)=>{"use strict";var De=j(),Vr=D(),Mo=y(),_r=Re(),Vo=A(),_o=wt(),Bo=$t(),Ho=It(),Wo=St(),Yo=Lt(),Jo=bt(),Zo=Tt(),Ko=Pt(),Qo=x(),ei=Dt(),ti=Ft(),ri=te(),ni=Mt(),si=_t(),oi=F(),ii=re(),ai=xe(),ci=Se(),li=ne(),ui=se(),fi=ve(),pi=er(),hi=G(),di=S(),mi=X(),Ei=mr(),wi=wr(),gi=$r(),$i=Ir(),yi=xr(),Ri=ae(),Ii=kr(),Oi=Ar(),xi=jr(),Si=Dr(),vi=Mr();Br.exports={parse:Vo,valid:_o,clean:Bo,inc:Ho,diff:Wo,major:Yo,minor:Jo,patch:Zo,prerelease:Ko,compare:Qo,rcompare:ei,compareLoose:ti,compareBuild:ri,sort:ni,rsort:si,gt:oi,lt:ii,eq:ai,neq:ci,gte:li,lte:ui,cmp:fi,coerce:pi,Comparator:hi,Range:di,satisfies:mi,toComparators:Ei,maxSatisfying:wi,minSatisfying:gi,minVersion:$i,validRange:yi,outside:Ri,gtr:Ii,ltr:Oi,intersects:xi,simplifyRange:Si,subset:vi,SemVer:Mo,re:De.re,src:De.src,tokens:De.t,SEMVER_SPEC_VERSION:Vr.SEMVER_SPEC_VERSION,RELEASE_TYPES:Vr.RELEASE_TYPES,compareIdentifiers:_r.compareIdentifiers,rcompareIdentifiers:_r.rcompareIdentifiers}});var ge=new TextDecoder;function et(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function tt(e,t){let r=String(t??"").split(/\s+/).filter(o=>o.startsWith("sha512-")).map(o=>o.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,o=>String.fromCharCode(o)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function rt(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let o=await r.read();!o.done;o=await r.read()){if(s+=o.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(o.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function C(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return ge.decode(s<0?n:n.subarray(0,s))}function nt(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,o)=>s*256+o,e[t]&127);let n=C(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function vn(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if(nt(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function Ln(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let o=ge.decode(e.subarray(n+1,r+s-1)),i=o.indexOf("=");t[o.slice(0,i)]=o.slice(i+1),r+=s}return t}function Nn(e,t){let r=e.subarray(t,t+512);vn(r);let n=nt(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function bn(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function kn(e){let t=C(e,0,100),r=C(e,257,5)==="ustar"?C(e,345,155):"";return r?`${r}/${t}`:t}var Qe={x:(e,t)=>({...e,pax:Ln(t).path}),L:(e,t)=>({...e,long:C(t,0,t.length)}),g:e=>e};function st(e){let t=[],r={};for(let n=0;!bn(e,n);){let{header:s,type:o,data:i,next:a}=Nn(e,n);if(n=a,Object.hasOwn(Qe,o)){r=Qe[o](r,i);continue}(o==="0"||o==="7")&&t.push({path:r.pax??r.long??kn(s),bytes:i}),r={}}return t}var ce=Y(V(),1);var N=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function _(e,t){let r=[],n=0;for(;;){let s=await N(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function Ue(e,{id:t,path:r,bytes:n},s){for(let o=0;o{}),a}}async function Li(e,t){let r=[],n=0;for(;;){let{done:s,value:o}=await e.read();if(s)return r;if(n+=o.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(o)}}async function Ni(e,t){try{return await Li(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function Hr(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await Ni(e.body.getReader(),t)).arrayBuffer())}var bi=/[\\\0:*?"<>|]/,ki=e=>e.split("/").some(t=>!t||t==="."||t==="..");function Ti(e){return typeof e!="string"||!e||bi.test(e)?!0:ki(e)}function k(e){if(Ti(e))throw new Error(`Unsafe package path: ${e}`);return e}var Ai=new TextDecoder,Pi=["preinstall","install","postinstall"];async function Wr(e){let t=new Map;for(let r of st(await rt(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=k(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var qi=e=>Pi.some(t=>e.scripts?.[t]),ji=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function Ci(e,t){return qi(e)||e.gypfile?!0:ji(t)}function Yr(e,t,r){let n=JSON.parse(Ai.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(Ci(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}var Fe=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),le=(e,t)=>`${e.replace("/","+")}@${t}`,Ge=(e,t,r)=>`${le(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function Di(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function Ui(e,t){let r=e["dist-tags"]?.[t];return r||(ce.default.valid(t)?t:ce.default.maxSatisfying(Object.keys(e.versions??{}),t))}function Fi(e,t,r){let n=r||"latest",s=Ui(e,n),o=e.versions?.[s];if(!o||!ce.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:o}}async function Gi(e,t,r,{fetchImpl:n,signal:s}){let o=new URL(t.dist?.tarball,r);if(o.protocol!=="https:"&&o.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let i=await n(o,{signal:s});if(!i.ok)throw new Error(`Package download for ${e}: HTTP ${i.status}`);let a=await Hr(i);return{bytes:a,integrity:await tt(a,t.dist.integrity)}}function ze(e){let t=new URL(e,globalThis.location?.href);if(t.protocol!=="https:"&&t.origin!==globalThis.location?.origin)throw new Error(`The npm registry must use HTTPS or the application origin: ${e}`);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function P(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!Fe(e))throw new Error(`Unsupported npm package name: ${e}`);let o=ze(r),i={fetchImpl:n,signal:s},{version:a,manifest:c}=Fi(await Di(e,o,i),e,t),{bytes:l,integrity:p}=await Gi(e,c,o,i),h=await Wr(l),w=Yr(h,e,a);return{id:le(e,a),key:Ge(e,a,p),manifest:w,integrity:p,files:h}}var ue=Y(V(),1);function zi(e,t,r){let n=e?.roots?.[t];return n?.requested===r&&e.packages[n.id]?e.packages[n.id]:ue.default.validRange(r)?Object.values(e?.packages??{}).filter(o=>o.name===t&&ue.default.satisfies(o.version,r)).sort((o,i)=>ue.default.rcompare(o.version,i.version))[0]??null:null}function Jr({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=P,previous:s}){let o=new Map;return async(i,a)=>{let c=`${i}@${a}`;if(o.has(c))return o.get(c);let l=zi(s,i,a),p=await n(i,l?.version??a,{registry:e,fetchImpl:t,signal:r});if(l&&p.integrity!==l.integrity)throw new Error(`${p.id} no longer matches the integrity recorded in the lock`);return o.set(c,p),p}}var Zr=Y(V(),1),Kr=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function Xi(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw Kr(e,t,r)}function Mi(e,[t,r],{nodes:n,roots:s}){let o=s[t]?.id??e.dependencies[t];if(!o)return Xi(e,t,r);if(!Zr.default.satisfies(n[o].version,r))throw Kr(e,t,r);return o}function Vi(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=Mi(e,r,t);n&&(e.dependencies[r[0]]=n)}}function Qr(e,t){for(let r of Object.values(e))Vi(r,{nodes:e,roots:t})}var en=Y(V(),1);function _i(e,t){return!Fe(t.name)||!en.default.valid(t.version)?!1:e===le(t.name,t.version)}function Bi(e){return e.integrity?.startsWith("sha512-")?e.key===Ge(e.name,e.version,e.integrity):!1}function Hi(e,t,r){if(!_i(t,r)||!Bi(r))throw new Error("Invalid locked package");for(let n of r.files)k(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function Wi(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function Xe(e){if(!Wi(e))throw new Error("Unsupported package lock");if(Object.keys(e.packages).length>512)throw new Error("The package lock exceeds 512 packages");for(let[t,r]of Object.entries(e.packages))Hi(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function Yi(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function Ji(e,t){let r={};for(let n of e){let{name:s,version:o}=et(n);r[s]={requested:o||"latest",id:await t(s,o||"latest")}}return r}async function tn(e,t={}){let r=Jr(t),n={nodes:{},downloads:new Map,total:0},s=async(i,a)=>{t.signal?.throwIfAborted();let c=await r(i,a);if(n.nodes[c.id])return c.id;Yi(n,i,c);for(let[l,p]of Object.entries(c.manifest.dependencies??{}).sort())n.nodes[c.id].dependencies[l]=await s(l,p);return c.id},o=await Ji(e,s);return Qr(n.nodes,o),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:o,packages:n.nodes},downloads:n.downloads}}function H(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var v="webfront.project.json",W=1,Me=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,Zi=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,Ki=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,rn=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,Qi=/^[A-Za-z_][A-Za-z0-9_]*$/,nn=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],ea=["files","publish","fetch"],$=e=>{throw new Error(`${v}: ${e}`)};function T(e,t){return H(e)||$(`${t} must be an object`),e}function Ve(e,t,r){for(let n of Object.keys(e))t.includes(n)||$(`unknown key "${n}" in ${r}`)}function fe(e,t){typeof e!="string"&&$(`${t} must be a project path`);try{return k(e)}catch{return $(`${t} is not a safe project-relative path: ${e}`)}}function sn(e,t){return(!Array.isArray(e)||e.length>256)&&$(`${t} must be an array of at most 256 paths`),e.map((r,n)=>fe(r,`${t}[${n}]`))}function ta(e){let t=T(e,"dependencies");for(let[r,n]of Object.entries(t))Me.test(r)||$(`invalid npm package name "${r}"`),(typeof n!="string"||!Ki.test(n)||n!==n.trim())&&$(`invalid version range for "${r}"`);return t}function ra(e){if(typeof e!="string"&&$("registry must be a URL"),e.startsWith("/")&&!e.startsWith("//"))return e;let t;try{t=new URL(e)}catch{return $("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&$("registry must use https"),e}function na(e){let t=T(e,"scripts");for(let[r,n]of Object.entries(t))(!rn.test(r)||typeof n!="string"||!n||n.length>1024)&&$(`invalid script "${r}"`);return t}function sa(e){let t=T(e,"entries");for(let[r,n]of Object.entries(t))rn.test(r)||$(`invalid entry name "${r}"`),fe(n,`entries.${r}`);return t}function oa(e,t){let r=T(e,"providers");for(let[n,s]of Object.entries(r))Qi.test(n)||$(`invalid provider name "${n}"`),T(s,`providers.${n}`),Ve(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&$(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||fe(s.entry,`providers.${n}.entry`),fe(s.output,`providers.${n}.output`).endsWith(".hpp")||$(`providers.${n}.output must be a .hpp file`);return r}function ia(e){let t=T(e,"test");return Ve(t,["specs"],"test"),t.specs!==void 0&&sn(t.specs,"test.specs"),t}function aa(e,t){let r;try{r=new URL(e)}catch{return $(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&$(`${t} must be an https origin without a path`),e}function ca(e){let t=T(e,"permissions");for(let r of Object.keys(t))ea.includes(r)||$(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&sn(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&$("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>aa(r,`permissions.fetch[${n}]`))),t}function la(e){(typeof e.name!="string"||!Me.test(e.name))&&$("name must be a lower-case npm package name"),(typeof e.version!="string"||!Zi.test(e.version))&&$("version must be a semantic version")}function ua(e){e.format!==W&&(Number.isInteger(e.format)&&e.format>W&&$(`format ${e.format} is not supported by this environment (it reads format ${W}); update the environment`),$(`format must be ${W}`))}function fa(e){T(e,"the manifest"),ua(e),Ve(e,nn,"the manifest"),la(e);let t=e.entries===void 0?{}:sa(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:ta(e.dependencies),entries:t,providers:e.providers===void 0?{}:oa(e.providers,t),...e.registry===void 0?{}:{registry:ra(e.registry)},...e.scripts===void 0?{}:{scripts:na(e.scripts)},...e.test===void 0?{}:{test:ia(e.test)},...e.permissions===void 0?{}:{permissions:ca(e.permissions)}}}function on(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return $("not valid JSON")}return fa(t)}function _e(e){let t={};for(let r of nn)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` +`}function an(e){return{format:W,name:e,version:"0.1.0",dependencies:{}}}function cn(e){let r=(String(e??"").split("/").filter(Boolean).pop()??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"");return Me.test(r)?r:"webfront-app"}async function pe(e){let t=JSON.stringify(Object.entries(e).sort(([n],[s])=>ns?1:0)),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(r)].map(n=>n.toString(16).padStart(2,"0")).join("")}var b="webfront-packages.lock.json",Be=".webfront/developer/packages",pa=new TextDecoder,ha=new TextEncoder,he="No webfront.project.json: run wf init",de="The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again";async function ln(e,t){try{return await _(e,t)}catch(r){if(r.message.includes("Cannot read project file:"))return null;throw r}}function da(e,t,r){return e?t?t.manifestDigest===r?"consistent":"desynchronized":"unlocked":"no-manifest"}async function me(e){let t=await N(e,"state",`${v} +${b}`),r=await ln(e,v),n=await ln(e,b),s=r?on(r):null,o=n?Xe(JSON.parse(pa.decode(n))):null,i=s?await pe(s.dependencies):null;return{manifest:s,lock:o,token:t,status:da(s,o,i),digest:i}}var un=e=>e.status==="desynchronized"?`Warning: ${de}.\r +`:"";async function fn(e,t,r,{signal:n}={}){let s=[];try{for(let[o,i]of t){n?.throwIfAborted();let a=await N(e,"begin",o,!1);s.push(a),await Ue(e,{id:a,path:"output",bytes:i},n)}n?.throwIfAborted(),await N(e,"commitGroup",s.join(` `),`${v} -${M}`,r.token)}catch(i){for(let o of s)await x(e,"abort",o).catch(()=>{});throw i}}function Cc(e,t,r){let n=e?.entries??{};if(t!==void 0)return Object.hasOwn(n,t)?n[t]:t;if(Object.hasOwn(n,"main"))return n.main;let s=Object.keys(n);if(s.length===1)return n[s[0]];throw new Error(`Usage: ${r} (declare entries.main in ${v} to omit the entry)`)}var de=e=>ea.encode(e);var nn=e=>{let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?[e,void 0]:[e.slice(0,t),e.slice(t+1)||void 0]};async function Vc(e,[t=".",...r],{signal:n}={}){if(r.length)throw new Error("Usage: wf init [directory]");let s=t==="."?"":A(t.replace(/\/+$/,"")),i=s?`${s}/${v}`:v,o=new Map([["output",de(Xe(Zr(Kr(s))))]]);return await oe(e,i,o,{directory:!1,replace:!1,signal:n}),`Created ${i}. Add libraries with wf install .`}function ra(e,t){let r={...e.dependencies},n=new Set;for(let s of t){let[i,o]=nn(s);r[i]=o??"latest",o&&o!=="latest"&&n.add(i)}return{dependencies:r,explicit:n}}function na({dependencies:e,explicit:t},r,n){let s={...e};for(let i of n){let o=nn(i)[0];t.has(o)||(s[o]=`^${r.packages[r.roots[o].id].version}`)}return s}async function sa(e,t,r){let n=Object.entries(e).map(([o,a])=>`${o}@${a}`),{lock:s,downloads:i}=await Br(n,{registry:r.registry,signal:r.signal,fetchImpl:r.fetchImpl,previous:t,download:async(...o)=>(r.progress(`Resolving ${o[0]}@${o[1]}`),P(...o))});return{lock:s,downloads:i}}async function ia(e,t,r,{signal:n,progress:s}){for(let[i,o]of r)s(`Storing ${i}`),await oe(e,`${pe}/${t.packages[i].key}`,o,{signal:n})}async function oa(e,t){try{return await ie(e,`${pe}/${t.key}/package.json`),!0}catch{return!1}}async function aa(e,t,{signal:r,progress:n,fetchImpl:s}){let i=0;for(let[o,a]of Object.entries(t.packages)){if(r?.throwIfAborted(),await oa(e,a))continue;n(`Restoring ${o}`);let c=await P(a.name,a.version,{registry:t.registry,fetchImpl:s,signal:r});if(c.integrity!==a.integrity)throw new Error(`${o} no longer matches the integrity recorded in the lock`);await oe(e,`${pe}/${a.key}`,c.files,{signal:r}),i++}return i}function ca(e){let t=e.includes("--update"),r=e.filter(n=>n!=="--update");if(r.some(n=>n.startsWith("-")))throw new Error("Usage: wf install [--update] [[@range] ...]");return{update:t,specs:r}}async function la(e,t,{manifest:r,lock:n},s){let i=new Map([[M,de(JSON.stringify(n,null,2)+` -`)]]);r&&i.set(v,de(Xe(r))),await rn(e,i,t,s)}var ua=async(e,t)=>({format:e.format,manifestDigest:await fe(t),...e});async function Mc(e,t,{registry:r,signal:n,progress:s=()=>{},fetchImpl:i=fetch}){let{update:o,specs:a}=ca(t),c=await tn(e);if(!c.manifest)throw new Error(en);let f={registry:c.manifest.registry??r,signal:n,fetchImpl:i,progress:s};if(a.length&&o)throw new Error("Usage: wf install --update does not take packages");if(a.length&&c.status==="desynchronized")throw new Error(he);if(!a.length&&!o&&c.status==="desynchronized")throw new Error(he);if(!a.length&&!o&&c.status==="consistent")return{lock:c.lock,restored:await aa(e,c.lock,{signal:n,progress:s,fetchImpl:f.fetchImpl})};let h=ra(c.manifest,a),p=c.status==="consistent"&&!o?c.lock:void 0,w=await sa(h.dependencies,p,f),d=na(h,w.lock,a);await ia(e,w.lock,w.downloads,{signal:n,progress:s});let _=await ua(w.lock,d),sn=a.length?{...c.manifest,dependencies:d}:null;return await la(e,c,{manifest:sn,lock:_},{signal:n}),{lock:_,restored:0}}export{fe as dependenciesDigest,he as desynchronized,P as downloadPackage,Uo as exactVersion,Go as identifier,Vc as initProject,Mc as install,tn as loadProject,M as lockPath,V as manifestFormat,Kr as manifestName,v as manifestPath,Zr as newManifest,en as noManifest,Ge as npmName,pe as packageRoot,Jr as parseManifest,rn as publishTogether,Cc as resolveEntry,Br as resolvePackages,A as safePackagePath,Xe as serializeManifest,jc as syncNotice,de as textBytes,Ue as validateLock,Ko as validateManifest}; +${b}`,r.token)}catch(o){for(let i of s)await N(e,"abort",i).catch(()=>{});throw o}}function nl(e,t,r){let n=e?.entries??{};if(t!==void 0)return Object.hasOwn(n,t)?n[t]:t;if(Object.hasOwn(n,"main"))return n.main;let s=Object.keys(n);if(s.length===1)return n[s[0]];throw new Error(`Usage: ${r} (declare entries.main in ${v} to omit the entry)`)}var Ee=e=>ha.encode(e);var pn=e=>`${Be}/${e.key}`,hn=e=>`${Be}/${e.key}.json`,ma=new TextEncoder,Ea=new TextDecoder,dn=e=>e.message.includes("Cannot read project file:");async function mn(e){return[...new Uint8Array(await crypto.subtle.digest("SHA-256",e))].map(r=>r.toString(16).padStart(2,"0")).join("")}async function we(e,t,r,{signal:n}={}){let s={};for(let i of[...r.keys()].sort())s[i]=await mn(r.get(i));await B(e,pn(t),r,{signal:n});let o=JSON.stringify({format:1,integrity:t.integrity,files:s},null,2)+` +`;await B(e,hn(t),new Map([["output",ma.encode(o)]]),{directory:!1,signal:n})}async function wa(e,t){try{return JSON.parse(Ea.decode(await _(e,hn(t))))}catch(r){return dn(r)?null:{}}}var ga=(e,t)=>Object.keys(e.files).sort().join(` +`)===[...t.files].sort().join(` +`);async function $a(e,t,r,n){try{return await mn(await _(e,`${pn(t)}/${r}`))===n}catch(s){if(dn(s))return!1;throw s}}async function En(e,t,{signal:r}={}){let n=await wa(e,t);if(!n)return"missing";if(n.integrity!==t.integrity||!H(n.files)||!ga(n,t))return"corrupted";for(let s of t.files)if(r?.throwIfAborted(),!await $a(e,t,s,n.files[s]))return"corrupted";return"valid"}var ya="https://registry.npmjs.org/",Ra=256*1024*1024;function Ia({registry:e,registryExplicit:t}={},r){return t&&e?{url:e,source:"application option"}:r?.registry?{url:r.registry,source:v}:{url:e||ya,source:"default"}}function He(e,t){let r=Ia(e,t);return ze(r.url),r}var We=({url:e,source:t})=>`Registry: ${e} (${t})`,Oa=e=>[...e.values()].reduce((t,r)=>t+r.length,0);async function xa(e,[t,r],{registry:n,fetchImpl:s,signal:o}){let i=await P(r.name,r.version,{registry:n,fetchImpl:s,signal:o});if(i.integrity!==r.integrity)throw new Error(`${t} no longer matches the integrity recorded in the lock`);return await we(e,r,i.files,{signal:o}),Oa(i.files)}async function Ye(e,t,{registry:r,offline:n=!1,signal:s,progress:o=()=>{},fetchImpl:i=fetch}){let a={verified:0,restored:0,problems:[]},c=0;for(let l of Object.entries(t.packages)){s?.throwIfAborted();let p=await En(e,l[1],{signal:s});if(p==="valid"){a.verified++;continue}if(n){a.problems.push(`${l[0]} (${p})`);continue}if(o(`Restoring ${l[0]}${p==="corrupted"?" (corrupted in the cache)":""}`),c+=await xa(e,l,{registry:r,fetchImpl:i,signal:s}),c>Ra)throw new Error("Restored packages exceed 256 MiB");a.restored++}if(a.problems.length)throw new Error(`The cache does not match ${b}; missing or corrupted, nothing downloaded:\r + ${a.problems.join(`\r + `)}\r +Run wf restore to download them.`);return a}function Sa(e){let t=e.includes("--offline");if(e.some(r=>r!=="--offline"))throw new Error("Usage: wf restore [--offline]");return{offline:t}}async function hl(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}={}){let{offline:a}=Sa(t),c=await me(e);if(!c.manifest)throw new Error(he);if(!c.lock)throw new Error(`No ${b}: run wf install to resolve the dependencies`);let l=a?null:He({registry:r,registryExplicit:n},c.manifest);o(a?"Offline: no registry is contacted":We(l));let p=await Ye(e,c.lock,{registry:l?.url,offline:a,signal:s,progress:o,fetchImpl:i}),h=Object.keys(c.lock.packages).length,w=a?`Cache verified offline: ${h} packages match ${b}.`:`Restored ${p.restored} of ${h} packages (${p.verified} already in the cache). Lock: ${b}`;return{...p,registry:l,text:un(c)+w}}var wn=e=>{let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?[e,void 0]:[e.slice(0,t),e.slice(t+1)||void 0]};async function Il(e,[t=".",...r],{signal:n}={}){if(r.length)throw new Error("Usage: wf init [directory]");let s=t==="."?"":k(t.replace(/\/+$/,"")),o=s?`${s}/${v}`:v,i=new Map([["output",Ee(_e(an(cn(s))))]]);return await B(e,o,i,{directory:!1,replace:!1,signal:n}),`Created ${o}. Add libraries with wf install .`}function va(e,t){let r={...e.dependencies},n=new Set;for(let s of t){let[o,i]=wn(s);r[o]=i??"latest",i&&i!=="latest"&&n.add(o)}return{dependencies:r,explicit:n}}function La({dependencies:e,explicit:t},r,n){let s={...e};for(let o of n){let i=wn(o)[0];t.has(i)||(s[i]=`^${r.packages[r.roots[i].id].version}`)}return s}async function Na(e,t,r){let n=Object.entries(e).map(([i,a])=>`${i}@${a}`),{lock:s,downloads:o}=await tn(n,{registry:r.registry,signal:r.signal,fetchImpl:r.fetchImpl,previous:t,download:async(...i)=>(r.progress(`Resolving ${i[0]}@${i[1]}`),P(...i))});return{lock:s,downloads:o}}async function ba(e,t,r,{signal:n,progress:s}){for(let[o,i]of r)s(`Storing ${o}`),await we(e,t.packages[o],i,{signal:n})}function ka(e){let t=e.includes("--update"),r=e.filter(n=>n!=="--update");if(r.some(n=>n.startsWith("-")))throw new Error("Usage: wf install [--update] [[@range] ...]");return{update:t,specs:r}}async function Ta(e,t,{manifest:r,lock:n},s){let o=new Map([[b,Ee(JSON.stringify(n,null,2)+` +`)]]);r&&o.set(v,Ee(_e(r))),await fn(e,o,t,s)}var Aa=async(e,t)=>({format:e.format,manifestDigest:await pe(t),...e});async function Ol(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}){let{update:a,specs:c}=ka(t),l=await me(e);if(!l.manifest)throw new Error(he);let p=He({registry:r,registryExplicit:n},l.manifest),h={registry:p.url,signal:s,fetchImpl:i,progress:o};if(c.length&&a)throw new Error("Usage: wf install --update does not take packages");if(c.length&&l.status==="desynchronized")throw new Error(de);if(!c.length&&!a&&l.status==="desynchronized")throw new Error(de);if(o(We(p)),!c.length&&!a&&l.status==="consistent"){let{restored:$n}=await Ye(e,l.lock,h);return{lock:l.lock,restored:$n,registry:p}}let w=va(l.manifest,c),d=l.status==="consistent"&&!a?l.lock:void 0,q=await Na(w.dependencies,d,h),Je=La(w,q.lock,c);await ba(e,q.lock,q.downloads,{signal:s,progress:o});let Ze=await Aa(q.lock,Je),gn=c.length?{...l.manifest,dependencies:Je}:null;return await Ta(e,l,{manifest:gn,lock:Ze},{signal:s}),{lock:Ze,restored:0,registry:p}}export{En as cacheState,ya as defaultRegistry,pe as dependenciesDigest,We as describeRegistry,de as desynchronized,P as downloadPackage,Ia as effectiveRegistry,Zi as exactVersion,Qi as identifier,Il as initProject,Ol as install,me as loadProject,b as lockPath,W as manifestFormat,cn as manifestName,v as manifestPath,an as newManifest,he as noManifest,Me as npmName,pn as packageDirectory,Be as packageRoot,on as parseManifest,fn as publishTogether,hn as recordPath,nl as resolveEntry,tn as resolvePackages,hl as restore,Ye as restorePackages,k as safePackagePath,_e as serializeManifest,we as storePackage,un as syncNotice,Ee as textBytes,He as usableRegistry,Xe as validateLock,fa as validateManifest}; diff --git a/js/developer/environment/registry.mjs b/js/developer/environment/registry.mjs index eb49dd26..adf15642 100644 --- a/js/developer/environment/registry.mjs +++ b/js/developer/environment/registry.mjs @@ -39,8 +39,11 @@ async function fetchTarball(name, manifest, base, {fetchImpl, signal}) { return {bytes, integrity: await verifyIntegrity(bytes, manifest.dist.integrity)}; } -function registryBase(registry) { +// Like the environment archive: HTTPS, or the application's own origin for a local mirror. +export function registryBase(registry) { const base = new URL(registry, globalThis.location?.href); + if (base.protocol !== 'https:' && base.origin !== globalThis.location?.origin) + throw new Error(`The npm registry must use HTTPS or the application origin: ${registry}`); if (!base.pathname.endsWith('/')) base.pathname += '/'; return base; } diff --git a/js/developer/environment/restore.mjs b/js/developer/environment/restore.mjs new file mode 100644 index 00000000..09a1a1c2 --- /dev/null +++ b/js/developer/environment/restore.mjs @@ -0,0 +1,82 @@ +// wf restore: rebuilds the package cache from the lock alone, from one registry or, with --offline, from nothing. +import {downloadPackage, registryBase} from './registry.mjs'; +import {cacheState, storePackage} from './cache.mjs'; +import {loadProject, syncNotice, lockPath, noManifest} from './project.mjs'; +import {manifestPath} from './manifest.mjs'; + +export const defaultRegistry = 'https://registry.npmjs.org/'; +const unpackedLimit = 256 * 1024 * 1024; + +/** + * The registry the commands use, and where it comes from: the application's explicit option (the distributor's + * channel, which also lets a test impose its local registry), then the manifest's "registry", then the default. + */ +export function effectiveRegistry({registry, registryExplicit} = {}, manifest) { + if (registryExplicit && registry) return {url: registry, source: 'application option'}; + if (manifest?.registry) return {url: manifest.registry, source: manifestPath}; + return {url: registry || defaultRegistry, source: 'default'}; +} + +/** The effective registry of a command that may download, refused before any request when it is not allowed. */ +export function usableRegistry(options, manifest) { + const effective = effectiveRegistry(options, manifest); + registryBase(effective.url); + return effective; +} + +export const describeRegistry = ({url, source}) => `Registry: ${url} (${source})`; + +const unpackedSize = files => [...files.values()].reduce((total, bytes) => total + bytes.length, 0); + +async function restorePackage(bridge, [id, node], {registry, fetchImpl, signal}) { + const pkg = await downloadPackage(node.name, node.version, {registry, fetchImpl, signal}); + if (pkg.integrity !== node.integrity) throw new Error(`${id} no longer matches the integrity recorded in the lock`); + await storePackage(bridge, node, pkg.files, {signal}); + return unpackedSize(pkg.files); +} + +/** + * Brings the cache to the exact locked graph: each package is checked against its record and, when missing or + * corrupted, downloaded at its locked version (no range is resolved again) and checked against the lock's SHA-512. + * Each package is published on its own, so an interruption or an error keeps every package already restored, and + * the lock is never written. Offline, nothing is downloaded: the packages that would be are listed in an error. + */ +export async function restorePackages(bridge, lock, {registry, offline = false, signal, progress = () => {}, fetchImpl = fetch}) { + const result = {verified: 0, restored: 0, problems: []}; + let unpacked = 0; + for (const entry of Object.entries(lock.packages)) { + signal?.throwIfAborted(); + const state = await cacheState(bridge, entry[1], {signal}); + if (state === 'valid') { result.verified++; continue; } + if (offline) { result.problems.push(`${entry[0]} (${state})`); continue; } + progress(`Restoring ${entry[0]}${state === 'corrupted' ? ' (corrupted in the cache)' : ''}`); + unpacked += await restorePackage(bridge, entry, {registry, fetchImpl, signal}); + if (unpacked > unpackedLimit) throw new Error('Restored packages exceed 256 MiB'); + result.restored++; + } + if (result.problems.length) + throw new Error(`The cache does not match ${lockPath}; missing or corrupted, nothing downloaded:\r\n ${result.problems.join('\r\n ')}\r\nRun wf restore to download them.`); + return result; +} + +function parseOptions(args) { + const offline = args.includes('--offline'); + if (args.some(arg => arg !== '--offline')) throw new Error('Usage: wf restore [--offline]'); + return {offline}; +} + +/** wf restore [--offline]: the cache is rebuilt from the lock; manifest and lock are only read. */ +export async function restore(bridge, args, {registry, registryExplicit, signal, progress = () => {}, fetchImpl = fetch} = {}) { + const {offline} = parseOptions(args); + const project = await loadProject(bridge); + if (!project.manifest) throw new Error(noManifest); + if (!project.lock) throw new Error(`No ${lockPath}: run wf install to resolve the dependencies`); + const effective = offline ? null : usableRegistry({registry, registryExplicit}, project.manifest); + progress(offline ? 'Offline: no registry is contacted' : describeRegistry(effective)); + const result = await restorePackages(bridge, project.lock, {registry: effective?.url, offline, signal, progress, fetchImpl}); + const count = Object.keys(project.lock.packages).length; + const summary = offline + ? `Cache verified offline: ${count} packages match ${lockPath}.` + : `Restored ${result.restored} of ${count} packages (${result.verified} already in the cache). Lock: ${lockPath}`; + return {...result, registry: effective, text: syncNotice(project) + summary}; +} diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index fb98c710..0ff5783f 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -5,6 +5,7 @@ import {validateLock} from './packages.mjs'; import {readProject, publish} from './io.mjs'; import {createStarter} from './starter.mjs'; import {install, initProject} from './installer.mjs'; +import {restore, describeRegistry} from './restore.mjs'; import {loadProject, syncNotice, resolveEntry, lockPath, packageRoot} from './project.mjs'; import {generateProvider, applicationPage} from './embed.mjs'; @@ -93,10 +94,19 @@ async function create([starter, directory, ...extra], {bridge, config, signal}) const init = (args, {bridge, signal}) => initProject(bridge, args, {signal}); +const registryOptions = (config, signal, write) => + ({registry: config.registry, registryExplicit: config.registryExplicit === true, signal, progress: text => write(text + '\r\n')}); + async function installCommand(args, {bridge, config, signal, write = () => {}}) { - const {lock, restored} = await install(bridge, args, {registry: config.registry, signal, progress: text => write(text + '\r\n')}); + const {lock, restored, registry} = await install(bridge, args, registryOptions(config, signal, write)); const count = Object.keys(lock.packages).length; - return restored || !args.length ? `Installed ${count} packages (${restored} restored). Lock: ${lockPath}` : `Installed ${count} packages. Lock: ${lockPath}`; + const summary = restored || !args.length ? `Installed ${count} packages (${restored} restored).` : `Installed ${count} packages.`; + return `${summary} ${describeRegistry(registry)}. Lock: ${lockPath}`; +} + +async function restoreCommand(args, {bridge, config, signal, write = () => {}}) { + const result = await restore(bridge, args, registryOptions(config, signal, write)); + return result.registry ? `${result.text}\r\n${describeRegistry(result.registry)}` : result.text; } async function preview(args, {bridge, signal, preview: frame}) { @@ -137,8 +147,8 @@ async function list(_args, {bridge}) { return syncNotice(project) + (names || 'No installed packages.'); } -const help = () => 'wf init [directory]\nwf create [directory]\nwf install [--update] [[@range] ...]\nwf list\nwf preview [entry.tsx|name]\nwf embed | --output \nCtrl+C interrupts a browser command. No system shell is exposed.'; -const commands = {init, create, install: installCommand, preview, embed, list, help}; +const help = () => 'wf init [directory]\nwf create [directory]\nwf install [--update] [[@range] ...]\nwf restore [--offline]\nwf list\nwf preview [entry.tsx|name]\nwf embed | --output \nCtrl+C interrupts a browser command. No system shell is exposed.'; +const commands = {init, create, install: installCommand, restore: restoreCommand, preview, embed, list, help}; export async function execute(args, context) { const [command = 'help', ...rest] = args; diff --git a/js/developer/tools/build.mjs b/js/developer/tools/build.mjs index 55643a31..8f4d630b 100644 --- a/js/developer/tools/build.mjs +++ b/js/developer/tools/build.mjs @@ -79,7 +79,7 @@ if (refresh) { await copyFile(resolve(root, 'js/developer/vendor/node_modules/semver/LICENSE'), resolve(root, 'js/developer/environment/PACKAGES-LICENSE.txt')); await writeFile(resolve(root, 'include/webfront/system/DeveloperReleaseData.hpp'), header); const inputs = {}; - for (const path of ['js/developer/environment/manifest.mjs', 'js/developer/environment/project.mjs', 'js/developer/environment/installer.mjs', 'js/developer/environment/packages-entry.mjs', 'js/developer/environment/bootstrap.mjs', 'js/developer/environment/bootstrap-entry.mjs', 'js/developer/environment/packages.mjs', 'js/developer/environment/starter.mjs', 'js/developer/environment/paths.mjs', 'js/developer/environment/runtime.mjs', 'js/developer/environment/compiler.mjs', 'js/developer/environment/bundler.mjs', 'js/developer/environment/entry.mjs', 'js/developer/environment/conditions.mjs', 'js/developer/environment/io.mjs', 'js/developer/environment/recipe.mjs', 'js/developer/environment/registry.mjs', 'js/developer/environment/archive.mjs', 'js/developer/environment/lock.mjs', 'js/developer/environment/pins.mjs', 'js/developer/environment/peers.mjs', 'js/developer/environment/resolve.mjs', 'js/developer/environment/embed.mjs', 'js/developer/tools/starters/pi/main.tsx', 'js/developer/tools/starters/pi/style.css', 'examples/life/ui/main.tsx', 'examples/life/ui/style.css', 'js/developer/components/tools/wf.mjs', 'js/developer/tools/distribution.json', 'js/developer/tools/build.mjs', 'js/developer/tools/site.mjs', 'js/developer/tools/archive.mjs', 'js/developer/vendor/package-lock.json', 'js/core/bootstrap/bootstrap.bundle.mjs', 'js/developer/environment/packages.bundle.mjs', 'include/webfront/system/DeveloperReleaseData.hpp']) + for (const path of ['js/developer/environment/manifest.mjs', 'js/developer/environment/project.mjs', 'js/developer/environment/installer.mjs', 'js/developer/environment/restore.mjs', 'js/developer/environment/cache.mjs', 'js/developer/environment/packages-entry.mjs', 'js/developer/environment/bootstrap.mjs', 'js/developer/environment/bootstrap-entry.mjs', 'js/developer/environment/packages.mjs', 'js/developer/environment/starter.mjs', 'js/developer/environment/paths.mjs', 'js/developer/environment/runtime.mjs', 'js/developer/environment/compiler.mjs', 'js/developer/environment/bundler.mjs', 'js/developer/environment/entry.mjs', 'js/developer/environment/conditions.mjs', 'js/developer/environment/io.mjs', 'js/developer/environment/recipe.mjs', 'js/developer/environment/registry.mjs', 'js/developer/environment/archive.mjs', 'js/developer/environment/lock.mjs', 'js/developer/environment/pins.mjs', 'js/developer/environment/peers.mjs', 'js/developer/environment/resolve.mjs', 'js/developer/environment/embed.mjs', 'js/developer/tools/starters/pi/main.tsx', 'js/developer/tools/starters/pi/style.css', 'examples/life/ui/main.tsx', 'examples/life/ui/style.css', 'js/developer/components/tools/wf.mjs', 'js/developer/tools/distribution.json', 'js/developer/tools/build.mjs', 'js/developer/tools/site.mjs', 'js/developer/tools/archive.mjs', 'js/developer/vendor/package-lock.json', 'js/core/bootstrap/bootstrap.bundle.mjs', 'js/developer/environment/packages.bundle.mjs', 'include/webfront/system/DeveloperReleaseData.hpp']) inputs[path] = createHash('sha256').update(await readFile(resolve(root, path))).digest('hex'); await writeFile(resolve(root, 'js/developer/environment/bundles.json'), JSON.stringify(inputs, null, 2) + '\n'); for (const [source, name] of [['js/core/bootstrap/index.html', 'DeveloperIndexHtmlData'], ['js/core/bootstrap/bootstrap.bundle.mjs', 'DeveloperBootstrapData']]) diff --git a/js/developer/tools/fixtures.mjs b/js/developer/tools/fixtures.mjs index 494c9b0e..1355ae80 100644 --- a/js/developer/tools/fixtures.mjs +++ b/js/developer/tools/fixtures.mjs @@ -1,32 +1,15 @@ // Configure offline browser fixtures from the maintainer's pinned npm ci installation. -import {readFile, writeFile, mkdir, readdir, copyFile} from 'node:fs/promises'; +import {mkdir, copyFile} from 'node:fs/promises'; import {resolve} from 'node:path'; import {fileURLToPath} from 'node:url'; -import {createHash} from 'node:crypto'; -import {tar} from './archive.mjs'; -import {compress} from '../environment/embed.mjs'; +import {pinnedPackages, syntheticPackages} from './registry-fixture.mjs'; +import {installedPackage, writeRegistry} from './registry-fixture-node.mjs'; const root = fileURLToPath(new URL('../../../', import.meta.url)); const output = resolve(process.argv[2] ?? 'build-developer-environment'); -await mkdir(resolve(output, 'registry'), {recursive: true}); -for (const name of ['react', 'react-dom', 'scheduler']) { - const directory = resolve(root, 'js/developer/vendor/node_modules', name); - const manifest = JSON.parse(await readFile(resolve(directory, 'package.json'))); - const files = new Map(); - async function walk(path = '') { - for (const entry of await readdir(resolve(directory, path), {withFileTypes: true})) { - if (entry.name === 'node_modules') continue; - const relative = path ? `${path}/${entry.name}` : entry.name; - if (entry.isDirectory()) await walk(relative); - else if (entry.isFile()) files.set(`package/${relative}`, await readFile(resolve(directory, relative))); - } - } - await walk(); - const bytes = compress(tar(files)); - await writeFile(resolve(output, 'registry', `${name}.tgz`), bytes); - const integrity = 'sha512-' + createHash('sha512').update(bytes).digest('base64'); - await writeFile(resolve(output, 'registry', name), JSON.stringify({'dist-tags': {latest: manifest.version}, - versions: {[manifest.version]: {...manifest, dist: {tarball: `./${name}.tgz`, integrity}}}})); -} +await mkdir(output, {recursive: true}); +const nodeModules = resolve(root, 'js/developer/vendor/node_modules'); +const pinned = await Promise.all(pinnedPackages.map(name => installedPackage(nodeModules, name))); +await writeRegistry(resolve(output, 'registry'), [...pinned, ...syntheticPackages()]); await copyFile(resolve(root, 'test/web/developer-specs.mjs'), resolve(output, 'run.mjs')); await copyFile(resolve(root, 'js/developer/tools/starters/pi/main.tsx'), resolve(output, 'main.tsx')); await copyFile(resolve(root, 'js/developer/tools/starters/pi/style.css'), resolve(output, 'style.css')); diff --git a/js/developer/tools/manifest-check.mjs b/js/developer/tools/manifest-check.mjs index 926209c9..7778b7f1 100644 --- a/js/developer/tools/manifest-check.mjs +++ b/js/developer/tools/manifest-check.mjs @@ -6,6 +6,7 @@ import {validateManifest, parseManifest, serializeManifest, manifestName, depend import {install, initProject, loadProject, syncNotice, resolveEntry, lockPath, manifestPath} from '../environment/packages.bundle.mjs'; import {compress} from '../environment/embed.mjs'; import {tar} from './archive.mjs'; +import {memoryBridge} from './memory-bridge.mjs'; const encoder = new TextEncoder(); const decoder = new TextDecoder(); @@ -71,46 +72,6 @@ test('entries are named in the manifest or given as paths', () => { assert.throws(() => resolveEntry(validateManifest(minimal), undefined, 'wf preview'), /entries.main/); }); -// An in-memory project behind the webfront.developer.* callbacks, with the store's group publication and precondition. -function memoryBridge(storage = new Map()) { - const transactions = new Map(); - let next = 0; - const stateOf = paths => paths.map(path => storage.has(path) ? createHash('sha256').update(storage.get(path)).digest('hex') : '-').join(','); - const operations = { - read: (path, offset) => { - if (!storage.has(path)) throw new Error('Cannot read project file: ' + path); - return storage.get(path).subarray(offset, offset + 256 * 1024); - }, - begin: (destination, directory) => { transactions.set(String(++next), {destination, directory, files: new Map(), replace: true}); return String(next); }, - beginNew: (destination, directory) => { transactions.set(String(++next), {destination, directory, files: new Map(), replace: false}); return String(next); }, - write: (id, path, offset, bytes) => { - const files = transactions.get(id).files; - const previous = files.get(path) ?? new Uint8Array(); - assert.equal(previous.length, offset); - files.set(path, new Uint8Array([...previous, ...bytes])); - }, - commit: id => { - const {destination, directory, files, replace} = transactions.get(id); - if (!replace && (storage.has(destination) || [...storage.keys()].some(key => key.startsWith(destination + '/')))) - throw new Error('Starter destination already exists'); - for (const [path, bytes] of files) storage.set(directory ? `${destination}/${path}` : destination, bytes); - transactions.delete(id); - }, - abort: id => { transactions.delete(id); }, - state: paths => stateOf(paths.split('\n')), - commitGroup: (ids, paths, expected) => { - if (stateOf(paths.split('\n')) !== expected) throw new Error('The project changed since it was read; run the command again'); - for (const id of ids.split('\n')) { - const {destination, files} = transactions.get(id); - storage.set(destination, files.get('output')); - transactions.delete(id); - } - }, - }; - const bridge = {cppFunction: name => async (...args) => operations[name.replace('webfront.developer.', '')](...args)}; - return {bridge, storage, pending: () => transactions.size}; -} - const tagged = (packages, tags) => async url => { const response = await packages(url); const body = response.headers.get('content-type')?.includes('json') ? await response.json() : null; diff --git a/js/developer/tools/memory-bridge.mjs b/js/developer/tools/memory-bridge.mjs new file mode 100644 index 00000000..049f4618 --- /dev/null +++ b/js/developer/tools/memory-bridge.mjs @@ -0,0 +1,45 @@ +// An in-memory project behind the webfront.developer.* callbacks, with the store's directory replacement, group +// publication and precondition. Shared by the Node tests; it uses only browser APIs, so that the tests can move to +// a browser runner. +export function memoryBridge(storage = new Map()) { + const transactions = new Map(); + let next = 0; + // The state of a file is its content: compared synchronously, so that check and publication stay one step. + const stateOf = paths => JSON.stringify(paths.map(path => storage.has(path) ? [...storage.get(path)] : null)); + const inside = destination => [...storage.keys()].filter(key => key.startsWith(destination + '/')); + const operations = { + read: (path, offset) => { + if (!storage.has(path)) throw new Error('Cannot read project file: ' + path); + return storage.get(path).subarray(offset, offset + 256 * 1024); + }, + begin: (destination, directory) => { transactions.set(String(++next), {destination, directory, files: new Map(), replace: true}); return String(next); }, + beginNew: (destination, directory) => { transactions.set(String(++next), {destination, directory, files: new Map(), replace: false}); return String(next); }, + write: (id, path, offset, bytes) => { + const files = transactions.get(id).files; + const previous = files.get(path) ?? new Uint8Array(); + if (previous.length !== offset) throw new Error('Non-sequential developer write'); + files.set(path, new Uint8Array([...previous, ...bytes])); + }, + commit: id => { + const {destination, directory, files, replace} = transactions.get(id); + if (!replace && (storage.has(destination) || inside(destination).length)) + throw new Error('Starter destination already exists'); + // A directory publication replaces the whole directory, as the store does. + if (directory) inside(destination).forEach(key => storage.delete(key)); + for (const [path, bytes] of files) storage.set(directory ? `${destination}/${path}` : destination, bytes); + transactions.delete(id); + }, + abort: id => { transactions.delete(id); }, + state: paths => stateOf(paths.split('\n')), + commitGroup: (ids, paths, expected) => { + if (stateOf(paths.split('\n')) !== expected) throw new Error('The project changed since it was read; run the command again'); + for (const id of ids.split('\n')) { + const {destination, files} = transactions.get(id); + storage.set(destination, files.get('output')); + transactions.delete(id); + } + }, + }; + const bridge = {cppFunction: name => async (...args) => operations[name.replace('webfront.developer.', '')](...args)}; + return {bridge, storage, pending: () => transactions.size}; +} diff --git a/js/developer/tools/registry-fixture-node.mjs b/js/developer/tools/registry-fixture-node.mjs new file mode 100644 index 00000000..6c99e51e --- /dev/null +++ b/js/developer/tools/registry-fixture-node.mjs @@ -0,0 +1,28 @@ +// Node-only part of the registry fixture: packages read from an npm ci installation, files written to a directory. +import {readFile, writeFile, mkdir, readdir} from 'node:fs/promises'; +import {resolve} from 'node:path'; +import {registryFiles} from './registry-fixture.mjs'; + +async function collect(directory, files, path = '') { + const entries = await readdir(resolve(directory, path), {withFileTypes: true}); + for (const entry of entries) { + const relative = path ? `${path}/${entry.name}` : entry.name; + if (entry.isDirectory() && entry.name !== 'node_modules') await collect(directory, files, relative); + else if (entry.isFile()) files.set(relative, await readFile(resolve(directory, relative))); + } + return files; +} + +/** A package installed by npm ci, as the files of its archive. */ +export async function installedPackage(nodeModules, name) { + const directory = resolve(nodeModules, name); + return {manifest: JSON.parse(await readFile(resolve(directory, 'package.json'), 'utf8')), files: await collect(directory, new Map())}; +} + +/** Writes the registry's files into `directory`; returns each package's integrity. */ +export async function writeRegistry(directory, packages) { + const {files, integrities} = await registryFiles(packages); + await mkdir(directory, {recursive: true}); + for (const [name, bytes] of files) await writeFile(resolve(directory, name), bytes); + return integrities; +} diff --git a/js/developer/tools/registry-fixture.mjs b/js/developer/tools/registry-fixture.mjs new file mode 100644 index 00000000..ed9bf11d --- /dev/null +++ b/js/developer/tools/registry-fixture.mjs @@ -0,0 +1,72 @@ +// The local npm registry of the tests: packuments and tarballs as plain files, generated reproducibly from pinned +// versions (the maintainer's npm ci installation) and from synthetic packages for the edge cases. The test +// application serves the directory from its own origin, so no test reaches the public registry. +// registryFiles() and syntheticPackages() use only browser APIs, so that wf can generate the fixture itself; +// reading node_modules and writing the directory are the Node-only part. +import {tar} from './archive.mjs'; +import {compress} from '../environment/embed.mjs'; + +/** Pinned packages copied from js/developer/vendor/node_modules, at the versions of its package-lock.json. */ +export const pinnedPackages = ['jasmine-core', 'react', 'react-dom', 'scheduler']; + +const encoder = new TextEncoder(); +async function integrity(bytes) { + const digest = new Uint8Array(await crypto.subtle.digest('SHA-512', bytes)); + return 'sha512-' + btoa(String.fromCharCode(...digest)); +} +const archive = files => compress(tar(new Map([...files].map(([path, bytes]) => [`package/${path}`, bytes])))); +// The fixture's versions are plain major.minor.patch numbers. +function compareVersions(a, b) { + const [x, y] = [a, b].map(version => version.split('.').map(Number)); + for (let i = 0; i < 3; i++) if (x[i] !== y[i]) return x[i] - y[i]; + return 0; +} +const newest = versions => versions.toSorted(compareVersions).at(-1); + +function synthetic(name, version, fields = {}) { + const manifest = {name, version, type: 'module', main: 'index.js', ...fields}; + return {manifest, files: new Map([ + ['package.json', encoder.encode(JSON.stringify(manifest, null, 2) + '\n')], + ['index.js', encoder.encode(`export default ${JSON.stringify(`${name}@${version}`)};\n`)], + ])}; +} + +/** + * Edge cases: a dependency range under which a newer version than the locked one exists (a restore must not move + * to it), and a published archive that no longer matches the integrity of its packument. A package absent from the + * registry is simply not generated. + */ +export const syntheticPackages = () => [ + synthetic('webfront-fixture-app', '1.0.0', {dependencies: {'webfront-fixture-lib': '^1.0.0'}}), + synthetic('webfront-fixture-lib', '1.0.0'), + synthetic('webfront-fixture-lib', '1.1.0'), + {...synthetic('webfront-fixture-tampered', '1.0.0'), tampered: true}, +]; + +function byName(packages) { + const names = new Map(); + for (const pkg of packages) { + if (pkg.manifest.name.includes('/')) throw new Error('Scoped packages are not supported by the registry fixture'); + names.set(pkg.manifest.name, [...names.get(pkg.manifest.name) ?? [], pkg]); + } + return names; +} + +/** The registry's files: `` packuments and `-.tgz` archives, and each package's integrity. */ +export async function registryFiles(packages) { + const files = new Map(); + const integrities = {}; + for (const [name, versions] of byName(packages)) { + const described = {}; + for (const {manifest, files: contents, tampered} of versions) { + const file = `${name}-${manifest.version}.tgz`; + const bytes = archive(contents); + files.set(file, tampered ? archive(new Map([...contents, ['TAMPERED', encoder.encode('changed')]])) : bytes); + integrities[`${name}@${manifest.version}`] = await integrity(bytes); + described[manifest.version] = {...manifest, dist: {tarball: `./${file}`, integrity: integrities[`${name}@${manifest.version}`]}}; + } + const packument = {name, 'dist-tags': {latest: newest(Object.keys(described))}, versions: described}; + files.set(name, encoder.encode(JSON.stringify(packument, null, 2) + '\n')); + } + return {files, integrities}; +} diff --git a/js/developer/tools/restore-check.mjs b/js/developer/tools/restore-check.mjs new file mode 100644 index 00000000..6e2870aa --- /dev/null +++ b/js/developer/tools/restore-check.mjs @@ -0,0 +1,188 @@ +// Tests of wf restore against the local registry fixture, served as plain files. Apart from node:test and +// node:assert, they use only browser APIs, so that they can move to wf test. +import {test, before} from 'node:test'; +import assert from 'node:assert/strict'; +import {install, initProject, restore, effectiveRegistry, cacheState, validateLock, lockPath, manifestPath, packageRoot} from '../environment/packages.bundle.mjs'; +import {syntheticPackages, registryFiles} from './registry-fixture.mjs'; +import {memoryBridge} from './memory-bridge.mjs'; + +const encoder = new TextEncoder(); +const decoder = new TextDecoder(); +const json = (storage, path) => JSON.parse(decoder.decode(storage.get(path))); +const cacheKeys = storage => [...storage.keys()].filter(key => key.startsWith(packageRoot + '/')).sort(); +const snapshot = storage => new Map(storage); + +const registries = {}; +before(async () => { + const packages = syntheticPackages(); + const genuine = packages.map(pkg => ({...pkg, tampered: false})); + registries.local = (await registryFiles(packages)).files; + // The same packages, with the tampered archive still matching its integrity: a lock can be created from it. + registries.genuine = (await registryFiles(genuine)).files; + // A mirror missing a package of the lock. + registries.partial = (await registryFiles(genuine.filter(pkg => pkg.manifest.name !== 'webfront-fixture-lib'))).files; +}); + +// Serves the registry's files at an origin, as a static file server would; records every request. +function served(files, origin = 'https://registry.test') { + const requests = []; + const fetchImpl = async (url, {signal} = {}) => { + signal?.throwIfAborted(); + requests.push(String(url)); + const {origin: requested, pathname} = new URL(url); + if (requested !== origin) return new Response('', {status: 503}); + const bytes = files.get(decodeURIComponent(pathname.slice(1))); + return bytes ? new Response(bytes) : new Response('', {status: 404}); + }; + return {fetchImpl, requests, registry: `${origin}/`}; +} + +const explicit = source => ({registry: source.registry, registryExplicit: true, fetchImpl: source.fetchImpl}); + +// A project locked to webfront-fixture-app@1.0.0 and webfront-fixture-lib@1.0.0, although lib 1.1.0 satisfies ^1.0.0. +async function lockedProject(files = registries.local, specs = ['webfront-fixture-lib@1.0.0', 'webfront-fixture-app@1.0.0']) { + const memory = memoryBridge(); + await initProject(memory.bridge, [], {}); + for (const spec of specs) await install(memory.bridge, [spec], explicit(served(files))); + return memory; +} + +test('lock and empty cache: wf restore rebuilds the exact locked graph from the local registry', async () => { + const {bridge, storage, pending} = await lockedProject(); + const lock = json(storage, lockPath); + assert.deepEqual(Object.keys(lock.packages).sort(), ['webfront-fixture-app@1.0.0', 'webfront-fixture-lib@1.0.0']); + const cached = cacheKeys(storage); + assert.ok(cached.some(key => key.endsWith('.json')), 'each cached package has a record'); + cached.forEach(key => storage.delete(key)); + const before = snapshot(storage); + const source = served(registries.local); + const lines = []; + const result = await restore(bridge, [], {...explicit(source), progress: line => lines.push(line)}); + assert.equal(result.restored, 2); + assert.match(result.text, /Restored 2 of 2 packages \(0 already in the cache\)/); + assert.deepEqual(cacheKeys(storage), cached, 'the cache is the one the installation wrote'); + assert.ok([...before].every(([key, bytes]) => storage.get(key) === bytes), 'manifest and lock are only read'); + assert.ok(source.requests.every(url => !url.includes('1.1.0')), 'no range is resolved again'); + assert.ok(source.requests.every(url => url.startsWith(source.registry))); + assert.equal(lines[0], `Registry: ${source.registry} (application option)`); + assert.equal(pending(), 0); + // Idempotent: a valid cache is verified, not downloaded again. + source.requests.length = 0; + const again = await restore(bridge, [], explicit(source)); + assert.equal(again.restored, 0); + assert.equal(again.verified, 2); + assert.equal(source.requests.length, 0); +}); + +test('wf restore --offline checks the cache without any request and lists what is missing or corrupted', async () => { + const {bridge, storage} = await lockedProject(); + const noNetwork = async () => { throw new Error('network access'); }; + const ok = await restore(bridge, ['--offline'], {fetchImpl: noNetwork}); + assert.match(ok.text, /Cache verified offline: 2 packages match/); + const lock = json(storage, lockPath); + const [app, lib] = ['webfront-fixture-app@1.0.0', 'webfront-fixture-lib@1.0.0'].map(id => lock.packages[id]); + storage.delete(`${packageRoot}/${app.key}.json`); + storage.set(`${packageRoot}/${lib.key}/index.js`, encoder.encode('changed')); + const before = snapshot(storage); + await assert.rejects(restore(bridge, ['--offline'], {fetchImpl: noNetwork}), + error => /webfront-fixture-app@1\.0\.0 \(missing\)/.test(error.message) && /webfront-fixture-lib@1\.0\.0 \(corrupted\)/.test(error.message)); + assert.deepEqual(storage, before, 'an offline check writes nothing'); + assert.equal(await cacheState(bridge, app), 'missing'); + assert.equal(await cacheState(bridge, lib), 'corrupted'); + // Online, the same packages are downloaded again and the cache is valid. + const result = await restore(bridge, [], explicit(served(registries.local))); + assert.equal(result.restored, 2); + assert.equal(await cacheState(bridge, lib), 'valid'); + // Only the files the lock lists are checked; a file added beside them is never read by a build. + storage.set(`${packageRoot}/${lib.key}/extra.js`, encoder.encode('')); + assert.equal(await cacheState(bridge, lib), 'valid'); +}); + +test('the application registry takes precedence over the manifest one, which takes precedence over the default', async () => { + const {bridge, storage} = await lockedProject(); + const manifest = json(storage, manifestPath); + storage.set(manifestPath, encoder.encode(JSON.stringify({...manifest, registry: 'https://manifest.test/'}))); + cacheKeys(storage).forEach(key => storage.delete(key)); + const application = served(registries.local); + const result = await restore(bridge, [], explicit(application)); + assert.deepEqual(result.registry, {url: 'https://registry.test/', source: 'application option'}); + assert.ok(application.requests.length && application.requests.every(url => url.startsWith('https://registry.test/'))); + cacheKeys(storage).forEach(key => storage.delete(key)); + const mirror = served(registries.local, 'https://manifest.test'); + const fromManifest = await restore(bridge, [], {registry: 'https://registry.test/', fetchImpl: mirror.fetchImpl}); + assert.deepEqual(fromManifest.registry, {url: 'https://manifest.test/', source: 'webfront.project.json'}); + assert.deepEqual(effectiveRegistry({}, {}), {url: 'https://registry.npmjs.org/', source: 'default'}); + assert.deepEqual(effectiveRegistry({registry: '/mirror/'}, {}), {url: '/mirror/', source: 'default'}); + await assert.rejects(restore(bridge, [], {registry: 'http://plain.test/', registryExplicit: true, fetchImpl: mirror.fetchImpl}), /HTTPS or the application origin/); +}); + +test('a changed archive or a package missing from the registry fails and keeps lock and valid cache intact', async () => { + const {bridge, storage} = await lockedProject(registries.genuine, ['webfront-fixture-lib@1.0.0', 'webfront-fixture-tampered@1.0.0']); + const lock = json(storage, lockPath); + const tampered = lock.packages['webfront-fixture-tampered@1.0.0']; + const lib = lock.packages['webfront-fixture-lib@1.0.0']; + cacheKeys(storage).filter(key => key.includes('tampered')).forEach(key => storage.delete(key)); + const lockBytes = storage.get(lockPath); + await assert.rejects(restore(bridge, [], explicit(served(registries.local))), /Integrity check failed/); + assert.equal(storage.get(lockPath), lockBytes); + assert.equal(await cacheState(bridge, tampered), 'missing'); + assert.equal(await cacheState(bridge, lib), 'valid'); + cacheKeys(storage).filter(key => key.includes('fixture-lib')).forEach(key => storage.delete(key)); + await assert.rejects(restore(bridge, [], explicit(served(registries.partial))), /webfront-fixture-lib: HTTP 404/); + assert.equal(storage.get(lockPath), lockBytes); +}); + +test('an interrupted restore keeps the packages already restored and resumes with the others', async () => { + const {bridge, storage, pending} = await lockedProject(); + cacheKeys(storage).forEach(key => storage.delete(key)); + const controller = new AbortController(); + const source = served(registries.local); + let packuments = 0; + const interrupting = async (url, options) => { + if (!String(url).endsWith('.tgz') && ++packuments === 2) controller.abort(new Error('Interrupted')); + return source.fetchImpl(url, options); + }; + await assert.rejects(restore(bridge, [], {...explicit(source), fetchImpl: interrupting, signal: controller.signal}), /Interrupted/); + assert.equal(pending(), 0, 'no staged transaction is left behind'); + const states = await Promise.all(Object.values(json(storage, lockPath).packages).map(node => cacheState(bridge, node))); + assert.deepEqual(states.sort(), ['missing', 'valid']); + const resumed = await restore(bridge, [], explicit(source)); + assert.equal(resumed.restored, 1); + assert.equal(resumed.verified, 1); +}); + +test('an invalid or absent lock is refused before any request or write', async () => { + const {bridge, storage} = await lockedProject(); + const source = served(registries.local); + for (const lock of ['{', JSON.stringify({format: 2, roots: {}, packages: {}})]) { + storage.set(lockPath, encoder.encode(lock)); + const before = snapshot(storage); + await assert.rejects(restore(bridge, [], explicit(source))); + assert.deepEqual(storage, before); + } + storage.delete(lockPath); + await assert.rejects(restore(bridge, [], explicit(source)), /No webfront-packages.lock.json: run wf install/); + await assert.rejects(restore(bridge, ['--force'], explicit(source)), /Usage: wf restore \[--offline\]/); + assert.equal(source.requests.length, 0); + const packages = Object.fromEntries(Array.from({length: 513}, (_, i) => [`p${i}@1.0.0`, {}])); + assert.throws(() => validateLock({format: 1, roots: {}, packages}), /exceeds 512 packages/); +}); + +test('wf install of a consistent lock repairs a corrupted cache and names its registry', async () => { + const {bridge, storage} = await lockedProject(); + const lib = json(storage, lockPath).packages['webfront-fixture-lib@1.0.0']; + storage.set(`${packageRoot}/${lib.key}/index.js`, encoder.encode('changed')); + const lines = []; + const result = await install(bridge, [], {...explicit(served(registries.local)), progress: line => lines.push(line)}); + assert.equal(result.restored, 1); + assert.deepEqual(result.registry, {url: 'https://registry.test/', source: 'application option'}); + assert.ok(lines.includes('Registry: https://registry.test/ (application option)')); + assert.equal(await cacheState(bridge, lib), 'valid'); +}); + +test('the registry fixture is reproducible', async () => { + const first = await registryFiles(syntheticPackages()); + const second = await registryFiles(syntheticPackages()); + assert.deepEqual(first, second); + assert.equal(JSON.parse(new TextDecoder().decode(first.files.get('webfront-fixture-lib')))['dist-tags'].latest, '1.1.0'); +}); diff --git a/test/unit/DeveloperTests.cpp b/test/unit/DeveloperTests.cpp index 6af81c35..4bf0e925 100644 --- a/test/unit/DeveloperTests.cpp +++ b/test/unit/DeveloperTests.cpp @@ -338,6 +338,30 @@ SCENARIO("The developer application needs an explicit project and a trusted envi REQUIRE_NOTHROW(app.bootstrap("developer", trusted)); REQUIRE_THROWS_AS(app.bootstrap("developer", trusted), std::logic_error); } + THEN("a registry that is neither HTTPS nor same-origin is refused") { + for (const auto* registry : {"http://registry.test/", "//registry.test/", "registry/", ""}) { + auto options = trusted; + options.registry = registry; + REQUIRE_THROWS_AS(app.bootstrap("developer", options), std::invalid_argument); + } + } + } +} + +SCENARIO("The environment learns whether the application chose the npm registry") { + const DeveloperBootstrapOptions trusted{.environment = "https://example.test/env.tgz", .integrity = "sha512-abc"}; + GIVEN("no registry option") { + THEN("the default registry is passed and marked as not chosen, so the manifest's applies") { + REQUIRE(developer::bootstrapConfig(trusted) + == R"({"environment":"https://example.test/env.tgz","integrity":"sha512-abc","registry":"https://registry.npmjs.org/","registryExplicit":false})"); + } + } + GIVEN("a same-origin mirror chosen by the application") { + auto options = trusted; + options.registry = "/mirror/"; + THEN("it is passed as the application's choice") { + REQUIRE_THAT(developer::bootstrapConfig(options), Catch::Matchers::EndsWith(R"("registry":"/mirror/","registryExplicit":true})")); + } } } diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index 84b6d947..90183e74 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -153,6 +153,38 @@ try { delete manifest.dependencies.scheduler; await writeFile('webfront.project.json', JSON.stringify(manifest, null, 2)); assert(/Installed 3 packages/.test(await runtime.execute(['install'], context)), 'A consistent lock must install its exact graph'); + // wf restore rebuilds an emptied cache from the lock alone, from the application's local registry although the + // manifest names another one; --offline only checks the cache, without any request. + const requests = []; + const pageFetch = globalThis.fetch; + globalThis.fetch = (input, init) => { + requests.push(new URL(input instanceof Request ? input.url : input, location.href).href); + return pageFetch(input, init); + }; + try { + const emptied = await call('begin', '.webfront/developer/packages', true); + await call('commit', emptied); + const missing = await runtime.execute(['restore', '--offline'], context).then(() => '', error => error.message); + assert(/react@19\.3\.1 \(missing\)/.test(missing) && requests.length === 0, 'An offline check must list missing packages without any request'); + await writeFile('webfront.project.json', JSON.stringify({...manifest, registry: 'https://registry.invalid/'}, null, 2)); + const restored = await runtime.execute(['restore'], context); + assert(/Restored 3 of 3 packages/.test(restored) && restored.includes('Registry: /fixtures/registry/ (application option)'), `wf restore must use and name the application registry: ${restored}`); + assert(requests.length > 0 && requests.every(url => url.startsWith(`${location.origin}/fixtures/registry/`)), 'wf restore must contact the application registry only'); + requests.length = 0; + assert(/Cache verified offline: 3 packages/.test(await runtime.execute(['restore', '--offline'], context)) && requests.length === 0, 'A complete cache must verify offline'); + } finally { + globalThis.fetch = pageFetch; + } + await writeFile('webfront.project.json', JSON.stringify(manifest, null, 2)); + const previous = frame.contentWindow.location.href; + await runtime.execute(['preview'], context); + const piMounted = () => frame.contentDocument?.querySelector('output') && !frame.contentDocument.querySelector('[data-testid]'); + for (let attempt = 0; frame.contentWindow.location.href === previous || !piMounted(); ++attempt) { + if (attempt === 300) throw new Error('The preview did not build from the restored cache'); + await delay(50); + } + const absent = await runtime.execute(['install', 'webfront-fixture-absent'], context).then(() => '', error => error.message); + assert(/HTTP 404/.test(absent), 'A package absent from the registry must reject'); const failed = await runtime.execute(['install', 'INVALID-NPM-NAME'], context).then(() => false, () => true); assert(failed, 'Missing packages must reject'); assert(JSON.stringify(await runtime.readLock(webFront)) === JSON.stringify(lock), 'A failed install must preserve the lock'); From 7070e90f54547a2fa23cb726a0ec771543d82b2f Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 15:27:23 +0200 Subject: [PATCH 017/134] Close the journal before removing it, keep failed recoveries recoverable and fix review findings [#305] - Windows: recovery read the journal through a stream still open when rollForward removed it. - A committed publication that cannot be completed no longer prevents opening the project: it is reported as IncompletePublication, its journal is kept, and state() or commitGroup() completes it. - A failure before the commit point returns the staged files to their transactions. - wf install validates requested ranges before resolving and rewrites the manifest as written. - wf init writes the root manifest and adopts the roots of an existing lock; a lock without a manifest digest whose roots satisfy the dependencies is usable and gets its digest recorded. - wf embed names the class after the provider; --output requires a C++ class name. - The installer reuses parseSpec. - CI checks a pin behind the sources against the published archive. --- .github/workflows/DeveloperDistribution.yml | 4 +- docs/CHANGELOG.md | 4 +- docs/DEVELOPER_ENVIRONMENT.md | 17 ++++- include/webfront/system/DeveloperJournal.hpp | 32 +++++++-- include/webfront/system/DeveloperStore.hpp | 76 ++++++++++++++++---- js/developer/environment/bundles.json | 10 +-- js/developer/environment/installer.mjs | 71 ++++++++++++------ js/developer/environment/manifest.mjs | 11 ++- js/developer/environment/packages.bundle.mjs | 14 ++-- js/developer/environment/project.mjs | 40 +++++++++-- js/developer/environment/runtime.mjs | 18 +---- js/developer/tools/PUBLISHING.md | 4 +- js/developer/tools/manifest-check.mjs | 74 ++++++++++++++++--- js/developer/tools/pin-check.mjs | 20 ++++++ test/unit/DeveloperTests.cpp | 76 ++++++++++++++++++++ 15 files changed, 385 insertions(+), 86 deletions(-) create mode 100644 js/developer/tools/pin-check.mjs diff --git a/.github/workflows/DeveloperDistribution.yml b/.github/workflows/DeveloperDistribution.yml index 013c942e..97adb980 100644 --- a/.github/workflows/DeveloperDistribution.yml +++ b/.github/workflows/DeveloperDistribution.yml @@ -59,13 +59,15 @@ jobs: cmp build-distribution/environment.tgz build-distribution-repeat/environment.tgz cmp build-distribution/pi-starter.tgz build-distribution-repeat/pi-starter.tgz cmp build-distribution/life-starter.tgz build-distribution-repeat/life-starter.tgz - # The pin names the last published version; sources ahead of it are checked again when they are pinned. + # The pin names the last published version. Sources at that version must rebuild it; sources ahead of it + # leave the header pinning the published archive, which is checked against the deployed file. pinned=$(sed -n 's/.*version{"\([^"]*\)"}.*/\1/p' include/webfront/system/DeveloperReleaseData.hpp) building=$(node -p "require('./js/developer/tools/distribution.json').version") if [ "$pinned" = "$building" ] || [ "$PUBLISHING" = true ]; then cmp include/webfront/system/DeveloperReleaseData.hpp build-distribution/DeveloperReleaseData.hpp else echo "::notice::Sources build $building; DeveloperReleaseData.hpp still pins the published $pinned." + node js/developer/tools/pin-check.mjs fi node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs js/developer/tools/manifest-check.mjs - name: Check the dedicated release tag diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9349b036..48efaf07 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -11,7 +11,9 @@ the manifest dependencies and reports a desynchronized state. `developer::Store::commitGroup` publishes manifest and lock through a synced intent journal with crash recovery and a concurrent-install precondition. New bridge callbacks `webfront.developer.state` and `webfront.developer.commitGroup`. Starters ship a manifest; - `wf install` now needs `wf init` first. + `wf install` now needs `wf init` first, which adopts the roots of an existing lock so a project locked before 0.5.0 + keeps its locked graph. A committed publication that cannot be completed does not prevent opening the project: + it is reported (`developer::IncompletePublication`) and completed by the next command. ### Changed diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 771b6ad7..13ffedda 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -165,24 +165,37 @@ unknown permission are errors printed in the terminal, never silently ignored. ` `permissions` are validated here and used by the later commands (#307, #310); permissions will only frame the operations of the `context` API of authorized scripts, they are not a sandbox. -- `wf init [directory]` writes a minimal manifest; it never replaces an existing one. +- `wf init [name]` writes `webfront.project.json` at the project root, the manifest every `wf` command + reads; it never replaces an existing one. When a lock already exists (a project installed before + 0.5.0), the manifest takes its roots as dependencies (`^version`, or the range they were installed with). - `wf install [@range]` resolves, downloads and verifies into the cache, then publishes the manifest (the requested range, or `^version` when none was given) and the lock in a single transaction. - `wf install` without argument installs exactly the locked graph (like `npm ci`) when the lock agrees with the manifest, resolves the manifest and creates the lock when there is none, and fails when they disagree. `wf install --update` resolves the manifest again. - `wf preview [entry]` and `wf embed ` use `entries` and `providers`; an explicit path still works. + `wf embed ` generates the C++ class `webfront::fs::`; with `--output `, + the file name must be a C++ class name. +- A requested range is checked like the manifest that records it, before anything is resolved: a range or + tag the manifest cannot hold is refused instead of written. The manifest is rewritten with the keys it had, + plus the new dependencies. The manifest holds the intent (roots and ranges), the lock the exact resolution. The lock records a digest of the manifest's `dependencies` (`manifestDigest`). The project is **consistent** when they match, **unlocked** without a lock (no installed graph) and **desynchronized** when the dependencies changed since the lock was written; every command reports that state and none resolves implicitly. +A lock written before 0.5.0 has no digest: it is used as consistent when its roots satisfy the +dependencies (after `wf init`, they do), and `wf install` records the digest without resolving anything. Both files are published by one all-or-nothing transaction (`developer::Store::commitGroup`): the staged files are moved under `.webfront/developer/journal/`, a journal naming them is written and synchronized to disk (the commit point), then each file replaces its target. Opening the project completes a journal that reached its commit point and abandons the others, so a crash never leaves -a manifest and a lock that belong to different installations. The publication carries a precondition, +a manifest and a lock that belong to different installations. A failure before the commit point returns +the staged files to their transactions. A committed publication whose replacement fails (a target turned +into a directory, a file locked by another program) is reported as committed but not applied yet; its +journal is kept, the project still opens, and every later command first completes it, failing with the +cause until it can. The publication carries a precondition, the fingerprint of both files as read when the command began: if another browser or command changed them meanwhile, it is refused with "The project changed since it was read; run the command again" and nothing is lost. Recovery and group publications also hold an advisory lock on `.webfront/developer/journal/.lock`, so diff --git a/include/webfront/system/DeveloperJournal.hpp b/include/webfront/system/DeveloperJournal.hpp index f76d6620..72ce233e 100644 --- a/include/webfront/system/DeveloperJournal.hpp +++ b/include/webfront/system/DeveloperJournal.hpp @@ -228,9 +228,18 @@ inline void rollForward(const std::filesystem::path& root, const std::filesystem std::filesystem::remove_all(owned, ignored); } +/// A publication past its commit point that could not be completed yet: its journal is kept, and the next +/// recovery (the next state() or group publication, or the next opening of the project) completes it. +struct IncompletePublication : std::runtime_error { + explicit IncompletePublication(const std::string& reason) + : std::runtime_error("A committed publication of the project is not applied yet (" + reason + + "); fix the cause and run the command again to complete it") {} +}; + /// Completes the journals that reached their commit point and abandons the others. A journal is /// committed once it is renamed to ".journal"; everything else is the remains of a publication -/// interrupted before that point, where no project file was touched. +/// interrupted before that point, where no project file was touched. A committed journal that cannot be +/// completed is kept, the others are still processed, and IncompletePublication reports the first failure. inline void recoverLocked(const std::filesystem::path& root, const StepHook& hook) { std::filesystem::path directory; try { @@ -248,13 +257,17 @@ inline void recoverLocked(const std::filesystem::path& root, const StepHook& hoo if (error) return; std::ranges::sort(found); - std::set committed; + std::set committed; + std::optional failure; for (const auto& path : found) { if (path.extension() != ".journal") continue; - std::ifstream stream(path, std::ios::binary); std::ostringstream content; - content << stream.rdbuf(); + { + // Closed before rollForward() removes the journal: Windows cannot remove an open file. + std::ifstream stream(path, std::ios::binary); + content << stream.rdbuf(); + } const auto entries = parseJournal(content.str()); if (!entries) continue; @@ -265,13 +278,22 @@ inline void recoverLocked(const std::filesystem::path& root, const StepHook& hoo continue; } committed.insert(path.stem().string()); - rollForward(root, directory, path.stem().string(), *entries, hook); + try { + rollForward(root, directory, path.stem().string(), *entries, hook); + } catch (const InjectedFault&) { + throw; + } catch (const std::exception& exception) { + if (!failure) + failure = exception.what(); + } } for (const auto& path : found) { const auto name = path.stem().string(); if (!committed.contains(name)) std::filesystem::remove_all(path, error); } + if (failure) + throw IncompletePublication{*failure}; } /// recoverLocked() for a caller that does not hold the project lock. diff --git a/include/webfront/system/DeveloperStore.hpp b/include/webfront/system/DeveloperStore.hpp index 45063608..380613c6 100644 --- a/include/webfront/system/DeveloperStore.hpp +++ b/include/webfront/system/DeveloperStore.hpp @@ -13,14 +13,20 @@ namespace webfront::developer { class Store { public: /// Opening a project completes the group publications that reached their commit point before - /// the previous process stopped and abandons the others. The hook is for tests only. + /// the previous process stopped and abandons the others. A publication that cannot be completed + /// does not prevent opening the project: state() and commitGroup() retry it and report why it fails, + /// and recoveryFailure() describes it meanwhile. The hook is for tests only. explicit Store(std::filesystem::path project, std::chrono::steady_clock::duration abandoned = defaultAbandonedAfter, StepHook stepHook = {}) : root(std::filesystem::canonical(project)), abandonedAfter(abandoned), hook(std::move(stepHook)) { if (!std::filesystem::is_directory(root)) throw std::invalid_argument("Developer project must be a directory"); removeStaleStaging(root); - recoverJournals(root, hook); + try { + recoverJournals(root, hook); + } catch (const IncompletePublication& incomplete) { + pendingRecovery = incomplete.what(); + } } Store(const Store&) = delete; Store& operator=(const Store&) = delete; @@ -104,19 +110,29 @@ class Store { transactions.erase(id); } - /// Identifies the current content of project files; see commitGroup(). - std::string state(const std::vector& paths) const { + /// Identifies the current content of project files; see commitGroup(). A committed publication that is + /// not applied yet is completed first; while it cannot be, this throws IncompletePublication. + std::string state(const std::vector& paths) { std::scoped_lock lock(mutex); + recover(); return fingerprint(root, paths); } + /// Why a committed publication could not be completed, if it still cannot. + std::optional recoveryFailure() const { + std::scoped_lock lock(mutex); + return pendingRecovery; + } + /// Publishes several staged files as one change. The change is applied only if the files named by /// `paths` (which include every destination) still have the content identified by `expected`, as /// read by state() when the operation began; otherwise nothing changes and the caller runs again. /// /// The commit point is the journal, completely written and synchronized after the files are - /// staged and before the first replacement. A crash before it leaves the previous files; a crash - /// after it is completed when the project is next opened. + /// staged and before the first replacement. A failure before it returns the files to their + /// transactions, which the caller may commit again or abort; a crash before it leaves the previous + /// files. After it, the publication happens: if a replacement fails, this throws + /// IncompletePublication and the next state(), commitGroup() or opening of the project completes it. void commitGroup(const std::vector& ids, const std::vector& paths, const std::string& expected) { std::scoped_lock lock(mutex); const auto directory = projectPath(root, journalDirectory); @@ -124,7 +140,7 @@ class Store { createDirectoriesDurably(root, directory); // From here to the end, no other process recovers, checks the precondition or publishes. ProjectLock processLock{directory / lockName}; - recoverLocked(root, hook); + recoverHoldingLock(); auto group = checkedGroup(ids, paths); if (fingerprint(root, paths) != expected) throw std::runtime_error("The project changed since it was read; run the command again"); @@ -135,9 +151,9 @@ class Store { throw; } catch (...) { std::error_code ignored; - std::filesystem::remove_all(directory / (number + ".d"), ignored); std::filesystem::remove(directory / (number + ".tmp"), ignored); std::filesystem::remove(directory / (number + ".journal"), ignored); + returnStaged(directory / (number + ".d"), group); throw; } std::vector entries; @@ -148,11 +164,19 @@ class Store { std::filesystem::remove_all(transactions.at(id).staging, ignored); transactions.erase(id); } - rollForward(root, directory, number, entries, hook); + try { + rollForward(root, directory, number, entries, hook); + } catch (const InjectedFault&) { + throw; + } catch (const std::exception& exception) { + IncompletePublication incomplete{exception.what()}; + pendingRecovery = incomplete.what(); + throw incomplete; + } } /// Bridge forms of state() and commitGroup(): one path or identifier per line. - std::string stateOfLines(std::string paths) const { + std::string stateOfLines(std::string paths) { return state(lines(paths)); } void commitGroupLines(std::string ids, std::string paths, std::string expected) { @@ -218,8 +242,7 @@ class Store { } catch (const InjectedFault&) { throw; } catch (...) { - std::error_code ignored; - std::filesystem::remove_all(directory / (number + ".d"), ignored); + returnStaged(directory / (number + ".d"), group); throw; } return number; @@ -246,6 +269,34 @@ class Store { step("after-journal"); } + // Before the commit point: puts the files moved into a journal directory back in their transactions. + static void returnStaged(const std::filesystem::path& owned, const std::vector& group) { + std::error_code ignored; + for (std::size_t i = 0; i < group.size(); ++i) { + const auto moved = owned / std::to_string(i); + if (std::filesystem::is_regular_file(moved, ignored)) + std::filesystem::rename(moved, group[i]->staging / "output", ignored); + } + std::filesystem::remove_all(owned, ignored); + } + + // Completes the committed publications, recording why one cannot be completed. + template void recordRecovery(Recovery recovery) { + try { + recovery(root, hook); + pendingRecovery.reset(); + } catch (const IncompletePublication& incomplete) { + pendingRecovery = incomplete.what(); + throw; + } + } + void recover() { + recordRecovery(recoverJournals); + } + void recoverHoldingLock() { + recordRecovery(recoverLocked); + } + void step(std::string_view name) const { if (hook) hook(name); @@ -333,6 +384,7 @@ class Store { std::filesystem::path root; std::chrono::steady_clock::duration abandonedAfter; StepHook hook; + std::optional pendingRecovery; mutable std::mutex mutex; std::map transactions; }; diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 0ea3f01e..71456a07 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -1,14 +1,14 @@ { - "js/developer/environment/manifest.mjs": "248e7cbe44dd71be514a57e3997860fb148d39e5fbf04b133e08f17dbc878a6a", - "js/developer/environment/project.mjs": "d971b2c225179be7798a9c442a48006e1e9b7af56c329f325858dbd665fc351e", - "js/developer/environment/installer.mjs": "bfe47a54b65e7fbe37df2a21da8722f3d40ddaa903a25636bc51692a51b393ea", + "js/developer/environment/manifest.mjs": "1cb0c70c87ca31ec81ad0591c0c1d1cb2637ecc491caef9c3d3ec8f1670ea900", + "js/developer/environment/project.mjs": "525bc1545f6ff9a70c744c536e46c2404bdc20daa83b25b29419222161003c3b", + "js/developer/environment/installer.mjs": "e02e047f591a539b04c519570902aa6166614958ac96b61e2aff4dc167d8c816", "js/developer/environment/packages-entry.mjs": "7b5dc8aac408b741ccd3f9098165fca7645c4e88fd7ca7b8822fe37b7ad21fce", "js/developer/environment/bootstrap.mjs": "534af4b3d07891338c3390e1d5e06c2fb6dd8df11ca6547735565b17f1b9cd70", "js/developer/environment/bootstrap-entry.mjs": "ff8084f23f5acc721f97eb1ed0a454e7bfee1894de17d54f0100fa11f7ef8b77", "js/developer/environment/packages.mjs": "faed29500a34c6ce24756d07bd4b47b9168ccec4bd49d12f00096a869637d74d", "js/developer/environment/starter.mjs": "048cf2af36b407bc075323f78a1195b4be91ad7da51f6ce941d9fb230f314ff9", "js/developer/environment/paths.mjs": "6ebb626610756143c58762c87af18980802809d7f0f53d3b588e4b20e8db0161", - "js/developer/environment/runtime.mjs": "7181d01ece3ab790692165a1c269ef9be9798bc5c6730494d264ec693224149c", + "js/developer/environment/runtime.mjs": "8c1eec7e111ac33ad40a33baa7722bcb2f0e5e3301981cc4c14e1d07771946aa", "js/developer/environment/compiler.mjs": "3f7e187ca9a4c2645ef3823127457cad655919cbea3c7c0f22fb7ae2cc87e0e5", "js/developer/environment/bundler.mjs": "b0ff79a1b0caa012c25ec7b7f121d7d50af1aa1651231d3dcf2f39470c4ea25c", "js/developer/environment/entry.mjs": "b2b942443e3c74ae2c008392ba244d9b7e91db70ba1b4ebbe1357c455ebf51bb", @@ -33,6 +33,6 @@ "js/developer/tools/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b", "js/developer/vendor/package-lock.json": "eb545112b672f9dbf520125df1f44a878d62cc8e611f0e33baee36470ded4dec", "js/core/bootstrap/bootstrap.bundle.mjs": "792fe7cf564bd12ac47fef419d8c71e2070925764a17706552e7d3f5d6ba2181", - "js/developer/environment/packages.bundle.mjs": "b15d96e360d6bc10f6d94c549c6e8f121d4196c87be8236937be0be11257b564", + "js/developer/environment/packages.bundle.mjs": "1bd773a901b747e2a38607171b49e7976af4792214c1e50fc7ed3710fed3bf22", "include/webfront/system/DeveloperReleaseData.hpp": "c97a8c3b21df3306c179f7b46d945159b5854f9d2810f135a4ab224c768c75d7" } diff --git a/js/developer/environment/installer.mjs b/js/developer/environment/installer.mjs index 2a2bb736..78370ebb 100644 --- a/js/developer/environment/installer.mjs +++ b/js/developer/environment/installer.mjs @@ -1,37 +1,61 @@ // wf init and wf install: the manifest states the intent, the lock the exact resolution; both are published together. +import semver from 'semver'; import {resolvePackages, downloadPackage} from './packages.mjs'; +import {parseSpec} from '../components/tools/wf.mjs'; import {publish, readProject} from './io.mjs'; -import {safePackagePath} from './paths.mjs'; -import {manifestPath, newManifest, manifestName, serializeManifest, dependenciesDigest} from './manifest.mjs'; +import {manifestPath, newManifest, manifestName, serializeManifest, validateManifest, dependenciesDigest} from './manifest.mjs'; import {loadProject, publishTogether, lockPath, packageRoot, noManifest, desynchronized, textBytes} from './project.mjs'; +// The spec syntax resolvePackages() reads: a missing version is undefined, resolved as latest. const splitSpec = spec => { - const at = spec.indexOf('@', spec.startsWith('@') ? 1 : 0); - return at < 0 ? [spec, undefined] : [spec.slice(0, at), spec.slice(at + 1) || undefined]; + const {name, version} = parseSpec(spec); + return [name, version || undefined]; }; -/** Creates a minimal manifest without replacing an existing one. */ -export async function initProject(bridge, [directory = '.', ...extra], {signal} = {}) { - if (extra.length) throw new Error('Usage: wf init [directory]'); - const folder = directory === '.' ? '' : safePackagePath(directory.replace(/\/+$/, '')); - const path = folder ? `${folder}/${manifestPath}` : manifestPath; - const files = new Map([['output', textBytes(serializeManifest(newManifest(manifestName(folder))))]]); - await publish(bridge, path, files, {directory: false, replace: false, signal}); - return `Created ${path}. Add libraries with wf install .`; +// The range a manifest records for a root of a lock written before the manifest: the range it was installed with, +// or ^version for an exact version or a dist-tag, like npm. +function legacyRange(lock, root) { + const {version} = lock.packages[root.id]; + const exact = semver.valid(root.requested) !== null; + return !exact && root.requested !== 'latest' && semver.validRange(root.requested) !== null ? root.requested : `^${version}`; } -// The ranges to resolve: the manifest's, with the requested packages added or replaced. -function requestedDependencies(manifest, specs) { - const dependencies = {...manifest.dependencies}; +/** + * Creates webfront.project.json at the project root, without replacing an existing one. Every wf command reads that + * manifest. An existing lock gives the dependencies, so a project installed before the manifest keeps its locked graph. + */ +export async function initProject(bridge, [name, ...extra], {signal} = {}) { + if (extra.length) throw new Error('Usage: wf init [name]'); + const {lock} = await loadProject(bridge); + const manifest = newManifest(name ?? manifestName('')); + if (lock) manifest.dependencies = Object.fromEntries(Object.entries(lock.roots).map(([root, entry]) => [root, legacyRange(lock, entry)])); + validateManifest(manifest); + await publish(bridge, manifestPath, new Map([['output', textBytes(serializeManifest(manifest))]]), {directory: false, replace: false, signal}); + const adopted = lock ? ` with the ${Object.keys(manifest.dependencies).length} dependencies of ${lockPath}` : ''; + return `Created ${manifestPath}${adopted}. Add libraries with wf install .`; +} + +// The ranges to resolve: the manifest's, with the requested packages added or replaced. They are checked like the manifest +// that will record them before anything is resolved, so a range the manifest cannot hold is refused instead of written. +function requestedDependencies(project, specs) { + const dependencies = {...project.manifest.dependencies}; const explicit = new Set(); for (const spec of specs) { const [name, range] = splitSpec(spec); dependencies[name] = range ?? 'latest'; if (range && range !== 'latest') explicit.add(name); } + validateManifest({...project.source, dependencies}); return {dependencies, explicit}; } +// The manifest as written with new dependencies: the defaults added by validation are not written back. +function updatedManifest(project, dependencies) { + const manifest = {...project.source, dependencies}; + validateManifest(manifest); + return manifest; +} + // A package installed without a range is recorded as ^version, like npm; an explicit range is kept as typed. function recordedDependencies({dependencies, explicit}, lock, specs) { const recorded = {...dependencies}; @@ -107,17 +131,24 @@ export async function install(bridge, args, {registry, signal, progress = () => if (specs.length && update) throw new Error('Usage: wf install --update does not take packages'); if (specs.length && project.status === 'desynchronized') throw new Error(desynchronized); if (!specs.length && !update && project.status === 'desynchronized') throw new Error(desynchronized); - if (!specs.length && !update && project.status === 'consistent') - return {lock: project.lock, restored: await restoreLocked(bridge, project.lock, {signal, progress, fetchImpl: options.fetchImpl})}; - const request = requestedDependencies(project.manifest, specs); + const locked = project.status === 'consistent' || project.status === 'legacy'; + if (!specs.length && !update && locked) { + const restored = await restoreLocked(bridge, project.lock, {signal, progress, fetchImpl: options.fetchImpl}); + if (project.status === 'consistent') return {lock: project.lock, restored}; + // A lock written before the manifest: the same graph, now recording the dependencies it was resolved from. + const lock = await withDigest(project.lock, project.manifest.dependencies); + await publishResolution(bridge, project, {manifest: null, lock}, {signal}); + return {lock, restored}; + } + const request = requestedDependencies(project, specs); // --update ignores the locked versions; installing a package keeps the others where they are. - const previous = project.status === 'consistent' && !update ? project.lock : undefined; + const previous = locked && !update ? project.lock : undefined; const resolved = await resolveLock(request.dependencies, previous, options); const dependencies = recordedDependencies(request, resolved.lock, specs); await storePackages(bridge, resolved.lock, resolved.downloads, {signal, progress}); // The journal of the joint publication is the installation commit point. A failed install may leave unused cache files. const lock = await withDigest(resolved.lock, dependencies); - const manifest = specs.length ? {...project.manifest, dependencies} : null; + const manifest = specs.length ? updatedManifest(project, dependencies) : null; await publishResolution(bridge, project, {manifest, lock}, {signal}); return {lock, restored: 0}; } diff --git a/js/developer/environment/manifest.mjs b/js/developer/environment/manifest.mjs index 6a3ebaea..6fb4eae7 100644 --- a/js/developer/environment/manifest.mjs +++ b/js/developer/environment/manifest.mjs @@ -143,10 +143,15 @@ export function validateManifest(manifest) { }; } +/** The manifest as written (`source`, to update without adding the defaults) and validated (`manifest`). */ +export function readManifest(bytes) { + let source; + try { source = JSON.parse(new TextDecoder().decode(bytes)); } catch { return fail('not valid JSON'); } + return {source, manifest: validateManifest(source)}; +} + export function parseManifest(bytes) { - let value; - try { value = JSON.parse(new TextDecoder().decode(bytes)); } catch { return fail('not valid JSON'); } - return validateManifest(value); + return readManifest(bytes).manifest; } /** The text written to disk: the schema's keys in a stable order. */ diff --git a/js/developer/environment/packages.bundle.mjs b/js/developer/environment/packages.bundle.mjs index ab176f1c..e3243dfe 100644 --- a/js/developer/environment/packages.bundle.mjs +++ b/js/developer/environment/packages.bundle.mjs @@ -1,7 +1,7 @@ -var on=Object.create;var Ve=Object.defineProperty;var an=Object.getOwnPropertyDescriptor;var cn=Object.getOwnPropertyNames;var ln=Object.getPrototypeOf,un=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var fn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of cn(t))!un.call(e,s)&&s!==r&&Ve(e,s,{get:()=>t[s],enumerable:!(n=an(t,s))||n.enumerable});return e};var B=(e,t,r)=>(r=e!=null?on(ln(e)):{},fn(t||!e||!e.__esModule?Ve(r,"default",{value:e,enumerable:!0}):r,e));var j=m((ha,Je)=>{"use strict";var wn="2.0.0",$n=Number.MAX_SAFE_INTEGER||9007199254740991,gn=16,yn=250,Rn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Je.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:gn,MAX_SAFE_BUILD_LENGTH:yn,MAX_SAFE_INTEGER:$n,RELEASE_TYPES:Rn,SEMVER_SPEC_VERSION:wn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var C=m((da,Ze)=>{"use strict";var In=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Ze.exports=In});var k=m((N,Ke)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Ee,MAX_SAFE_BUILD_LENGTH:On,MAX_LENGTH:Ln}=j(),Sn=C();N=Ke.exports={};var Nn=N.re=[],xn=N.safeRe=[],l=N.src=[],vn=N.safeSrc=[],u=N.t={},An=0,we="[a-zA-Z0-9-]",Tn=[["\\s",1],["\\d",Ln],[we,On]],bn=e=>{for(let[t,r]of Tn)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},E=(e,t,r)=>{let n=bn(t),s=An++;Sn(e,s,t),u[e]=s,l[s]=t,vn[s]=n,Nn[s]=new RegExp(t,r?"g":void 0),xn[s]=new RegExp(n,r?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${we}*`);E("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${we}+`);E("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`);E("FULL",`^${l[u.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`);E("LOOSE",`^${l[u.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`);E("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Ee}})(?:\\.(\\d{1,${Ee}}))?(?:\\.(\\d{1,${Ee}}))?`);E("COERCE",`${l[u.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",l[u.COERCEPLAIN]+`(?:${l[u.PRERELEASE]})?(?:${l[u.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",l[u.COERCE],!0);E("COERCERTLFULL",l[u.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0);N.tildeTrimReplace="$1~";E("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0);N.caretTrimReplace="$1^";E("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0);N.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var H=m((ma,Qe)=>{"use strict";var kn=Object.freeze({loose:!0}),Pn=Object.freeze({}),qn=e=>e?typeof e!="object"?kn:e:Pn;Qe.exports=qn});var $e=m((Ea,rt)=>{"use strict";var et=/^[0-9]+$/,tt=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:ett(t,e);rt.exports={compareIdentifiers:tt,rcompareIdentifiers:jn}});var y=m((wa,st)=>{"use strict";var W=C(),{MAX_LENGTH:nt,MAX_SAFE_INTEGER:Y}=j(),{safeRe:J,t:Z}=k(),Cn=H(),{compareIdentifiers:ge}=$e(),ye=class e{constructor(t,r){if(r=Cn(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>nt)throw new TypeError(`version is longer than ${nt} characters`);W("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?J[Z.LOOSE]:J[Z.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Y||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Y||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Y||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let i=+s;if(i>=0&&it.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(W("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ge(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(W("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ge(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?J[Z.PRERELEASELOOSE]:J[Z.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let i=[r,s];n===!1&&(i=[r]),ge(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};st.exports=ye});var b=m(($a,ot)=>{"use strict";var it=y(),Dn=(e,t,r=!1)=>{if(e instanceof it)return e;try{return new it(e,t)}catch(n){if(!r)return null;throw n}};ot.exports=Dn});var ct=m((ga,at)=>{"use strict";var Un=b(),Fn=(e,t)=>{let r=Un(e,t);return r?r.version:null};at.exports=Fn});var ut=m((ya,lt)=>{"use strict";var Gn=b(),zn=(e,t)=>{let r=Gn(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};lt.exports=zn});var ht=m((Ra,pt)=>{"use strict";var ft=y(),Xn=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new ft(e instanceof ft?e.version:e,r).inc(t,n,s).version}catch{return null}};pt.exports=Xn});var Et=m((Ia,mt)=>{"use strict";var dt=b(),Vn=(e,t)=>{let r=dt(e,null,!0),n=dt(t,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let h=c?"pre":"";return r.major!==n.major?h+"major":r.minor!==n.minor?h+"minor":r.patch!==n.patch?h+"patch":"prerelease"};mt.exports=Vn});var $t=m((Oa,wt)=>{"use strict";var Mn=y(),_n=(e,t)=>new Mn(e,t).major;wt.exports=_n});var yt=m((La,gt)=>{"use strict";var Bn=y(),Hn=(e,t)=>new Bn(e,t).minor;gt.exports=Hn});var It=m((Sa,Rt)=>{"use strict";var Wn=y(),Yn=(e,t)=>new Wn(e,t).patch;Rt.exports=Yn});var Lt=m((Na,Ot)=>{"use strict";var Jn=b(),Zn=(e,t)=>{let r=Jn(e,t);return r&&r.prerelease.length?r.prerelease:null};Ot.exports=Zn});var L=m((xa,Nt)=>{"use strict";var St=y(),Kn=(e,t,r)=>new St(e,r).compare(new St(t,r));Nt.exports=Kn});var vt=m((va,xt)=>{"use strict";var Qn=L(),es=(e,t,r)=>Qn(t,e,r);xt.exports=es});var Tt=m((Aa,At)=>{"use strict";var ts=L(),rs=(e,t)=>ts(e,t,!0);At.exports=rs});var K=m((Ta,kt)=>{"use strict";var bt=y(),ns=(e,t,r)=>{let n=new bt(e,r),s=new bt(t,r);return n.compare(s)||n.compareBuild(s)};kt.exports=ns});var qt=m((ba,Pt)=>{"use strict";var ss=K(),is=(e,t)=>e.sort((r,n)=>ss(r,n,t));Pt.exports=is});var Ct=m((ka,jt)=>{"use strict";var os=K(),as=(e,t)=>e.sort((r,n)=>os(n,r,t));jt.exports=as});var D=m((Pa,Dt)=>{"use strict";var cs=L(),ls=(e,t,r)=>cs(e,t,r)>0;Dt.exports=ls});var Q=m((qa,Ut)=>{"use strict";var us=L(),fs=(e,t,r)=>us(e,t,r)<0;Ut.exports=fs});var Re=m((ja,Ft)=>{"use strict";var ps=L(),hs=(e,t,r)=>ps(e,t,r)===0;Ft.exports=hs});var Ie=m((Ca,Gt)=>{"use strict";var ds=L(),ms=(e,t,r)=>ds(e,t,r)!==0;Gt.exports=ms});var ee=m((Da,zt)=>{"use strict";var Es=L(),ws=(e,t,r)=>Es(e,t,r)>=0;zt.exports=ws});var te=m((Ua,Xt)=>{"use strict";var $s=L(),gs=(e,t,r)=>$s(e,t,r)<=0;Xt.exports=gs});var Oe=m((Fa,Vt)=>{"use strict";var ys=Re(),Rs=Ie(),Is=D(),Os=ee(),Ls=Q(),Ss=te(),Ns=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return ys(e,r,n);case"!=":return Rs(e,r,n);case">":return Is(e,r,n);case">=":return Os(e,r,n);case"<":return Ls(e,r,n);case"<=":return Ss(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};Vt.exports=Ns});var _t=m((Ga,Mt)=>{"use strict";var xs=y(),vs=b(),{safeRe:re,t:ne}=k(),As=(e,t)=>{if(e instanceof xs)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?re[ne.COERCEFULL]:re[ne.COERCE]);else{let c=t.includePrerelease?re[ne.COERCERTLFULL]:re[ne.COERCERTL],f;for(;(f=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||f.index+f[0].length!==r.index+r[0].length)&&(r=f),c.lastIndex=f.index+f[1].length+f[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return vs(`${n}.${s}.${i}${o}${a}`,t)};Mt.exports=As});var Ht=m((za,Bt)=>{"use strict";var Le=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};Bt.exports=Le});var S=m((Xa,Zt)=>{"use strict";var Ts=/\s+/g,Se=class e{constructor(t,r){if(r=ks(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Ne)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(Ts," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!Yt(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&Fs(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&Ds)|(this.options.loose&&Us))+":"+t,s=Wt.get(n);if(s)return s;let i=this.options.loose,o=i?I[R.HYPHENRANGELOOSE]:I[R.HYPHENRANGE];t=t.replace(o,Ys(this.options.includePrerelease)),$("hyphen replace",t),t=t.replace(I[R.COMPARATORTRIM],qs),$("comparator trim",t),t=t.replace(I[R.TILDETRIM],js),$("tilde trim",t),t=t.replace(I[R.CARETTRIM],Cs),$("caret trim",t);let a=t.split(" ").map(p=>Gs(p,this.options)).join(" ").split(/\s+/).map(p=>Ws(p,this.options));i&&(a=a.filter(p=>($("loose invalid filter",p,this.options),!!p.match(I[R.COMPARATORLOOSE])))),$("range list",a);let c=new Map,f=a.map(p=>new Ne(p,this.options));for(let p of f){if(Yt(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let h=[...c.values()];return Wt.set(n,h),h}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>Jt(n,r)&&t.set.some(s=>Jt(s,r)&&n.every(i=>s.every(o=>i.intersects(o,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new Ps(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",Fs=e=>e.value==="",Jt=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(i=>s.intersects(i,t)),s=n.pop();return r},Gs=(e,t)=>(e=e.replace(I[R.BUILD],""),$("comp",e,t),e=Vs(e,t),$("caret",e),e=zs(e,t),$("tildes",e),e=_s(e,t),$("xrange",e),e=Hs(e,t),$("stars",e),e),O=e=>!e||e.toLowerCase()==="x"||e==="*",zs=(e,t)=>e.trim().split(/\s+/).map(r=>Xs(r,t)).join(" "),Xs=(e,t)=>{let r=t.loose?I[R.TILDELOOSE]:I[R.TILDE];return e.replace(r,(n,s,i,o,a)=>{$("tilde",e,n,s,i,o,a);let c;return O(s)?c="":O(i)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:O(o)?c=`>=${s}.${i}.0 <${s}.${+i+1}.0-0`:a?($("replaceTilde pr",a),c=`>=${s}.${i}.${o}-${a} <${s}.${+i+1}.0-0`):c=`>=${s}.${i}.${o} <${s}.${+i+1}.0-0`,$("tilde return",c),c})},Vs=(e,t)=>e.trim().split(/\s+/).map(r=>Ms(r,t)).join(" "),Ms=(e,t)=>{$("caret",e,t);let r=t.loose?I[R.CARETLOOSE]:I[R.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,c)=>{$("caret",e,s,i,o,a,c);let f;return O(i)?f="":O(o)?f=`>=${i}.0.0${n} <${+i+1}.0.0-0`:O(a)?i==="0"?f=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`:c?($("replaceCaret pr",c),i==="0"?o==="0"?f=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):($("no pr"),i==="0"?o==="0"?f=`>=${i}.${o}.${a}${n} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}${n} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),$("caret return",f),f})},_s=(e,t)=>($("replaceXRanges",e,t),e.split(/\s+/).map(r=>Bs(r,t)).join(" ")),Bs=(e,t)=>{e=e.trim();let r=t.loose?I[R.XRANGELOOSE]:I[R.XRANGE];return e.replace(r,(n,s,i,o,a,c)=>{$("xRange",e,n,s,i,o,a,c);let f=O(i),h=f||O(o),p=h||O(a),w=p;return s==="="&&w&&(s=""),c=t.includePrerelease?"-0":"",f?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&w?(h&&(o=0),a=0,s===">"?(s=">=",h?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):s==="<="&&(s="<",h?i=+i+1:o=+o+1),s==="<"&&(c="-0"),n=`${s+i}.${o}.${a}${c}`):h?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:p&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),$("xRange return",n),n})},Hs=(e,t)=>($("replaceStars",e,t),e.trim().replace(I[R.STAR],"")),Ws=(e,t)=>($("replaceGTE0",e,t),e.trim().replace(I[t.includePrerelease?R.GTE0PRE:R.GTE0],"")),Ys=e=>(t,r,n,s,i,o,a,c,f,h,p,w)=>(O(n)?r="":O(s)?r=`>=${n}.0.0${e?"-0":""}`:O(i)?r=`>=${n}.${s}.0${e?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,O(f)?c="":O(h)?c=`<${+f+1}.0.0-0`:O(p)?c=`<${f}.${+h+1}.0-0`:w?c=`<=${f}.${h}.${p}-${w}`:e?c=`<${f}.${h}.${+p+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),Js=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var U=m((Va,nr)=>{"use strict";var F=Symbol("SemVer ANY"),Ae=class e{static get ANY(){return F}constructor(t,r){if(r=Kt(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),ve("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===F?this.value="":this.value=this.operator+this.semver.version,ve("comp",this)}parse(t){let r=this.options.loose?Qt[er.COMPARATORLOOSE]:Qt[er.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new tr(n[2],this.options.loose):this.semver=F}toString(){return this.value}test(t){if(ve("Comparator.test",t,this.options.loose),this.semver===F||t===F)return!0;if(typeof t=="string")try{t=new tr(t,this.options)}catch{return!1}return xe(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new rr(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new rr(this.value,r).test(t.semver):(r=Kt(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||xe(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||xe(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};nr.exports=Ae;var Kt=H(),{safeRe:Qt,t:er}=k(),xe=Oe(),ve=C(),tr=y(),rr=S()});var G=m((Ma,sr)=>{"use strict";var Zs=S(),Ks=(e,t,r)=>{try{t=new Zs(t,r)}catch{return!1}return t.test(e)};sr.exports=Ks});var or=m((_a,ir)=>{"use strict";var Qs=S(),ei=(e,t)=>new Qs(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));ir.exports=ei});var cr=m((Ba,ar)=>{"use strict";var ti=y(),ri=S(),ni=(e,t,r)=>{let n=null,s=null,i=null;try{i=new ri(t,r)}catch{return null}return e.forEach(o=>{i.test(o)&&(!n||s.compare(o)===-1)&&(n=o,s=new ti(n,r))}),n};ar.exports=ni});var ur=m((Ha,lr)=>{"use strict";var si=y(),ii=S(),oi=(e,t,r)=>{let n=null,s=null,i=null;try{i=new ii(t,r)}catch{return null}return e.forEach(o=>{i.test(o)&&(!n||s.compare(o)===1)&&(n=o,s=new si(n,r))}),n};lr.exports=oi});var hr=m((Wa,pr)=>{"use strict";var Te=y(),ai=S(),fr=D(),ci=(e,t)=>{e=new ai(e,t);let r=new Te("0.0.0");if(e.test(r)||(r=new Te("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let a=new Te(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||fr(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||fr(r,i))&&(r=i)}return r&&e.test(r)?r:null};pr.exports=ci});var mr=m((Ya,dr)=>{"use strict";var li=S(),ui=(e,t)=>{try{return new li(e,t).range||"*"}catch{return null}};dr.exports=ui});var se=m((Ja,gr)=>{"use strict";var fi=y(),$r=U(),{ANY:pi}=$r,hi=S(),di=G(),Er=D(),wr=Q(),mi=te(),Ei=ee(),wi=(e,t,r,n)=>{e=new fi(e,n),t=new hi(t,n);let s,i,o,a,c;switch(r){case">":s=Er,i=mi,o=wr,a=">",c=">=";break;case"<":s=wr,i=Ei,o=Er,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(di(e,t,n))return!1;for(let f=0;f{d.semver===pi&&(d=new $r(">=0.0.0")),p=p||d,w=w||d,s(d.semver,p.semver,n)?p=d:o(d.semver,w.semver,n)&&(w=d)}),p.operator===a||p.operator===c||(!w.operator||w.operator===a)&&i(e,w.semver))return!1;if(w.operator===c&&o(e,w.semver))return!1}return!0};gr.exports=wi});var Rr=m((Za,yr)=>{"use strict";var $i=se(),gi=(e,t,r)=>$i(e,t,">",r);yr.exports=gi});var Or=m((Ka,Ir)=>{"use strict";var yi=se(),Ri=(e,t,r)=>yi(e,t,"<",r);Ir.exports=Ri});var Nr=m((Qa,Sr)=>{"use strict";var Lr=S(),Ii=(e,t,r)=>(e=new Lr(e,r),t=new Lr(t,r),e.intersects(t,r));Sr.exports=Ii});var vr=m((ec,xr)=>{"use strict";var Oi=G(),Li=L();xr.exports=(e,t,r)=>{let n=[],s=null,i=null,o=e.sort((h,p)=>Li(h,p,r));for(let h of o)Oi(h,t,r)?(i=h,s||(s=h)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);let a=[];for(let[h,p]of n)h===p?a.push(h):!p&&h===o[0]?a.push("*"):p?h===o[0]?a.push(`<=${p}`):a.push(`${h} - ${p}`):a.push(`>=${h}`);let c=a.join(" || "),f=typeof t.raw=="string"?t.raw:String(t);return c.length{"use strict";var Ar=S(),ke=U(),{ANY:be}=ke,z=G(),Pe=L(),Si=(e,t,r={})=>{if(e===t)return!0;e=new Ar(e,r),t=new Ar(t,r);let n=!1;e:for(let s of e.set){for(let i of t.set){let o=xi(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},Ni=[new ke(">=0.0.0-0")],Tr=[new ke(">=0.0.0")],xi=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===be){if(t.length===1&&t[0].semver===be)return!0;r.includePrerelease?e=Ni:e=Tr}if(t.length===1&&t[0].semver===be){if(r.includePrerelease)return!0;t=Tr}let n=new Set,s,i;for(let d of e)d.operator===">"||d.operator===">="?s=br(s,d,r):d.operator==="<"||d.operator==="<="?i=kr(i,d,r):n.add(d.semver);if(n.size>1)return null;let o;if(s&&i){if(o=Pe(s.semver,i.semver,r),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let d of n){if(s&&!z(d,String(s),r)||i&&!z(d,String(i),r))return null;for(let _ of t)if(!z(d,String(_),r))return!1;return!0}let a,c,f,h,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,w=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let d of t){if(h=h||d.operator===">"||d.operator===">=",f=f||d.operator==="<"||d.operator==="<=",s){if(w&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===w.major&&d.semver.minor===w.minor&&d.semver.patch===w.patch&&(w=!1),d.operator===">"||d.operator===">="){if(a=br(s,d,r),a===d&&a!==s)return!1}else if(s.operator===">="&&!z(s.semver,String(d),r))return!1}if(i){if(p&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===p.major&&d.semver.minor===p.minor&&d.semver.patch===p.patch&&(p=!1),d.operator==="<"||d.operator==="<="){if(c=kr(i,d,r),c===d&&c!==i)return!1}else if(i.operator==="<="&&!z(i.semver,String(d),r))return!1}if(!d.operator&&(i||s)&&o!==0)return!1}return!(s&&f&&!i&&o!==0||i&&h&&!s&&o!==0||w||p)},br=(e,t,r)=>{if(!e)return t;let n=Pe(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},kr=(e,t,r)=>{if(!e)return t;let n=Pe(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};Pr.exports=Si});var X=m((rc,Dr)=>{"use strict";var qe=k(),jr=j(),vi=y(),Cr=$e(),Ai=b(),Ti=ct(),bi=ut(),ki=ht(),Pi=Et(),qi=$t(),ji=yt(),Ci=It(),Di=Lt(),Ui=L(),Fi=vt(),Gi=Tt(),zi=K(),Xi=qt(),Vi=Ct(),Mi=D(),_i=Q(),Bi=Re(),Hi=Ie(),Wi=ee(),Yi=te(),Ji=Oe(),Zi=_t(),Ki=U(),Qi=S(),eo=G(),to=or(),ro=cr(),no=ur(),so=hr(),io=mr(),oo=se(),ao=Rr(),co=Or(),lo=Nr(),uo=vr(),fo=qr();Dr.exports={parse:Ai,valid:Ti,clean:bi,inc:ki,diff:Pi,major:qi,minor:ji,patch:Ci,prerelease:Di,compare:Ui,rcompare:Fi,compareLoose:Gi,compareBuild:zi,sort:Xi,rsort:Vi,gt:Mi,lt:_i,eq:Bi,neq:Hi,gte:Wi,lte:Yi,cmp:Ji,coerce:Zi,Comparator:Ki,Range:Qi,satisfies:eo,toComparators:to,maxSatisfying:ro,minSatisfying:no,minVersion:so,validRange:io,outside:oo,gtr:ao,ltr:co,intersects:lo,simplifyRange:uo,subset:fo,SemVer:vi,re:qe.re,src:qe.src,tokens:qe.t,SEMVER_SPEC_VERSION:jr.SEMVER_SPEC_VERSION,RELEASE_TYPES:jr.RELEASE_TYPES,compareIdentifiers:Cr.compareIdentifiers,rcompareIdentifiers:Cr.rcompareIdentifiers}});var me=new TextDecoder;function _e(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function Be(e,t){let r=String(t??"").split(/\s+/).filter(i=>i.startsWith("sha512-")).map(i=>i.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,i=>String.fromCharCode(i)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function He(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let i=await r.read();!i.done;i=await r.read()){if(s+=i.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(i.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function q(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return me.decode(s<0?n:n.subarray(0,s))}function We(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,i)=>s*256+i,e[t]&127);let n=q(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function pn(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if(We(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function hn(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let i=me.decode(e.subarray(n+1,r+s-1)),o=i.indexOf("=");t[i.slice(0,o)]=i.slice(o+1),r+=s}return t}function dn(e,t){let r=e.subarray(t,t+512);pn(r);let n=We(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function mn(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function En(e){let t=q(e,0,100),r=q(e,257,5)==="ustar"?q(e,345,155):"";return r?`${r}/${t}`:t}var Me={x:(e,t)=>({...e,pax:hn(t).path}),L:(e,t)=>({...e,long:q(t,0,t.length)}),g:e=>e};function Ye(e){let t=[],r={};for(let n=0;!mn(e,n);){let{header:s,type:i,data:o,next:a}=dn(e,n);if(n=a,Object.hasOwn(Me,i)){r=Me[i](r,o);continue}(i==="0"||i==="7")&&t.push({path:r.pax??r.long??En(s),bytes:o}),r={}}return t}var ae=B(X(),1);var x=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function ie(e,t){let r=[],n=0;for(;;){let s=await x(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function je(e,{id:t,path:r,bytes:n},s){for(let i=0;i{}),a}}async function po(e,t){let r=[],n=0;for(;;){let{done:s,value:i}=await e.read();if(s)return r;if(n+=i.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(i)}}async function ho(e,t){try{return await po(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function Ur(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await ho(e.body.getReader(),t)).arrayBuffer())}var mo=/[\\\0:*?"<>|]/,Eo=e=>e.split("/").some(t=>!t||t==="."||t==="..");function wo(e){return typeof e!="string"||!e||mo.test(e)?!0:Eo(e)}function A(e){if(wo(e))throw new Error(`Unsafe package path: ${e}`);return e}var $o=new TextDecoder,go=["preinstall","install","postinstall"];async function Fr(e){let t=new Map;for(let r of Ye(await He(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=A(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var yo=e=>go.some(t=>e.scripts?.[t]),Ro=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function Io(e,t){return yo(e)||e.gypfile?!0:Ro(t)}function Gr(e,t,r){let n=JSON.parse($o.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(Io(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}var Ce=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),ce=(e,t)=>`${e.replace("/","+")}@${t}`,De=(e,t,r)=>`${ce(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function Oo(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function Lo(e,t){let r=e["dist-tags"]?.[t];return r||(ae.default.valid(t)?t:ae.default.maxSatisfying(Object.keys(e.versions??{}),t))}function So(e,t,r){let n=r||"latest",s=Lo(e,n),i=e.versions?.[s];if(!i||!ae.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:i}}async function No(e,t,r,{fetchImpl:n,signal:s}){let i=new URL(t.dist?.tarball,r);if(i.protocol!=="https:"&&i.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let o=await n(i,{signal:s});if(!o.ok)throw new Error(`Package download for ${e}: HTTP ${o.status}`);let a=await Ur(o);return{bytes:a,integrity:await Be(a,t.dist.integrity)}}function xo(e){let t=new URL(e,globalThis.location?.href);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function P(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!Ce(e))throw new Error(`Unsupported npm package name: ${e}`);let i=xo(r),o={fetchImpl:n,signal:s},{version:a,manifest:c}=So(await Oo(e,i,o),e,t),{bytes:f,integrity:h}=await No(e,c,i,o),p=await Fr(f),w=Gr(p,e,a);return{id:ce(e,a),key:De(e,a,h),manifest:w,integrity:h,files:p}}var le=B(X(),1);function vo(e,t,r){let n=e?.roots?.[t];return n?.requested===r&&e.packages[n.id]?e.packages[n.id]:le.default.validRange(r)?Object.values(e?.packages??{}).filter(i=>i.name===t&&le.default.satisfies(i.version,r)).sort((i,o)=>le.default.rcompare(i.version,o.version))[0]??null:null}function zr({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=P,previous:s}){let i=new Map;return async(o,a)=>{let c=`${o}@${a}`;if(i.has(c))return i.get(c);let f=vo(s,o,a),h=await n(o,f?.version??a,{registry:e,fetchImpl:t,signal:r});if(f&&h.integrity!==f.integrity)throw new Error(`${h.id} no longer matches the integrity recorded in the lock`);return i.set(c,h),h}}var Xr=B(X(),1),Vr=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function Ao(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw Vr(e,t,r)}function To(e,[t,r],{nodes:n,roots:s}){let i=s[t]?.id??e.dependencies[t];if(!i)return Ao(e,t,r);if(!Xr.default.satisfies(n[i].version,r))throw Vr(e,t,r);return i}function bo(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=To(e,r,t);n&&(e.dependencies[r[0]]=n)}}function Mr(e,t){for(let r of Object.values(e))bo(r,{nodes:e,roots:t})}var _r=B(X(),1);function ko(e,t){return!Ce(t.name)||!_r.default.valid(t.version)?!1:e===ce(t.name,t.version)}function Po(e){return e.integrity?.startsWith("sha512-")?e.key===De(e.name,e.version,e.integrity):!1}function qo(e,t,r){if(!ko(t,r)||!Po(r))throw new Error("Invalid locked package");for(let n of r.files)A(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function jo(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function Ue(e){if(!jo(e))throw new Error("Unsupported package lock");for(let[t,r]of Object.entries(e.packages))qo(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function Co(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function Do(e,t){let r={};for(let n of e){let{name:s,version:i}=_e(n);r[s]={requested:i||"latest",id:await t(s,i||"latest")}}return r}async function Br(e,t={}){let r=zr(t),n={nodes:{},downloads:new Map,total:0},s=async(o,a)=>{t.signal?.throwIfAborted();let c=await r(o,a);if(n.nodes[c.id])return c.id;Co(n,o,c);for(let[f,h]of Object.entries(c.manifest.dependencies??{}).sort())n.nodes[c.id].dependencies[f]=await s(f,h);return c.id},i=await Do(e,s);return Mr(n.nodes,i),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:i,packages:n.nodes},downloads:n.downloads}}function Fe(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var v="webfront.project.json",V=1,Ge=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,Uo=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,Fo=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,Hr=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,Go=/^[A-Za-z_][A-Za-z0-9_]*$/,Wr=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],zo=["files","publish","fetch"],g=e=>{throw new Error(`${v}: ${e}`)};function T(e,t){return Fe(e)||g(`${t} must be an object`),e}function ze(e,t,r){for(let n of Object.keys(e))t.includes(n)||g(`unknown key "${n}" in ${r}`)}function ue(e,t){typeof e!="string"&&g(`${t} must be a project path`);try{return A(e)}catch{return g(`${t} is not a safe project-relative path: ${e}`)}}function Yr(e,t){return(!Array.isArray(e)||e.length>256)&&g(`${t} must be an array of at most 256 paths`),e.map((r,n)=>ue(r,`${t}[${n}]`))}function Xo(e){let t=T(e,"dependencies");for(let[r,n]of Object.entries(t))Ge.test(r)||g(`invalid npm package name "${r}"`),(typeof n!="string"||!Fo.test(n)||n!==n.trim())&&g(`invalid version range for "${r}"`);return t}function Vo(e){if(typeof e!="string"&&g("registry must be a URL"),e.startsWith("/")&&!e.startsWith("//"))return e;let t;try{t=new URL(e)}catch{return g("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&g("registry must use https"),e}function Mo(e){let t=T(e,"scripts");for(let[r,n]of Object.entries(t))(!Hr.test(r)||typeof n!="string"||!n||n.length>1024)&&g(`invalid script "${r}"`);return t}function _o(e){let t=T(e,"entries");for(let[r,n]of Object.entries(t))Hr.test(r)||g(`invalid entry name "${r}"`),ue(n,`entries.${r}`);return t}function Bo(e,t){let r=T(e,"providers");for(let[n,s]of Object.entries(r))Go.test(n)||g(`invalid provider name "${n}"`),T(s,`providers.${n}`),ze(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&g(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||ue(s.entry,`providers.${n}.entry`),ue(s.output,`providers.${n}.output`).endsWith(".hpp")||g(`providers.${n}.output must be a .hpp file`);return r}function Ho(e){let t=T(e,"test");return ze(t,["specs"],"test"),t.specs!==void 0&&Yr(t.specs,"test.specs"),t}function Wo(e,t){let r;try{r=new URL(e)}catch{return g(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&g(`${t} must be an https origin without a path`),e}function Yo(e){let t=T(e,"permissions");for(let r of Object.keys(t))zo.includes(r)||g(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&Yr(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&g("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>Wo(r,`permissions.fetch[${n}]`))),t}function Jo(e){(typeof e.name!="string"||!Ge.test(e.name))&&g("name must be a lower-case npm package name"),(typeof e.version!="string"||!Uo.test(e.version))&&g("version must be a semantic version")}function Zo(e){e.format!==V&&(Number.isInteger(e.format)&&e.format>V&&g(`format ${e.format} is not supported by this environment (it reads format ${V}); update the environment`),g(`format must be ${V}`))}function Ko(e){T(e,"the manifest"),Zo(e),ze(e,Wr,"the manifest"),Jo(e);let t=e.entries===void 0?{}:_o(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:Xo(e.dependencies),entries:t,providers:e.providers===void 0?{}:Bo(e.providers,t),...e.registry===void 0?{}:{registry:Vo(e.registry)},...e.scripts===void 0?{}:{scripts:Mo(e.scripts)},...e.test===void 0?{}:{test:Ho(e.test)},...e.permissions===void 0?{}:{permissions:Yo(e.permissions)}}}function Jr(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return g("not valid JSON")}return Ko(t)}function Xe(e){let t={};for(let r of Wr)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` -`}function Zr(e){return{format:V,name:e,version:"0.1.0",dependencies:{}}}function Kr(e){let r=(String(e??"").split("/").filter(Boolean).pop()??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"");return Ge.test(r)?r:"webfront-app"}async function fe(e){let t=JSON.stringify(Object.entries(e).sort(([n],[s])=>ns?1:0)),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(r)].map(n=>n.toString(16).padStart(2,"0")).join("")}var M="webfront-packages.lock.json",pe=".webfront/developer/packages",Qo=new TextDecoder,ea=new TextEncoder,en="No webfront.project.json: run wf init",he="The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again";async function Qr(e,t){try{return await ie(e,t)}catch(r){if(r.message.includes("Cannot read project file:"))return null;throw r}}function ta(e,t,r){return e?t?t.manifestDigest===r?"consistent":"desynchronized":"unlocked":"no-manifest"}async function tn(e){let t=await x(e,"state",`${v} -${M}`),r=await Qr(e,v),n=await Qr(e,M),s=r?Jr(r):null,i=n?Ue(JSON.parse(Qo.decode(n))):null,o=s?await fe(s.dependencies):null;return{manifest:s,lock:i,token:t,status:ta(s,i,o),digest:o}}var jc=e=>e.status==="desynchronized"?`Warning: ${he}.\r -`:"";async function rn(e,t,r,{signal:n}={}){let s=[];try{for(let[i,o]of t){n?.throwIfAborted();let a=await x(e,"begin",i,!1);s.push(a),await je(e,{id:a,path:"output",bytes:o},n)}n?.throwIfAborted(),await x(e,"commitGroup",s.join(` -`),`${v} -${M}`,r.token)}catch(i){for(let o of s)await x(e,"abort",o).catch(()=>{});throw i}}function Cc(e,t,r){let n=e?.entries??{};if(t!==void 0)return Object.hasOwn(n,t)?n[t]:t;if(Object.hasOwn(n,"main"))return n.main;let s=Object.keys(n);if(s.length===1)return n[s[0]];throw new Error(`Usage: ${r} (declare entries.main in ${v} to omit the entry)`)}var de=e=>ea.encode(e);var nn=e=>{let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?[e,void 0]:[e.slice(0,t),e.slice(t+1)||void 0]};async function Vc(e,[t=".",...r],{signal:n}={}){if(r.length)throw new Error("Usage: wf init [directory]");let s=t==="."?"":A(t.replace(/\/+$/,"")),i=s?`${s}/${v}`:v,o=new Map([["output",de(Xe(Zr(Kr(s))))]]);return await oe(e,i,o,{directory:!1,replace:!1,signal:n}),`Created ${i}. Add libraries with wf install .`}function ra(e,t){let r={...e.dependencies},n=new Set;for(let s of t){let[i,o]=nn(s);r[i]=o??"latest",o&&o!=="latest"&&n.add(i)}return{dependencies:r,explicit:n}}function na({dependencies:e,explicit:t},r,n){let s={...e};for(let i of n){let o=nn(i)[0];t.has(o)||(s[o]=`^${r.packages[r.roots[o].id].version}`)}return s}async function sa(e,t,r){let n=Object.entries(e).map(([o,a])=>`${o}@${a}`),{lock:s,downloads:i}=await Br(n,{registry:r.registry,signal:r.signal,fetchImpl:r.fetchImpl,previous:t,download:async(...o)=>(r.progress(`Resolving ${o[0]}@${o[1]}`),P(...o))});return{lock:s,downloads:i}}async function ia(e,t,r,{signal:n,progress:s}){for(let[i,o]of r)s(`Storing ${i}`),await oe(e,`${pe}/${t.packages[i].key}`,o,{signal:n})}async function oa(e,t){try{return await ie(e,`${pe}/${t.key}/package.json`),!0}catch{return!1}}async function aa(e,t,{signal:r,progress:n,fetchImpl:s}){let i=0;for(let[o,a]of Object.entries(t.packages)){if(r?.throwIfAborted(),await oa(e,a))continue;n(`Restoring ${o}`);let c=await P(a.name,a.version,{registry:t.registry,fetchImpl:s,signal:r});if(c.integrity!==a.integrity)throw new Error(`${o} no longer matches the integrity recorded in the lock`);await oe(e,`${pe}/${a.key}`,c.files,{signal:r}),i++}return i}function ca(e){let t=e.includes("--update"),r=e.filter(n=>n!=="--update");if(r.some(n=>n.startsWith("-")))throw new Error("Usage: wf install [--update] [[@range] ...]");return{update:t,specs:r}}async function la(e,t,{manifest:r,lock:n},s){let i=new Map([[M,de(JSON.stringify(n,null,2)+` -`)]]);r&&i.set(v,de(Xe(r))),await rn(e,i,t,s)}var ua=async(e,t)=>({format:e.format,manifestDigest:await fe(t),...e});async function Mc(e,t,{registry:r,signal:n,progress:s=()=>{},fetchImpl:i=fetch}){let{update:o,specs:a}=ca(t),c=await tn(e);if(!c.manifest)throw new Error(en);let f={registry:c.manifest.registry??r,signal:n,fetchImpl:i,progress:s};if(a.length&&o)throw new Error("Usage: wf install --update does not take packages");if(a.length&&c.status==="desynchronized")throw new Error(he);if(!a.length&&!o&&c.status==="desynchronized")throw new Error(he);if(!a.length&&!o&&c.status==="consistent")return{lock:c.lock,restored:await aa(e,c.lock,{signal:n,progress:s,fetchImpl:f.fetchImpl})};let h=ra(c.manifest,a),p=c.status==="consistent"&&!o?c.lock:void 0,w=await sa(h.dependencies,p,f),d=na(h,w.lock,a);await ia(e,w.lock,w.downloads,{signal:n,progress:s});let _=await ua(w.lock,d),sn=a.length?{...c.manifest,dependencies:d}:null;return await la(e,c,{manifest:sn,lock:_},{signal:n}),{lock:_,restored:0}}export{fe as dependenciesDigest,he as desynchronized,P as downloadPackage,Uo as exactVersion,Go as identifier,Vc as initProject,Mc as install,tn as loadProject,M as lockPath,V as manifestFormat,Kr as manifestName,v as manifestPath,Zr as newManifest,en as noManifest,Ge as npmName,pe as packageRoot,Jr as parseManifest,rn as publishTogether,Cc as resolveEntry,Br as resolvePackages,A as safePackagePath,Xe as serializeManifest,jc as syncNotice,de as textBytes,Ue as validateLock,Ko as validateManifest}; +var En=Object.create;var Qe=Object.defineProperty;var wn=Object.getOwnPropertyDescriptor;var $n=Object.getOwnPropertyNames;var gn=Object.getPrototypeOf,yn=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var Rn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of $n(t))!yn.call(e,s)&&s!==r&&Qe(e,s,{get:()=>t[s],enumerable:!(n=wn(t,s))||n.enumerable});return e};var P=(e,t,r)=>(r=e!=null?En(gn(e)):{},Rn(t||!e||!e.__esModule?Qe(r,"default",{value:e,enumerable:!0}):r,e));var U=m((Oa,it)=>{"use strict";var Sn="2.0.0",Nn=Number.MAX_SAFE_INTEGER||9007199254740991,bn=16,An=250,Tn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];it.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:bn,MAX_SAFE_BUILD_LENGTH:An,MAX_SAFE_INTEGER:Nn,RELEASE_TYPES:Tn,SEMVER_SPEC_VERSION:Sn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var F=m((va,ot)=>{"use strict";var kn=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};ot.exports=kn});var q=m((x,at)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:$e,MAX_SAFE_BUILD_LENGTH:Pn,MAX_LENGTH:qn}=U(),jn=F();x=at.exports={};var Cn=x.re=[],Dn=x.safeRe=[],l=x.src=[],Un=x.safeSrc=[],u=x.t={},Fn=0,ge="[a-zA-Z0-9-]",Gn=[["\\s",1],["\\d",qn],[ge,Pn]],zn=e=>{for(let[t,r]of Gn)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},E=(e,t,r)=>{let n=zn(t),s=Fn++;jn(e,s,t),u[e]=s,l[s]=t,Un[s]=n,Cn[s]=new RegExp(t,r?"g":void 0),Dn[s]=new RegExp(n,r?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${ge}*`);E("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${ge}+`);E("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`);E("FULL",`^${l[u.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`);E("LOOSE",`^${l[u.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`);E("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${$e}})(?:\\.(\\d{1,${$e}}))?(?:\\.(\\d{1,${$e}}))?`);E("COERCE",`${l[u.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",l[u.COERCEPLAIN]+`(?:${l[u.PRERELEASE]})?(?:${l[u.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",l[u.COERCE],!0);E("COERCERTLFULL",l[u.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0);x.tildeTrimReplace="$1~";E("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0);x.caretTrimReplace="$1^";E("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0);x.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Y=m((La,ct)=>{"use strict";var Xn=Object.freeze({loose:!0}),Mn=Object.freeze({}),Vn=e=>e?typeof e!="object"?Xn:e:Mn;ct.exports=Vn});var ye=m((xa,ft)=>{"use strict";var lt=/^[0-9]+$/,ut=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:eut(t,e);ft.exports={compareIdentifiers:ut,rcompareIdentifiers:_n}});var y=m((Sa,ht)=>{"use strict";var J=F(),{MAX_LENGTH:pt,MAX_SAFE_INTEGER:Z}=U(),{safeRe:K,t:Q}=q(),Bn=Y(),{compareIdentifiers:Re}=ye(),Ie=class e{constructor(t,r){if(r=Bn(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>pt)throw new TypeError(`version is longer than ${pt} characters`);J("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?K[Q.LOOSE]:K[Q.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Z||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Z||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Z||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let i=+s;if(i>=0&&it.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(J("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return Re(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(J("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return Re(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?K[Q.PRERELEASELOOSE]:K[Q.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let i=[r,s];n===!1&&(i=[r]),Re(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};ht.exports=Ie});var A=m((Na,mt)=>{"use strict";var dt=y(),Hn=(e,t,r=!1)=>{if(e instanceof dt)return e;try{return new dt(e,t)}catch(n){if(!r)return null;throw n}};mt.exports=Hn});var wt=m((ba,Et)=>{"use strict";var Wn=A(),Yn=(e,t)=>{let r=Wn(e,t);return r?r.version:null};Et.exports=Yn});var gt=m((Aa,$t)=>{"use strict";var Jn=A(),Zn=(e,t)=>{let r=Jn(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};$t.exports=Zn});var It=m((Ta,Rt)=>{"use strict";var yt=y(),Kn=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new yt(e instanceof yt?e.version:e,r).inc(t,n,s).version}catch{return null}};Rt.exports=Kn});var Lt=m((ka,vt)=>{"use strict";var Ot=A(),Qn=(e,t)=>{let r=Ot(e,null,!0),n=Ot(t,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let d=c?"pre":"";return r.major!==n.major?d+"major":r.minor!==n.minor?d+"minor":r.patch!==n.patch?d+"patch":"prerelease"};vt.exports=Qn});var St=m((Pa,xt)=>{"use strict";var es=y(),ts=(e,t)=>new es(e,t).major;xt.exports=ts});var bt=m((qa,Nt)=>{"use strict";var rs=y(),ns=(e,t)=>new rs(e,t).minor;Nt.exports=ns});var Tt=m((ja,At)=>{"use strict";var ss=y(),is=(e,t)=>new ss(e,t).patch;At.exports=is});var Pt=m((Ca,kt)=>{"use strict";var os=A(),as=(e,t)=>{let r=os(e,t);return r&&r.prerelease.length?r.prerelease:null};kt.exports=as});var v=m((Da,jt)=>{"use strict";var qt=y(),cs=(e,t,r)=>new qt(e,r).compare(new qt(t,r));jt.exports=cs});var Dt=m((Ua,Ct)=>{"use strict";var ls=v(),us=(e,t,r)=>ls(t,e,r);Ct.exports=us});var Ft=m((Fa,Ut)=>{"use strict";var fs=v(),ps=(e,t)=>fs(e,t,!0);Ut.exports=ps});var ee=m((Ga,zt)=>{"use strict";var Gt=y(),hs=(e,t,r)=>{let n=new Gt(e,r),s=new Gt(t,r);return n.compare(s)||n.compareBuild(s)};zt.exports=hs});var Mt=m((za,Xt)=>{"use strict";var ds=ee(),ms=(e,t)=>e.sort((r,n)=>ds(r,n,t));Xt.exports=ms});var _t=m((Xa,Vt)=>{"use strict";var Es=ee(),ws=(e,t)=>e.sort((r,n)=>Es(n,r,t));Vt.exports=ws});var G=m((Ma,Bt)=>{"use strict";var $s=v(),gs=(e,t,r)=>$s(e,t,r)>0;Bt.exports=gs});var te=m((Va,Ht)=>{"use strict";var ys=v(),Rs=(e,t,r)=>ys(e,t,r)<0;Ht.exports=Rs});var Oe=m((_a,Wt)=>{"use strict";var Is=v(),Os=(e,t,r)=>Is(e,t,r)===0;Wt.exports=Os});var ve=m((Ba,Yt)=>{"use strict";var vs=v(),Ls=(e,t,r)=>vs(e,t,r)!==0;Yt.exports=Ls});var re=m((Ha,Jt)=>{"use strict";var xs=v(),Ss=(e,t,r)=>xs(e,t,r)>=0;Jt.exports=Ss});var ne=m((Wa,Zt)=>{"use strict";var Ns=v(),bs=(e,t,r)=>Ns(e,t,r)<=0;Zt.exports=bs});var Le=m((Ya,Kt)=>{"use strict";var As=Oe(),Ts=ve(),ks=G(),Ps=re(),qs=te(),js=ne(),Cs=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return As(e,r,n);case"!=":return Ts(e,r,n);case">":return ks(e,r,n);case">=":return Ps(e,r,n);case"<":return qs(e,r,n);case"<=":return js(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};Kt.exports=Cs});var er=m((Ja,Qt)=>{"use strict";var Ds=y(),Us=A(),{safeRe:se,t:ie}=q(),Fs=(e,t)=>{if(e instanceof Ds)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?se[ie.COERCEFULL]:se[ie.COERCE]);else{let c=t.includePrerelease?se[ie.COERCERTLFULL]:se[ie.COERCERTL],f;for(;(f=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||f.index+f[0].length!==r.index+r[0].length)&&(r=f),c.lastIndex=f.index+f[1].length+f[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Us(`${n}.${s}.${i}${o}${a}`,t)};Qt.exports=Fs});var rr=m((Za,tr)=>{"use strict";var xe=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};tr.exports=xe});var L=m((Ka,or)=>{"use strict";var Gs=/\s+/g,Se=class e{constructor(t,r){if(r=Xs(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Ne)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(Gs," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!sr(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&Ys(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&Hs)|(this.options.loose&&Ws))+":"+t,s=nr.get(n);if(s)return s;let i=this.options.loose,o=i?I[R.HYPHENRANGELOOSE]:I[R.HYPHENRANGE];t=t.replace(o,ii(this.options.includePrerelease)),$("hyphen replace",t),t=t.replace(I[R.COMPARATORTRIM],Vs),$("comparator trim",t),t=t.replace(I[R.TILDETRIM],_s),$("tilde trim",t),t=t.replace(I[R.CARETTRIM],Bs),$("caret trim",t);let a=t.split(" ").map(p=>Js(p,this.options)).join(" ").split(/\s+/).map(p=>si(p,this.options));i&&(a=a.filter(p=>($("loose invalid filter",p,this.options),!!p.match(I[R.COMPARATORLOOSE])))),$("range list",a);let c=new Map,f=a.map(p=>new Ne(p,this.options));for(let p of f){if(sr(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let d=[...c.values()];return nr.set(n,d),d}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>ir(n,r)&&t.set.some(s=>ir(s,r)&&n.every(i=>s.every(o=>i.intersects(o,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new Ms(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",Ys=e=>e.value==="",ir=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(i=>s.intersects(i,t)),s=n.pop();return r},Js=(e,t)=>(e=e.replace(I[R.BUILD],""),$("comp",e,t),e=Qs(e,t),$("caret",e),e=Zs(e,t),$("tildes",e),e=ti(e,t),$("xrange",e),e=ni(e,t),$("stars",e),e),O=e=>!e||e.toLowerCase()==="x"||e==="*",Zs=(e,t)=>e.trim().split(/\s+/).map(r=>Ks(r,t)).join(" "),Ks=(e,t)=>{let r=t.loose?I[R.TILDELOOSE]:I[R.TILDE];return e.replace(r,(n,s,i,o,a)=>{$("tilde",e,n,s,i,o,a);let c;return O(s)?c="":O(i)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:O(o)?c=`>=${s}.${i}.0 <${s}.${+i+1}.0-0`:a?($("replaceTilde pr",a),c=`>=${s}.${i}.${o}-${a} <${s}.${+i+1}.0-0`):c=`>=${s}.${i}.${o} <${s}.${+i+1}.0-0`,$("tilde return",c),c})},Qs=(e,t)=>e.trim().split(/\s+/).map(r=>ei(r,t)).join(" "),ei=(e,t)=>{$("caret",e,t);let r=t.loose?I[R.CARETLOOSE]:I[R.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,c)=>{$("caret",e,s,i,o,a,c);let f;return O(i)?f="":O(o)?f=`>=${i}.0.0${n} <${+i+1}.0.0-0`:O(a)?i==="0"?f=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`:c?($("replaceCaret pr",c),i==="0"?o==="0"?f=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):($("no pr"),i==="0"?o==="0"?f=`>=${i}.${o}.${a}${n} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}${n} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),$("caret return",f),f})},ti=(e,t)=>($("replaceXRanges",e,t),e.split(/\s+/).map(r=>ri(r,t)).join(" ")),ri=(e,t)=>{e=e.trim();let r=t.loose?I[R.XRANGELOOSE]:I[R.XRANGE];return e.replace(r,(n,s,i,o,a,c)=>{$("xRange",e,n,s,i,o,a,c);let f=O(i),d=f||O(o),p=d||O(a),w=p;return s==="="&&w&&(s=""),c=t.includePrerelease?"-0":"",f?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&w?(d&&(o=0),a=0,s===">"?(s=">=",d?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):s==="<="&&(s="<",d?i=+i+1:o=+o+1),s==="<"&&(c="-0"),n=`${s+i}.${o}.${a}${c}`):d?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:p&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),$("xRange return",n),n})},ni=(e,t)=>($("replaceStars",e,t),e.trim().replace(I[R.STAR],"")),si=(e,t)=>($("replaceGTE0",e,t),e.trim().replace(I[t.includePrerelease?R.GTE0PRE:R.GTE0],"")),ii=e=>(t,r,n,s,i,o,a,c,f,d,p,w)=>(O(n)?r="":O(s)?r=`>=${n}.0.0${e?"-0":""}`:O(i)?r=`>=${n}.${s}.0${e?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,O(f)?c="":O(d)?c=`<${+f+1}.0.0-0`:O(p)?c=`<${f}.${+d+1}.0-0`:w?c=`<=${f}.${d}.${p}-${w}`:e?c=`<${f}.${d}.${+p+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),oi=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var z=m((Qa,pr)=>{"use strict";var X=Symbol("SemVer ANY"),Te=class e{static get ANY(){return X}constructor(t,r){if(r=ar(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),Ae("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===X?this.value="":this.value=this.operator+this.semver.version,Ae("comp",this)}parse(t){let r=this.options.loose?cr[lr.COMPARATORLOOSE]:cr[lr.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new ur(n[2],this.options.loose):this.semver=X}toString(){return this.value}test(t){if(Ae("Comparator.test",t,this.options.loose),this.semver===X||t===X)return!0;if(typeof t=="string")try{t=new ur(t,this.options)}catch{return!1}return be(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new fr(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new fr(this.value,r).test(t.semver):(r=ar(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||be(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||be(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};pr.exports=Te;var ar=Y(),{safeRe:cr,t:lr}=q(),be=Le(),Ae=F(),ur=y(),fr=L()});var M=m((ec,hr)=>{"use strict";var ai=L(),ci=(e,t,r)=>{try{t=new ai(t,r)}catch{return!1}return t.test(e)};hr.exports=ci});var mr=m((tc,dr)=>{"use strict";var li=L(),ui=(e,t)=>new li(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));dr.exports=ui});var wr=m((rc,Er)=>{"use strict";var fi=y(),pi=L(),hi=(e,t,r)=>{let n=null,s=null,i=null;try{i=new pi(t,r)}catch{return null}return e.forEach(o=>{i.test(o)&&(!n||s.compare(o)===-1)&&(n=o,s=new fi(n,r))}),n};Er.exports=hi});var gr=m((nc,$r)=>{"use strict";var di=y(),mi=L(),Ei=(e,t,r)=>{let n=null,s=null,i=null;try{i=new mi(t,r)}catch{return null}return e.forEach(o=>{i.test(o)&&(!n||s.compare(o)===1)&&(n=o,s=new di(n,r))}),n};$r.exports=Ei});var Ir=m((sc,Rr)=>{"use strict";var ke=y(),wi=L(),yr=G(),$i=(e,t)=>{e=new wi(e,t);let r=new ke("0.0.0");if(e.test(r)||(r=new ke("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let a=new ke(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||yr(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||yr(r,i))&&(r=i)}return r&&e.test(r)?r:null};Rr.exports=$i});var vr=m((ic,Or)=>{"use strict";var gi=L(),yi=(e,t)=>{try{return new gi(e,t).range||"*"}catch{return null}};Or.exports=yi});var oe=m((oc,Nr)=>{"use strict";var Ri=y(),Sr=z(),{ANY:Ii}=Sr,Oi=L(),vi=M(),Lr=G(),xr=te(),Li=ne(),xi=re(),Si=(e,t,r,n)=>{e=new Ri(e,n),t=new Oi(t,n);let s,i,o,a,c;switch(r){case">":s=Lr,i=Li,o=xr,a=">",c=">=";break;case"<":s=xr,i=xi,o=Lr,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(vi(e,t,n))return!1;for(let f=0;f{h.semver===Ii&&(h=new Sr(">=0.0.0")),p=p||h,w=w||h,s(h.semver,p.semver,n)?p=h:o(h.semver,w.semver,n)&&(w=h)}),p.operator===a||p.operator===c||(!w.operator||w.operator===a)&&i(e,w.semver))return!1;if(w.operator===c&&o(e,w.semver))return!1}return!0};Nr.exports=Si});var Ar=m((ac,br)=>{"use strict";var Ni=oe(),bi=(e,t,r)=>Ni(e,t,">",r);br.exports=bi});var kr=m((cc,Tr)=>{"use strict";var Ai=oe(),Ti=(e,t,r)=>Ai(e,t,"<",r);Tr.exports=Ti});var jr=m((lc,qr)=>{"use strict";var Pr=L(),ki=(e,t,r)=>(e=new Pr(e,r),t=new Pr(t,r),e.intersects(t,r));qr.exports=ki});var Dr=m((uc,Cr)=>{"use strict";var Pi=M(),qi=v();Cr.exports=(e,t,r)=>{let n=[],s=null,i=null,o=e.sort((d,p)=>qi(d,p,r));for(let d of o)Pi(d,t,r)?(i=d,s||(s=d)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);let a=[];for(let[d,p]of n)d===p?a.push(d):!p&&d===o[0]?a.push("*"):p?d===o[0]?a.push(`<=${p}`):a.push(`${d} - ${p}`):a.push(`>=${d}`);let c=a.join(" || "),f=typeof t.raw=="string"?t.raw:String(t);return c.length{"use strict";var Ur=L(),qe=z(),{ANY:Pe}=qe,V=M(),je=v(),ji=(e,t,r={})=>{if(e===t)return!0;e=new Ur(e,r),t=new Ur(t,r);let n=!1;e:for(let s of e.set){for(let i of t.set){let o=Di(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},Ci=[new qe(">=0.0.0-0")],Fr=[new qe(">=0.0.0")],Di=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Pe){if(t.length===1&&t[0].semver===Pe)return!0;r.includePrerelease?e=Ci:e=Fr}if(t.length===1&&t[0].semver===Pe){if(r.includePrerelease)return!0;t=Fr}let n=new Set,s,i;for(let h of e)h.operator===">"||h.operator===">="?s=Gr(s,h,r):h.operator==="<"||h.operator==="<="?i=zr(i,h,r):n.add(h.semver);if(n.size>1)return null;let o;if(s&&i){if(o=je(s.semver,i.semver,r),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let h of n){if(s&&!V(h,String(s),r)||i&&!V(h,String(i),r))return null;for(let H of t)if(!V(h,String(H),r))return!1;return!0}let a,c,f,d,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,w=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let h of t){if(d=d||h.operator===">"||h.operator===">=",f=f||h.operator==="<"||h.operator==="<=",s){if(w&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===w.major&&h.semver.minor===w.minor&&h.semver.patch===w.patch&&(w=!1),h.operator===">"||h.operator===">="){if(a=Gr(s,h,r),a===h&&a!==s)return!1}else if(s.operator===">="&&!V(s.semver,String(h),r))return!1}if(i){if(p&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===p.major&&h.semver.minor===p.minor&&h.semver.patch===p.patch&&(p=!1),h.operator==="<"||h.operator==="<="){if(c=zr(i,h,r),c===h&&c!==i)return!1}else if(i.operator==="<="&&!V(i.semver,String(h),r))return!1}if(!h.operator&&(i||s)&&o!==0)return!1}return!(s&&f&&!i&&o!==0||i&&d&&!s&&o!==0||w||p)},Gr=(e,t,r)=>{if(!e)return t;let n=je(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},zr=(e,t,r)=>{if(!e)return t;let n=je(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};Xr.exports=ji});var T=m((pc,Br)=>{"use strict";var Ce=q(),Vr=U(),Ui=y(),_r=ye(),Fi=A(),Gi=wt(),zi=gt(),Xi=It(),Mi=Lt(),Vi=St(),_i=bt(),Bi=Tt(),Hi=Pt(),Wi=v(),Yi=Dt(),Ji=Ft(),Zi=ee(),Ki=Mt(),Qi=_t(),eo=G(),to=te(),ro=Oe(),no=ve(),so=re(),io=ne(),oo=Le(),ao=er(),co=z(),lo=L(),uo=M(),fo=mr(),po=wr(),ho=gr(),mo=Ir(),Eo=vr(),wo=oe(),$o=Ar(),go=kr(),yo=jr(),Ro=Dr(),Io=Mr();Br.exports={parse:Fi,valid:Gi,clean:zi,inc:Xi,diff:Mi,major:Vi,minor:_i,patch:Bi,prerelease:Hi,compare:Wi,rcompare:Yi,compareLoose:Ji,compareBuild:Zi,sort:Ki,rsort:Qi,gt:eo,lt:to,eq:ro,neq:no,gte:so,lte:io,cmp:oo,coerce:ao,Comparator:co,Range:lo,satisfies:uo,toComparators:fo,maxSatisfying:po,minSatisfying:ho,minVersion:mo,validRange:Eo,outside:wo,gtr:$o,ltr:go,intersects:yo,simplifyRange:Ro,subset:Io,SemVer:Ui,re:Ce.re,src:Ce.src,tokens:Ce.t,SEMVER_SPEC_VERSION:Vr.SEMVER_SPEC_VERSION,RELEASE_TYPES:Vr.RELEASE_TYPES,compareIdentifiers:_r.compareIdentifiers,rcompareIdentifiers:_r.rcompareIdentifiers}});var we=new TextDecoder;function W(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function tt(e,t){let r=String(t??"").split(/\s+/).filter(i=>i.startsWith("sha512-")).map(i=>i.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,i=>String.fromCharCode(i)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function rt(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let i=await r.read();!i.done;i=await r.read()){if(s+=i.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(i.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function D(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return we.decode(s<0?n:n.subarray(0,s))}function nt(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,i)=>s*256+i,e[t]&127);let n=D(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function In(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if(nt(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function On(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let i=we.decode(e.subarray(n+1,r+s-1)),o=i.indexOf("=");t[i.slice(0,o)]=i.slice(o+1),r+=s}return t}function vn(e,t){let r=e.subarray(t,t+512);In(r);let n=nt(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function Ln(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function xn(e){let t=D(e,0,100),r=D(e,257,5)==="ustar"?D(e,345,155):"";return r?`${r}/${t}`:t}var et={x:(e,t)=>({...e,pax:On(t).path}),L:(e,t)=>({...e,long:D(t,0,t.length)}),g:e=>e};function st(e){let t=[],r={};for(let n=0;!Ln(e,n);){let{header:s,type:i,data:o,next:a}=vn(e,n);if(n=a,Object.hasOwn(et,i)){r=et[i](r,o);continue}(i==="0"||i==="7")&&t.push({path:r.pax??r.long??xn(s),bytes:o}),r={}}return t}var le=P(T(),1);var S=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function ae(e,t){let r=[],n=0;for(;;){let s=await S(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function De(e,{id:t,path:r,bytes:n},s){for(let i=0;i{}),a}}async function Oo(e,t){let r=[],n=0;for(;;){let{done:s,value:i}=await e.read();if(s)return r;if(n+=i.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(i)}}async function vo(e,t){try{return await Oo(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function Hr(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await vo(e.body.getReader(),t)).arrayBuffer())}var Lo=/[\\\0:*?"<>|]/,xo=e=>e.split("/").some(t=>!t||t==="."||t==="..");function So(e){return typeof e!="string"||!e||Lo.test(e)?!0:xo(e)}function k(e){if(So(e))throw new Error(`Unsafe package path: ${e}`);return e}var No=new TextDecoder,bo=["preinstall","install","postinstall"];async function Wr(e){let t=new Map;for(let r of st(await rt(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=k(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var Ao=e=>bo.some(t=>e.scripts?.[t]),To=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function ko(e,t){return Ao(e)||e.gypfile?!0:To(t)}function Yr(e,t,r){let n=JSON.parse(No.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(ko(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}var Ue=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),ue=(e,t)=>`${e.replace("/","+")}@${t}`,Fe=(e,t,r)=>`${ue(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function Po(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function qo(e,t){let r=e["dist-tags"]?.[t];return r||(le.default.valid(t)?t:le.default.maxSatisfying(Object.keys(e.versions??{}),t))}function jo(e,t,r){let n=r||"latest",s=qo(e,n),i=e.versions?.[s];if(!i||!le.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:i}}async function Co(e,t,r,{fetchImpl:n,signal:s}){let i=new URL(t.dist?.tarball,r);if(i.protocol!=="https:"&&i.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let o=await n(i,{signal:s});if(!o.ok)throw new Error(`Package download for ${e}: HTTP ${o.status}`);let a=await Hr(o);return{bytes:a,integrity:await tt(a,t.dist.integrity)}}function Do(e){let t=new URL(e,globalThis.location?.href);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function j(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!Ue(e))throw new Error(`Unsupported npm package name: ${e}`);let i=Do(r),o={fetchImpl:n,signal:s},{version:a,manifest:c}=jo(await Po(e,i,o),e,t),{bytes:f,integrity:d}=await Co(e,c,i,o),p=await Wr(f),w=Yr(p,e,a);return{id:ue(e,a),key:Fe(e,a,d),manifest:w,integrity:d,files:p}}var fe=P(T(),1);function Uo(e,t,r){let n=e?.roots?.[t];return n?.requested===r&&e.packages[n.id]?e.packages[n.id]:fe.default.validRange(r)?Object.values(e?.packages??{}).filter(i=>i.name===t&&fe.default.satisfies(i.version,r)).sort((i,o)=>fe.default.rcompare(i.version,o.version))[0]??null:null}function Jr({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=j,previous:s}){let i=new Map;return async(o,a)=>{let c=`${o}@${a}`;if(i.has(c))return i.get(c);let f=Uo(s,o,a),d=await n(o,f?.version??a,{registry:e,fetchImpl:t,signal:r});if(f&&d.integrity!==f.integrity)throw new Error(`${d.id} no longer matches the integrity recorded in the lock`);return i.set(c,d),d}}var Zr=P(T(),1),Kr=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function Fo(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw Kr(e,t,r)}function Go(e,[t,r],{nodes:n,roots:s}){let i=s[t]?.id??e.dependencies[t];if(!i)return Fo(e,t,r);if(!Zr.default.satisfies(n[i].version,r))throw Kr(e,t,r);return i}function zo(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=Go(e,r,t);n&&(e.dependencies[r[0]]=n)}}function Qr(e,t){for(let r of Object.values(e))zo(r,{nodes:e,roots:t})}var en=P(T(),1);function Xo(e,t){return!Ue(t.name)||!en.default.valid(t.version)?!1:e===ue(t.name,t.version)}function Mo(e){return e.integrity?.startsWith("sha512-")?e.key===Fe(e.name,e.version,e.integrity):!1}function Vo(e,t,r){if(!Xo(t,r)||!Mo(r))throw new Error("Invalid locked package");for(let n of r.files)k(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function _o(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function Ge(e){if(!_o(e))throw new Error("Unsupported package lock");for(let[t,r]of Object.entries(e.packages))Vo(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function Bo(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function Ho(e,t){let r={};for(let n of e){let{name:s,version:i}=W(n);r[s]={requested:i||"latest",id:await t(s,i||"latest")}}return r}async function tn(e,t={}){let r=Jr(t),n={nodes:{},downloads:new Map,total:0},s=async(o,a)=>{t.signal?.throwIfAborted();let c=await r(o,a);if(n.nodes[c.id])return c.id;Bo(n,o,c);for(let[f,d]of Object.entries(c.manifest.dependencies??{}).sort())n.nodes[c.id].dependencies[f]=await s(f,d);return c.id},i=await Ho(e,s);return Qr(n.nodes,i),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:i,packages:n.nodes},downloads:n.downloads}}function ze(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var N="webfront.project.json",_=1,Xe=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,Wo=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,Yo=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,rn=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,Me=/^[A-Za-z_][A-Za-z0-9_]*$/,nn=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],Jo=["files","publish","fetch"],g=e=>{throw new Error(`${N}: ${e}`)};function b(e,t){return ze(e)||g(`${t} must be an object`),e}function Ve(e,t,r){for(let n of Object.keys(e))t.includes(n)||g(`unknown key "${n}" in ${r}`)}function pe(e,t){typeof e!="string"&&g(`${t} must be a project path`);try{return k(e)}catch{return g(`${t} is not a safe project-relative path: ${e}`)}}function sn(e,t){return(!Array.isArray(e)||e.length>256)&&g(`${t} must be an array of at most 256 paths`),e.map((r,n)=>pe(r,`${t}[${n}]`))}function Zo(e){let t=b(e,"dependencies");for(let[r,n]of Object.entries(t))Xe.test(r)||g(`invalid npm package name "${r}"`),(typeof n!="string"||!Yo.test(n)||n!==n.trim())&&g(`invalid version range for "${r}"`);return t}function Ko(e){if(typeof e!="string"&&g("registry must be a URL"),e.startsWith("/")&&!e.startsWith("//"))return e;let t;try{t=new URL(e)}catch{return g("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&g("registry must use https"),e}function Qo(e){let t=b(e,"scripts");for(let[r,n]of Object.entries(t))(!rn.test(r)||typeof n!="string"||!n||n.length>1024)&&g(`invalid script "${r}"`);return t}function ea(e){let t=b(e,"entries");for(let[r,n]of Object.entries(t))rn.test(r)||g(`invalid entry name "${r}"`),pe(n,`entries.${r}`);return t}function ta(e,t){let r=b(e,"providers");for(let[n,s]of Object.entries(r))Me.test(n)||g(`invalid provider name "${n}"`),b(s,`providers.${n}`),Ve(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&g(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||pe(s.entry,`providers.${n}.entry`),pe(s.output,`providers.${n}.output`).endsWith(".hpp")||g(`providers.${n}.output must be a .hpp file`);return r}function ra(e){let t=b(e,"test");return Ve(t,["specs"],"test"),t.specs!==void 0&&sn(t.specs,"test.specs"),t}function na(e,t){let r;try{r=new URL(e)}catch{return g(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&g(`${t} must be an https origin without a path`),e}function sa(e){let t=b(e,"permissions");for(let r of Object.keys(t))Jo.includes(r)||g(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&sn(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&g("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>na(r,`permissions.fetch[${n}]`))),t}function ia(e){(typeof e.name!="string"||!Xe.test(e.name))&&g("name must be a lower-case npm package name"),(typeof e.version!="string"||!Wo.test(e.version))&&g("version must be a semantic version")}function oa(e){e.format!==_&&(Number.isInteger(e.format)&&e.format>_&&g(`format ${e.format} is not supported by this environment (it reads format ${_}); update the environment`),g(`format must be ${_}`))}function B(e){b(e,"the manifest"),oa(e),Ve(e,nn,"the manifest"),ia(e);let t=e.entries===void 0?{}:ea(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:Zo(e.dependencies),entries:t,providers:e.providers===void 0?{}:ta(e.providers,t),...e.registry===void 0?{}:{registry:Ko(e.registry)},...e.scripts===void 0?{}:{scripts:Qo(e.scripts)},...e.test===void 0?{}:{test:ra(e.test)},...e.permissions===void 0?{}:{permissions:sa(e.permissions)}}}function _e(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return g("not valid JSON")}return{source:t,manifest:B(t)}}function zc(e){return _e(e).manifest}function Be(e){let t={};for(let r of nn)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` +`}function on(e){return{format:_,name:e,version:"0.1.0",dependencies:{}}}function an(e){let r=(String(e??"").split("/").filter(Boolean).pop()??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"");return Xe.test(r)?r:"webfront-app"}async function he(e){let t=JSON.stringify(Object.entries(e).sort(([n],[s])=>ns?1:0)),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(r)].map(n=>n.toString(16).padStart(2,"0")).join("")}var He=P(T(),1);var C="webfront-packages.lock.json",de=".webfront/developer/packages",aa=new TextDecoder,ca=new TextEncoder,un="No webfront.project.json: run wf init",me="The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again";async function cn(e,t){try{return await ae(e,t)}catch(r){if(r.message.includes("Cannot read project file:"))return null;throw r}}function la(e,t,r){return t?r===t.requested?!0:He.default.validRange(r)!==null&&He.default.satisfies(e.packages[t.id].version,r):!1}function ua(e,t){let r=Object.keys(t);return r.length===Object.keys(e.roots).length&&r.every(n=>la(e,e.roots[n],t[n]))}function fa(e,t,r){return e?t?t.manifestDigest===void 0?ua(t,e.dependencies)?"legacy":"desynchronized":t.manifestDigest===r?"consistent":"desynchronized":"unlocked":"no-manifest"}async function We(e){let t=await S(e,"state",`${N} +${C}`),r=await cn(e,N),n=await cn(e,C),{source:s,manifest:i}=r?_e(r):{source:null,manifest:null},o=n?Ge(JSON.parse(aa.decode(n))):null,a=i?await he(i.dependencies):null;return{manifest:i,source:s,lock:o,token:t,status:fa(i,o,a),digest:a}}var Bc=e=>e.status==="desynchronized"?`Warning: ${me}.\r +`:"";async function fn(e,t,r,{signal:n}={}){let s=[];try{for(let[i,o]of t){n?.throwIfAborted();let a=await S(e,"begin",i,!1);s.push(a),await De(e,{id:a,path:"output",bytes:o},n)}n?.throwIfAborted(),await S(e,"commitGroup",s.join(` +`),`${N} +${C}`,r.token)}catch(i){for(let o of s)await S(e,"abort",o).catch(()=>{});throw i}}function ln(e,t,r){let n=e?.entries??{};if(t!==void 0)return Object.hasOwn(n,t)?n[t]:t;if(Object.hasOwn(n,"main"))return n.main;let s=Object.keys(n);if(s.length===1)return n[s[0]];throw new Error(`Usage: ${r} (declare entries.main in ${N} to omit the entry)`)}function Hc(e,[t,r,n,...s]){if(t&&Object.hasOwn(e?.providers??{},t)&&r===void 0){let o=e.providers[t];return{entry:ln(e,o.entry),output:o.output,className:t}}if(!t||r!=="--output"||s.length||!n?.endsWith(".hpp"))throw new Error("wf embed requires or --output ");let i=n.split("/").pop().slice(0,-4);if(!Me.test(i))throw new Error(`wf embed: ${i} is not a C++ class name; name the output .hpp`);return{entry:ln(e,t),output:n,className:i}}var Ee=e=>ca.encode(e);var Ye=P(T(),1);var dn=e=>{let{name:t,version:r}=W(e);return[t,r||void 0]};function pa(e,t){let{version:r}=e.packages[t.id];return!(Ye.default.valid(t.requested)!==null)&&t.requested!=="latest"&&Ye.default.validRange(t.requested)!==null?t.requested:`^${r}`}async function el(e,[t,...r],{signal:n}={}){if(r.length)throw new Error("Usage: wf init [name]");let{lock:s}=await We(e),i=on(t??an(""));s&&(i.dependencies=Object.fromEntries(Object.entries(s.roots).map(([a,c])=>[a,pa(s,c)]))),B(i),await ce(e,N,new Map([["output",Ee(Be(i))]]),{directory:!1,replace:!1,signal:n});let o=s?` with the ${Object.keys(i.dependencies).length} dependencies of ${C}`:"";return`Created ${N}${o}. Add libraries with wf install .`}function ha(e,t){let r={...e.manifest.dependencies},n=new Set;for(let s of t){let[i,o]=dn(s);r[i]=o??"latest",o&&o!=="latest"&&n.add(i)}return B({...e.source,dependencies:r}),{dependencies:r,explicit:n}}function da(e,t){let r={...e.source,dependencies:t};return B(r),r}function ma({dependencies:e,explicit:t},r,n){let s={...e};for(let i of n){let o=dn(i)[0];t.has(o)||(s[o]=`^${r.packages[r.roots[o].id].version}`)}return s}async function Ea(e,t,r){let n=Object.entries(e).map(([o,a])=>`${o}@${a}`),{lock:s,downloads:i}=await tn(n,{registry:r.registry,signal:r.signal,fetchImpl:r.fetchImpl,previous:t,download:async(...o)=>(r.progress(`Resolving ${o[0]}@${o[1]}`),j(...o))});return{lock:s,downloads:i}}async function wa(e,t,r,{signal:n,progress:s}){for(let[i,o]of r)s(`Storing ${i}`),await ce(e,`${de}/${t.packages[i].key}`,o,{signal:n})}async function $a(e,t){try{return await ae(e,`${de}/${t.key}/package.json`),!0}catch{return!1}}async function ga(e,t,{signal:r,progress:n,fetchImpl:s}){let i=0;for(let[o,a]of Object.entries(t.packages)){if(r?.throwIfAborted(),await $a(e,a))continue;n(`Restoring ${o}`);let c=await j(a.name,a.version,{registry:t.registry,fetchImpl:s,signal:r});if(c.integrity!==a.integrity)throw new Error(`${o} no longer matches the integrity recorded in the lock`);await ce(e,`${de}/${a.key}`,c.files,{signal:r}),i++}return i}function ya(e){let t=e.includes("--update"),r=e.filter(n=>n!=="--update");if(r.some(n=>n.startsWith("-")))throw new Error("Usage: wf install [--update] [[@range] ...]");return{update:t,specs:r}}async function pn(e,t,{manifest:r,lock:n},s){let i=new Map([[C,Ee(JSON.stringify(n,null,2)+` +`)]]);r&&i.set(N,Ee(Be(r))),await fn(e,i,t,s)}var hn=async(e,t)=>({format:e.format,manifestDigest:await he(t),...e});async function tl(e,t,{registry:r,signal:n,progress:s=()=>{},fetchImpl:i=fetch}){let{update:o,specs:a}=ya(t),c=await We(e);if(!c.manifest)throw new Error(un);let f={registry:c.manifest.registry??r,signal:n,fetchImpl:i,progress:s};if(a.length&&o)throw new Error("Usage: wf install --update does not take packages");if(a.length&&c.status==="desynchronized")throw new Error(me);if(!a.length&&!o&&c.status==="desynchronized")throw new Error(me);let d=c.status==="consistent"||c.status==="legacy";if(!a.length&&!o&&d){let Ze=await ga(e,c.lock,{signal:n,progress:s,fetchImpl:f.fetchImpl});if(c.status==="consistent")return{lock:c.lock,restored:Ze};let Ke=await hn(c.lock,c.manifest.dependencies);return await pn(e,c,{manifest:null,lock:Ke},{signal:n}),{lock:Ke,restored:Ze}}let p=ha(c,a),w=d&&!o?c.lock:void 0,h=await Ea(p.dependencies,w,f),H=ma(p,h.lock,a);await wa(e,h.lock,h.downloads,{signal:n,progress:s});let Je=await hn(h.lock,H),mn=a.length?da(c,H):null;return await pn(e,c,{manifest:mn,lock:Je},{signal:n}),{lock:Je,restored:0}}export{he as dependenciesDigest,me as desynchronized,j as downloadPackage,Hc as embedTarget,Wo as exactVersion,Me as identifier,el as initProject,tl as install,We as loadProject,C as lockPath,ua as locksDependencies,_ as manifestFormat,an as manifestName,N as manifestPath,on as newManifest,un as noManifest,Xe as npmName,de as packageRoot,zc as parseManifest,fn as publishTogether,_e as readManifest,ln as resolveEntry,tn as resolvePackages,k as safePackagePath,Be as serializeManifest,Bc as syncNotice,Ee as textBytes,Ge as validateLock,B as validateManifest}; diff --git a/js/developer/environment/project.mjs b/js/developer/environment/project.mjs index 51446a5a..70b9d446 100644 --- a/js/developer/environment/project.mjs +++ b/js/developer/environment/project.mjs @@ -1,6 +1,7 @@ // The project as the wf commands see it: manifest, lock, whether they agree, and their joint publication. import {call, readProject, writeChunks} from './io.mjs'; -import {manifestPath, parseManifest, dependenciesDigest} from './manifest.mjs'; +import semver from 'semver'; +import {manifestPath, readManifest, dependenciesDigest, identifier} from './manifest.mjs'; import {validateLock} from './lock.mjs'; export const lockPath = 'webfront-packages.lock.json'; @@ -20,27 +21,45 @@ async function readOptional(bridge, path) { } } +// Whether a locked root satisfies a manifest range: a range or exact version by semver, a dist-tag by the name it was resolved with. +function satisfiesRoot(lock, root, range) { + if (!root) return false; + if (range === root.requested) return true; + return semver.validRange(range) !== null && semver.satisfies(lock.packages[root.id].version, range); +} + +/** Whether a lock without a manifest digest (written before the manifest existed) resolves exactly these dependencies. */ +export function locksDependencies(lock, dependencies) { + const names = Object.keys(dependencies); + return names.length === Object.keys(lock.roots).length && + names.every(name => satisfiesRoot(lock, lock.roots[name], dependencies[name])); +} + function statusOf(manifest, lock, digest) { if (!manifest) return 'no-manifest'; if (!lock) return 'unlocked'; + if (lock.manifestDigest === undefined) return locksDependencies(lock, manifest.dependencies) ? 'legacy' : 'desynchronized'; return lock.manifestDigest === digest ? 'consistent' : 'desynchronized'; } /** * Reads the manifest and the lock and compares them. `token` identifies the exact state that was read: - * a publication prepared from it is refused if either file changed in the meantime. + * a publication prepared from it is refused if either file changed in the meantime. `source` is the + * manifest as written, `manifest` the validated one with its defaults. * no-manifest: no webfront.project.json; unlocked: no lock, so no installed graph; * consistent: the lock was resolved from the manifest's current dependencies; + * legacy: a lock written before the manifest, without its digest, whose roots satisfy the dependencies: + * it is used as a consistent one, and wf install records the digest; * desynchronized: the dependencies changed since; nothing is resolved implicitly. */ export async function loadProject(bridge) { const token = await call(bridge, 'state', `${manifestPath}\n${lockPath}`); const manifestBytes = await readOptional(bridge, manifestPath); const lockBytes = await readOptional(bridge, lockPath); - const manifest = manifestBytes ? parseManifest(manifestBytes) : null; + const {source, manifest} = manifestBytes ? readManifest(manifestBytes) : {source: null, manifest: null}; const lock = lockBytes ? validateLock(JSON.parse(decoder.decode(lockBytes))) : null; const digest = manifest ? await dependenciesDigest(manifest.dependencies) : null; - return {manifest, lock, token, status: statusOf(manifest, lock, digest), digest}; + return {manifest, source, lock, token, status: statusOf(manifest, lock, digest), digest}; } /** A line to put before the output of a command that reads a lock which no longer matches its manifest. */ @@ -77,4 +96,17 @@ export function resolveEntry(manifest, argument, command) { throw new Error(`Usage: ${command} (declare entries.main in ${manifestPath} to omit the entry)`); } +// wf embed : the class is the provider's name. wf embed --output : the class is the file name. +export function embedTarget(manifest, [first, flag, output, ...extra]) { + if (first && Object.hasOwn(manifest?.providers ?? {}, first) && flag === undefined) { + const provider = manifest.providers[first]; + return {entry: resolveEntry(manifest, provider.entry), output: provider.output, className: first}; + } + if (!first || flag !== '--output' || extra.length || !output?.endsWith('.hpp')) + throw new Error('wf embed requires or --output '); + const className = output.split('/').pop().slice(0, -4); + if (!identifier.test(className)) throw new Error(`wf embed: ${className} is not a C++ class name; name the output .hpp`); + return {entry: resolveEntry(manifest, first), output, className}; +} + export const textBytes = text => encoder.encode(text); diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index fb98c710..e049b588 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -5,7 +5,7 @@ import {validateLock} from './packages.mjs'; import {readProject, publish} from './io.mjs'; import {createStarter} from './starter.mjs'; import {install, initProject} from './installer.mjs'; -import {loadProject, syncNotice, resolveEntry, lockPath, packageRoot} from './project.mjs'; +import {loadProject, syncNotice, resolveEntry, embedTarget, lockPath, packageRoot} from './project.mjs'; import {generateProvider, applicationPage} from './embed.mjs'; const encoder = new TextEncoder(); @@ -111,22 +111,10 @@ async function preview(args, {bridge, signal, preview: frame}) { return syncNotice(project) + 'Preview ready.'; } -// wf embed , or wf embed --output -function embedTarget(manifest, [first, flag, output, ...extra]) { - if (first && Object.hasOwn(manifest?.providers ?? {}, first) && flag === undefined) { - const provider = manifest.providers[first]; - return {entry: resolveEntry(manifest, provider.entry), output: provider.output}; - } - if (!first || flag !== '--output' || extra.length || !output?.endsWith('.hpp')) - throw new Error('wf embed requires or --output '); - return {entry: resolveEntry(manifest, first), output}; -} - async function embed(args, {bridge, signal}) { const project = await loadProject(bridge); - const {entry, output} = embedTarget(project.manifest, args); + const {entry, output, className} = embedTarget(project.manifest, args); const result = await compile(bridge, entry, signal); - const className = output.split('/').pop().slice(0, -4); await publish(bridge, output, textFile(generateProvider(result.files, className, result.notices)), {directory: false, signal}); return `${syncNotice(project)}Generated ${output}. Use webfront::fs::${className} and recompile the application.`; } @@ -137,7 +125,7 @@ async function list(_args, {bridge}) { return syncNotice(project) + (names || 'No installed packages.'); } -const help = () => 'wf init [directory]\nwf create [directory]\nwf install [--update] [[@range] ...]\nwf list\nwf preview [entry.tsx|name]\nwf embed | --output \nCtrl+C interrupts a browser command. No system shell is exposed.'; +const help = () => 'wf init [name]\nwf create [directory]\nwf install [--update] [[@range] ...]\nwf list\nwf preview [entry.tsx|name]\nwf embed | --output \nCtrl+C interrupts a browser command. No system shell is exposed.'; const commands = {init, create, install: installCommand, preview, embed, list, help}; export async function execute(args, context) { diff --git a/js/developer/tools/PUBLISHING.md b/js/developer/tools/PUBLISHING.md index 593d28c1..20b372e7 100644 --- a/js/developer/tools/PUBLISHING.md +++ b/js/developer/tools/PUBLISHING.md @@ -31,7 +31,9 @@ changed environment, starter, public URL or provisioning configuration. `distribution.json` names the version under development; `DeveloperReleaseData.hpp` pins the last version that is published. Pull requests and branch pushes therefore require the header to match a fresh build only when both name -the same version; a publication (a `developer-v*` tag or a dispatch with `publish=true`) always requires it. +the same version; a publication (a `developer-v*` tag or a dispatch with `publish=true`) always requires it. When the +sources are ahead, `pin-check.mjs` requires the header to be exactly the one generated for its version and the deployed +archive at its URL to have its integrity. 1. Merge the changes with the header still on the previous version. 2. On a release branch, run `build.mjs build-distribution --refresh-bootstrap` and commit the new header. diff --git a/js/developer/tools/manifest-check.mjs b/js/developer/tools/manifest-check.mjs index 926209c9..5b284921 100644 --- a/js/developer/tools/manifest-check.mjs +++ b/js/developer/tools/manifest-check.mjs @@ -3,7 +3,7 @@ import {test} from 'node:test'; import assert from 'node:assert/strict'; import {createHash} from 'node:crypto'; import {validateManifest, parseManifest, serializeManifest, manifestName, dependenciesDigest} from '../environment/manifest.mjs'; -import {install, initProject, loadProject, syncNotice, resolveEntry, lockPath, manifestPath} from '../environment/packages.bundle.mjs'; +import {install, initProject, loadProject, syncNotice, resolveEntry, embedTarget, lockPath, manifestPath} from '../environment/packages.bundle.mjs'; import {compress} from '../environment/embed.mjs'; import {tar} from './archive.mjs'; @@ -71,6 +71,14 @@ test('entries are named in the manifest or given as paths', () => { assert.throws(() => resolveEntry(validateManifest(minimal), undefined, 'wf preview'), /entries.main/); }); +test('wf embed names the generated class after the provider, and refuses a file name that is not a C++ name', () => { + const manifest = validateManifest({...minimal, entries: {main: 'ui/main.tsx'}, providers: {PiUI: {entry: 'main', output: 'generated/pi-ui.hpp'}}}); + assert.deepEqual(embedTarget(manifest, ['PiUI']), {entry: 'ui/main.tsx', output: 'generated/pi-ui.hpp', className: 'PiUI'}); + assert.equal(embedTarget(manifest, ['ui/main.tsx', '--output', 'generated/LifeUI.hpp']).className, 'LifeUI'); + assert.throws(() => embedTarget(manifest, ['ui/main.tsx', '--output', 'generated/life-ui.hpp']), /not a C\+\+ class name/); + assert.throws(() => embedTarget(manifest, ['ui/main.tsx']), /--output/); +}); + // An in-memory project behind the webfront.developer.* callbacks, with the store's group publication and precondition. function memoryBridge(storage = new Map()) { const transactions = new Map(); @@ -152,15 +160,65 @@ async function project(...files) { return memory; } -test('wf init creates a minimal manifest and never replaces an existing one', async () => { +test('wf init creates the root manifest every command reads, and never replaces it', async () => { const {bridge, storage} = memoryBridge(); assert.match(await initProject(bridge, [], {}), /Created webfront.project.json/); assert.deepEqual(json(storage, manifestPath), {format: 1, name: 'webfront-app', version: '0.1.0', dependencies: {}}); + assert.equal((await loadProject(bridge)).status, 'unlocked'); await assert.rejects(initProject(bridge, [], {}), /already exists/); - await initProject(bridge, ['apps/Ui'], {}); - assert.equal(json(storage, 'apps/Ui/webfront.project.json').name, 'ui'); - await assert.rejects(initProject(bridge, ['../escape'], {}), /Unsafe package path/); await assert.rejects(initProject(bridge, ['a', 'b'], {}), /Usage/); + const named = memoryBridge(); + await initProject(named.bridge, ['my-app'], {}); + assert.equal(json(named.storage, manifestPath).name, 'my-app'); + await assert.rejects(initProject(memoryBridge().bridge, ['Bad Name'], {}), /name must be/); +}); + +test('a project locked before the manifest keeps its locked graph through wf init and wf install', async () => { + const {bridge, storage, pending} = await project('a', 'b@2.0.0', 'c@^3'); + const lock = json(storage, lockPath); + delete lock.manifestDigest; + storage.set(lockPath, encode(lock)); + storage.delete(manifestPath); + assert.match(await initProject(bridge, [], {}), /with the 3 dependencies of webfront-packages.lock.json/); + assert.deepEqual(json(storage, manifestPath).dependencies, {a: '^1.2.0', b: '^2.0.0', c: '^3'}); + assert.equal((await loadProject(bridge)).status, 'legacy'); + assert.equal(syncNotice(await loadProject(bridge)), ''); + // A newer a is published: wf install keeps the locked version and only records the digest. + const newer = {...source(), a: {version: '1.3.0', bytes: pkg('a', '1.3.0'), older: {'1.2.0': pkg('a', '1.2.0')}}}; + await install(bridge, [], options(registry(newer).fetchImpl)); + const adopted = json(storage, lockPath); + assert.deepEqual(Object.keys(adopted.packages).sort(), ['a@1.2.0', 'b@2.0.0', 'c@3.1.0']); + assert.equal(adopted.manifestDigest, await dependenciesDigest({a: '^1.2.0', b: '^2.0.0', c: '^3'})); + assert.equal((await loadProject(bridge)).status, 'consistent'); + assert.equal(pending(), 0); +}); + +test('a legacy lock also stays usable for wf install , and one that does not match is desynchronized', async () => { + const {bridge, storage} = await project('a'); + const lock = json(storage, lockPath); + delete lock.manifestDigest; + storage.set(lockPath, encode(lock)); + const newer = {...source(), a: {version: '1.3.0', bytes: pkg('a', '1.3.0'), older: {'1.2.0': pkg('a', '1.2.0')}}}; + await install(bridge, ['b'], options(registry(newer).fetchImpl)); + assert.deepEqual(Object.keys(json(storage, lockPath).packages).sort(), ['a@1.2.0', 'b@2.0.0']); + assert.equal((await loadProject(bridge)).status, 'consistent'); + const stale = json(storage, lockPath); + delete stale.manifestDigest; + storage.set(lockPath, encode(stale)); + storage.set(manifestPath, encode({...minimal, dependencies: {a: '^2.0.0', b: '^2.0.0'}})); + assert.equal((await loadProject(bridge)).status, 'desynchronized'); +}); + +test('wf install refuses a range the manifest cannot hold before resolving, and writes only what the user wrote', async () => { + const {bridge, storage} = await project(); + const {fetchImpl, requests} = registry(source()); + const before = storage.get(manifestPath); + for (const spec of ['a@next_v2', `a@${'1'.repeat(129)}`]) await assert.rejects(install(bridge, [spec], options(fetchImpl)), /invalid version range/); + assert.equal(requests.length, 0); + assert.equal(storage.get(manifestPath), before); + await install(bridge, ['a@'], options(fetchImpl)); + assert.deepEqual(json(storage, manifestPath), {format: 1, name: 'webfront-app', version: '0.1.0', dependencies: {a: '^1.2.0'}}); + assert.deepEqual((await loadProject(bridge)).manifest.entries, {}, 'the defaults are still applied when reading'); }); test('wf install needs a manifest, then publishes manifest and lock together', async () => { @@ -243,12 +301,8 @@ test('two installations that read the same state cannot overwrite each other', a assert.equal((await loadProject(bridge)).status, 'consistent'); }); -test('an invalid manifest or a lock without its digest is reported before anything is resolved', async () => { +test('an invalid manifest is reported before anything is resolved', async () => { const {bridge, storage} = await project('a'); - const lock = json(storage, lockPath); - delete lock.manifestDigest; - storage.set(lockPath, encode(lock)); - assert.equal((await loadProject(bridge)).status, 'desynchronized'); storage.set(manifestPath, encode({...minimal, format: 3})); await assert.rejects(loadProject(bridge), /format 3 is not supported/); storage.set(manifestPath, encode({...minimal, permissions: {network: true}})); diff --git a/js/developer/tools/pin-check.mjs b/js/developer/tools/pin-check.mjs new file mode 100644 index 00000000..581d692a --- /dev/null +++ b/js/developer/tools/pin-check.mjs @@ -0,0 +1,20 @@ +// Checks DeveloperReleaseData.hpp against the published distribution it pins, for sources that build a newer version: +// the header must be exactly the one generated for its version, and the archive at its URL must have its integrity. +import {readFile} from 'node:fs/promises'; +import {createHash} from 'node:crypto'; +import {bootstrapHeader} from './site.mjs'; + +const root = new URL('../../../', import.meta.url); +const header = await readFile(new URL('include/webfront/system/DeveloperReleaseData.hpp', root), 'utf8'); +const distribution = JSON.parse(await readFile(new URL('js/developer/tools/distribution.json', root))); +const field = name => header.match(new RegExp(`\\b${name}\\{"([^"]*)"\\}`))?.[1] ?? ''; +const version = field('version'); +const integrity = field('integrity'); +if (header !== bootstrapHeader(version, distribution.baseUrl, integrity)) + throw new Error(`DeveloperReleaseData.hpp is not the header generated for the published ${version}`); +const url = field('environment'); +const response = await fetch(url); +if (!response.ok) throw new Error(`The pinned environment ${url} is not published (${response.status})`); +const actual = 'sha512-' + createHash('sha512').update(new Uint8Array(await response.arrayBuffer())).digest('base64'); +if (actual !== integrity) throw new Error(`The published ${url} does not have the pinned integrity`); +console.log(`DeveloperReleaseData.hpp pins the published ${version}.`); diff --git a/test/unit/DeveloperTests.cpp b/test/unit/DeveloperTests.cpp index 6af81c35..4a9b3c5c 100644 --- a/test/unit/DeveloperTests.cpp +++ b/test/unit/DeveloperTests.cpp @@ -9,6 +9,7 @@ #include #include #include +#include using namespace webfront; using webfront::test::TemporaryDirectory; @@ -485,6 +486,81 @@ SCENARIO("A manifest and its lock are published together or not at all") { } } +SCENARIO("A committed publication that cannot be completed does not prevent opening the project") { + TemporaryDirectory project; + const auto journal = project.path() / ".webfront/developer/journal"; + { + developer::Store store{project.path()}; + publishFile(store, manifestPath, "manifest-1"); + publishFile(store, lockPath, "lock-1"); + } + GIVEN("a publication committed before a crash whose manifest replacement is now blocked") { + REQUIRE(crashAt("after-journal", project.path()) == "manifest-2|lock-2"); + { + // Commit a second publication, then obstruct its first target. + developer::Store store{project.path(), developer::defaultAbandonedAfter, [](std::string_view name) { + if (name == "after-journal") + throw developer::InjectedFault{"crash"}; + }}; + REQUIRE_THROWS_AS(publishPair(store, "manifest-3", "lock-3", store.state(pair)), developer::InjectedFault); + } + std::filesystem::remove(project.path() / manifestPath); + std::filesystem::create_directories(project.path() / manifestPath / "obstacle"); + WHEN("the project is opened") { + developer::Store store{project.path()}; + THEN("it opens, reports the failure, refuses to read a state and keeps the journal") { + REQUIRE(store.recoveryFailure().has_value()); + REQUIRE_THROWS_AS(store.state(pair), developer::IncompletePublication); + REQUIRE(journalsRemain(journal)); + REQUIRE(read(store, lockPath) == "lock-2"); + } + AND_WHEN("the obstacle is removed") { + std::filesystem::remove_all(project.path() / manifestPath); + THEN("the next state completes the publication") { + store.state(pair); + REQUIRE_FALSE(store.recoveryFailure().has_value()); + REQUIRE(projectState(store) == "manifest-3|lock-3"); + REQUIRE_FALSE(journalsRemain(journal)); + } + } + } + } + GIVEN("a replacement failing during the publication") { + bool failOnce = true; + developer::Store store{project.path(), developer::defaultAbandonedAfter, [&failOnce](std::string_view name) { + if (name == "replacement-1" && std::exchange(failOnce, false)) + throw std::runtime_error("target locked"); + }}; + WHEN("the group is published") { + THEN("the caller learns that the change is committed but not applied, and the next state applies it") { + REQUIRE_THROWS_AS(publishPair(store, "manifest-2", "lock-2", store.state(pair)), developer::IncompletePublication); + REQUIRE(store.recoveryFailure().has_value()); + store.state(pair); + REQUIRE(projectState(store) == "manifest-2|lock-2"); + REQUIRE_FALSE(journalsRemain(journal)); + } + } + } + GIVEN("a failure before the commit point") { + developer::Store store{project.path(), developer::defaultAbandonedAfter, [](std::string_view name) { + if (name == "before-journal") + throw std::runtime_error("disk full"); + }}; + const auto first = store.begin(manifestPath, false); + const auto second = store.begin(lockPath, false); + store.write(first, "output", 0, bytes("manifest-2")); + store.write(second, "output", 0, bytes("lock-2")); + REQUIRE_THROWS_WITH(store.commitGroup({first, second}, pair, store.state(pair)), "disk full"); + THEN("the staged files are returned to their transactions, which still publish") { + REQUIRE(projectState(store) == "manifest-1|lock-1"); + REQUIRE_FALSE(journalsRemain(journal)); + store.commit(first); + store.commit(second); + REQUIRE(projectState(store) == "manifest-2|lock-2"); + } + } +} + SCENARIO("A publication prepared from stale state is refused") { TemporaryDirectory project; developer::Store store{project.path()}; From c5ed385865abd97a928b19ef851d7e5c851e6787 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 15:44:56 +0200 Subject: [PATCH 018/134] Bound the whole restored graph before publishing and repair oversized cached files [#306] - The 256 MiB bound counts the packages already in the cache and is checked before each publication, so a failed or resumed restore cannot exceed it. - A cached file larger than the bound is a corrupted package: reading stops at the bound instead of failing, so wf restore downloads it again and --offline lists it. --- docs/DEVELOPER_ENVIRONMENT.md | 4 +- js/developer/environment/bundles.json | 6 +-- js/developer/environment/cache.mjs | 44 ++++++++++++----- js/developer/environment/packages.bundle.mjs | 20 ++++---- js/developer/environment/restore.mjs | 51 ++++++++++++-------- js/developer/tools/restore-check.mjs | 39 ++++++++++++++- 6 files changed, 116 insertions(+), 48 deletions(-) diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 26650dbd..07037961 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -217,7 +217,9 @@ when it is damaged, `wf restore` rebuilds it from the lock alone: Each cached package directory `/` is followed by a record `.json` naming the archive's integrity and the SHA-256 of every file; the record is written last, so an interrupted copy is *missing*, and a file that differs -from its record is *corrupted*. `wf install` with a consistent lock performs the same restoration. +from its record, or exceeds the bound below, is *corrupted*. The 256 MiB bound applies to the whole unpacked graph, +packages already in the cache included, and is checked before each package is published, so resuming a restore +cannot exceed it. `wf install` with a consistent lock performs the same restoration. The registry used by `wf install` and `wf restore` is, in order of precedence: diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 74244c4f..a889bc79 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -2,8 +2,8 @@ "js/developer/environment/manifest.mjs": "1cb0c70c87ca31ec81ad0591c0c1d1cb2637ecc491caef9c3d3ec8f1670ea900", "js/developer/environment/project.mjs": "525bc1545f6ff9a70c744c536e46c2404bdc20daa83b25b29419222161003c3b", "js/developer/environment/installer.mjs": "f3e919535847c93f62498ee0ad3fec49ff5f7531fb657feaca80e2ccb6da1c0c", - "js/developer/environment/restore.mjs": "bc5d8f576b83868df44d0b870fa7498a7346694a9e991ba2546862975bc4db56", - "js/developer/environment/cache.mjs": "8dd4f39926a2ce1195f1a0e0c418fd41e00a3091a6809929e69983f3cf33f860", + "js/developer/environment/restore.mjs": "cdd22eebd55d68bd705685cd5ee3059e228a35053eaad116ab99c4c05b908098", + "js/developer/environment/cache.mjs": "e25a4c633794a7ba49fb1cddf182084571570988eb6e8a716d9dac31a3dd7346", "js/developer/environment/packages-entry.mjs": "edf47d25099428ea8d33f9fe4552f239035715b98fd2bff6be0f9143ab0cfe8a", "js/developer/environment/bootstrap.mjs": "534af4b3d07891338c3390e1d5e06c2fb6dd8df11ca6547735565b17f1b9cd70", "js/developer/environment/bootstrap-entry.mjs": "ff8084f23f5acc721f97eb1ed0a454e7bfee1894de17d54f0100fa11f7ef8b77", @@ -35,6 +35,6 @@ "js/developer/tools/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b", "js/developer/vendor/package-lock.json": "eb545112b672f9dbf520125df1f44a878d62cc8e611f0e33baee36470ded4dec", "js/core/bootstrap/bootstrap.bundle.mjs": "792fe7cf564bd12ac47fef419d8c71e2070925764a17706552e7d3f5d6ba2181", - "js/developer/environment/packages.bundle.mjs": "0365a4f12b974923f35b0b11df7d36795944eacc60713701ed3c4119a1b0fa38", + "js/developer/environment/packages.bundle.mjs": "10d0b5863ef9941bf6915c0cb28b5b4053ff044527c301bd4fe917bba23d32d6", "include/webfront/system/DeveloperReleaseData.hpp": "c97a8c3b21df3306c179f7b46d945159b5854f9d2810f135a4ab224c768c75d7" } diff --git a/js/developer/environment/cache.mjs b/js/developer/environment/cache.mjs index a6d952a4..8cebd15c 100644 --- a/js/developer/environment/cache.mjs +++ b/js/developer/environment/cache.mjs @@ -1,6 +1,6 @@ // The package cache: one directory per locked archive, then a record of its files' digests. The record is written // last, so a package without one (an interrupted store) is missing, and files differing from it are corrupted. -import {publish, readProject} from './io.mjs'; +import {call, blockSize, publish, readProject} from './io.mjs'; import {isPlainObject} from './entry.mjs'; import {packageRoot} from './project.mjs'; @@ -32,22 +32,42 @@ async function readRecord(bridge, node) { const sameFiles = (record, node) => Object.keys(record.files).sort().join('\n') === [...node.files].sort().join('\n'); -async function fileMatches(bridge, node, path, digest) { - try { return await sha256(await readProject(bridge, `${packageDirectory(node)}/${path}`)) === digest; } - catch (error) { - if (unreadable(error)) return false; - throw error; +// A cached file, or null when it is missing or larger than `limit`: reading stops as soon as the limit is passed, +// so an oversized file is a corruption to repair, not a read error. +async function readCached(bridge, path, limit) { + const chunks = []; + let size = 0; + for (;;) { + let chunk; + try { chunk = await call(bridge, 'read', path, size); } + catch (error) { + if (unreadable(error)) return null; + throw error; + } + size += chunk.length; + if (size > limit) return null; + chunks.push(chunk); + if (chunk.length < blockSize) return new Uint8Array(await new Blob(chunks).arrayBuffer()); } } -/** 'valid', 'missing' or 'corrupted': the cached files of a locked package, checked against its record. */ -export async function cacheState(bridge, node, {signal} = {}) { +/** + * The cached files of a locked package, checked against its record: {state: 'valid' | 'missing' | 'corrupted', size}. + * `size` is the unpacked size of a valid package; a package larger than `limit` bytes is corrupted. + */ +export async function inspectCache(bridge, node, {signal, limit = Infinity} = {}) { const record = await readRecord(bridge, node); - if (!record) return 'missing'; - if (record.integrity !== node.integrity || !isPlainObject(record.files) || !sameFiles(record, node)) return 'corrupted'; + if (!record) return {state: 'missing', size: 0}; + if (record.integrity !== node.integrity || !isPlainObject(record.files) || !sameFiles(record, node)) return {state: 'corrupted', size: 0}; + let size = 0; for (const path of node.files) { signal?.throwIfAborted(); - if (!await fileMatches(bridge, node, path, record.files[path])) return 'corrupted'; + const bytes = await readCached(bridge, `${packageDirectory(node)}/${path}`, limit - size); + if (!bytes || await sha256(bytes) !== record.files[path]) return {state: 'corrupted', size: 0}; + size += bytes.length; } - return 'valid'; + return {state: 'valid', size}; } + +/** 'valid', 'missing' or 'corrupted': see inspectCache(). */ +export const cacheState = async (bridge, node, options) => (await inspectCache(bridge, node, options)).state; diff --git a/js/developer/environment/packages.bundle.mjs b/js/developer/environment/packages.bundle.mjs index 16df4bc4..70e78e3c 100644 --- a/js/developer/environment/packages.bundle.mjs +++ b/js/developer/environment/packages.bundle.mjs @@ -1,13 +1,13 @@ -var Ln=Object.create;var at=Object.defineProperty;var kn=Object.getOwnPropertyDescriptor;var Tn=Object.getOwnPropertyNames;var An=Object.getPrototypeOf,Pn=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var qn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Tn(t))!Pn.call(e,s)&&s!==r&&at(e,s,{get:()=>t[s],enumerable:!(n=kn(t,s))||n.enumerable});return e};var j=(e,t,r)=>(r=e!=null?Ln(An(e)):{},qn(t||!e||!e.__esModule?at(r,"default",{value:e,enumerable:!0}):r,e));var U=m((Va,ht)=>{"use strict";var Gn="2.0.0",zn=Number.MAX_SAFE_INTEGER||9007199254740991,Mn=16,Xn=250,Vn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];ht.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Mn,MAX_SAFE_BUILD_LENGTH:Xn,MAX_SAFE_INTEGER:zn,RELEASE_TYPES:Vn,SEMVER_SPEC_VERSION:Gn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var F=m((_a,dt)=>{"use strict";var _n=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};dt.exports=_n});var C=m((N,mt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Oe,MAX_SAFE_BUILD_LENGTH:Bn,MAX_LENGTH:Hn}=U(),Wn=F();N=mt.exports={};var Yn=N.re=[],Jn=N.safeRe=[],u=N.src=[],Zn=N.safeSrc=[],f=N.t={},Kn=0,Ie="[a-zA-Z0-9-]",Qn=[["\\s",1],["\\d",Hn],[Ie,Bn]],es=e=>{for(let[t,r]of Qn)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},w=(e,t,r)=>{let n=es(t),s=Kn++;Wn(e,s,t),f[e]=s,u[s]=t,Zn[s]=n,Yn[s]=new RegExp(t,r?"g":void 0),Jn[s]=new RegExp(n,r?"g":void 0)};w("NUMERICIDENTIFIER","0|[1-9]\\d*");w("NUMERICIDENTIFIERLOOSE","\\d+");w("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Ie}*`);w("MAINVERSION",`(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})`);w("MAINVERSIONLOOSE",`(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})`);w("PRERELEASEIDENTIFIER",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIER]})`);w("PRERELEASEIDENTIFIERLOOSE",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIERLOOSE]})`);w("PRERELEASE",`(?:-(${u[f.PRERELEASEIDENTIFIER]}(?:\\.${u[f.PRERELEASEIDENTIFIER]})*))`);w("PRERELEASELOOSE",`(?:-?(${u[f.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[f.PRERELEASEIDENTIFIERLOOSE]})*))`);w("BUILDIDENTIFIER",`${Ie}+`);w("BUILD",`(?:\\+(${u[f.BUILDIDENTIFIER]}(?:\\.${u[f.BUILDIDENTIFIER]})*))`);w("FULLPLAIN",`v?${u[f.MAINVERSION]}${u[f.PRERELEASE]}?${u[f.BUILD]}?`);w("FULL",`^${u[f.FULLPLAIN]}$`);w("LOOSEPLAIN",`[v=\\s]*${u[f.MAINVERSIONLOOSE]}${u[f.PRERELEASELOOSE]}?${u[f.BUILD]}?`);w("LOOSE",`^${u[f.LOOSEPLAIN]}$`);w("GTLT","((?:<|>)?=?)");w("XRANGEIDENTIFIERLOOSE",`${u[f.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);w("XRANGEIDENTIFIER",`${u[f.NUMERICIDENTIFIER]}|x|X|\\*`);w("XRANGEPLAIN",`[v=\\s]*(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:${u[f.PRERELEASE]})?${u[f.BUILD]}?)?)?`);w("XRANGEPLAINLOOSE",`[v=\\s]*(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:${u[f.PRERELEASELOOSE]})?${u[f.BUILD]}?)?)?`);w("XRANGE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAIN]}$`);w("XRANGELOOSE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAINLOOSE]}$`);w("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Oe}})(?:\\.(\\d{1,${Oe}}))?(?:\\.(\\d{1,${Oe}}))?`);w("COERCE",`${u[f.COERCEPLAIN]}(?:$|[^\\d])`);w("COERCEFULL",u[f.COERCEPLAIN]+`(?:${u[f.PRERELEASE]})?(?:${u[f.BUILD]})?(?:$|[^\\d])`);w("COERCERTL",u[f.COERCE],!0);w("COERCERTLFULL",u[f.COERCEFULL],!0);w("LONETILDE","(?:~>?)");w("TILDETRIM",`(\\s*)${u[f.LONETILDE]}\\s+`,!0);N.tildeTrimReplace="$1~";w("TILDE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAIN]}$`);w("TILDELOOSE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAINLOOSE]}$`);w("LONECARET","(?:\\^)");w("CARETTRIM",`(\\s*)${u[f.LONECARET]}\\s+`,!0);N.caretTrimReplace="$1^";w("CARET",`^${u[f.LONECARET]}${u[f.XRANGEPLAIN]}$`);w("CARETLOOSE",`^${u[f.LONECARET]}${u[f.XRANGEPLAINLOOSE]}$`);w("COMPARATORLOOSE",`^${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]})$|^$`);w("COMPARATOR",`^${u[f.GTLT]}\\s*(${u[f.FULLPLAIN]})$|^$`);w("COMPARATORTRIM",`(\\s*)${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]}|${u[f.XRANGEPLAIN]})`,!0);N.comparatorTrimReplace="$1$2$3";w("HYPHENRANGE",`^\\s*(${u[f.XRANGEPLAIN]})\\s+-\\s+(${u[f.XRANGEPLAIN]})\\s*$`);w("HYPHENRANGELOOSE",`^\\s*(${u[f.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[f.XRANGEPLAINLOOSE]})\\s*$`);w("STAR","(<|>)?=?\\s*\\*");w("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");w("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Q=m((Ba,wt)=>{"use strict";var ts=Object.freeze({loose:!0}),rs=Object.freeze({}),ns=e=>e?typeof e!="object"?ts:e:rs;wt.exports=ns});var xe=m((Ha,$t)=>{"use strict";var Et=/^[0-9]+$/,gt=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:egt(t,e);$t.exports={compareIdentifiers:gt,rcompareIdentifiers:ss}});var y=m((Wa,Rt)=>{"use strict";var ee=F(),{MAX_LENGTH:yt,MAX_SAFE_INTEGER:te}=U(),{safeRe:re,t:ne}=C(),os=Q(),{compareIdentifiers:ve}=xe(),Se=class e{constructor(t,r){if(r=os(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>yt)throw new TypeError(`version is longer than ${yt} characters`);ee("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?re[ne.LOOSE]:re[ne.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>te||this.major<0)throw new TypeError("Invalid major version");if(this.minor>te||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>te||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let o=+s;if(o>=0&&ot.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(ee("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ve(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(ee("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ve(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?re[ne.PRERELEASELOOSE]:re[ne.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let o=[r,s];n===!1&&(o=[r]),ve(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Rt.exports=Se});var T=m((Ya,It)=>{"use strict";var Ot=y(),is=(e,t,r=!1)=>{if(e instanceof Ot)return e;try{return new Ot(e,t)}catch(n){if(!r)return null;throw n}};It.exports=is});var vt=m((Ja,xt)=>{"use strict";var as=T(),cs=(e,t)=>{let r=as(e,t);return r?r.version:null};xt.exports=cs});var bt=m((Za,St)=>{"use strict";var ls=T(),us=(e,t)=>{let r=ls(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};St.exports=us});var kt=m((Ka,Lt)=>{"use strict";var Nt=y(),fs=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new Nt(e instanceof Nt?e.version:e,r).inc(t,n,s).version}catch{return null}};Lt.exports=fs});var Pt=m((Qa,At)=>{"use strict";var Tt=T(),ps=(e,t)=>{let r=Tt(e,null,!0),n=Tt(t,null,!0),s=r.compare(n);if(s===0)return null;let o=s>0,i=o?r:n,a=o?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0)return a.minor&&!a.patch?"minor":"patch"}let p=c?"pre":"";return r.major!==n.major?p+"major":r.minor!==n.minor?p+"minor":r.patch!==n.patch?p+"patch":"prerelease"};At.exports=ps});var jt=m((ec,qt)=>{"use strict";var hs=y(),ds=(e,t)=>new hs(e,t).major;qt.exports=ds});var Dt=m((tc,Ct)=>{"use strict";var ms=y(),ws=(e,t)=>new ms(e,t).minor;Ct.exports=ws});var Ft=m((rc,Ut)=>{"use strict";var Es=y(),gs=(e,t)=>new Es(e,t).patch;Ut.exports=gs});var zt=m((nc,Gt)=>{"use strict";var $s=T(),ys=(e,t)=>{let r=$s(e,t);return r&&r.prerelease.length?r.prerelease:null};Gt.exports=ys});var x=m((sc,Xt)=>{"use strict";var Mt=y(),Rs=(e,t,r)=>new Mt(e,r).compare(new Mt(t,r));Xt.exports=Rs});var _t=m((oc,Vt)=>{"use strict";var Os=x(),Is=(e,t,r)=>Os(t,e,r);Vt.exports=Is});var Ht=m((ic,Bt)=>{"use strict";var xs=x(),vs=(e,t)=>xs(e,t,!0);Bt.exports=vs});var se=m((ac,Yt)=>{"use strict";var Wt=y(),Ss=(e,t,r)=>{let n=new Wt(e,r),s=new Wt(t,r);return n.compare(s)||n.compareBuild(s)};Yt.exports=Ss});var Zt=m((cc,Jt)=>{"use strict";var bs=se(),Ns=(e,t)=>e.sort((r,n)=>bs(r,n,t));Jt.exports=Ns});var Qt=m((lc,Kt)=>{"use strict";var Ls=se(),ks=(e,t)=>e.sort((r,n)=>Ls(n,r,t));Kt.exports=ks});var G=m((uc,er)=>{"use strict";var Ts=x(),As=(e,t,r)=>Ts(e,t,r)>0;er.exports=As});var oe=m((fc,tr)=>{"use strict";var Ps=x(),qs=(e,t,r)=>Ps(e,t,r)<0;tr.exports=qs});var be=m((pc,rr)=>{"use strict";var js=x(),Cs=(e,t,r)=>js(e,t,r)===0;rr.exports=Cs});var Ne=m((hc,nr)=>{"use strict";var Ds=x(),Us=(e,t,r)=>Ds(e,t,r)!==0;nr.exports=Us});var ie=m((dc,sr)=>{"use strict";var Fs=x(),Gs=(e,t,r)=>Fs(e,t,r)>=0;sr.exports=Gs});var ae=m((mc,or)=>{"use strict";var zs=x(),Ms=(e,t,r)=>zs(e,t,r)<=0;or.exports=Ms});var Le=m((wc,ir)=>{"use strict";var Xs=be(),Vs=Ne(),_s=G(),Bs=ie(),Hs=oe(),Ws=ae(),Ys=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Xs(e,r,n);case"!=":return Vs(e,r,n);case">":return _s(e,r,n);case">=":return Bs(e,r,n);case"<":return Hs(e,r,n);case"<=":return Ws(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};ir.exports=Ys});var cr=m((Ec,ar)=>{"use strict";var Js=y(),Zs=T(),{safeRe:ce,t:le}=C(),Ks=(e,t)=>{if(e instanceof Js)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?ce[le.COERCEFULL]:ce[le.COERCE]);else{let c=t.includePrerelease?ce[le.COERCERTLFULL]:ce[le.COERCERTL],l;for(;(l=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||l.index+l[0].length!==r.index+r[0].length)&&(r=l),c.lastIndex=l.index+l[1].length+l[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",o=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Zs(`${n}.${s}.${o}${i}${a}`,t)};ar.exports=Ks});var ur=m((gc,lr)=>{"use strict";var ke=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};lr.exports=ke});var v=m(($c,dr)=>{"use strict";var Qs=/\s+/g,Te=class e{constructor(t,r){if(r=to(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Ae)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(Qs," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!pr(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&co(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&io)|(this.options.loose&&ao))+":"+t,s=fr.get(n);if(s)return s;let o=this.options.loose,i=o?O[R.HYPHENRANGELOOSE]:O[R.HYPHENRANGE];t=t.replace(i,$o(this.options.includePrerelease)),g("hyphen replace",t),t=t.replace(O[R.COMPARATORTRIM],no),g("comparator trim",t),t=t.replace(O[R.TILDETRIM],so),g("tilde trim",t),t=t.replace(O[R.CARETTRIM],oo),g("caret trim",t);let a=t.split(" ").map(h=>lo(h,this.options)).join(" ").split(/\s+/).map(h=>go(h,this.options));o&&(a=a.filter(h=>(g("loose invalid filter",h,this.options),!!h.match(O[R.COMPARATORLOOSE])))),g("range list",a);let c=new Map,l=a.map(h=>new Ae(h,this.options));for(let h of l){if(pr(h))return[h];c.set(h.value,h)}c.size>1&&c.has("")&&c.delete("");let p=[...c.values()];return fr.set(n,p),p}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>hr(n,r)&&t.set.some(s=>hr(s,r)&&n.every(o=>s.every(i=>o.intersects(i,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new ro(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",co=e=>e.value==="",hr=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(o=>s.intersects(o,t)),s=n.pop();return r},lo=(e,t)=>(e=e.replace(O[R.BUILD],""),g("comp",e,t),e=po(e,t),g("caret",e),e=uo(e,t),g("tildes",e),e=mo(e,t),g("xrange",e),e=Eo(e,t),g("stars",e),e),I=e=>!e||e.toLowerCase()==="x"||e==="*",uo=(e,t)=>e.trim().split(/\s+/).map(r=>fo(r,t)).join(" "),fo=(e,t)=>{let r=t.loose?O[R.TILDELOOSE]:O[R.TILDE];return e.replace(r,(n,s,o,i,a)=>{g("tilde",e,n,s,o,i,a);let c;return I(s)?c="":I(o)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:I(i)?c=`>=${s}.${o}.0 <${s}.${+o+1}.0-0`:a?(g("replaceTilde pr",a),c=`>=${s}.${o}.${i}-${a} <${s}.${+o+1}.0-0`):c=`>=${s}.${o}.${i} <${s}.${+o+1}.0-0`,g("tilde return",c),c})},po=(e,t)=>e.trim().split(/\s+/).map(r=>ho(r,t)).join(" "),ho=(e,t)=>{g("caret",e,t);let r=t.loose?O[R.CARETLOOSE]:O[R.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,o,i,a,c)=>{g("caret",e,s,o,i,a,c);let l;return I(o)?l="":I(i)?l=`>=${o}.0.0${n} <${+o+1}.0.0-0`:I(a)?o==="0"?l=`>=${o}.${i}.0${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.0${n} <${+o+1}.0.0-0`:c?(g("replaceCaret pr",c),o==="0"?i==="0"?l=`>=${o}.${i}.${a}-${c} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}-${c} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a}-${c} <${+o+1}.0.0-0`):(g("no pr"),o==="0"?i==="0"?l=`>=${o}.${i}.${a}${n} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a} <${+o+1}.0.0-0`),g("caret return",l),l})},mo=(e,t)=>(g("replaceXRanges",e,t),e.split(/\s+/).map(r=>wo(r,t)).join(" ")),wo=(e,t)=>{e=e.trim();let r=t.loose?O[R.XRANGELOOSE]:O[R.XRANGE];return e.replace(r,(n,s,o,i,a,c)=>{g("xRange",e,n,s,o,i,a,c);let l=I(o),p=l||I(i),h=p||I(a),E=h;return s==="="&&E&&(s=""),c=t.includePrerelease?"-0":"",l?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&E?(p&&(i=0),a=0,s===">"?(s=">=",p?(o=+o+1,i=0,a=0):(i=+i+1,a=0)):s==="<="&&(s="<",p?o=+o+1:i=+i+1),s==="<"&&(c="-0"),n=`${s+o}.${i}.${a}${c}`):p?n=`>=${o}.0.0${c} <${+o+1}.0.0-0`:h&&(n=`>=${o}.${i}.0${c} <${o}.${+i+1}.0-0`),g("xRange return",n),n})},Eo=(e,t)=>(g("replaceStars",e,t),e.trim().replace(O[R.STAR],"")),go=(e,t)=>(g("replaceGTE0",e,t),e.trim().replace(O[t.includePrerelease?R.GTE0PRE:R.GTE0],"")),$o=e=>(t,r,n,s,o,i,a,c,l,p,h,E)=>(I(n)?r="":I(s)?r=`>=${n}.0.0${e?"-0":""}`:I(o)?r=`>=${n}.${s}.0${e?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,I(l)?c="":I(p)?c=`<${+l+1}.0.0-0`:I(h)?c=`<${l}.${+p+1}.0-0`:E?c=`<=${l}.${p}.${h}-${E}`:e?c=`<${l}.${p}.${+h+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),yo=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var z=m((yc,yr)=>{"use strict";var M=Symbol("SemVer ANY"),je=class e{static get ANY(){return M}constructor(t,r){if(r=mr(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),qe("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===M?this.value="":this.value=this.operator+this.semver.version,qe("comp",this)}parse(t){let r=this.options.loose?wr[Er.COMPARATORLOOSE]:wr[Er.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new gr(n[2],this.options.loose):this.semver=M}toString(){return this.value}test(t){if(qe("Comparator.test",t,this.options.loose),this.semver===M||t===M)return!0;if(typeof t=="string")try{t=new gr(t,this.options)}catch{return!1}return Pe(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new $r(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new $r(this.value,r).test(t.semver):(r=mr(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||Pe(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||Pe(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};yr.exports=je;var mr=Q(),{safeRe:wr,t:Er}=C(),Pe=Le(),qe=F(),gr=y(),$r=v()});var X=m((Rc,Rr)=>{"use strict";var Ro=v(),Oo=(e,t,r)=>{try{t=new Ro(t,r)}catch{return!1}return t.test(e)};Rr.exports=Oo});var Ir=m((Oc,Or)=>{"use strict";var Io=v(),xo=(e,t)=>new Io(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Or.exports=xo});var vr=m((Ic,xr)=>{"use strict";var vo=y(),So=v(),bo=(e,t,r)=>{let n=null,s=null,o=null;try{o=new So(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===-1)&&(n=i,s=new vo(n,r))}),n};xr.exports=bo});var br=m((xc,Sr)=>{"use strict";var No=y(),Lo=v(),ko=(e,t,r)=>{let n=null,s=null,o=null;try{o=new Lo(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===1)&&(n=i,s=new No(n,r))}),n};Sr.exports=ko});var kr=m((vc,Lr)=>{"use strict";var Ce=y(),To=v(),Nr=G(),Ao=(e,t)=>{e=new To(e,t);let r=new Ce("0.0.0");if(e.test(r)||(r=new Ce("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let a=new Ce(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||Nr(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||Nr(r,o))&&(r=o)}return r&&e.test(r)?r:null};Lr.exports=Ao});var Ar=m((Sc,Tr)=>{"use strict";var Po=v(),qo=(e,t)=>{try{return new Po(e,t).range||"*"}catch{return null}};Tr.exports=qo});var ue=m((bc,Cr)=>{"use strict";var jo=y(),jr=z(),{ANY:Co}=jr,Do=v(),Uo=X(),Pr=G(),qr=oe(),Fo=ae(),Go=ie(),zo=(e,t,r,n)=>{e=new jo(e,n),t=new Do(t,n);let s,o,i,a,c;switch(r){case">":s=Pr,o=Fo,i=qr,a=">",c=">=";break;case"<":s=qr,o=Go,i=Pr,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Uo(e,t,n))return!1;for(let l=0;l{d.semver===Co&&(d=new jr(">=0.0.0")),h=h||d,E=E||d,s(d.semver,h.semver,n)?h=d:i(d.semver,E.semver,n)&&(E=d)}),h.operator===a||h.operator===c||(!E.operator||E.operator===a)&&o(e,E.semver))return!1;if(E.operator===c&&i(e,E.semver))return!1}return!0};Cr.exports=zo});var Ur=m((Nc,Dr)=>{"use strict";var Mo=ue(),Xo=(e,t,r)=>Mo(e,t,">",r);Dr.exports=Xo});var Gr=m((Lc,Fr)=>{"use strict";var Vo=ue(),_o=(e,t,r)=>Vo(e,t,"<",r);Fr.exports=_o});var Xr=m((kc,Mr)=>{"use strict";var zr=v(),Bo=(e,t,r)=>(e=new zr(e,r),t=new zr(t,r),e.intersects(t,r));Mr.exports=Bo});var _r=m((Tc,Vr)=>{"use strict";var Ho=X(),Wo=x();Vr.exports=(e,t,r)=>{let n=[],s=null,o=null,i=e.sort((p,h)=>Wo(p,h,r));for(let p of i)Ho(p,t,r)?(o=p,s||(s=p)):(o&&n.push([s,o]),o=null,s=null);s&&n.push([s,null]);let a=[];for(let[p,h]of n)p===h?a.push(p):!h&&p===i[0]?a.push("*"):h?p===i[0]?a.push(`<=${h}`):a.push(`${p} - ${h}`):a.push(`>=${p}`);let c=a.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return c.length{"use strict";var Br=v(),Ue=z(),{ANY:De}=Ue,V=X(),Fe=x(),Yo=(e,t,r={})=>{if(e===t)return!0;e=new Br(e,r),t=new Br(t,r);let n=!1;e:for(let s of e.set){for(let o of t.set){let i=Zo(s,o,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},Jo=[new Ue(">=0.0.0-0")],Hr=[new Ue(">=0.0.0")],Zo=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===De){if(t.length===1&&t[0].semver===De)return!0;r.includePrerelease?e=Jo:e=Hr}if(t.length===1&&t[0].semver===De){if(r.includePrerelease)return!0;t=Hr}let n=new Set,s,o;for(let d of e)d.operator===">"||d.operator===">="?s=Wr(s,d,r):d.operator==="<"||d.operator==="<="?o=Yr(o,d,r):n.add(d.semver);if(n.size>1)return null;let i;if(s&&o){if(i=Fe(s.semver,o.semver,r),i>0)return null;if(i===0&&(s.operator!==">="||o.operator!=="<="))return null}for(let d of n){if(s&&!V(d,String(s),r)||o&&!V(d,String(o),r))return null;for(let ye of t)if(!V(d,String(ye),r))return!1;return!0}let a,c,l,p,h=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,E=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;h&&h.prerelease.length===1&&o.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let d of t){if(p=p||d.operator===">"||d.operator===">=",l=l||d.operator==="<"||d.operator==="<=",s){if(E&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===E.major&&d.semver.minor===E.minor&&d.semver.patch===E.patch&&(E=!1),d.operator===">"||d.operator===">="){if(a=Wr(s,d,r),a===d&&a!==s)return!1}else if(s.operator===">="&&!V(s.semver,String(d),r))return!1}if(o){if(h&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===h.major&&d.semver.minor===h.minor&&d.semver.patch===h.patch&&(h=!1),d.operator==="<"||d.operator==="<="){if(c=Yr(o,d,r),c===d&&c!==o)return!1}else if(o.operator==="<="&&!V(o.semver,String(d),r))return!1}if(!d.operator&&(o||s)&&i!==0)return!1}return!(s&&l&&!o&&i!==0||o&&p&&!s&&i!==0||E||h)},Wr=(e,t,r)=>{if(!e)return t;let n=Fe(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},Yr=(e,t,r)=>{if(!e)return t;let n=Fe(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};Jr.exports=Yo});var A=m((Pc,en)=>{"use strict";var Ge=C(),Kr=U(),Ko=y(),Qr=xe(),Qo=T(),ei=vt(),ti=bt(),ri=kt(),ni=Pt(),si=jt(),oi=Dt(),ii=Ft(),ai=zt(),ci=x(),li=_t(),ui=Ht(),fi=se(),pi=Zt(),hi=Qt(),di=G(),mi=oe(),wi=be(),Ei=Ne(),gi=ie(),$i=ae(),yi=Le(),Ri=cr(),Oi=z(),Ii=v(),xi=X(),vi=Ir(),Si=vr(),bi=br(),Ni=kr(),Li=Ar(),ki=ue(),Ti=Ur(),Ai=Gr(),Pi=Xr(),qi=_r(),ji=Zr();en.exports={parse:Qo,valid:ei,clean:ti,inc:ri,diff:ni,major:si,minor:oi,patch:ii,prerelease:ai,compare:ci,rcompare:li,compareLoose:ui,compareBuild:fi,sort:pi,rsort:hi,gt:di,lt:mi,eq:wi,neq:Ei,gte:gi,lte:$i,cmp:yi,coerce:Ri,Comparator:Oi,Range:Ii,satisfies:xi,toComparators:vi,maxSatisfying:Si,minSatisfying:bi,minVersion:Ni,validRange:Li,outside:ki,gtr:Ti,ltr:Ai,intersects:Pi,simplifyRange:qi,subset:ji,SemVer:Ko,re:Ge.re,src:Ge.src,tokens:Ge.t,SEMVER_SPEC_VERSION:Kr.SEMVER_SPEC_VERSION,RELEASE_TYPES:Kr.RELEASE_TYPES,compareIdentifiers:Qr.compareIdentifiers,rcompareIdentifiers:Qr.rcompareIdentifiers}});var Re=new TextDecoder;function K(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function lt(e,t){let r=String(t??"").split(/\s+/).filter(o=>o.startsWith("sha512-")).map(o=>o.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,o=>String.fromCharCode(o)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function ut(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let o=await r.read();!o.done;o=await r.read()){if(s+=o.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(o.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function D(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return Re.decode(s<0?n:n.subarray(0,s))}function ft(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,o)=>s*256+o,e[t]&127);let n=D(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function jn(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if(ft(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function Cn(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let o=Re.decode(e.subarray(n+1,r+s-1)),i=o.indexOf("=");t[o.slice(0,i)]=o.slice(i+1),r+=s}return t}function Dn(e,t){let r=e.subarray(t,t+512);jn(r);let n=ft(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function Un(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function Fn(e){let t=D(e,0,100),r=D(e,257,5)==="ustar"?D(e,345,155):"";return r?`${r}/${t}`:t}var ct={x:(e,t)=>({...e,pax:Cn(t).path}),L:(e,t)=>({...e,long:D(t,0,t.length)}),g:e=>e};function pt(e){let t=[],r={};for(let n=0;!Un(e,n);){let{header:s,type:o,data:i,next:a}=Dn(e,n);if(n=a,Object.hasOwn(ct,o)){r=ct[o](r,i);continue}(o==="0"||o==="7")&&t.push({path:r.pax??r.long??Fn(s),bytes:i}),r={}}return t}var fe=j(A(),1);var L=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function _(e,t){let r=[],n=0;for(;;){let s=await L(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function ze(e,{id:t,path:r,bytes:n},s){for(let o=0;o{}),a}}async function Ci(e,t){let r=[],n=0;for(;;){let{done:s,value:o}=await e.read();if(s)return r;if(n+=o.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(o)}}async function Di(e,t){try{return await Ci(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function tn(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await Di(e.body.getReader(),t)).arrayBuffer())}var Ui=/[\\\0:*?"<>|]/,Fi=e=>e.split("/").some(t=>!t||t==="."||t==="..");function Gi(e){return typeof e!="string"||!e||Ui.test(e)?!0:Fi(e)}function P(e){if(Gi(e))throw new Error(`Unsafe package path: ${e}`);return e}var zi=new TextDecoder,Mi=["preinstall","install","postinstall"];async function rn(e){let t=new Map;for(let r of pt(await ut(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=P(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var Xi=e=>Mi.some(t=>e.scripts?.[t]),Vi=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function _i(e,t){return Xi(e)||e.gypfile?!0:Vi(t)}function nn(e,t,r){let n=JSON.parse(zi.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(_i(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}var Me=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),pe=(e,t)=>`${e.replace("/","+")}@${t}`,Xe=(e,t,r)=>`${pe(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function Bi(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function Hi(e,t){let r=e["dist-tags"]?.[t];return r||(fe.default.valid(t)?t:fe.default.maxSatisfying(Object.keys(e.versions??{}),t))}function Wi(e,t,r){let n=r||"latest",s=Hi(e,n),o=e.versions?.[s];if(!o||!fe.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:o}}async function Yi(e,t,r,{fetchImpl:n,signal:s}){let o=new URL(t.dist?.tarball,r);if(o.protocol!=="https:"&&o.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let i=await n(o,{signal:s});if(!i.ok)throw new Error(`Package download for ${e}: HTTP ${i.status}`);let a=await tn(i);return{bytes:a,integrity:await lt(a,t.dist.integrity)}}function Ve(e){let t=new URL(e,globalThis.location?.href);if(t.protocol!=="https:"&&t.origin!==globalThis.location?.origin)throw new Error(`The npm registry must use HTTPS or the application origin: ${e}`);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function q(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!Me(e))throw new Error(`Unsupported npm package name: ${e}`);let o=Ve(r),i={fetchImpl:n,signal:s},{version:a,manifest:c}=Wi(await Bi(e,o,i),e,t),{bytes:l,integrity:p}=await Yi(e,c,o,i),h=await rn(l),E=nn(h,e,a);return{id:pe(e,a),key:Xe(e,a,p),manifest:E,integrity:p,files:h}}var he=j(A(),1);function Ji(e,t,r){let n=e?.roots?.[t];return n?.requested===r&&e.packages[n.id]?e.packages[n.id]:he.default.validRange(r)?Object.values(e?.packages??{}).filter(o=>o.name===t&&he.default.satisfies(o.version,r)).sort((o,i)=>he.default.rcompare(o.version,i.version))[0]??null:null}function sn({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=q,previous:s}){let o=new Map;return async(i,a)=>{let c=`${i}@${a}`;if(o.has(c))return o.get(c);let l=Ji(s,i,a),p=await n(i,l?.version??a,{registry:e,fetchImpl:t,signal:r});if(l&&p.integrity!==l.integrity)throw new Error(`${p.id} no longer matches the integrity recorded in the lock`);return o.set(c,p),p}}var on=j(A(),1),an=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function Zi(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw an(e,t,r)}function Ki(e,[t,r],{nodes:n,roots:s}){let o=s[t]?.id??e.dependencies[t];if(!o)return Zi(e,t,r);if(!on.default.satisfies(n[o].version,r))throw an(e,t,r);return o}function Qi(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=Ki(e,r,t);n&&(e.dependencies[r[0]]=n)}}function cn(e,t){for(let r of Object.values(e))Qi(r,{nodes:e,roots:t})}var ln=j(A(),1);function ea(e,t){return!Me(t.name)||!ln.default.valid(t.version)?!1:e===pe(t.name,t.version)}function ta(e){return e.integrity?.startsWith("sha512-")?e.key===Xe(e.name,e.version,e.integrity):!1}function ra(e,t,r){if(!ea(t,r)||!ta(r))throw new Error("Invalid locked package");for(let n of r.files)P(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function na(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function _e(e){if(!na(e))throw new Error("Unsupported package lock");if(Object.keys(e.packages).length>512)throw new Error("The package lock exceeds 512 packages");for(let[t,r]of Object.entries(e.packages))ra(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function sa(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function oa(e,t){let r={};for(let n of e){let{name:s,version:o}=K(n);r[s]={requested:o||"latest",id:await t(s,o||"latest")}}return r}async function un(e,t={}){let r=sn(t),n={nodes:{},downloads:new Map,total:0},s=async(i,a)=>{t.signal?.throwIfAborted();let c=await r(i,a);if(n.nodes[c.id])return c.id;sa(n,i,c);for(let[l,p]of Object.entries(c.manifest.dependencies??{}).sort())n.nodes[c.id].dependencies[l]=await s(l,p);return c.id},o=await oa(e,s);return cn(n.nodes,o),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:o,packages:n.nodes},downloads:n.downloads}}function H(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var S="webfront.project.json",W=1,Be=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,ia=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,aa=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,fn=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,He=/^[A-Za-z_][A-Za-z0-9_]*$/,pn=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],ca=["files","publish","fetch"],$=e=>{throw new Error(`${S}: ${e}`)};function k(e,t){return H(e)||$(`${t} must be an object`),e}function We(e,t,r){for(let n of Object.keys(e))t.includes(n)||$(`unknown key "${n}" in ${r}`)}function de(e,t){typeof e!="string"&&$(`${t} must be a project path`);try{return P(e)}catch{return $(`${t} is not a safe project-relative path: ${e}`)}}function hn(e,t){return(!Array.isArray(e)||e.length>256)&&$(`${t} must be an array of at most 256 paths`),e.map((r,n)=>de(r,`${t}[${n}]`))}function la(e){let t=k(e,"dependencies");for(let[r,n]of Object.entries(t))Be.test(r)||$(`invalid npm package name "${r}"`),(typeof n!="string"||!aa.test(n)||n!==n.trim())&&$(`invalid version range for "${r}"`);return t}function ua(e){if(typeof e!="string"&&$("registry must be a URL"),e.startsWith("/")&&!e.startsWith("//"))return e;let t;try{t=new URL(e)}catch{return $("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&$("registry must use https"),e}function fa(e){let t=k(e,"scripts");for(let[r,n]of Object.entries(t))(!fn.test(r)||typeof n!="string"||!n||n.length>1024)&&$(`invalid script "${r}"`);return t}function pa(e){let t=k(e,"entries");for(let[r,n]of Object.entries(t))fn.test(r)||$(`invalid entry name "${r}"`),de(n,`entries.${r}`);return t}function ha(e,t){let r=k(e,"providers");for(let[n,s]of Object.entries(r))He.test(n)||$(`invalid provider name "${n}"`),k(s,`providers.${n}`),We(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&$(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||de(s.entry,`providers.${n}.entry`),de(s.output,`providers.${n}.output`).endsWith(".hpp")||$(`providers.${n}.output must be a .hpp file`);return r}function da(e){let t=k(e,"test");return We(t,["specs"],"test"),t.specs!==void 0&&hn(t.specs,"test.specs"),t}function ma(e,t){let r;try{r=new URL(e)}catch{return $(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&$(`${t} must be an https origin without a path`),e}function wa(e){let t=k(e,"permissions");for(let r of Object.keys(t))ca.includes(r)||$(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&hn(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&$("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>ma(r,`permissions.fetch[${n}]`))),t}function Ea(e){(typeof e.name!="string"||!Be.test(e.name))&&$("name must be a lower-case npm package name"),(typeof e.version!="string"||!ia.test(e.version))&&$("version must be a semantic version")}function ga(e){e.format!==W&&(Number.isInteger(e.format)&&e.format>W&&$(`format ${e.format} is not supported by this environment (it reads format ${W}); update the environment`),$(`format must be ${W}`))}function Y(e){k(e,"the manifest"),ga(e),We(e,pn,"the manifest"),Ea(e);let t=e.entries===void 0?{}:pa(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:la(e.dependencies),entries:t,providers:e.providers===void 0?{}:ha(e.providers,t),...e.registry===void 0?{}:{registry:ua(e.registry)},...e.scripts===void 0?{}:{scripts:fa(e.scripts)},...e.test===void 0?{}:{test:da(e.test)},...e.permissions===void 0?{}:{permissions:wa(e.permissions)}}}function Ye(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return $("not valid JSON")}return{source:t,manifest:Y(t)}}function cl(e){return Ye(e).manifest}function Je(e){let t={};for(let r of pn)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` -`}function dn(e){return{format:W,name:e,version:"0.1.0",dependencies:{}}}function mn(e){let r=(String(e??"").split("/").filter(Boolean).pop()??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"");return Be.test(r)?r:"webfront-app"}async function me(e){let t=JSON.stringify(Object.entries(e).sort(([n],[s])=>ns?1:0)),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(r)].map(n=>n.toString(16).padStart(2,"0")).join("")}var Ze=j(A(),1);var b="webfront-packages.lock.json",Ke=".webfront/developer/packages",$a=new TextDecoder,ya=new TextEncoder,we="No webfront.project.json: run wf init",Ee="The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again";async function wn(e,t){try{return await _(e,t)}catch(r){if(r.message.includes("Cannot read project file:"))return null;throw r}}function Ra(e,t,r){return t?r===t.requested?!0:Ze.default.validRange(r)!==null&&Ze.default.satisfies(e.packages[t.id].version,r):!1}function Oa(e,t){let r=Object.keys(t);return r.length===Object.keys(e.roots).length&&r.every(n=>Ra(e,e.roots[n],t[n]))}function Ia(e,t,r){return e?t?t.manifestDigest===void 0?Oa(t,e.dependencies)?"legacy":"desynchronized":t.manifestDigest===r?"consistent":"desynchronized":"unlocked":"no-manifest"}async function J(e){let t=await L(e,"state",`${S} -${b}`),r=await wn(e,S),n=await wn(e,b),{source:s,manifest:o}=r?Ye(r):{source:null,manifest:null},i=n?_e(JSON.parse($a.decode(n))):null,a=o?await me(o.dependencies):null;return{manifest:o,source:s,lock:i,token:t,status:Ia(o,i,a),digest:a}}var gn=e=>e.status==="desynchronized"?`Warning: ${Ee}.\r -`:"";async function $n(e,t,r,{signal:n}={}){let s=[];try{for(let[o,i]of t){n?.throwIfAborted();let a=await L(e,"begin",o,!1);s.push(a),await ze(e,{id:a,path:"output",bytes:i},n)}n?.throwIfAborted(),await L(e,"commitGroup",s.join(` +var Ln=Object.create;var ct=Object.defineProperty;var Nn=Object.getOwnPropertyDescriptor;var Tn=Object.getOwnPropertyNames;var An=Object.getPrototypeOf,Pn=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var qn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Tn(t))!Pn.call(e,s)&&s!==r&&ct(e,s,{get:()=>t[s],enumerable:!(n=Nn(t,s))||n.enumerable});return e};var D=(e,t,r)=>(r=e!=null?Ln(An(e)):{},qn(t||!e||!e.__esModule?ct(r,"default",{value:e,enumerable:!0}):r,e));var F=m((_a,dt)=>{"use strict";var Fn="2.0.0",Gn=Number.MAX_SAFE_INTEGER||9007199254740991,Mn=16,Xn=250,Vn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];dt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Mn,MAX_SAFE_BUILD_LENGTH:Xn,MAX_SAFE_INTEGER:Gn,RELEASE_TYPES:Vn,SEMVER_SPEC_VERSION:Fn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var G=m((Ha,mt)=>{"use strict";var Bn=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};mt.exports=Bn});var U=m((N,wt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Oe,MAX_SAFE_BUILD_LENGTH:_n,MAX_LENGTH:Hn}=F(),Wn=G();N=wt.exports={};var Yn=N.re=[],Jn=N.safeRe=[],u=N.src=[],Zn=N.safeSrc=[],f=N.t={},Kn=0,Ie="[a-zA-Z0-9-]",Qn=[["\\s",1],["\\d",Hn],[Ie,_n]],es=e=>{for(let[t,r]of Qn)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},w=(e,t,r)=>{let n=es(t),s=Kn++;Wn(e,s,t),f[e]=s,u[s]=t,Zn[s]=n,Yn[s]=new RegExp(t,r?"g":void 0),Jn[s]=new RegExp(n,r?"g":void 0)};w("NUMERICIDENTIFIER","0|[1-9]\\d*");w("NUMERICIDENTIFIERLOOSE","\\d+");w("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Ie}*`);w("MAINVERSION",`(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})`);w("MAINVERSIONLOOSE",`(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})`);w("PRERELEASEIDENTIFIER",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIER]})`);w("PRERELEASEIDENTIFIERLOOSE",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIERLOOSE]})`);w("PRERELEASE",`(?:-(${u[f.PRERELEASEIDENTIFIER]}(?:\\.${u[f.PRERELEASEIDENTIFIER]})*))`);w("PRERELEASELOOSE",`(?:-?(${u[f.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[f.PRERELEASEIDENTIFIERLOOSE]})*))`);w("BUILDIDENTIFIER",`${Ie}+`);w("BUILD",`(?:\\+(${u[f.BUILDIDENTIFIER]}(?:\\.${u[f.BUILDIDENTIFIER]})*))`);w("FULLPLAIN",`v?${u[f.MAINVERSION]}${u[f.PRERELEASE]}?${u[f.BUILD]}?`);w("FULL",`^${u[f.FULLPLAIN]}$`);w("LOOSEPLAIN",`[v=\\s]*${u[f.MAINVERSIONLOOSE]}${u[f.PRERELEASELOOSE]}?${u[f.BUILD]}?`);w("LOOSE",`^${u[f.LOOSEPLAIN]}$`);w("GTLT","((?:<|>)?=?)");w("XRANGEIDENTIFIERLOOSE",`${u[f.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);w("XRANGEIDENTIFIER",`${u[f.NUMERICIDENTIFIER]}|x|X|\\*`);w("XRANGEPLAIN",`[v=\\s]*(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:${u[f.PRERELEASE]})?${u[f.BUILD]}?)?)?`);w("XRANGEPLAINLOOSE",`[v=\\s]*(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:${u[f.PRERELEASELOOSE]})?${u[f.BUILD]}?)?)?`);w("XRANGE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAIN]}$`);w("XRANGELOOSE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAINLOOSE]}$`);w("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Oe}})(?:\\.(\\d{1,${Oe}}))?(?:\\.(\\d{1,${Oe}}))?`);w("COERCE",`${u[f.COERCEPLAIN]}(?:$|[^\\d])`);w("COERCEFULL",u[f.COERCEPLAIN]+`(?:${u[f.PRERELEASE]})?(?:${u[f.BUILD]})?(?:$|[^\\d])`);w("COERCERTL",u[f.COERCE],!0);w("COERCERTLFULL",u[f.COERCEFULL],!0);w("LONETILDE","(?:~>?)");w("TILDETRIM",`(\\s*)${u[f.LONETILDE]}\\s+`,!0);N.tildeTrimReplace="$1~";w("TILDE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAIN]}$`);w("TILDELOOSE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAINLOOSE]}$`);w("LONECARET","(?:\\^)");w("CARETTRIM",`(\\s*)${u[f.LONECARET]}\\s+`,!0);N.caretTrimReplace="$1^";w("CARET",`^${u[f.LONECARET]}${u[f.XRANGEPLAIN]}$`);w("CARETLOOSE",`^${u[f.LONECARET]}${u[f.XRANGEPLAINLOOSE]}$`);w("COMPARATORLOOSE",`^${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]})$|^$`);w("COMPARATOR",`^${u[f.GTLT]}\\s*(${u[f.FULLPLAIN]})$|^$`);w("COMPARATORTRIM",`(\\s*)${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]}|${u[f.XRANGEPLAIN]})`,!0);N.comparatorTrimReplace="$1$2$3";w("HYPHENRANGE",`^\\s*(${u[f.XRANGEPLAIN]})\\s+-\\s+(${u[f.XRANGEPLAIN]})\\s*$`);w("HYPHENRANGELOOSE",`^\\s*(${u[f.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[f.XRANGEPLAINLOOSE]})\\s*$`);w("STAR","(<|>)?=?\\s*\\*");w("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");w("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Q=m((Wa,Et)=>{"use strict";var ts=Object.freeze({loose:!0}),rs=Object.freeze({}),ns=e=>e?typeof e!="object"?ts:e:rs;Et.exports=ns});var xe=m((Ya,yt)=>{"use strict";var gt=/^[0-9]+$/,$t=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e$t(t,e);yt.exports={compareIdentifiers:$t,rcompareIdentifiers:ss}});var y=m((Ja,Ot)=>{"use strict";var ee=G(),{MAX_LENGTH:Rt,MAX_SAFE_INTEGER:te}=F(),{safeRe:re,t:ne}=U(),os=Q(),{compareIdentifiers:ve}=xe(),be=class e{constructor(t,r){if(r=os(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Rt)throw new TypeError(`version is longer than ${Rt} characters`);ee("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?re[ne.LOOSE]:re[ne.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>te||this.major<0)throw new TypeError("Invalid major version");if(this.minor>te||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>te||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let o=+s;if(o>=0&&ot.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(ee("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ve(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(ee("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ve(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?re[ne.PRERELEASELOOSE]:re[ne.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let o=[r,s];n===!1&&(o=[r]),ve(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Ot.exports=be});var A=m((Za,xt)=>{"use strict";var It=y(),is=(e,t,r=!1)=>{if(e instanceof It)return e;try{return new It(e,t)}catch(n){if(!r)return null;throw n}};xt.exports=is});var bt=m((Ka,vt)=>{"use strict";var as=A(),cs=(e,t)=>{let r=as(e,t);return r?r.version:null};vt.exports=cs});var kt=m((Qa,St)=>{"use strict";var ls=A(),us=(e,t)=>{let r=ls(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};St.exports=us});var Tt=m((ec,Nt)=>{"use strict";var Lt=y(),fs=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new Lt(e instanceof Lt?e.version:e,r).inc(t,n,s).version}catch{return null}};Nt.exports=fs});var qt=m((tc,Pt)=>{"use strict";var At=A(),ps=(e,t)=>{let r=At(e,null,!0),n=At(t,null,!0),s=r.compare(n);if(s===0)return null;let o=s>0,i=o?r:n,a=o?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0)return a.minor&&!a.patch?"minor":"patch"}let h=c?"pre":"";return r.major!==n.major?h+"major":r.minor!==n.minor?h+"minor":r.patch!==n.patch?h+"patch":"prerelease"};Pt.exports=ps});var Ct=m((rc,jt)=>{"use strict";var hs=y(),ds=(e,t)=>new hs(e,t).major;jt.exports=ds});var Ut=m((nc,Dt)=>{"use strict";var ms=y(),ws=(e,t)=>new ms(e,t).minor;Dt.exports=ws});var Ft=m((sc,zt)=>{"use strict";var Es=y(),gs=(e,t)=>new Es(e,t).patch;zt.exports=gs});var Mt=m((oc,Gt)=>{"use strict";var $s=A(),ys=(e,t)=>{let r=$s(e,t);return r&&r.prerelease.length?r.prerelease:null};Gt.exports=ys});var x=m((ic,Vt)=>{"use strict";var Xt=y(),Rs=(e,t,r)=>new Xt(e,r).compare(new Xt(t,r));Vt.exports=Rs});var _t=m((ac,Bt)=>{"use strict";var Os=x(),Is=(e,t,r)=>Os(t,e,r);Bt.exports=Is});var Wt=m((cc,Ht)=>{"use strict";var xs=x(),vs=(e,t)=>xs(e,t,!0);Ht.exports=vs});var se=m((lc,Jt)=>{"use strict";var Yt=y(),bs=(e,t,r)=>{let n=new Yt(e,r),s=new Yt(t,r);return n.compare(s)||n.compareBuild(s)};Jt.exports=bs});var Kt=m((uc,Zt)=>{"use strict";var Ss=se(),ks=(e,t)=>e.sort((r,n)=>Ss(r,n,t));Zt.exports=ks});var er=m((fc,Qt)=>{"use strict";var Ls=se(),Ns=(e,t)=>e.sort((r,n)=>Ls(n,r,t));Qt.exports=Ns});var M=m((pc,tr)=>{"use strict";var Ts=x(),As=(e,t,r)=>Ts(e,t,r)>0;tr.exports=As});var oe=m((hc,rr)=>{"use strict";var Ps=x(),qs=(e,t,r)=>Ps(e,t,r)<0;rr.exports=qs});var Se=m((dc,nr)=>{"use strict";var js=x(),Cs=(e,t,r)=>js(e,t,r)===0;nr.exports=Cs});var ke=m((mc,sr)=>{"use strict";var Ds=x(),Us=(e,t,r)=>Ds(e,t,r)!==0;sr.exports=Us});var ie=m((wc,or)=>{"use strict";var zs=x(),Fs=(e,t,r)=>zs(e,t,r)>=0;or.exports=Fs});var ae=m((Ec,ir)=>{"use strict";var Gs=x(),Ms=(e,t,r)=>Gs(e,t,r)<=0;ir.exports=Ms});var Le=m((gc,ar)=>{"use strict";var Xs=Se(),Vs=ke(),Bs=M(),_s=ie(),Hs=oe(),Ws=ae(),Ys=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Xs(e,r,n);case"!=":return Vs(e,r,n);case">":return Bs(e,r,n);case">=":return _s(e,r,n);case"<":return Hs(e,r,n);case"<=":return Ws(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};ar.exports=Ys});var lr=m(($c,cr)=>{"use strict";var Js=y(),Zs=A(),{safeRe:ce,t:le}=U(),Ks=(e,t)=>{if(e instanceof Js)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?ce[le.COERCEFULL]:ce[le.COERCE]);else{let c=t.includePrerelease?ce[le.COERCERTLFULL]:ce[le.COERCERTL],l;for(;(l=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||l.index+l[0].length!==r.index+r[0].length)&&(r=l),c.lastIndex=l.index+l[1].length+l[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",o=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Zs(`${n}.${s}.${o}${i}${a}`,t)};cr.exports=Ks});var fr=m((yc,ur)=>{"use strict";var Ne=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};ur.exports=Ne});var v=m((Rc,mr)=>{"use strict";var Qs=/\s+/g,Te=class e{constructor(t,r){if(r=to(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Ae)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(Qs," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!hr(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&co(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&io)|(this.options.loose&&ao))+":"+t,s=pr.get(n);if(s)return s;let o=this.options.loose,i=o?O[R.HYPHENRANGELOOSE]:O[R.HYPHENRANGE];t=t.replace(i,$o(this.options.includePrerelease)),g("hyphen replace",t),t=t.replace(O[R.COMPARATORTRIM],no),g("comparator trim",t),t=t.replace(O[R.TILDETRIM],so),g("tilde trim",t),t=t.replace(O[R.CARETTRIM],oo),g("caret trim",t);let a=t.split(" ").map(p=>lo(p,this.options)).join(" ").split(/\s+/).map(p=>go(p,this.options));o&&(a=a.filter(p=>(g("loose invalid filter",p,this.options),!!p.match(O[R.COMPARATORLOOSE])))),g("range list",a);let c=new Map,l=a.map(p=>new Ae(p,this.options));for(let p of l){if(hr(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let h=[...c.values()];return pr.set(n,h),h}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>dr(n,r)&&t.set.some(s=>dr(s,r)&&n.every(o=>s.every(i=>o.intersects(i,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new ro(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",co=e=>e.value==="",dr=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(o=>s.intersects(o,t)),s=n.pop();return r},lo=(e,t)=>(e=e.replace(O[R.BUILD],""),g("comp",e,t),e=po(e,t),g("caret",e),e=uo(e,t),g("tildes",e),e=mo(e,t),g("xrange",e),e=Eo(e,t),g("stars",e),e),I=e=>!e||e.toLowerCase()==="x"||e==="*",uo=(e,t)=>e.trim().split(/\s+/).map(r=>fo(r,t)).join(" "),fo=(e,t)=>{let r=t.loose?O[R.TILDELOOSE]:O[R.TILDE];return e.replace(r,(n,s,o,i,a)=>{g("tilde",e,n,s,o,i,a);let c;return I(s)?c="":I(o)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:I(i)?c=`>=${s}.${o}.0 <${s}.${+o+1}.0-0`:a?(g("replaceTilde pr",a),c=`>=${s}.${o}.${i}-${a} <${s}.${+o+1}.0-0`):c=`>=${s}.${o}.${i} <${s}.${+o+1}.0-0`,g("tilde return",c),c})},po=(e,t)=>e.trim().split(/\s+/).map(r=>ho(r,t)).join(" "),ho=(e,t)=>{g("caret",e,t);let r=t.loose?O[R.CARETLOOSE]:O[R.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,o,i,a,c)=>{g("caret",e,s,o,i,a,c);let l;return I(o)?l="":I(i)?l=`>=${o}.0.0${n} <${+o+1}.0.0-0`:I(a)?o==="0"?l=`>=${o}.${i}.0${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.0${n} <${+o+1}.0.0-0`:c?(g("replaceCaret pr",c),o==="0"?i==="0"?l=`>=${o}.${i}.${a}-${c} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}-${c} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a}-${c} <${+o+1}.0.0-0`):(g("no pr"),o==="0"?i==="0"?l=`>=${o}.${i}.${a}${n} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a} <${+o+1}.0.0-0`),g("caret return",l),l})},mo=(e,t)=>(g("replaceXRanges",e,t),e.split(/\s+/).map(r=>wo(r,t)).join(" ")),wo=(e,t)=>{e=e.trim();let r=t.loose?O[R.XRANGELOOSE]:O[R.XRANGE];return e.replace(r,(n,s,o,i,a,c)=>{g("xRange",e,n,s,o,i,a,c);let l=I(o),h=l||I(i),p=h||I(a),E=p;return s==="="&&E&&(s=""),c=t.includePrerelease?"-0":"",l?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&E?(h&&(i=0),a=0,s===">"?(s=">=",h?(o=+o+1,i=0,a=0):(i=+i+1,a=0)):s==="<="&&(s="<",h?o=+o+1:i=+i+1),s==="<"&&(c="-0"),n=`${s+o}.${i}.${a}${c}`):h?n=`>=${o}.0.0${c} <${+o+1}.0.0-0`:p&&(n=`>=${o}.${i}.0${c} <${o}.${+i+1}.0-0`),g("xRange return",n),n})},Eo=(e,t)=>(g("replaceStars",e,t),e.trim().replace(O[R.STAR],"")),go=(e,t)=>(g("replaceGTE0",e,t),e.trim().replace(O[t.includePrerelease?R.GTE0PRE:R.GTE0],"")),$o=e=>(t,r,n,s,o,i,a,c,l,h,p,E)=>(I(n)?r="":I(s)?r=`>=${n}.0.0${e?"-0":""}`:I(o)?r=`>=${n}.${s}.0${e?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,I(l)?c="":I(h)?c=`<${+l+1}.0.0-0`:I(p)?c=`<${l}.${+h+1}.0-0`:E?c=`<=${l}.${h}.${p}-${E}`:e?c=`<${l}.${h}.${+p+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),yo=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var X=m((Oc,Rr)=>{"use strict";var V=Symbol("SemVer ANY"),je=class e{static get ANY(){return V}constructor(t,r){if(r=wr(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),qe("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===V?this.value="":this.value=this.operator+this.semver.version,qe("comp",this)}parse(t){let r=this.options.loose?Er[gr.COMPARATORLOOSE]:Er[gr.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new $r(n[2],this.options.loose):this.semver=V}toString(){return this.value}test(t){if(qe("Comparator.test",t,this.options.loose),this.semver===V||t===V)return!0;if(typeof t=="string")try{t=new $r(t,this.options)}catch{return!1}return Pe(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new yr(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new yr(this.value,r).test(t.semver):(r=wr(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||Pe(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||Pe(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Rr.exports=je;var wr=Q(),{safeRe:Er,t:gr}=U(),Pe=Le(),qe=G(),$r=y(),yr=v()});var B=m((Ic,Or)=>{"use strict";var Ro=v(),Oo=(e,t,r)=>{try{t=new Ro(t,r)}catch{return!1}return t.test(e)};Or.exports=Oo});var xr=m((xc,Ir)=>{"use strict";var Io=v(),xo=(e,t)=>new Io(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Ir.exports=xo});var br=m((vc,vr)=>{"use strict";var vo=y(),bo=v(),So=(e,t,r)=>{let n=null,s=null,o=null;try{o=new bo(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===-1)&&(n=i,s=new vo(n,r))}),n};vr.exports=So});var kr=m((bc,Sr)=>{"use strict";var ko=y(),Lo=v(),No=(e,t,r)=>{let n=null,s=null,o=null;try{o=new Lo(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===1)&&(n=i,s=new ko(n,r))}),n};Sr.exports=No});var Tr=m((Sc,Nr)=>{"use strict";var Ce=y(),To=v(),Lr=M(),Ao=(e,t)=>{e=new To(e,t);let r=new Ce("0.0.0");if(e.test(r)||(r=new Ce("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let a=new Ce(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||Lr(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||Lr(r,o))&&(r=o)}return r&&e.test(r)?r:null};Nr.exports=Ao});var Pr=m((kc,Ar)=>{"use strict";var Po=v(),qo=(e,t)=>{try{return new Po(e,t).range||"*"}catch{return null}};Ar.exports=qo});var ue=m((Lc,Dr)=>{"use strict";var jo=y(),Cr=X(),{ANY:Co}=Cr,Do=v(),Uo=B(),qr=M(),jr=oe(),zo=ae(),Fo=ie(),Go=(e,t,r,n)=>{e=new jo(e,n),t=new Do(t,n);let s,o,i,a,c;switch(r){case">":s=qr,o=zo,i=jr,a=">",c=">=";break;case"<":s=jr,o=Fo,i=qr,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Uo(e,t,n))return!1;for(let l=0;l{d.semver===Co&&(d=new Cr(">=0.0.0")),p=p||d,E=E||d,s(d.semver,p.semver,n)?p=d:i(d.semver,E.semver,n)&&(E=d)}),p.operator===a||p.operator===c||(!E.operator||E.operator===a)&&o(e,E.semver))return!1;if(E.operator===c&&i(e,E.semver))return!1}return!0};Dr.exports=Go});var zr=m((Nc,Ur)=>{"use strict";var Mo=ue(),Xo=(e,t,r)=>Mo(e,t,">",r);Ur.exports=Xo});var Gr=m((Tc,Fr)=>{"use strict";var Vo=ue(),Bo=(e,t,r)=>Vo(e,t,"<",r);Fr.exports=Bo});var Vr=m((Ac,Xr)=>{"use strict";var Mr=v(),_o=(e,t,r)=>(e=new Mr(e,r),t=new Mr(t,r),e.intersects(t,r));Xr.exports=_o});var _r=m((Pc,Br)=>{"use strict";var Ho=B(),Wo=x();Br.exports=(e,t,r)=>{let n=[],s=null,o=null,i=e.sort((h,p)=>Wo(h,p,r));for(let h of i)Ho(h,t,r)?(o=h,s||(s=h)):(o&&n.push([s,o]),o=null,s=null);s&&n.push([s,null]);let a=[];for(let[h,p]of n)h===p?a.push(h):!p&&h===i[0]?a.push("*"):p?h===i[0]?a.push(`<=${p}`):a.push(`${h} - ${p}`):a.push(`>=${h}`);let c=a.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return c.length{"use strict";var Hr=v(),Ue=X(),{ANY:De}=Ue,_=B(),ze=x(),Yo=(e,t,r={})=>{if(e===t)return!0;e=new Hr(e,r),t=new Hr(t,r);let n=!1;e:for(let s of e.set){for(let o of t.set){let i=Zo(s,o,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},Jo=[new Ue(">=0.0.0-0")],Wr=[new Ue(">=0.0.0")],Zo=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===De){if(t.length===1&&t[0].semver===De)return!0;r.includePrerelease?e=Jo:e=Wr}if(t.length===1&&t[0].semver===De){if(r.includePrerelease)return!0;t=Wr}let n=new Set,s,o;for(let d of e)d.operator===">"||d.operator===">="?s=Yr(s,d,r):d.operator==="<"||d.operator==="<="?o=Jr(o,d,r):n.add(d.semver);if(n.size>1)return null;let i;if(s&&o){if(i=ze(s.semver,o.semver,r),i>0)return null;if(i===0&&(s.operator!==">="||o.operator!=="<="))return null}for(let d of n){if(s&&!_(d,String(s),r)||o&&!_(d,String(o),r))return null;for(let C of t)if(!_(d,String(C),r))return!1;return!0}let a,c,l,h,p=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,E=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;p&&p.prerelease.length===1&&o.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let d of t){if(h=h||d.operator===">"||d.operator===">=",l=l||d.operator==="<"||d.operator==="<=",s){if(E&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===E.major&&d.semver.minor===E.minor&&d.semver.patch===E.patch&&(E=!1),d.operator===">"||d.operator===">="){if(a=Yr(s,d,r),a===d&&a!==s)return!1}else if(s.operator===">="&&!_(s.semver,String(d),r))return!1}if(o){if(p&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===p.major&&d.semver.minor===p.minor&&d.semver.patch===p.patch&&(p=!1),d.operator==="<"||d.operator==="<="){if(c=Jr(o,d,r),c===d&&c!==o)return!1}else if(o.operator==="<="&&!_(o.semver,String(d),r))return!1}if(!d.operator&&(o||s)&&i!==0)return!1}return!(s&&l&&!o&&i!==0||o&&h&&!s&&i!==0||E||p)},Yr=(e,t,r)=>{if(!e)return t;let n=ze(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},Jr=(e,t,r)=>{if(!e)return t;let n=ze(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};Zr.exports=Yo});var P=m((jc,tn)=>{"use strict";var Fe=U(),Qr=F(),Ko=y(),en=xe(),Qo=A(),ei=bt(),ti=kt(),ri=Tt(),ni=qt(),si=Ct(),oi=Ut(),ii=Ft(),ai=Mt(),ci=x(),li=_t(),ui=Wt(),fi=se(),pi=Kt(),hi=er(),di=M(),mi=oe(),wi=Se(),Ei=ke(),gi=ie(),$i=ae(),yi=Le(),Ri=lr(),Oi=X(),Ii=v(),xi=B(),vi=xr(),bi=br(),Si=kr(),ki=Tr(),Li=Pr(),Ni=ue(),Ti=zr(),Ai=Gr(),Pi=Vr(),qi=_r(),ji=Kr();tn.exports={parse:Qo,valid:ei,clean:ti,inc:ri,diff:ni,major:si,minor:oi,patch:ii,prerelease:ai,compare:ci,rcompare:li,compareLoose:ui,compareBuild:fi,sort:pi,rsort:hi,gt:di,lt:mi,eq:wi,neq:Ei,gte:gi,lte:$i,cmp:yi,coerce:Ri,Comparator:Oi,Range:Ii,satisfies:xi,toComparators:vi,maxSatisfying:bi,minSatisfying:Si,minVersion:ki,validRange:Li,outside:Ni,gtr:Ti,ltr:Ai,intersects:Pi,simplifyRange:qi,subset:ji,SemVer:Ko,re:Fe.re,src:Fe.src,tokens:Fe.t,SEMVER_SPEC_VERSION:Qr.SEMVER_SPEC_VERSION,RELEASE_TYPES:Qr.RELEASE_TYPES,compareIdentifiers:en.compareIdentifiers,rcompareIdentifiers:en.rcompareIdentifiers}});var Re=new TextDecoder;function K(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function ut(e,t){let r=String(t??"").split(/\s+/).filter(o=>o.startsWith("sha512-")).map(o=>o.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,o=>String.fromCharCode(o)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function ft(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let o=await r.read();!o.done;o=await r.read()){if(s+=o.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(o.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function z(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return Re.decode(s<0?n:n.subarray(0,s))}function pt(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,o)=>s*256+o,e[t]&127);let n=z(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function jn(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if(pt(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function Cn(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let o=Re.decode(e.subarray(n+1,r+s-1)),i=o.indexOf("=");t[o.slice(0,i)]=o.slice(i+1),r+=s}return t}function Dn(e,t){let r=e.subarray(t,t+512);jn(r);let n=pt(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function Un(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function zn(e){let t=z(e,0,100),r=z(e,257,5)==="ustar"?z(e,345,155):"";return r?`${r}/${t}`:t}var lt={x:(e,t)=>({...e,pax:Cn(t).path}),L:(e,t)=>({...e,long:z(t,0,t.length)}),g:e=>e};function ht(e){let t=[],r={};for(let n=0;!Un(e,n);){let{header:s,type:o,data:i,next:a}=Dn(e,n);if(n=a,Object.hasOwn(lt,o)){r=lt[o](r,i);continue}(o==="0"||o==="7")&&t.push({path:r.pax??r.long??zn(s),bytes:i}),r={}}return t}var pe=D(P(),1);var b=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function fe(e,t){let r=[],n=0;for(;;){let s=await b(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function Ge(e,{id:t,path:r,bytes:n},s){for(let o=0;o{}),a}}async function Ci(e,t){let r=[],n=0;for(;;){let{done:s,value:o}=await e.read();if(s)return r;if(n+=o.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(o)}}async function Di(e,t){try{return await Ci(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function rn(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await Di(e.body.getReader(),t)).arrayBuffer())}var Ui=/[\\\0:*?"<>|]/,zi=e=>e.split("/").some(t=>!t||t==="."||t==="..");function Fi(e){return typeof e!="string"||!e||Ui.test(e)?!0:zi(e)}function q(e){if(Fi(e))throw new Error(`Unsafe package path: ${e}`);return e}var Gi=new TextDecoder,Mi=["preinstall","install","postinstall"];async function nn(e){let t=new Map;for(let r of ht(await ft(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=q(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var Xi=e=>Mi.some(t=>e.scripts?.[t]),Vi=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function Bi(e,t){return Xi(e)||e.gypfile?!0:Vi(t)}function sn(e,t,r){let n=JSON.parse(Gi.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(Bi(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}var Me=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),he=(e,t)=>`${e.replace("/","+")}@${t}`,Xe=(e,t,r)=>`${he(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function _i(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function Hi(e,t){let r=e["dist-tags"]?.[t];return r||(pe.default.valid(t)?t:pe.default.maxSatisfying(Object.keys(e.versions??{}),t))}function Wi(e,t,r){let n=r||"latest",s=Hi(e,n),o=e.versions?.[s];if(!o||!pe.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:o}}async function Yi(e,t,r,{fetchImpl:n,signal:s}){let o=new URL(t.dist?.tarball,r);if(o.protocol!=="https:"&&o.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let i=await n(o,{signal:s});if(!i.ok)throw new Error(`Package download for ${e}: HTTP ${i.status}`);let a=await rn(i);return{bytes:a,integrity:await ut(a,t.dist.integrity)}}function Ve(e){let t=new URL(e,globalThis.location?.href);if(t.protocol!=="https:"&&t.origin!==globalThis.location?.origin)throw new Error(`The npm registry must use HTTPS or the application origin: ${e}`);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function j(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!Me(e))throw new Error(`Unsupported npm package name: ${e}`);let o=Ve(r),i={fetchImpl:n,signal:s},{version:a,manifest:c}=Wi(await _i(e,o,i),e,t),{bytes:l,integrity:h}=await Yi(e,c,o,i),p=await nn(l),E=sn(p,e,a);return{id:he(e,a),key:Xe(e,a,h),manifest:E,integrity:h,files:p}}var de=D(P(),1);function Ji(e,t,r){let n=e?.roots?.[t];return n?.requested===r&&e.packages[n.id]?e.packages[n.id]:de.default.validRange(r)?Object.values(e?.packages??{}).filter(o=>o.name===t&&de.default.satisfies(o.version,r)).sort((o,i)=>de.default.rcompare(o.version,i.version))[0]??null:null}function on({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=j,previous:s}){let o=new Map;return async(i,a)=>{let c=`${i}@${a}`;if(o.has(c))return o.get(c);let l=Ji(s,i,a),h=await n(i,l?.version??a,{registry:e,fetchImpl:t,signal:r});if(l&&h.integrity!==l.integrity)throw new Error(`${h.id} no longer matches the integrity recorded in the lock`);return o.set(c,h),h}}var an=D(P(),1),cn=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function Zi(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw cn(e,t,r)}function Ki(e,[t,r],{nodes:n,roots:s}){let o=s[t]?.id??e.dependencies[t];if(!o)return Zi(e,t,r);if(!an.default.satisfies(n[o].version,r))throw cn(e,t,r);return o}function Qi(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=Ki(e,r,t);n&&(e.dependencies[r[0]]=n)}}function ln(e,t){for(let r of Object.values(e))Qi(r,{nodes:e,roots:t})}var un=D(P(),1);function ea(e,t){return!Me(t.name)||!un.default.valid(t.version)?!1:e===he(t.name,t.version)}function ta(e){return e.integrity?.startsWith("sha512-")?e.key===Xe(e.name,e.version,e.integrity):!1}function ra(e,t,r){if(!ea(t,r)||!ta(r))throw new Error("Invalid locked package");for(let n of r.files)q(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function na(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function Be(e){if(!na(e))throw new Error("Unsupported package lock");if(Object.keys(e.packages).length>512)throw new Error("The package lock exceeds 512 packages");for(let[t,r]of Object.entries(e.packages))ra(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function sa(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function oa(e,t){let r={};for(let n of e){let{name:s,version:o}=K(n);r[s]={requested:o||"latest",id:await t(s,o||"latest")}}return r}async function fn(e,t={}){let r=on(t),n={nodes:{},downloads:new Map,total:0},s=async(i,a)=>{t.signal?.throwIfAborted();let c=await r(i,a);if(n.nodes[c.id])return c.id;sa(n,i,c);for(let[l,h]of Object.entries(c.manifest.dependencies??{}).sort())n.nodes[c.id].dependencies[l]=await s(l,h);return c.id},o=await oa(e,s);return ln(n.nodes,o),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:o,packages:n.nodes},downloads:n.downloads}}function W(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var S="webfront.project.json",Y=1,_e=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,ia=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,aa=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,pn=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,He=/^[A-Za-z_][A-Za-z0-9_]*$/,hn=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],ca=["files","publish","fetch"],$=e=>{throw new Error(`${S}: ${e}`)};function T(e,t){return W(e)||$(`${t} must be an object`),e}function We(e,t,r){for(let n of Object.keys(e))t.includes(n)||$(`unknown key "${n}" in ${r}`)}function me(e,t){typeof e!="string"&&$(`${t} must be a project path`);try{return q(e)}catch{return $(`${t} is not a safe project-relative path: ${e}`)}}function dn(e,t){return(!Array.isArray(e)||e.length>256)&&$(`${t} must be an array of at most 256 paths`),e.map((r,n)=>me(r,`${t}[${n}]`))}function la(e){let t=T(e,"dependencies");for(let[r,n]of Object.entries(t))_e.test(r)||$(`invalid npm package name "${r}"`),(typeof n!="string"||!aa.test(n)||n!==n.trim())&&$(`invalid version range for "${r}"`);return t}function ua(e){if(typeof e!="string"&&$("registry must be a URL"),e.startsWith("/")&&!e.startsWith("//"))return e;let t;try{t=new URL(e)}catch{return $("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&$("registry must use https"),e}function fa(e){let t=T(e,"scripts");for(let[r,n]of Object.entries(t))(!pn.test(r)||typeof n!="string"||!n||n.length>1024)&&$(`invalid script "${r}"`);return t}function pa(e){let t=T(e,"entries");for(let[r,n]of Object.entries(t))pn.test(r)||$(`invalid entry name "${r}"`),me(n,`entries.${r}`);return t}function ha(e,t){let r=T(e,"providers");for(let[n,s]of Object.entries(r))He.test(n)||$(`invalid provider name "${n}"`),T(s,`providers.${n}`),We(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&$(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||me(s.entry,`providers.${n}.entry`),me(s.output,`providers.${n}.output`).endsWith(".hpp")||$(`providers.${n}.output must be a .hpp file`);return r}function da(e){let t=T(e,"test");return We(t,["specs"],"test"),t.specs!==void 0&&dn(t.specs,"test.specs"),t}function ma(e,t){let r;try{r=new URL(e)}catch{return $(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&$(`${t} must be an https origin without a path`),e}function wa(e){let t=T(e,"permissions");for(let r of Object.keys(t))ca.includes(r)||$(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&dn(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&$("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>ma(r,`permissions.fetch[${n}]`))),t}function Ea(e){(typeof e.name!="string"||!_e.test(e.name))&&$("name must be a lower-case npm package name"),(typeof e.version!="string"||!ia.test(e.version))&&$("version must be a semantic version")}function ga(e){e.format!==Y&&(Number.isInteger(e.format)&&e.format>Y&&$(`format ${e.format} is not supported by this environment (it reads format ${Y}); update the environment`),$(`format must be ${Y}`))}function J(e){T(e,"the manifest"),ga(e),We(e,hn,"the manifest"),Ea(e);let t=e.entries===void 0?{}:pa(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:la(e.dependencies),entries:t,providers:e.providers===void 0?{}:ha(e.providers,t),...e.registry===void 0?{}:{registry:ua(e.registry)},...e.scripts===void 0?{}:{scripts:fa(e.scripts)},...e.test===void 0?{}:{test:da(e.test)},...e.permissions===void 0?{}:{permissions:wa(e.permissions)}}}function Ye(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return $("not valid JSON")}return{source:t,manifest:J(t)}}function ul(e){return Ye(e).manifest}function Je(e){let t={};for(let r of hn)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` +`}function mn(e){return{format:Y,name:e,version:"0.1.0",dependencies:{}}}function wn(e){let r=(String(e??"").split("/").filter(Boolean).pop()??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"");return _e.test(r)?r:"webfront-app"}async function we(e){let t=JSON.stringify(Object.entries(e).sort(([n],[s])=>ns?1:0)),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(r)].map(n=>n.toString(16).padStart(2,"0")).join("")}var Ze=D(P(),1);var k="webfront-packages.lock.json",Ke=".webfront/developer/packages",$a=new TextDecoder,ya=new TextEncoder,Ee="No webfront.project.json: run wf init",ge="The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again";async function En(e,t){try{return await fe(e,t)}catch(r){if(r.message.includes("Cannot read project file:"))return null;throw r}}function Ra(e,t,r){return t?r===t.requested?!0:Ze.default.validRange(r)!==null&&Ze.default.satisfies(e.packages[t.id].version,r):!1}function Oa(e,t){let r=Object.keys(t);return r.length===Object.keys(e.roots).length&&r.every(n=>Ra(e,e.roots[n],t[n]))}function Ia(e,t,r){return e?t?t.manifestDigest===void 0?Oa(t,e.dependencies)?"legacy":"desynchronized":t.manifestDigest===r?"consistent":"desynchronized":"unlocked":"no-manifest"}async function Z(e){let t=await b(e,"state",`${S} +${k}`),r=await En(e,S),n=await En(e,k),{source:s,manifest:o}=r?Ye(r):{source:null,manifest:null},i=n?Be(JSON.parse($a.decode(n))):null,a=o?await we(o.dependencies):null;return{manifest:o,source:s,lock:i,token:t,status:Ia(o,i,a),digest:a}}var $n=e=>e.status==="desynchronized"?`Warning: ${ge}.\r +`:"";async function yn(e,t,r,{signal:n}={}){let s=[];try{for(let[o,i]of t){n?.throwIfAborted();let a=await b(e,"begin",o,!1);s.push(a),await Ge(e,{id:a,path:"output",bytes:i},n)}n?.throwIfAborted(),await b(e,"commitGroup",s.join(` `),`${S} -${b}`,r.token)}catch(o){for(let i of s)await L(e,"abort",i).catch(()=>{});throw o}}function En(e,t,r){let n=e?.entries??{};if(t!==void 0)return Object.hasOwn(n,t)?n[t]:t;if(Object.hasOwn(n,"main"))return n.main;let s=Object.keys(n);if(s.length===1)return n[s[0]];throw new Error(`Usage: ${r} (declare entries.main in ${S} to omit the entry)`)}function hl(e,[t,r,n,...s]){if(t&&Object.hasOwn(e?.providers??{},t)&&r===void 0){let i=e.providers[t];return{entry:En(e,i.entry),output:i.output,className:t}}if(!t||r!=="--output"||s.length||!n?.endsWith(".hpp"))throw new Error("wf embed requires or --output ");let o=n.split("/").pop().slice(0,-4);if(!He.test(o))throw new Error(`wf embed: ${o} is not a C++ class name; name the output .hpp`);return{entry:En(e,t),output:n,className:o}}var ge=e=>ya.encode(e);var rt=j(A(),1);var yn=e=>`${Ke}/${e.key}`,Rn=e=>`${Ke}/${e.key}.json`,xa=new TextEncoder,va=new TextDecoder,On=e=>e.message.includes("Cannot read project file:");async function In(e){return[...new Uint8Array(await crypto.subtle.digest("SHA-256",e))].map(r=>r.toString(16).padStart(2,"0")).join("")}async function $e(e,t,r,{signal:n}={}){let s={};for(let i of[...r.keys()].sort())s[i]=await In(r.get(i));await B(e,yn(t),r,{signal:n});let o=JSON.stringify({format:1,integrity:t.integrity,files:s},null,2)+` -`;await B(e,Rn(t),new Map([["output",xa.encode(o)]]),{directory:!1,signal:n})}async function Sa(e,t){try{return JSON.parse(va.decode(await _(e,Rn(t))))}catch(r){return On(r)?null:{}}}var ba=(e,t)=>Object.keys(e.files).sort().join(` +${k}`,r.token)}catch(o){for(let i of s)await b(e,"abort",i).catch(()=>{});throw o}}function gn(e,t,r){let n=e?.entries??{};if(t!==void 0)return Object.hasOwn(n,t)?n[t]:t;if(Object.hasOwn(n,"main"))return n.main;let s=Object.keys(n);if(s.length===1)return n[s[0]];throw new Error(`Usage: ${r} (declare entries.main in ${S} to omit the entry)`)}function ml(e,[t,r,n,...s]){if(t&&Object.hasOwn(e?.providers??{},t)&&r===void 0){let i=e.providers[t];return{entry:gn(e,i.entry),output:i.output,className:t}}if(!t||r!=="--output"||s.length||!n?.endsWith(".hpp"))throw new Error("wf embed requires or --output ");let o=n.split("/").pop().slice(0,-4);if(!He.test(o))throw new Error(`wf embed: ${o} is not a C++ class name; name the output .hpp`);return{entry:gn(e,t),output:n,className:o}}var $e=e=>ya.encode(e);var nt=D(P(),1);var Rn=e=>`${Ke}/${e.key}`,On=e=>`${Ke}/${e.key}.json`,va=new TextEncoder,ba=new TextDecoder,In=e=>e.message.includes("Cannot read project file:");async function xn(e){return[...new Uint8Array(await crypto.subtle.digest("SHA-256",e))].map(r=>r.toString(16).padStart(2,"0")).join("")}async function ye(e,t,r,{signal:n}={}){let s={};for(let i of[...r.keys()].sort())s[i]=await xn(r.get(i));await H(e,Rn(t),r,{signal:n});let o=JSON.stringify({format:1,integrity:t.integrity,files:s},null,2)+` +`;await H(e,On(t),new Map([["output",va.encode(o)]]),{directory:!1,signal:n})}async function Sa(e,t){try{return JSON.parse(ba.decode(await fe(e,On(t))))}catch(r){return In(r)?null:{}}}var ka=(e,t)=>Object.keys(e.files).sort().join(` `)===[...t.files].sort().join(` -`);async function Na(e,t,r,n){try{return await In(await _(e,`${yn(t)}/${r}`))===n}catch(s){if(On(s))return!1;throw s}}async function xn(e,t,{signal:r}={}){let n=await Sa(e,t);if(!n)return"missing";if(n.integrity!==t.integrity||!H(n.files)||!ba(n,t))return"corrupted";for(let s of t.files)if(r?.throwIfAborted(),!await Na(e,t,s,n.files[s]))return"corrupted";return"valid"}var La="https://registry.npmjs.org/",ka=256*1024*1024;function Ta({registry:e,registryExplicit:t}={},r){return t&&e?{url:e,source:"application option"}:r?.registry?{url:r.registry,source:S}:{url:e||La,source:"default"}}function Qe(e,t){let r=Ta(e,t);return Ve(r.url),r}var et=({url:e,source:t})=>`Registry: ${e} (${t})`,Aa=e=>[...e.values()].reduce((t,r)=>t+r.length,0);async function Pa(e,[t,r],{registry:n,fetchImpl:s,signal:o}){let i=await q(r.name,r.version,{registry:n,fetchImpl:s,signal:o});if(i.integrity!==r.integrity)throw new Error(`${t} no longer matches the integrity recorded in the lock`);return await $e(e,r,i.files,{signal:o}),Aa(i.files)}async function tt(e,t,{registry:r,offline:n=!1,signal:s,progress:o=()=>{},fetchImpl:i=fetch}){let a={verified:0,restored:0,problems:[]},c=0;for(let l of Object.entries(t.packages)){s?.throwIfAborted();let p=await xn(e,l[1],{signal:s});if(p==="valid"){a.verified++;continue}if(n){a.problems.push(`${l[0]} (${p})`);continue}if(o(`Restoring ${l[0]}${p==="corrupted"?" (corrupted in the cache)":""}`),c+=await Pa(e,l,{registry:r,fetchImpl:i,signal:s}),c>ka)throw new Error("Restored packages exceed 256 MiB");a.restored++}if(a.problems.length)throw new Error(`The cache does not match ${b}; missing or corrupted, nothing downloaded:\r - ${a.problems.join(`\r +`);async function La(e,t,r){let n=[],s=0;for(;;){let o;try{o=await b(e,"read",t,s)}catch(i){if(In(i))return null;throw i}if(s+=o.length,s>r)return null;if(n.push(o),o.length<262144)return new Uint8Array(await new Blob(n).arrayBuffer())}}async function Qe(e,t,{signal:r,limit:n=1/0}={}){let s=await Sa(e,t);if(!s)return{state:"missing",size:0};if(s.integrity!==t.integrity||!W(s.files)||!ka(s,t))return{state:"corrupted",size:0};let o=0;for(let i of t.files){r?.throwIfAborted();let a=await La(e,`${Rn(t)}/${i}`,n-o);if(!a||await xn(a)!==s.files[i])return{state:"corrupted",size:0};o+=a.length}return{state:"valid",size:o}}var yl=async(e,t,r)=>(await Qe(e,t,r)).state;var Na="https://registry.npmjs.org/";function Ta({registry:e,registryExplicit:t}={},r){return t&&e?{url:e,source:"application option"}:r?.registry?{url:r.registry,source:S}:{url:e||Na,source:"default"}}function et(e,t){let r=Ta(e,t);return Ve(r.url),r}var tt=({url:e,source:t})=>`Registry: ${e} (${t})`,Aa=256*1024*1024,Pa=e=>[...e.values()].reduce((t,r)=>t+r.length,0),qa=e=>new Error(`The locked packages exceed ${e/(1024*1024)} MiB unpacked`);async function ja(e,t,{signal:r,limit:n}){let s=[],o=0;for(let[i,a]of Object.entries(t.packages)){r?.throwIfAborted();let c=await Qe(e,a,{signal:r,limit:n-o});o+=c.size,s.push({id:i,node:a,state:c.state})}return{states:s,size:o}}async function rt(e,t,{registry:r,offline:n=!1,signal:s,progress:o=()=>{},fetchImpl:i=fetch,limit:a=Aa}){let{states:c,size:l}=await ja(e,t,{signal:s,limit:a}),h=l,p={verified:c.filter(({state:E})=>E==="valid").length,restored:0,problems:[]};for(let{id:E,node:d,state:C}of c.filter(({state:L})=>L!=="valid")){if(n){p.problems.push(`${E} (${C})`);continue}o(`Restoring ${E}${C==="corrupted"?" (corrupted in the cache)":""}`);let L=await j(d.name,d.version,{registry:r,fetchImpl:i,signal:s});if(L.integrity!==d.integrity)throw new Error(`${E} no longer matches the integrity recorded in the lock`);if(h+=Pa(L.files),h>a)throw qa(a);await ye(e,d,L.files,{signal:s}),p.restored++}if(p.problems.length)throw new Error(`The cache does not match ${k}; missing or corrupted, nothing downloaded:\r + ${p.problems.join(`\r `)}\r -Run wf restore to download them.`);return a}function qa(e){let t=e.includes("--offline");if(e.some(r=>r!=="--offline"))throw new Error("Usage: wf restore [--offline]");return{offline:t}}async function Il(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}={}){let{offline:a}=qa(t),c=await J(e);if(!c.manifest)throw new Error(we);if(!c.lock)throw new Error(`No ${b}: run wf install to resolve the dependencies`);let l=a?null:Qe({registry:r,registryExplicit:n},c.manifest);o(a?"Offline: no registry is contacted":et(l));let p=await tt(e,c.lock,{registry:l?.url,offline:a,signal:s,progress:o,fetchImpl:i}),h=Object.keys(c.lock.packages).length,E=a?`Cache verified offline: ${h} packages match ${b}.`:`Restored ${p.restored} of ${h} packages (${p.verified} already in the cache). Lock: ${b}`;return{...p,registry:l,text:gn(c)+E}}var bn=e=>{let{name:t,version:r}=K(e);return[t,r||void 0]};function ja(e,t){let{version:r}=e.packages[t.id];return!(rt.default.valid(t.requested)!==null)&&t.requested!=="latest"&&rt.default.validRange(t.requested)!==null?t.requested:`^${r}`}async function Al(e,[t,...r],{signal:n}={}){if(r.length)throw new Error("Usage: wf init [name]");let{lock:s}=await J(e),o=dn(t??mn(""));s&&(o.dependencies=Object.fromEntries(Object.entries(s.roots).map(([a,c])=>[a,ja(s,c)]))),Y(o),await B(e,S,new Map([["output",ge(Je(o))]]),{directory:!1,replace:!1,signal:n});let i=s?` with the ${Object.keys(o.dependencies).length} dependencies of ${b}`:"";return`Created ${S}${i}. Add libraries with wf install .`}function Ca(e,t){let r={...e.manifest.dependencies},n=new Set;for(let s of t){let[o,i]=bn(s);r[o]=i??"latest",i&&i!=="latest"&&n.add(o)}return Y({...e.source,dependencies:r}),{dependencies:r,explicit:n}}function Da(e,t){let r={...e.source,dependencies:t};return Y(r),r}function Ua({dependencies:e,explicit:t},r,n){let s={...e};for(let o of n){let i=bn(o)[0];t.has(i)||(s[i]=`^${r.packages[r.roots[i].id].version}`)}return s}async function Fa(e,t,r){let n=Object.entries(e).map(([i,a])=>`${i}@${a}`),{lock:s,downloads:o}=await un(n,{registry:r.registry,signal:r.signal,fetchImpl:r.fetchImpl,previous:t,download:async(...i)=>(r.progress(`Resolving ${i[0]}@${i[1]}`),q(...i))});return{lock:s,downloads:o}}async function Ga(e,t,r,{signal:n,progress:s}){for(let[o,i]of r)s(`Storing ${o}`),await $e(e,t.packages[o],i,{signal:n})}function za(e){let t=e.includes("--update"),r=e.filter(n=>n!=="--update");if(r.some(n=>n.startsWith("-")))throw new Error("Usage: wf install [--update] [[@range] ...]");return{update:t,specs:r}}async function vn(e,t,{manifest:r,lock:n},s){let o=new Map([[b,ge(JSON.stringify(n,null,2)+` -`)]]);r&&o.set(S,ge(Je(r))),await $n(e,o,t,s)}var Sn=async(e,t)=>({format:e.format,manifestDigest:await me(t),...e});async function Pl(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}){let{update:a,specs:c}=za(t),l=await J(e);if(!l.manifest)throw new Error(we);let p=Qe({registry:r,registryExplicit:n},l.manifest),h={registry:p.url,signal:s,fetchImpl:i,progress:o};if(c.length&&a)throw new Error("Usage: wf install --update does not take packages");if(c.length&&l.status==="desynchronized")throw new Error(Ee);if(!c.length&&!a&&l.status==="desynchronized")throw new Error(Ee);o(et(p));let E=l.status==="consistent"||l.status==="legacy";if(!c.length&&!a&&E){let{restored:ot}=await tt(e,l.lock,h);if(l.status==="consistent")return{lock:l.lock,restored:ot,registry:p};let it=await Sn(l.lock,l.manifest.dependencies);return await vn(e,l,{manifest:null,lock:it},{signal:s}),{lock:it,restored:ot,registry:p}}let d=Ca(l,c),ye=E&&!a?l.lock:void 0,Z=await Fa(d.dependencies,ye,h),nt=Ua(d,Z.lock,c);await Ga(e,Z.lock,Z.downloads,{signal:s,progress:o});let st=await Sn(Z.lock,nt),Nn=c.length?Da(l,nt):null;return await vn(e,l,{manifest:Nn,lock:st},{signal:s}),{lock:st,restored:0,registry:p}}export{xn as cacheState,La as defaultRegistry,me as dependenciesDigest,et as describeRegistry,Ee as desynchronized,q as downloadPackage,Ta as effectiveRegistry,hl as embedTarget,ia as exactVersion,He as identifier,Al as initProject,Pl as install,J as loadProject,b as lockPath,Oa as locksDependencies,W as manifestFormat,mn as manifestName,S as manifestPath,dn as newManifest,we as noManifest,Be as npmName,yn as packageDirectory,Ke as packageRoot,cl as parseManifest,$n as publishTogether,Ye as readManifest,Rn as recordPath,En as resolveEntry,un as resolvePackages,Il as restore,tt as restorePackages,P as safePackagePath,Je as serializeManifest,$e as storePackage,gn as syncNotice,ge as textBytes,Qe as usableRegistry,_e as validateLock,Y as validateManifest}; +Run wf restore to download them.`);return p}function Ca(e){let t=e.includes("--offline");if(e.some(r=>r!=="--offline"))throw new Error("Usage: wf restore [--offline]");return{offline:t}}async function bl(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}={}){let{offline:a}=Ca(t),c=await Z(e);if(!c.manifest)throw new Error(Ee);if(!c.lock)throw new Error(`No ${k}: run wf install to resolve the dependencies`);let l=a?null:et({registry:r,registryExplicit:n},c.manifest);o(a?"Offline: no registry is contacted":tt(l));let h=await rt(e,c.lock,{registry:l?.url,offline:a,signal:s,progress:o,fetchImpl:i}),p=Object.keys(c.lock.packages).length,E=a?`Cache verified offline: ${p} packages match ${k}.`:`Restored ${h.restored} of ${p} packages (${h.verified} already in the cache). Lock: ${k}`;return{...h,registry:l,text:$n(c)+E}}var Sn=e=>{let{name:t,version:r}=K(e);return[t,r||void 0]};function Da(e,t){let{version:r}=e.packages[t.id];return!(nt.default.valid(t.requested)!==null)&&t.requested!=="latest"&&nt.default.validRange(t.requested)!==null?t.requested:`^${r}`}async function jl(e,[t,...r],{signal:n}={}){if(r.length)throw new Error("Usage: wf init [name]");let{lock:s}=await Z(e),o=mn(t??wn(""));s&&(o.dependencies=Object.fromEntries(Object.entries(s.roots).map(([a,c])=>[a,Da(s,c)]))),J(o),await H(e,S,new Map([["output",$e(Je(o))]]),{directory:!1,replace:!1,signal:n});let i=s?` with the ${Object.keys(o.dependencies).length} dependencies of ${k}`:"";return`Created ${S}${i}. Add libraries with wf install .`}function Ua(e,t){let r={...e.manifest.dependencies},n=new Set;for(let s of t){let[o,i]=Sn(s);r[o]=i??"latest",i&&i!=="latest"&&n.add(o)}return J({...e.source,dependencies:r}),{dependencies:r,explicit:n}}function za(e,t){let r={...e.source,dependencies:t};return J(r),r}function Fa({dependencies:e,explicit:t},r,n){let s={...e};for(let o of n){let i=Sn(o)[0];t.has(i)||(s[i]=`^${r.packages[r.roots[i].id].version}`)}return s}async function Ga(e,t,r){let n=Object.entries(e).map(([i,a])=>`${i}@${a}`),{lock:s,downloads:o}=await fn(n,{registry:r.registry,signal:r.signal,fetchImpl:r.fetchImpl,previous:t,download:async(...i)=>(r.progress(`Resolving ${i[0]}@${i[1]}`),j(...i))});return{lock:s,downloads:o}}async function Ma(e,t,r,{signal:n,progress:s}){for(let[o,i]of r)s(`Storing ${o}`),await ye(e,t.packages[o],i,{signal:n})}function Xa(e){let t=e.includes("--update"),r=e.filter(n=>n!=="--update");if(r.some(n=>n.startsWith("-")))throw new Error("Usage: wf install [--update] [[@range] ...]");return{update:t,specs:r}}async function vn(e,t,{manifest:r,lock:n},s){let o=new Map([[k,$e(JSON.stringify(n,null,2)+` +`)]]);r&&o.set(S,$e(Je(r))),await yn(e,o,t,s)}var bn=async(e,t)=>({format:e.format,manifestDigest:await we(t),...e});async function Cl(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}){let{update:a,specs:c}=Xa(t),l=await Z(e);if(!l.manifest)throw new Error(Ee);let h=et({registry:r,registryExplicit:n},l.manifest),p={registry:h.url,signal:s,fetchImpl:i,progress:o};if(c.length&&a)throw new Error("Usage: wf install --update does not take packages");if(c.length&&l.status==="desynchronized")throw new Error(ge);if(!c.length&&!a&&l.status==="desynchronized")throw new Error(ge);o(tt(h));let E=l.status==="consistent"||l.status==="legacy";if(!c.length&&!a&&E){let{restored:it}=await rt(e,l.lock,p);if(l.status==="consistent")return{lock:l.lock,restored:it,registry:h};let at=await bn(l.lock,l.manifest.dependencies);return await vn(e,l,{manifest:null,lock:at},{signal:s}),{lock:at,restored:it,registry:h}}let d=Ua(l,c),C=E&&!a?l.lock:void 0,L=await Ga(d.dependencies,C,p),st=Fa(d,L.lock,c);await Ma(e,L.lock,L.downloads,{signal:s,progress:o});let ot=await bn(L.lock,st),kn=c.length?za(l,st):null;return await vn(e,l,{manifest:kn,lock:ot},{signal:s}),{lock:ot,restored:0,registry:h}}export{yl as cacheState,Na as defaultRegistry,we as dependenciesDigest,tt as describeRegistry,ge as desynchronized,j as downloadPackage,Ta as effectiveRegistry,ml as embedTarget,ia as exactVersion,He as identifier,jl as initProject,Qe as inspectCache,Cl as install,Z as loadProject,k as lockPath,Oa as locksDependencies,Y as manifestFormat,wn as manifestName,S as manifestPath,mn as newManifest,Ee as noManifest,_e as npmName,Rn as packageDirectory,Ke as packageRoot,ul as parseManifest,yn as publishTogether,Ye as readManifest,On as recordPath,gn as resolveEntry,fn as resolvePackages,bl as restore,rt as restorePackages,q as safePackagePath,Je as serializeManifest,ye as storePackage,$n as syncNotice,$e as textBytes,Aa as unpackedLimit,et as usableRegistry,Be as validateLock,J as validateManifest}; diff --git a/js/developer/environment/restore.mjs b/js/developer/environment/restore.mjs index 09a1a1c2..111555d3 100644 --- a/js/developer/environment/restore.mjs +++ b/js/developer/environment/restore.mjs @@ -1,12 +1,10 @@ // wf restore: rebuilds the package cache from the lock alone, from one registry or, with --offline, from nothing. import {downloadPackage, registryBase} from './registry.mjs'; -import {cacheState, storePackage} from './cache.mjs'; +import {inspectCache, storePackage} from './cache.mjs'; import {loadProject, syncNotice, lockPath, noManifest} from './project.mjs'; import {manifestPath} from './manifest.mjs'; export const defaultRegistry = 'https://registry.npmjs.org/'; -const unpackedLimit = 256 * 1024 * 1024; - /** * The registry the commands use, and where it comes from: the application's explicit option (the distributor's * channel, which also lets a test impose its local registry), then the manifest's "registry", then the default. @@ -26,32 +24,43 @@ export function usableRegistry(options, manifest) { export const describeRegistry = ({url, source}) => `Registry: ${url} (${source})`; +export const unpackedLimit = 256 * 1024 * 1024; const unpackedSize = files => [...files.values()].reduce((total, bytes) => total + bytes.length, 0); +const tooLarge = limit => new Error(`The locked packages exceed ${limit / (1024 * 1024)} MiB unpacked`); -async function restorePackage(bridge, [id, node], {registry, fetchImpl, signal}) { - const pkg = await downloadPackage(node.name, node.version, {registry, fetchImpl, signal}); - if (pkg.integrity !== node.integrity) throw new Error(`${id} no longer matches the integrity recorded in the lock`); - await storePackage(bridge, node, pkg.files, {signal}); - return unpackedSize(pkg.files); +// Every package's cache state; the valid ones count towards the bound of the graph. +async function inspectAll(bridge, lock, {signal, limit}) { + const states = []; + let size = 0; + for (const [id, node] of Object.entries(lock.packages)) { + signal?.throwIfAborted(); + const inspected = await inspectCache(bridge, node, {signal, limit: limit - size}); + size += inspected.size; + states.push({id, node, state: inspected.state}); + } + return {states, size}; } /** * Brings the cache to the exact locked graph: each package is checked against its record and, when missing or * corrupted, downloaded at its locked version (no range is resolved again) and checked against the lock's SHA-512. - * Each package is published on its own, so an interruption or an error keeps every package already restored, and - * the lock is never written. Offline, nothing is downloaded: the packages that would be are listed in an error. + * The unpacked graph, cached packages included, is bounded by `limit`, checked before each publication, so a + * restore that is resumed keeps the bound. Each package is published on its own: an interruption or an error keeps + * every package already restored, and the lock is never written. Offline, nothing is downloaded: the packages that + * would be are listed in an error. */ -export async function restorePackages(bridge, lock, {registry, offline = false, signal, progress = () => {}, fetchImpl = fetch}) { - const result = {verified: 0, restored: 0, problems: []}; - let unpacked = 0; - for (const entry of Object.entries(lock.packages)) { - signal?.throwIfAborted(); - const state = await cacheState(bridge, entry[1], {signal}); - if (state === 'valid') { result.verified++; continue; } - if (offline) { result.problems.push(`${entry[0]} (${state})`); continue; } - progress(`Restoring ${entry[0]}${state === 'corrupted' ? ' (corrupted in the cache)' : ''}`); - unpacked += await restorePackage(bridge, entry, {registry, fetchImpl, signal}); - if (unpacked > unpackedLimit) throw new Error('Restored packages exceed 256 MiB'); +export async function restorePackages(bridge, lock, {registry, offline = false, signal, progress = () => {}, fetchImpl = fetch, limit = unpackedLimit}) { + const {states, size: cached} = await inspectAll(bridge, lock, {signal, limit}); + let size = cached; + const result = {verified: states.filter(({state}) => state === 'valid').length, restored: 0, problems: []}; + for (const {id, node, state} of states.filter(({state}) => state !== 'valid')) { + if (offline) { result.problems.push(`${id} (${state})`); continue; } + progress(`Restoring ${id}${state === 'corrupted' ? ' (corrupted in the cache)' : ''}`); + const pkg = await downloadPackage(node.name, node.version, {registry, fetchImpl, signal}); + if (pkg.integrity !== node.integrity) throw new Error(`${id} no longer matches the integrity recorded in the lock`); + size += unpackedSize(pkg.files); + if (size > limit) throw tooLarge(limit); + await storePackage(bridge, node, pkg.files, {signal}); result.restored++; } if (result.problems.length) diff --git a/js/developer/tools/restore-check.mjs b/js/developer/tools/restore-check.mjs index 6e2870aa..7ca4ca5d 100644 --- a/js/developer/tools/restore-check.mjs +++ b/js/developer/tools/restore-check.mjs @@ -2,7 +2,7 @@ // node:assert, they use only browser APIs, so that they can move to wf test. import {test, before} from 'node:test'; import assert from 'node:assert/strict'; -import {install, initProject, restore, effectiveRegistry, cacheState, validateLock, lockPath, manifestPath, packageRoot} from '../environment/packages.bundle.mjs'; +import {install, initProject, restore, restorePackages, effectiveRegistry, cacheState, validateLock, lockPath, manifestPath, packageRoot} from '../environment/packages.bundle.mjs'; import {syntheticPackages, registryFiles} from './registry-fixture.mjs'; import {memoryBridge} from './memory-bridge.mjs'; @@ -151,6 +151,43 @@ test('an interrupted restore keeps the packages already restored and resumes wit assert.equal(resumed.verified, 1); }); +// Unpacked sizes of the cached packages of a project, from the files the lock lists. +const sizeOf = (storage, node) => node.files.reduce((total, path) => total + storage.get(`${packageRoot}/${node.key}/${path}`).length, 0); + +test('the bound of the unpacked graph counts the cached packages and is checked before publishing', async () => { + const {bridge, storage} = await lockedProject(); + const lock = json(storage, lockPath); + const [app, lib] = ['webfront-fixture-app@1.0.0', 'webfront-fixture-lib@1.0.0'].map(id => lock.packages[id]); + const limit = sizeOf(storage, app) + sizeOf(storage, lib) - 1; + cacheKeys(storage).filter(key => key.includes('fixture-lib')).forEach(key => storage.delete(key)); + const before = snapshot(storage); + const source = served(registries.local); + for (let attempt = 0; attempt < 2; attempt++) { + await assert.rejects(restorePackages(bridge, lock, {...explicit(source), limit}), /exceed .* MiB unpacked/); + assert.deepEqual(storage, before, 'nothing is published past the bound, and a second attempt keeps it'); + } + const restored = await restorePackages(bridge, lock, {...explicit(source), limit: limit + 1}); + assert.equal(restored.restored, 1); +}); + +test('a cached file larger than the bound is a corruption, listed offline and repaired online', async () => { + const {bridge, storage} = await lockedProject(); + const lock = json(storage, lockPath); + const lib = lock.packages['webfront-fixture-lib@1.0.0']; + const limit = 64 * 1024; + storage.set(`${packageRoot}/${lib.key}/index.js`, new Uint8Array(3 * 256 * 1024)); + const reads = []; + const counting = {cppFunction: name => async (...args) => { + if (name.endsWith('.read')) reads.push(args[0]); + return bridge.cppFunction(name)(...args); + }}; + await assert.rejects(restorePackages(counting, lock, {offline: true, limit}), /webfront-fixture-lib@1\.0\.0 \(corrupted\)/); + assert.equal(reads.filter(path => path.endsWith(`${lib.key}/index.js`)).length, 1, 'reading stops at the bound'); + const restored = await restorePackages(bridge, lock, {...explicit(served(registries.local)), limit}); + assert.equal(restored.restored, 1); + assert.equal(await cacheState(bridge, lib), 'valid'); +}); + test('an invalid or absent lock is refused before any request or write', async () => { const {bridge, storage} = await lockedProject(); const source = served(registries.local); From 9331c09ce0a1dee92c9aab2968dea5023fb5d331 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 16:41:22 +0200 Subject: [PATCH 019/134] Keep registry paths on the application origin and report bridge failures on cache records [#306] - A same-origin registry path starting with // or containing a backslash is refused in C++, in the manifest and when it is resolved: on an HTTPS page, "/\\host" resolves to another HTTPS origin. - Only a malformed cache record makes a package corrupted; a bridge failure while reading it is reported instead of triggering a download. --- docs/DEVELOPER_ENVIRONMENT.md | 3 ++- include/webfront/DeveloperApp.hpp | 8 +++++-- js/developer/environment/bundles.json | 8 +++---- js/developer/environment/cache.mjs | 10 ++++++-- js/developer/environment/manifest.mjs | 5 +++- js/developer/environment/packages.bundle.mjs | 18 +++++++------- js/developer/environment/registry.mjs | 5 +++- js/developer/tools/manifest-check.mjs | 1 + js/developer/tools/restore-check.mjs | 25 +++++++++++++++++++- test/unit/DeveloperTests.cpp | 2 +- 10 files changed, 63 insertions(+), 22 deletions(-) diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 07037961..0b86db1a 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -230,7 +230,8 @@ The registry used by `wf install` and `wf restore` is, in order of precedence: Both commands print the registry in use and where it comes from, for example `Registry: /mirror/ (application option)`. A registry must use HTTPS or be a path on the application's own -origin, like the environment archive; tarballs must use HTTPS or the registry's origin. The lock's `registry` +origin, like the environment archive (a path starting with `//` or containing a backslash, which browsers read as +another host, is refused); tarballs must use HTTPS or the registry's origin. The lock's `registry` field records where the graph was resolved and is not used to restore it, so a mirror can serve a lock resolved from the public registry. diff --git a/include/webfront/DeveloperApp.hpp b/include/webfront/DeveloperApp.hpp index 3c7fbda7..3ba8f550 100644 --- a/include/webfront/DeveloperApp.hpp +++ b/include/webfront/DeveloperApp.hpp @@ -29,6 +29,11 @@ inline WebFrontConfig projectConfig(WebFrontConfig config, const std::filesystem return config; } +/// A path that stays on the application's origin: browsers read "//host" and "/\\host" as another host. +inline bool sameOriginPath(std::string_view path) { + return path.starts_with('/') && !path.starts_with("//") && !path.contains('\\'); +} + inline void validateBootstrap(std::string_view mode, const std::filesystem::path& project, const DeveloperBootstrapOptions& options) { if (mode != "developer") throw std::invalid_argument("Unknown bootstrap mode"); @@ -36,8 +41,7 @@ inline void validateBootstrap(std::string_view mode, const std::filesystem::path throw std::invalid_argument("Developer bootstrap requires an explicit project directory"); if (options.environment.empty() || !options.integrity.starts_with("sha512-")) throw std::invalid_argument("Developer bootstrap requires an environment URL and trusted SHA-512 integrity"); - if (options.registry && !options.registry->starts_with("https://") - && !(options.registry->starts_with('/') && !options.registry->starts_with("//"))) + if (options.registry && !options.registry->starts_with("https://") && !developer::sameOriginPath(*options.registry)) throw std::invalid_argument("The developer registry must be an HTTPS URL or a same-origin path"); } diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index a889bc79..04e21bf0 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -1,9 +1,9 @@ { - "js/developer/environment/manifest.mjs": "1cb0c70c87ca31ec81ad0591c0c1d1cb2637ecc491caef9c3d3ec8f1670ea900", + "js/developer/environment/manifest.mjs": "126f0f0e5d64ebb85191c70ff7b42c3c8f9abd5133b4e3e96acc29f089419e6c", "js/developer/environment/project.mjs": "525bc1545f6ff9a70c744c536e46c2404bdc20daa83b25b29419222161003c3b", "js/developer/environment/installer.mjs": "f3e919535847c93f62498ee0ad3fec49ff5f7531fb657feaca80e2ccb6da1c0c", "js/developer/environment/restore.mjs": "cdd22eebd55d68bd705685cd5ee3059e228a35053eaad116ab99c4c05b908098", - "js/developer/environment/cache.mjs": "e25a4c633794a7ba49fb1cddf182084571570988eb6e8a716d9dac31a3dd7346", + "js/developer/environment/cache.mjs": "6fd0e3b760dfc1070a28e2e2eb3c86621c970c775045e7a9ae665da4f6845922", "js/developer/environment/packages-entry.mjs": "edf47d25099428ea8d33f9fe4552f239035715b98fd2bff6be0f9143ab0cfe8a", "js/developer/environment/bootstrap.mjs": "534af4b3d07891338c3390e1d5e06c2fb6dd8df11ca6547735565b17f1b9cd70", "js/developer/environment/bootstrap-entry.mjs": "ff8084f23f5acc721f97eb1ed0a454e7bfee1894de17d54f0100fa11f7ef8b77", @@ -17,7 +17,7 @@ "js/developer/environment/conditions.mjs": "7f0ecba239480831e38985ccffd4c82309949924f4eb9d938e4ad1b09f5f36ed", "js/developer/environment/io.mjs": "21af39f07c7eb863908c1df768e3c31de1c6eb8ff757c2a287c4a47c76855db6", "js/developer/environment/recipe.mjs": "5e7b80cb9090dce63fafafbb852879fce9f6ed2399ac364bbe5af1cf6f4c1758", - "js/developer/environment/registry.mjs": "31ce38b38ba3e48a31d5ef87dda7f169fd272a11eafff45d5277ae8ed59569fe", + "js/developer/environment/registry.mjs": "717b928b47d1eb8d1635cbfda60473f4a8e0918c1345d5364b6b7d2ffe199195", "js/developer/environment/archive.mjs": "1fb8b9c3c27219858597801104639bba1104c7a7d33973609cd556b5e5f81d2d", "js/developer/environment/lock.mjs": "d69a3a877b92da52b21dcc78877345015ac31b7dec1c484ee1ff1f97f154d51f", "js/developer/environment/pins.mjs": "df07f6f01edaf86a1052d0e76f6c6745cb6e7a3309bbd256ac720ee8adc85297", @@ -35,6 +35,6 @@ "js/developer/tools/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b", "js/developer/vendor/package-lock.json": "eb545112b672f9dbf520125df1f44a878d62cc8e611f0e33baee36470ded4dec", "js/core/bootstrap/bootstrap.bundle.mjs": "792fe7cf564bd12ac47fef419d8c71e2070925764a17706552e7d3f5d6ba2181", - "js/developer/environment/packages.bundle.mjs": "10d0b5863ef9941bf6915c0cb28b5b4053ff044527c301bd4fe917bba23d32d6", + "js/developer/environment/packages.bundle.mjs": "81b575e77911e7a21fb477df84d955aac0c0017969d93c717e0c9622d4eed913", "include/webfront/system/DeveloperReleaseData.hpp": "c97a8c3b21df3306c179f7b46d945159b5854f9d2810f135a4ab224c768c75d7" } diff --git a/js/developer/environment/cache.mjs b/js/developer/environment/cache.mjs index 8cebd15c..3aeecf5e 100644 --- a/js/developer/environment/cache.mjs +++ b/js/developer/environment/cache.mjs @@ -26,8 +26,14 @@ export async function storePackage(bridge, node, files, {signal} = {}) { } async function readRecord(bridge, node) { - try { return JSON.parse(decoder.decode(await readProject(bridge, recordPath(node)))); } - catch (error) { return unreadable(error) ? null : {}; } + let bytes; + try { bytes = await readProject(bridge, recordPath(node)); } + catch (error) { + if (unreadable(error)) return null; + throw error; + } + // Only a malformed record is a corruption; a bridge failure is reported as such. + try { return JSON.parse(decoder.decode(bytes)); } catch { return {}; } } const sameFiles = (record, node) => Object.keys(record.files).sort().join('\n') === [...node.files].sort().join('\n'); diff --git a/js/developer/environment/manifest.mjs b/js/developer/environment/manifest.mjs index 6fb4eae7..1efd3c3e 100644 --- a/js/developer/environment/manifest.mjs +++ b/js/developer/environment/manifest.mjs @@ -47,9 +47,12 @@ function checkDependencies(value) { return dependencies; } +// A path that stays on the application's origin: browsers read "//host" and "/\\host" as another host. +export const sameOriginPath = value => value.startsWith('/') && !value.startsWith('//') && !value.includes('\\'); + function checkRegistry(value) { if (typeof value !== 'string') fail('registry must be a URL'); - if (value.startsWith('/') && !value.startsWith('//')) return value; + if (sameOriginPath(value)) return value; let url; try { url = new URL(value); } catch { return fail('registry must be an https URL or an absolute path'); } if (url.protocol !== 'https:') fail('registry must use https'); diff --git a/js/developer/environment/packages.bundle.mjs b/js/developer/environment/packages.bundle.mjs index 70e78e3c..11eb5cda 100644 --- a/js/developer/environment/packages.bundle.mjs +++ b/js/developer/environment/packages.bundle.mjs @@ -1,13 +1,13 @@ -var Ln=Object.create;var ct=Object.defineProperty;var Nn=Object.getOwnPropertyDescriptor;var Tn=Object.getOwnPropertyNames;var An=Object.getPrototypeOf,Pn=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var qn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Tn(t))!Pn.call(e,s)&&s!==r&&ct(e,s,{get:()=>t[s],enumerable:!(n=Nn(t,s))||n.enumerable});return e};var D=(e,t,r)=>(r=e!=null?Ln(An(e)):{},qn(t||!e||!e.__esModule?ct(r,"default",{value:e,enumerable:!0}):r,e));var F=m((_a,dt)=>{"use strict";var Fn="2.0.0",Gn=Number.MAX_SAFE_INTEGER||9007199254740991,Mn=16,Xn=250,Vn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];dt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Mn,MAX_SAFE_BUILD_LENGTH:Xn,MAX_SAFE_INTEGER:Gn,RELEASE_TYPES:Vn,SEMVER_SPEC_VERSION:Fn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var G=m((Ha,mt)=>{"use strict";var Bn=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};mt.exports=Bn});var U=m((N,wt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Oe,MAX_SAFE_BUILD_LENGTH:_n,MAX_LENGTH:Hn}=F(),Wn=G();N=wt.exports={};var Yn=N.re=[],Jn=N.safeRe=[],u=N.src=[],Zn=N.safeSrc=[],f=N.t={},Kn=0,Ie="[a-zA-Z0-9-]",Qn=[["\\s",1],["\\d",Hn],[Ie,_n]],es=e=>{for(let[t,r]of Qn)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},w=(e,t,r)=>{let n=es(t),s=Kn++;Wn(e,s,t),f[e]=s,u[s]=t,Zn[s]=n,Yn[s]=new RegExp(t,r?"g":void 0),Jn[s]=new RegExp(n,r?"g":void 0)};w("NUMERICIDENTIFIER","0|[1-9]\\d*");w("NUMERICIDENTIFIERLOOSE","\\d+");w("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Ie}*`);w("MAINVERSION",`(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})`);w("MAINVERSIONLOOSE",`(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})`);w("PRERELEASEIDENTIFIER",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIER]})`);w("PRERELEASEIDENTIFIERLOOSE",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIERLOOSE]})`);w("PRERELEASE",`(?:-(${u[f.PRERELEASEIDENTIFIER]}(?:\\.${u[f.PRERELEASEIDENTIFIER]})*))`);w("PRERELEASELOOSE",`(?:-?(${u[f.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[f.PRERELEASEIDENTIFIERLOOSE]})*))`);w("BUILDIDENTIFIER",`${Ie}+`);w("BUILD",`(?:\\+(${u[f.BUILDIDENTIFIER]}(?:\\.${u[f.BUILDIDENTIFIER]})*))`);w("FULLPLAIN",`v?${u[f.MAINVERSION]}${u[f.PRERELEASE]}?${u[f.BUILD]}?`);w("FULL",`^${u[f.FULLPLAIN]}$`);w("LOOSEPLAIN",`[v=\\s]*${u[f.MAINVERSIONLOOSE]}${u[f.PRERELEASELOOSE]}?${u[f.BUILD]}?`);w("LOOSE",`^${u[f.LOOSEPLAIN]}$`);w("GTLT","((?:<|>)?=?)");w("XRANGEIDENTIFIERLOOSE",`${u[f.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);w("XRANGEIDENTIFIER",`${u[f.NUMERICIDENTIFIER]}|x|X|\\*`);w("XRANGEPLAIN",`[v=\\s]*(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:${u[f.PRERELEASE]})?${u[f.BUILD]}?)?)?`);w("XRANGEPLAINLOOSE",`[v=\\s]*(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:${u[f.PRERELEASELOOSE]})?${u[f.BUILD]}?)?)?`);w("XRANGE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAIN]}$`);w("XRANGELOOSE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAINLOOSE]}$`);w("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Oe}})(?:\\.(\\d{1,${Oe}}))?(?:\\.(\\d{1,${Oe}}))?`);w("COERCE",`${u[f.COERCEPLAIN]}(?:$|[^\\d])`);w("COERCEFULL",u[f.COERCEPLAIN]+`(?:${u[f.PRERELEASE]})?(?:${u[f.BUILD]})?(?:$|[^\\d])`);w("COERCERTL",u[f.COERCE],!0);w("COERCERTLFULL",u[f.COERCEFULL],!0);w("LONETILDE","(?:~>?)");w("TILDETRIM",`(\\s*)${u[f.LONETILDE]}\\s+`,!0);N.tildeTrimReplace="$1~";w("TILDE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAIN]}$`);w("TILDELOOSE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAINLOOSE]}$`);w("LONECARET","(?:\\^)");w("CARETTRIM",`(\\s*)${u[f.LONECARET]}\\s+`,!0);N.caretTrimReplace="$1^";w("CARET",`^${u[f.LONECARET]}${u[f.XRANGEPLAIN]}$`);w("CARETLOOSE",`^${u[f.LONECARET]}${u[f.XRANGEPLAINLOOSE]}$`);w("COMPARATORLOOSE",`^${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]})$|^$`);w("COMPARATOR",`^${u[f.GTLT]}\\s*(${u[f.FULLPLAIN]})$|^$`);w("COMPARATORTRIM",`(\\s*)${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]}|${u[f.XRANGEPLAIN]})`,!0);N.comparatorTrimReplace="$1$2$3";w("HYPHENRANGE",`^\\s*(${u[f.XRANGEPLAIN]})\\s+-\\s+(${u[f.XRANGEPLAIN]})\\s*$`);w("HYPHENRANGELOOSE",`^\\s*(${u[f.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[f.XRANGEPLAINLOOSE]})\\s*$`);w("STAR","(<|>)?=?\\s*\\*");w("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");w("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Q=m((Wa,Et)=>{"use strict";var ts=Object.freeze({loose:!0}),rs=Object.freeze({}),ns=e=>e?typeof e!="object"?ts:e:rs;Et.exports=ns});var xe=m((Ya,yt)=>{"use strict";var gt=/^[0-9]+$/,$t=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e$t(t,e);yt.exports={compareIdentifiers:$t,rcompareIdentifiers:ss}});var y=m((Ja,Ot)=>{"use strict";var ee=G(),{MAX_LENGTH:Rt,MAX_SAFE_INTEGER:te}=F(),{safeRe:re,t:ne}=U(),os=Q(),{compareIdentifiers:ve}=xe(),be=class e{constructor(t,r){if(r=os(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Rt)throw new TypeError(`version is longer than ${Rt} characters`);ee("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?re[ne.LOOSE]:re[ne.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>te||this.major<0)throw new TypeError("Invalid major version");if(this.minor>te||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>te||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let o=+s;if(o>=0&&ot.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(ee("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ve(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(ee("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ve(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?re[ne.PRERELEASELOOSE]:re[ne.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let o=[r,s];n===!1&&(o=[r]),ve(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Ot.exports=be});var A=m((Za,xt)=>{"use strict";var It=y(),is=(e,t,r=!1)=>{if(e instanceof It)return e;try{return new It(e,t)}catch(n){if(!r)return null;throw n}};xt.exports=is});var bt=m((Ka,vt)=>{"use strict";var as=A(),cs=(e,t)=>{let r=as(e,t);return r?r.version:null};vt.exports=cs});var kt=m((Qa,St)=>{"use strict";var ls=A(),us=(e,t)=>{let r=ls(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};St.exports=us});var Tt=m((ec,Nt)=>{"use strict";var Lt=y(),fs=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new Lt(e instanceof Lt?e.version:e,r).inc(t,n,s).version}catch{return null}};Nt.exports=fs});var qt=m((tc,Pt)=>{"use strict";var At=A(),ps=(e,t)=>{let r=At(e,null,!0),n=At(t,null,!0),s=r.compare(n);if(s===0)return null;let o=s>0,i=o?r:n,a=o?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0)return a.minor&&!a.patch?"minor":"patch"}let h=c?"pre":"";return r.major!==n.major?h+"major":r.minor!==n.minor?h+"minor":r.patch!==n.patch?h+"patch":"prerelease"};Pt.exports=ps});var Ct=m((rc,jt)=>{"use strict";var hs=y(),ds=(e,t)=>new hs(e,t).major;jt.exports=ds});var Ut=m((nc,Dt)=>{"use strict";var ms=y(),ws=(e,t)=>new ms(e,t).minor;Dt.exports=ws});var Ft=m((sc,zt)=>{"use strict";var Es=y(),gs=(e,t)=>new Es(e,t).patch;zt.exports=gs});var Mt=m((oc,Gt)=>{"use strict";var $s=A(),ys=(e,t)=>{let r=$s(e,t);return r&&r.prerelease.length?r.prerelease:null};Gt.exports=ys});var x=m((ic,Vt)=>{"use strict";var Xt=y(),Rs=(e,t,r)=>new Xt(e,r).compare(new Xt(t,r));Vt.exports=Rs});var _t=m((ac,Bt)=>{"use strict";var Os=x(),Is=(e,t,r)=>Os(t,e,r);Bt.exports=Is});var Wt=m((cc,Ht)=>{"use strict";var xs=x(),vs=(e,t)=>xs(e,t,!0);Ht.exports=vs});var se=m((lc,Jt)=>{"use strict";var Yt=y(),bs=(e,t,r)=>{let n=new Yt(e,r),s=new Yt(t,r);return n.compare(s)||n.compareBuild(s)};Jt.exports=bs});var Kt=m((uc,Zt)=>{"use strict";var Ss=se(),ks=(e,t)=>e.sort((r,n)=>Ss(r,n,t));Zt.exports=ks});var er=m((fc,Qt)=>{"use strict";var Ls=se(),Ns=(e,t)=>e.sort((r,n)=>Ls(n,r,t));Qt.exports=Ns});var M=m((pc,tr)=>{"use strict";var Ts=x(),As=(e,t,r)=>Ts(e,t,r)>0;tr.exports=As});var oe=m((hc,rr)=>{"use strict";var Ps=x(),qs=(e,t,r)=>Ps(e,t,r)<0;rr.exports=qs});var Se=m((dc,nr)=>{"use strict";var js=x(),Cs=(e,t,r)=>js(e,t,r)===0;nr.exports=Cs});var ke=m((mc,sr)=>{"use strict";var Ds=x(),Us=(e,t,r)=>Ds(e,t,r)!==0;sr.exports=Us});var ie=m((wc,or)=>{"use strict";var zs=x(),Fs=(e,t,r)=>zs(e,t,r)>=0;or.exports=Fs});var ae=m((Ec,ir)=>{"use strict";var Gs=x(),Ms=(e,t,r)=>Gs(e,t,r)<=0;ir.exports=Ms});var Le=m((gc,ar)=>{"use strict";var Xs=Se(),Vs=ke(),Bs=M(),_s=ie(),Hs=oe(),Ws=ae(),Ys=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Xs(e,r,n);case"!=":return Vs(e,r,n);case">":return Bs(e,r,n);case">=":return _s(e,r,n);case"<":return Hs(e,r,n);case"<=":return Ws(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};ar.exports=Ys});var lr=m(($c,cr)=>{"use strict";var Js=y(),Zs=A(),{safeRe:ce,t:le}=U(),Ks=(e,t)=>{if(e instanceof Js)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?ce[le.COERCEFULL]:ce[le.COERCE]);else{let c=t.includePrerelease?ce[le.COERCERTLFULL]:ce[le.COERCERTL],l;for(;(l=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||l.index+l[0].length!==r.index+r[0].length)&&(r=l),c.lastIndex=l.index+l[1].length+l[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",o=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Zs(`${n}.${s}.${o}${i}${a}`,t)};cr.exports=Ks});var fr=m((yc,ur)=>{"use strict";var Ne=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};ur.exports=Ne});var v=m((Rc,mr)=>{"use strict";var Qs=/\s+/g,Te=class e{constructor(t,r){if(r=to(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Ae)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(Qs," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!hr(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&co(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&io)|(this.options.loose&&ao))+":"+t,s=pr.get(n);if(s)return s;let o=this.options.loose,i=o?O[R.HYPHENRANGELOOSE]:O[R.HYPHENRANGE];t=t.replace(i,$o(this.options.includePrerelease)),g("hyphen replace",t),t=t.replace(O[R.COMPARATORTRIM],no),g("comparator trim",t),t=t.replace(O[R.TILDETRIM],so),g("tilde trim",t),t=t.replace(O[R.CARETTRIM],oo),g("caret trim",t);let a=t.split(" ").map(p=>lo(p,this.options)).join(" ").split(/\s+/).map(p=>go(p,this.options));o&&(a=a.filter(p=>(g("loose invalid filter",p,this.options),!!p.match(O[R.COMPARATORLOOSE])))),g("range list",a);let c=new Map,l=a.map(p=>new Ae(p,this.options));for(let p of l){if(hr(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let h=[...c.values()];return pr.set(n,h),h}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>dr(n,r)&&t.set.some(s=>dr(s,r)&&n.every(o=>s.every(i=>o.intersects(i,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new ro(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",co=e=>e.value==="",dr=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(o=>s.intersects(o,t)),s=n.pop();return r},lo=(e,t)=>(e=e.replace(O[R.BUILD],""),g("comp",e,t),e=po(e,t),g("caret",e),e=uo(e,t),g("tildes",e),e=mo(e,t),g("xrange",e),e=Eo(e,t),g("stars",e),e),I=e=>!e||e.toLowerCase()==="x"||e==="*",uo=(e,t)=>e.trim().split(/\s+/).map(r=>fo(r,t)).join(" "),fo=(e,t)=>{let r=t.loose?O[R.TILDELOOSE]:O[R.TILDE];return e.replace(r,(n,s,o,i,a)=>{g("tilde",e,n,s,o,i,a);let c;return I(s)?c="":I(o)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:I(i)?c=`>=${s}.${o}.0 <${s}.${+o+1}.0-0`:a?(g("replaceTilde pr",a),c=`>=${s}.${o}.${i}-${a} <${s}.${+o+1}.0-0`):c=`>=${s}.${o}.${i} <${s}.${+o+1}.0-0`,g("tilde return",c),c})},po=(e,t)=>e.trim().split(/\s+/).map(r=>ho(r,t)).join(" "),ho=(e,t)=>{g("caret",e,t);let r=t.loose?O[R.CARETLOOSE]:O[R.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,o,i,a,c)=>{g("caret",e,s,o,i,a,c);let l;return I(o)?l="":I(i)?l=`>=${o}.0.0${n} <${+o+1}.0.0-0`:I(a)?o==="0"?l=`>=${o}.${i}.0${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.0${n} <${+o+1}.0.0-0`:c?(g("replaceCaret pr",c),o==="0"?i==="0"?l=`>=${o}.${i}.${a}-${c} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}-${c} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a}-${c} <${+o+1}.0.0-0`):(g("no pr"),o==="0"?i==="0"?l=`>=${o}.${i}.${a}${n} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a} <${+o+1}.0.0-0`),g("caret return",l),l})},mo=(e,t)=>(g("replaceXRanges",e,t),e.split(/\s+/).map(r=>wo(r,t)).join(" ")),wo=(e,t)=>{e=e.trim();let r=t.loose?O[R.XRANGELOOSE]:O[R.XRANGE];return e.replace(r,(n,s,o,i,a,c)=>{g("xRange",e,n,s,o,i,a,c);let l=I(o),h=l||I(i),p=h||I(a),E=p;return s==="="&&E&&(s=""),c=t.includePrerelease?"-0":"",l?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&E?(h&&(i=0),a=0,s===">"?(s=">=",h?(o=+o+1,i=0,a=0):(i=+i+1,a=0)):s==="<="&&(s="<",h?o=+o+1:i=+i+1),s==="<"&&(c="-0"),n=`${s+o}.${i}.${a}${c}`):h?n=`>=${o}.0.0${c} <${+o+1}.0.0-0`:p&&(n=`>=${o}.${i}.0${c} <${o}.${+i+1}.0-0`),g("xRange return",n),n})},Eo=(e,t)=>(g("replaceStars",e,t),e.trim().replace(O[R.STAR],"")),go=(e,t)=>(g("replaceGTE0",e,t),e.trim().replace(O[t.includePrerelease?R.GTE0PRE:R.GTE0],"")),$o=e=>(t,r,n,s,o,i,a,c,l,h,p,E)=>(I(n)?r="":I(s)?r=`>=${n}.0.0${e?"-0":""}`:I(o)?r=`>=${n}.${s}.0${e?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,I(l)?c="":I(h)?c=`<${+l+1}.0.0-0`:I(p)?c=`<${l}.${+h+1}.0-0`:E?c=`<=${l}.${h}.${p}-${E}`:e?c=`<${l}.${h}.${+p+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),yo=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var X=m((Oc,Rr)=>{"use strict";var V=Symbol("SemVer ANY"),je=class e{static get ANY(){return V}constructor(t,r){if(r=wr(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),qe("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===V?this.value="":this.value=this.operator+this.semver.version,qe("comp",this)}parse(t){let r=this.options.loose?Er[gr.COMPARATORLOOSE]:Er[gr.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new $r(n[2],this.options.loose):this.semver=V}toString(){return this.value}test(t){if(qe("Comparator.test",t,this.options.loose),this.semver===V||t===V)return!0;if(typeof t=="string")try{t=new $r(t,this.options)}catch{return!1}return Pe(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new yr(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new yr(this.value,r).test(t.semver):(r=wr(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||Pe(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||Pe(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Rr.exports=je;var wr=Q(),{safeRe:Er,t:gr}=U(),Pe=Le(),qe=G(),$r=y(),yr=v()});var B=m((Ic,Or)=>{"use strict";var Ro=v(),Oo=(e,t,r)=>{try{t=new Ro(t,r)}catch{return!1}return t.test(e)};Or.exports=Oo});var xr=m((xc,Ir)=>{"use strict";var Io=v(),xo=(e,t)=>new Io(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Ir.exports=xo});var br=m((vc,vr)=>{"use strict";var vo=y(),bo=v(),So=(e,t,r)=>{let n=null,s=null,o=null;try{o=new bo(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===-1)&&(n=i,s=new vo(n,r))}),n};vr.exports=So});var kr=m((bc,Sr)=>{"use strict";var ko=y(),Lo=v(),No=(e,t,r)=>{let n=null,s=null,o=null;try{o=new Lo(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===1)&&(n=i,s=new ko(n,r))}),n};Sr.exports=No});var Tr=m((Sc,Nr)=>{"use strict";var Ce=y(),To=v(),Lr=M(),Ao=(e,t)=>{e=new To(e,t);let r=new Ce("0.0.0");if(e.test(r)||(r=new Ce("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let a=new Ce(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||Lr(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||Lr(r,o))&&(r=o)}return r&&e.test(r)?r:null};Nr.exports=Ao});var Pr=m((kc,Ar)=>{"use strict";var Po=v(),qo=(e,t)=>{try{return new Po(e,t).range||"*"}catch{return null}};Ar.exports=qo});var ue=m((Lc,Dr)=>{"use strict";var jo=y(),Cr=X(),{ANY:Co}=Cr,Do=v(),Uo=B(),qr=M(),jr=oe(),zo=ae(),Fo=ie(),Go=(e,t,r,n)=>{e=new jo(e,n),t=new Do(t,n);let s,o,i,a,c;switch(r){case">":s=qr,o=zo,i=jr,a=">",c=">=";break;case"<":s=jr,o=Fo,i=qr,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Uo(e,t,n))return!1;for(let l=0;l{d.semver===Co&&(d=new Cr(">=0.0.0")),p=p||d,E=E||d,s(d.semver,p.semver,n)?p=d:i(d.semver,E.semver,n)&&(E=d)}),p.operator===a||p.operator===c||(!E.operator||E.operator===a)&&o(e,E.semver))return!1;if(E.operator===c&&i(e,E.semver))return!1}return!0};Dr.exports=Go});var zr=m((Nc,Ur)=>{"use strict";var Mo=ue(),Xo=(e,t,r)=>Mo(e,t,">",r);Ur.exports=Xo});var Gr=m((Tc,Fr)=>{"use strict";var Vo=ue(),Bo=(e,t,r)=>Vo(e,t,"<",r);Fr.exports=Bo});var Vr=m((Ac,Xr)=>{"use strict";var Mr=v(),_o=(e,t,r)=>(e=new Mr(e,r),t=new Mr(t,r),e.intersects(t,r));Xr.exports=_o});var _r=m((Pc,Br)=>{"use strict";var Ho=B(),Wo=x();Br.exports=(e,t,r)=>{let n=[],s=null,o=null,i=e.sort((h,p)=>Wo(h,p,r));for(let h of i)Ho(h,t,r)?(o=h,s||(s=h)):(o&&n.push([s,o]),o=null,s=null);s&&n.push([s,null]);let a=[];for(let[h,p]of n)h===p?a.push(h):!p&&h===i[0]?a.push("*"):p?h===i[0]?a.push(`<=${p}`):a.push(`${h} - ${p}`):a.push(`>=${h}`);let c=a.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return c.length{"use strict";var Hr=v(),Ue=X(),{ANY:De}=Ue,_=B(),ze=x(),Yo=(e,t,r={})=>{if(e===t)return!0;e=new Hr(e,r),t=new Hr(t,r);let n=!1;e:for(let s of e.set){for(let o of t.set){let i=Zo(s,o,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},Jo=[new Ue(">=0.0.0-0")],Wr=[new Ue(">=0.0.0")],Zo=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===De){if(t.length===1&&t[0].semver===De)return!0;r.includePrerelease?e=Jo:e=Wr}if(t.length===1&&t[0].semver===De){if(r.includePrerelease)return!0;t=Wr}let n=new Set,s,o;for(let d of e)d.operator===">"||d.operator===">="?s=Yr(s,d,r):d.operator==="<"||d.operator==="<="?o=Jr(o,d,r):n.add(d.semver);if(n.size>1)return null;let i;if(s&&o){if(i=ze(s.semver,o.semver,r),i>0)return null;if(i===0&&(s.operator!==">="||o.operator!=="<="))return null}for(let d of n){if(s&&!_(d,String(s),r)||o&&!_(d,String(o),r))return null;for(let C of t)if(!_(d,String(C),r))return!1;return!0}let a,c,l,h,p=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,E=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;p&&p.prerelease.length===1&&o.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let d of t){if(h=h||d.operator===">"||d.operator===">=",l=l||d.operator==="<"||d.operator==="<=",s){if(E&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===E.major&&d.semver.minor===E.minor&&d.semver.patch===E.patch&&(E=!1),d.operator===">"||d.operator===">="){if(a=Yr(s,d,r),a===d&&a!==s)return!1}else if(s.operator===">="&&!_(s.semver,String(d),r))return!1}if(o){if(p&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===p.major&&d.semver.minor===p.minor&&d.semver.patch===p.patch&&(p=!1),d.operator==="<"||d.operator==="<="){if(c=Jr(o,d,r),c===d&&c!==o)return!1}else if(o.operator==="<="&&!_(o.semver,String(d),r))return!1}if(!d.operator&&(o||s)&&i!==0)return!1}return!(s&&l&&!o&&i!==0||o&&h&&!s&&i!==0||E||p)},Yr=(e,t,r)=>{if(!e)return t;let n=ze(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},Jr=(e,t,r)=>{if(!e)return t;let n=ze(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};Zr.exports=Yo});var P=m((jc,tn)=>{"use strict";var Fe=U(),Qr=F(),Ko=y(),en=xe(),Qo=A(),ei=bt(),ti=kt(),ri=Tt(),ni=qt(),si=Ct(),oi=Ut(),ii=Ft(),ai=Mt(),ci=x(),li=_t(),ui=Wt(),fi=se(),pi=Kt(),hi=er(),di=M(),mi=oe(),wi=Se(),Ei=ke(),gi=ie(),$i=ae(),yi=Le(),Ri=lr(),Oi=X(),Ii=v(),xi=B(),vi=xr(),bi=br(),Si=kr(),ki=Tr(),Li=Pr(),Ni=ue(),Ti=zr(),Ai=Gr(),Pi=Vr(),qi=_r(),ji=Kr();tn.exports={parse:Qo,valid:ei,clean:ti,inc:ri,diff:ni,major:si,minor:oi,patch:ii,prerelease:ai,compare:ci,rcompare:li,compareLoose:ui,compareBuild:fi,sort:pi,rsort:hi,gt:di,lt:mi,eq:wi,neq:Ei,gte:gi,lte:$i,cmp:yi,coerce:Ri,Comparator:Oi,Range:Ii,satisfies:xi,toComparators:vi,maxSatisfying:bi,minSatisfying:Si,minVersion:ki,validRange:Li,outside:Ni,gtr:Ti,ltr:Ai,intersects:Pi,simplifyRange:qi,subset:ji,SemVer:Ko,re:Fe.re,src:Fe.src,tokens:Fe.t,SEMVER_SPEC_VERSION:Qr.SEMVER_SPEC_VERSION,RELEASE_TYPES:Qr.RELEASE_TYPES,compareIdentifiers:en.compareIdentifiers,rcompareIdentifiers:en.rcompareIdentifiers}});var Re=new TextDecoder;function K(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function ut(e,t){let r=String(t??"").split(/\s+/).filter(o=>o.startsWith("sha512-")).map(o=>o.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,o=>String.fromCharCode(o)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function ft(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let o=await r.read();!o.done;o=await r.read()){if(s+=o.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(o.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function z(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return Re.decode(s<0?n:n.subarray(0,s))}function pt(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,o)=>s*256+o,e[t]&127);let n=z(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function jn(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if(pt(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function Cn(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let o=Re.decode(e.subarray(n+1,r+s-1)),i=o.indexOf("=");t[o.slice(0,i)]=o.slice(i+1),r+=s}return t}function Dn(e,t){let r=e.subarray(t,t+512);jn(r);let n=pt(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function Un(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function zn(e){let t=z(e,0,100),r=z(e,257,5)==="ustar"?z(e,345,155):"";return r?`${r}/${t}`:t}var lt={x:(e,t)=>({...e,pax:Cn(t).path}),L:(e,t)=>({...e,long:z(t,0,t.length)}),g:e=>e};function ht(e){let t=[],r={};for(let n=0;!Un(e,n);){let{header:s,type:o,data:i,next:a}=Dn(e,n);if(n=a,Object.hasOwn(lt,o)){r=lt[o](r,i);continue}(o==="0"||o==="7")&&t.push({path:r.pax??r.long??zn(s),bytes:i}),r={}}return t}var pe=D(P(),1);var b=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function fe(e,t){let r=[],n=0;for(;;){let s=await b(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function Ge(e,{id:t,path:r,bytes:n},s){for(let o=0;o{}),a}}async function Ci(e,t){let r=[],n=0;for(;;){let{done:s,value:o}=await e.read();if(s)return r;if(n+=o.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(o)}}async function Di(e,t){try{return await Ci(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function rn(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await Di(e.body.getReader(),t)).arrayBuffer())}var Ui=/[\\\0:*?"<>|]/,zi=e=>e.split("/").some(t=>!t||t==="."||t==="..");function Fi(e){return typeof e!="string"||!e||Ui.test(e)?!0:zi(e)}function q(e){if(Fi(e))throw new Error(`Unsafe package path: ${e}`);return e}var Gi=new TextDecoder,Mi=["preinstall","install","postinstall"];async function nn(e){let t=new Map;for(let r of ht(await ft(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=q(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var Xi=e=>Mi.some(t=>e.scripts?.[t]),Vi=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function Bi(e,t){return Xi(e)||e.gypfile?!0:Vi(t)}function sn(e,t,r){let n=JSON.parse(Gi.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(Bi(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}var Me=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),he=(e,t)=>`${e.replace("/","+")}@${t}`,Xe=(e,t,r)=>`${he(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function _i(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function Hi(e,t){let r=e["dist-tags"]?.[t];return r||(pe.default.valid(t)?t:pe.default.maxSatisfying(Object.keys(e.versions??{}),t))}function Wi(e,t,r){let n=r||"latest",s=Hi(e,n),o=e.versions?.[s];if(!o||!pe.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:o}}async function Yi(e,t,r,{fetchImpl:n,signal:s}){let o=new URL(t.dist?.tarball,r);if(o.protocol!=="https:"&&o.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let i=await n(o,{signal:s});if(!i.ok)throw new Error(`Package download for ${e}: HTTP ${i.status}`);let a=await rn(i);return{bytes:a,integrity:await ut(a,t.dist.integrity)}}function Ve(e){let t=new URL(e,globalThis.location?.href);if(t.protocol!=="https:"&&t.origin!==globalThis.location?.origin)throw new Error(`The npm registry must use HTTPS or the application origin: ${e}`);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function j(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!Me(e))throw new Error(`Unsupported npm package name: ${e}`);let o=Ve(r),i={fetchImpl:n,signal:s},{version:a,manifest:c}=Wi(await _i(e,o,i),e,t),{bytes:l,integrity:h}=await Yi(e,c,o,i),p=await nn(l),E=sn(p,e,a);return{id:he(e,a),key:Xe(e,a,h),manifest:E,integrity:h,files:p}}var de=D(P(),1);function Ji(e,t,r){let n=e?.roots?.[t];return n?.requested===r&&e.packages[n.id]?e.packages[n.id]:de.default.validRange(r)?Object.values(e?.packages??{}).filter(o=>o.name===t&&de.default.satisfies(o.version,r)).sort((o,i)=>de.default.rcompare(o.version,i.version))[0]??null:null}function on({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=j,previous:s}){let o=new Map;return async(i,a)=>{let c=`${i}@${a}`;if(o.has(c))return o.get(c);let l=Ji(s,i,a),h=await n(i,l?.version??a,{registry:e,fetchImpl:t,signal:r});if(l&&h.integrity!==l.integrity)throw new Error(`${h.id} no longer matches the integrity recorded in the lock`);return o.set(c,h),h}}var an=D(P(),1),cn=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function Zi(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw cn(e,t,r)}function Ki(e,[t,r],{nodes:n,roots:s}){let o=s[t]?.id??e.dependencies[t];if(!o)return Zi(e,t,r);if(!an.default.satisfies(n[o].version,r))throw cn(e,t,r);return o}function Qi(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=Ki(e,r,t);n&&(e.dependencies[r[0]]=n)}}function ln(e,t){for(let r of Object.values(e))Qi(r,{nodes:e,roots:t})}var un=D(P(),1);function ea(e,t){return!Me(t.name)||!un.default.valid(t.version)?!1:e===he(t.name,t.version)}function ta(e){return e.integrity?.startsWith("sha512-")?e.key===Xe(e.name,e.version,e.integrity):!1}function ra(e,t,r){if(!ea(t,r)||!ta(r))throw new Error("Invalid locked package");for(let n of r.files)q(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function na(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function Be(e){if(!na(e))throw new Error("Unsupported package lock");if(Object.keys(e.packages).length>512)throw new Error("The package lock exceeds 512 packages");for(let[t,r]of Object.entries(e.packages))ra(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function sa(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function oa(e,t){let r={};for(let n of e){let{name:s,version:o}=K(n);r[s]={requested:o||"latest",id:await t(s,o||"latest")}}return r}async function fn(e,t={}){let r=on(t),n={nodes:{},downloads:new Map,total:0},s=async(i,a)=>{t.signal?.throwIfAborted();let c=await r(i,a);if(n.nodes[c.id])return c.id;sa(n,i,c);for(let[l,h]of Object.entries(c.manifest.dependencies??{}).sort())n.nodes[c.id].dependencies[l]=await s(l,h);return c.id},o=await oa(e,s);return ln(n.nodes,o),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:o,packages:n.nodes},downloads:n.downloads}}function W(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var S="webfront.project.json",Y=1,_e=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,ia=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,aa=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,pn=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,He=/^[A-Za-z_][A-Za-z0-9_]*$/,hn=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],ca=["files","publish","fetch"],$=e=>{throw new Error(`${S}: ${e}`)};function T(e,t){return W(e)||$(`${t} must be an object`),e}function We(e,t,r){for(let n of Object.keys(e))t.includes(n)||$(`unknown key "${n}" in ${r}`)}function me(e,t){typeof e!="string"&&$(`${t} must be a project path`);try{return q(e)}catch{return $(`${t} is not a safe project-relative path: ${e}`)}}function dn(e,t){return(!Array.isArray(e)||e.length>256)&&$(`${t} must be an array of at most 256 paths`),e.map((r,n)=>me(r,`${t}[${n}]`))}function la(e){let t=T(e,"dependencies");for(let[r,n]of Object.entries(t))_e.test(r)||$(`invalid npm package name "${r}"`),(typeof n!="string"||!aa.test(n)||n!==n.trim())&&$(`invalid version range for "${r}"`);return t}function ua(e){if(typeof e!="string"&&$("registry must be a URL"),e.startsWith("/")&&!e.startsWith("//"))return e;let t;try{t=new URL(e)}catch{return $("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&$("registry must use https"),e}function fa(e){let t=T(e,"scripts");for(let[r,n]of Object.entries(t))(!pn.test(r)||typeof n!="string"||!n||n.length>1024)&&$(`invalid script "${r}"`);return t}function pa(e){let t=T(e,"entries");for(let[r,n]of Object.entries(t))pn.test(r)||$(`invalid entry name "${r}"`),me(n,`entries.${r}`);return t}function ha(e,t){let r=T(e,"providers");for(let[n,s]of Object.entries(r))He.test(n)||$(`invalid provider name "${n}"`),T(s,`providers.${n}`),We(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&$(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||me(s.entry,`providers.${n}.entry`),me(s.output,`providers.${n}.output`).endsWith(".hpp")||$(`providers.${n}.output must be a .hpp file`);return r}function da(e){let t=T(e,"test");return We(t,["specs"],"test"),t.specs!==void 0&&dn(t.specs,"test.specs"),t}function ma(e,t){let r;try{r=new URL(e)}catch{return $(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&$(`${t} must be an https origin without a path`),e}function wa(e){let t=T(e,"permissions");for(let r of Object.keys(t))ca.includes(r)||$(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&dn(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&$("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>ma(r,`permissions.fetch[${n}]`))),t}function Ea(e){(typeof e.name!="string"||!_e.test(e.name))&&$("name must be a lower-case npm package name"),(typeof e.version!="string"||!ia.test(e.version))&&$("version must be a semantic version")}function ga(e){e.format!==Y&&(Number.isInteger(e.format)&&e.format>Y&&$(`format ${e.format} is not supported by this environment (it reads format ${Y}); update the environment`),$(`format must be ${Y}`))}function J(e){T(e,"the manifest"),ga(e),We(e,hn,"the manifest"),Ea(e);let t=e.entries===void 0?{}:pa(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:la(e.dependencies),entries:t,providers:e.providers===void 0?{}:ha(e.providers,t),...e.registry===void 0?{}:{registry:ua(e.registry)},...e.scripts===void 0?{}:{scripts:fa(e.scripts)},...e.test===void 0?{}:{test:da(e.test)},...e.permissions===void 0?{}:{permissions:wa(e.permissions)}}}function Ye(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return $("not valid JSON")}return{source:t,manifest:J(t)}}function ul(e){return Ye(e).manifest}function Je(e){let t={};for(let r of hn)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` -`}function mn(e){return{format:Y,name:e,version:"0.1.0",dependencies:{}}}function wn(e){let r=(String(e??"").split("/").filter(Boolean).pop()??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"");return _e.test(r)?r:"webfront-app"}async function we(e){let t=JSON.stringify(Object.entries(e).sort(([n],[s])=>ns?1:0)),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(r)].map(n=>n.toString(16).padStart(2,"0")).join("")}var Ze=D(P(),1);var k="webfront-packages.lock.json",Ke=".webfront/developer/packages",$a=new TextDecoder,ya=new TextEncoder,Ee="No webfront.project.json: run wf init",ge="The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again";async function En(e,t){try{return await fe(e,t)}catch(r){if(r.message.includes("Cannot read project file:"))return null;throw r}}function Ra(e,t,r){return t?r===t.requested?!0:Ze.default.validRange(r)!==null&&Ze.default.satisfies(e.packages[t.id].version,r):!1}function Oa(e,t){let r=Object.keys(t);return r.length===Object.keys(e.roots).length&&r.every(n=>Ra(e,e.roots[n],t[n]))}function Ia(e,t,r){return e?t?t.manifestDigest===void 0?Oa(t,e.dependencies)?"legacy":"desynchronized":t.manifestDigest===r?"consistent":"desynchronized":"unlocked":"no-manifest"}async function Z(e){let t=await b(e,"state",`${S} -${k}`),r=await En(e,S),n=await En(e,k),{source:s,manifest:o}=r?Ye(r):{source:null,manifest:null},i=n?Be(JSON.parse($a.decode(n))):null,a=o?await we(o.dependencies):null;return{manifest:o,source:s,lock:i,token:t,status:Ia(o,i,a),digest:a}}var $n=e=>e.status==="desynchronized"?`Warning: ${ge}.\r -`:"";async function yn(e,t,r,{signal:n}={}){let s=[];try{for(let[o,i]of t){n?.throwIfAborted();let a=await b(e,"begin",o,!1);s.push(a),await Ge(e,{id:a,path:"output",bytes:i},n)}n?.throwIfAborted(),await b(e,"commitGroup",s.join(` +var Nn=Object.create;var lt=Object.defineProperty;var Tn=Object.getOwnPropertyDescriptor;var An=Object.getOwnPropertyNames;var Pn=Object.getPrototypeOf,qn=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var jn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of An(t))!qn.call(e,s)&&s!==r&<(e,s,{get:()=>t[s],enumerable:!(n=Tn(t,s))||n.enumerable});return e};var D=(e,t,r)=>(r=e!=null?Nn(Pn(e)):{},jn(t||!e||!e.__esModule?lt(r,"default",{value:e,enumerable:!0}):r,e));var F=m((Ha,mt)=>{"use strict";var Gn="2.0.0",Mn=Number.MAX_SAFE_INTEGER||9007199254740991,Xn=16,Vn=250,Bn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];mt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Xn,MAX_SAFE_BUILD_LENGTH:Vn,MAX_SAFE_INTEGER:Mn,RELEASE_TYPES:Bn,SEMVER_SPEC_VERSION:Gn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var G=m((Wa,wt)=>{"use strict";var _n=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};wt.exports=_n});var U=m((N,Et)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Oe,MAX_SAFE_BUILD_LENGTH:Hn,MAX_LENGTH:Wn}=F(),Yn=G();N=Et.exports={};var Jn=N.re=[],Zn=N.safeRe=[],u=N.src=[],Kn=N.safeSrc=[],f=N.t={},Qn=0,Ie="[a-zA-Z0-9-]",es=[["\\s",1],["\\d",Wn],[Ie,Hn]],ts=e=>{for(let[t,r]of es)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},w=(e,t,r)=>{let n=ts(t),s=Qn++;Yn(e,s,t),f[e]=s,u[s]=t,Kn[s]=n,Jn[s]=new RegExp(t,r?"g":void 0),Zn[s]=new RegExp(n,r?"g":void 0)};w("NUMERICIDENTIFIER","0|[1-9]\\d*");w("NUMERICIDENTIFIERLOOSE","\\d+");w("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Ie}*`);w("MAINVERSION",`(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})`);w("MAINVERSIONLOOSE",`(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})`);w("PRERELEASEIDENTIFIER",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIER]})`);w("PRERELEASEIDENTIFIERLOOSE",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIERLOOSE]})`);w("PRERELEASE",`(?:-(${u[f.PRERELEASEIDENTIFIER]}(?:\\.${u[f.PRERELEASEIDENTIFIER]})*))`);w("PRERELEASELOOSE",`(?:-?(${u[f.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[f.PRERELEASEIDENTIFIERLOOSE]})*))`);w("BUILDIDENTIFIER",`${Ie}+`);w("BUILD",`(?:\\+(${u[f.BUILDIDENTIFIER]}(?:\\.${u[f.BUILDIDENTIFIER]})*))`);w("FULLPLAIN",`v?${u[f.MAINVERSION]}${u[f.PRERELEASE]}?${u[f.BUILD]}?`);w("FULL",`^${u[f.FULLPLAIN]}$`);w("LOOSEPLAIN",`[v=\\s]*${u[f.MAINVERSIONLOOSE]}${u[f.PRERELEASELOOSE]}?${u[f.BUILD]}?`);w("LOOSE",`^${u[f.LOOSEPLAIN]}$`);w("GTLT","((?:<|>)?=?)");w("XRANGEIDENTIFIERLOOSE",`${u[f.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);w("XRANGEIDENTIFIER",`${u[f.NUMERICIDENTIFIER]}|x|X|\\*`);w("XRANGEPLAIN",`[v=\\s]*(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:${u[f.PRERELEASE]})?${u[f.BUILD]}?)?)?`);w("XRANGEPLAINLOOSE",`[v=\\s]*(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:${u[f.PRERELEASELOOSE]})?${u[f.BUILD]}?)?)?`);w("XRANGE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAIN]}$`);w("XRANGELOOSE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAINLOOSE]}$`);w("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Oe}})(?:\\.(\\d{1,${Oe}}))?(?:\\.(\\d{1,${Oe}}))?`);w("COERCE",`${u[f.COERCEPLAIN]}(?:$|[^\\d])`);w("COERCEFULL",u[f.COERCEPLAIN]+`(?:${u[f.PRERELEASE]})?(?:${u[f.BUILD]})?(?:$|[^\\d])`);w("COERCERTL",u[f.COERCE],!0);w("COERCERTLFULL",u[f.COERCEFULL],!0);w("LONETILDE","(?:~>?)");w("TILDETRIM",`(\\s*)${u[f.LONETILDE]}\\s+`,!0);N.tildeTrimReplace="$1~";w("TILDE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAIN]}$`);w("TILDELOOSE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAINLOOSE]}$`);w("LONECARET","(?:\\^)");w("CARETTRIM",`(\\s*)${u[f.LONECARET]}\\s+`,!0);N.caretTrimReplace="$1^";w("CARET",`^${u[f.LONECARET]}${u[f.XRANGEPLAIN]}$`);w("CARETLOOSE",`^${u[f.LONECARET]}${u[f.XRANGEPLAINLOOSE]}$`);w("COMPARATORLOOSE",`^${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]})$|^$`);w("COMPARATOR",`^${u[f.GTLT]}\\s*(${u[f.FULLPLAIN]})$|^$`);w("COMPARATORTRIM",`(\\s*)${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]}|${u[f.XRANGEPLAIN]})`,!0);N.comparatorTrimReplace="$1$2$3";w("HYPHENRANGE",`^\\s*(${u[f.XRANGEPLAIN]})\\s+-\\s+(${u[f.XRANGEPLAIN]})\\s*$`);w("HYPHENRANGELOOSE",`^\\s*(${u[f.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[f.XRANGEPLAINLOOSE]})\\s*$`);w("STAR","(<|>)?=?\\s*\\*");w("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");w("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Q=m((Ya,gt)=>{"use strict";var rs=Object.freeze({loose:!0}),ns=Object.freeze({}),ss=e=>e?typeof e!="object"?rs:e:ns;gt.exports=ss});var xe=m((Ja,Rt)=>{"use strict";var $t=/^[0-9]+$/,yt=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:eyt(t,e);Rt.exports={compareIdentifiers:yt,rcompareIdentifiers:os}});var y=m((Za,It)=>{"use strict";var ee=G(),{MAX_LENGTH:Ot,MAX_SAFE_INTEGER:te}=F(),{safeRe:re,t:ne}=U(),is=Q(),{compareIdentifiers:ve}=xe(),be=class e{constructor(t,r){if(r=is(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Ot)throw new TypeError(`version is longer than ${Ot} characters`);ee("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?re[ne.LOOSE]:re[ne.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>te||this.major<0)throw new TypeError("Invalid major version");if(this.minor>te||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>te||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let o=+s;if(o>=0&&ot.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(ee("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ve(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(ee("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return ve(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?re[ne.PRERELEASELOOSE]:re[ne.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let o=[r,s];n===!1&&(o=[r]),ve(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};It.exports=be});var A=m((Ka,vt)=>{"use strict";var xt=y(),as=(e,t,r=!1)=>{if(e instanceof xt)return e;try{return new xt(e,t)}catch(n){if(!r)return null;throw n}};vt.exports=as});var St=m((Qa,bt)=>{"use strict";var cs=A(),ls=(e,t)=>{let r=cs(e,t);return r?r.version:null};bt.exports=ls});var Lt=m((ec,kt)=>{"use strict";var us=A(),fs=(e,t)=>{let r=us(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};kt.exports=fs});var At=m((tc,Tt)=>{"use strict";var Nt=y(),ps=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new Nt(e instanceof Nt?e.version:e,r).inc(t,n,s).version}catch{return null}};Tt.exports=ps});var jt=m((rc,qt)=>{"use strict";var Pt=A(),hs=(e,t)=>{let r=Pt(e,null,!0),n=Pt(t,null,!0),s=r.compare(n);if(s===0)return null;let o=s>0,i=o?r:n,a=o?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0)return a.minor&&!a.patch?"minor":"patch"}let h=c?"pre":"";return r.major!==n.major?h+"major":r.minor!==n.minor?h+"minor":r.patch!==n.patch?h+"patch":"prerelease"};qt.exports=hs});var Dt=m((nc,Ct)=>{"use strict";var ds=y(),ms=(e,t)=>new ds(e,t).major;Ct.exports=ms});var zt=m((sc,Ut)=>{"use strict";var ws=y(),Es=(e,t)=>new ws(e,t).minor;Ut.exports=Es});var Gt=m((oc,Ft)=>{"use strict";var gs=y(),$s=(e,t)=>new gs(e,t).patch;Ft.exports=$s});var Xt=m((ic,Mt)=>{"use strict";var ys=A(),Rs=(e,t)=>{let r=ys(e,t);return r&&r.prerelease.length?r.prerelease:null};Mt.exports=Rs});var x=m((ac,Bt)=>{"use strict";var Vt=y(),Os=(e,t,r)=>new Vt(e,r).compare(new Vt(t,r));Bt.exports=Os});var Ht=m((cc,_t)=>{"use strict";var Is=x(),xs=(e,t,r)=>Is(t,e,r);_t.exports=xs});var Yt=m((lc,Wt)=>{"use strict";var vs=x(),bs=(e,t)=>vs(e,t,!0);Wt.exports=bs});var se=m((uc,Zt)=>{"use strict";var Jt=y(),Ss=(e,t,r)=>{let n=new Jt(e,r),s=new Jt(t,r);return n.compare(s)||n.compareBuild(s)};Zt.exports=Ss});var Qt=m((fc,Kt)=>{"use strict";var ks=se(),Ls=(e,t)=>e.sort((r,n)=>ks(r,n,t));Kt.exports=Ls});var tr=m((pc,er)=>{"use strict";var Ns=se(),Ts=(e,t)=>e.sort((r,n)=>Ns(n,r,t));er.exports=Ts});var M=m((hc,rr)=>{"use strict";var As=x(),Ps=(e,t,r)=>As(e,t,r)>0;rr.exports=Ps});var oe=m((dc,nr)=>{"use strict";var qs=x(),js=(e,t,r)=>qs(e,t,r)<0;nr.exports=js});var Se=m((mc,sr)=>{"use strict";var Cs=x(),Ds=(e,t,r)=>Cs(e,t,r)===0;sr.exports=Ds});var ke=m((wc,or)=>{"use strict";var Us=x(),zs=(e,t,r)=>Us(e,t,r)!==0;or.exports=zs});var ie=m((Ec,ir)=>{"use strict";var Fs=x(),Gs=(e,t,r)=>Fs(e,t,r)>=0;ir.exports=Gs});var ae=m((gc,ar)=>{"use strict";var Ms=x(),Xs=(e,t,r)=>Ms(e,t,r)<=0;ar.exports=Xs});var Le=m(($c,cr)=>{"use strict";var Vs=Se(),Bs=ke(),_s=M(),Hs=ie(),Ws=oe(),Ys=ae(),Js=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Vs(e,r,n);case"!=":return Bs(e,r,n);case">":return _s(e,r,n);case">=":return Hs(e,r,n);case"<":return Ws(e,r,n);case"<=":return Ys(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};cr.exports=Js});var ur=m((yc,lr)=>{"use strict";var Zs=y(),Ks=A(),{safeRe:ce,t:le}=U(),Qs=(e,t)=>{if(e instanceof Zs)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?ce[le.COERCEFULL]:ce[le.COERCE]);else{let c=t.includePrerelease?ce[le.COERCERTLFULL]:ce[le.COERCERTL],l;for(;(l=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||l.index+l[0].length!==r.index+r[0].length)&&(r=l),c.lastIndex=l.index+l[1].length+l[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",o=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Ks(`${n}.${s}.${o}${i}${a}`,t)};lr.exports=Qs});var pr=m((Rc,fr)=>{"use strict";var Ne=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};fr.exports=Ne});var v=m((Oc,wr)=>{"use strict";var eo=/\s+/g,Te=class e{constructor(t,r){if(r=ro(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Ae)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(eo," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!dr(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&lo(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&ao)|(this.options.loose&&co))+":"+t,s=hr.get(n);if(s)return s;let o=this.options.loose,i=o?O[R.HYPHENRANGELOOSE]:O[R.HYPHENRANGE];t=t.replace(i,yo(this.options.includePrerelease)),g("hyphen replace",t),t=t.replace(O[R.COMPARATORTRIM],so),g("comparator trim",t),t=t.replace(O[R.TILDETRIM],oo),g("tilde trim",t),t=t.replace(O[R.CARETTRIM],io),g("caret trim",t);let a=t.split(" ").map(p=>uo(p,this.options)).join(" ").split(/\s+/).map(p=>$o(p,this.options));o&&(a=a.filter(p=>(g("loose invalid filter",p,this.options),!!p.match(O[R.COMPARATORLOOSE])))),g("range list",a);let c=new Map,l=a.map(p=>new Ae(p,this.options));for(let p of l){if(dr(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let h=[...c.values()];return hr.set(n,h),h}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>mr(n,r)&&t.set.some(s=>mr(s,r)&&n.every(o=>s.every(i=>o.intersects(i,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new no(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",lo=e=>e.value==="",mr=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(o=>s.intersects(o,t)),s=n.pop();return r},uo=(e,t)=>(e=e.replace(O[R.BUILD],""),g("comp",e,t),e=ho(e,t),g("caret",e),e=fo(e,t),g("tildes",e),e=wo(e,t),g("xrange",e),e=go(e,t),g("stars",e),e),I=e=>!e||e.toLowerCase()==="x"||e==="*",fo=(e,t)=>e.trim().split(/\s+/).map(r=>po(r,t)).join(" "),po=(e,t)=>{let r=t.loose?O[R.TILDELOOSE]:O[R.TILDE];return e.replace(r,(n,s,o,i,a)=>{g("tilde",e,n,s,o,i,a);let c;return I(s)?c="":I(o)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:I(i)?c=`>=${s}.${o}.0 <${s}.${+o+1}.0-0`:a?(g("replaceTilde pr",a),c=`>=${s}.${o}.${i}-${a} <${s}.${+o+1}.0-0`):c=`>=${s}.${o}.${i} <${s}.${+o+1}.0-0`,g("tilde return",c),c})},ho=(e,t)=>e.trim().split(/\s+/).map(r=>mo(r,t)).join(" "),mo=(e,t)=>{g("caret",e,t);let r=t.loose?O[R.CARETLOOSE]:O[R.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,o,i,a,c)=>{g("caret",e,s,o,i,a,c);let l;return I(o)?l="":I(i)?l=`>=${o}.0.0${n} <${+o+1}.0.0-0`:I(a)?o==="0"?l=`>=${o}.${i}.0${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.0${n} <${+o+1}.0.0-0`:c?(g("replaceCaret pr",c),o==="0"?i==="0"?l=`>=${o}.${i}.${a}-${c} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}-${c} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a}-${c} <${+o+1}.0.0-0`):(g("no pr"),o==="0"?i==="0"?l=`>=${o}.${i}.${a}${n} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a} <${+o+1}.0.0-0`),g("caret return",l),l})},wo=(e,t)=>(g("replaceXRanges",e,t),e.split(/\s+/).map(r=>Eo(r,t)).join(" ")),Eo=(e,t)=>{e=e.trim();let r=t.loose?O[R.XRANGELOOSE]:O[R.XRANGE];return e.replace(r,(n,s,o,i,a,c)=>{g("xRange",e,n,s,o,i,a,c);let l=I(o),h=l||I(i),p=h||I(a),E=p;return s==="="&&E&&(s=""),c=t.includePrerelease?"-0":"",l?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&E?(h&&(i=0),a=0,s===">"?(s=">=",h?(o=+o+1,i=0,a=0):(i=+i+1,a=0)):s==="<="&&(s="<",h?o=+o+1:i=+i+1),s==="<"&&(c="-0"),n=`${s+o}.${i}.${a}${c}`):h?n=`>=${o}.0.0${c} <${+o+1}.0.0-0`:p&&(n=`>=${o}.${i}.0${c} <${o}.${+i+1}.0-0`),g("xRange return",n),n})},go=(e,t)=>(g("replaceStars",e,t),e.trim().replace(O[R.STAR],"")),$o=(e,t)=>(g("replaceGTE0",e,t),e.trim().replace(O[t.includePrerelease?R.GTE0PRE:R.GTE0],"")),yo=e=>(t,r,n,s,o,i,a,c,l,h,p,E)=>(I(n)?r="":I(s)?r=`>=${n}.0.0${e?"-0":""}`:I(o)?r=`>=${n}.${s}.0${e?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,I(l)?c="":I(h)?c=`<${+l+1}.0.0-0`:I(p)?c=`<${l}.${+h+1}.0-0`:E?c=`<=${l}.${h}.${p}-${E}`:e?c=`<${l}.${h}.${+p+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),Ro=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var X=m((Ic,Or)=>{"use strict";var V=Symbol("SemVer ANY"),je=class e{static get ANY(){return V}constructor(t,r){if(r=Er(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),qe("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===V?this.value="":this.value=this.operator+this.semver.version,qe("comp",this)}parse(t){let r=this.options.loose?gr[$r.COMPARATORLOOSE]:gr[$r.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new yr(n[2],this.options.loose):this.semver=V}toString(){return this.value}test(t){if(qe("Comparator.test",t,this.options.loose),this.semver===V||t===V)return!0;if(typeof t=="string")try{t=new yr(t,this.options)}catch{return!1}return Pe(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Rr(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new Rr(this.value,r).test(t.semver):(r=Er(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||Pe(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||Pe(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Or.exports=je;var Er=Q(),{safeRe:gr,t:$r}=U(),Pe=Le(),qe=G(),yr=y(),Rr=v()});var B=m((xc,Ir)=>{"use strict";var Oo=v(),Io=(e,t,r)=>{try{t=new Oo(t,r)}catch{return!1}return t.test(e)};Ir.exports=Io});var vr=m((vc,xr)=>{"use strict";var xo=v(),vo=(e,t)=>new xo(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));xr.exports=vo});var Sr=m((bc,br)=>{"use strict";var bo=y(),So=v(),ko=(e,t,r)=>{let n=null,s=null,o=null;try{o=new So(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===-1)&&(n=i,s=new bo(n,r))}),n};br.exports=ko});var Lr=m((Sc,kr)=>{"use strict";var Lo=y(),No=v(),To=(e,t,r)=>{let n=null,s=null,o=null;try{o=new No(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===1)&&(n=i,s=new Lo(n,r))}),n};kr.exports=To});var Ar=m((kc,Tr)=>{"use strict";var Ce=y(),Ao=v(),Nr=M(),Po=(e,t)=>{e=new Ao(e,t);let r=new Ce("0.0.0");if(e.test(r)||(r=new Ce("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let a=new Ce(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||Nr(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||Nr(r,o))&&(r=o)}return r&&e.test(r)?r:null};Tr.exports=Po});var qr=m((Lc,Pr)=>{"use strict";var qo=v(),jo=(e,t)=>{try{return new qo(e,t).range||"*"}catch{return null}};Pr.exports=jo});var ue=m((Nc,Ur)=>{"use strict";var Co=y(),Dr=X(),{ANY:Do}=Dr,Uo=v(),zo=B(),jr=M(),Cr=oe(),Fo=ae(),Go=ie(),Mo=(e,t,r,n)=>{e=new Co(e,n),t=new Uo(t,n);let s,o,i,a,c;switch(r){case">":s=jr,o=Fo,i=Cr,a=">",c=">=";break;case"<":s=Cr,o=Go,i=jr,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(zo(e,t,n))return!1;for(let l=0;l{d.semver===Do&&(d=new Dr(">=0.0.0")),p=p||d,E=E||d,s(d.semver,p.semver,n)?p=d:i(d.semver,E.semver,n)&&(E=d)}),p.operator===a||p.operator===c||(!E.operator||E.operator===a)&&o(e,E.semver))return!1;if(E.operator===c&&i(e,E.semver))return!1}return!0};Ur.exports=Mo});var Fr=m((Tc,zr)=>{"use strict";var Xo=ue(),Vo=(e,t,r)=>Xo(e,t,">",r);zr.exports=Vo});var Mr=m((Ac,Gr)=>{"use strict";var Bo=ue(),_o=(e,t,r)=>Bo(e,t,"<",r);Gr.exports=_o});var Br=m((Pc,Vr)=>{"use strict";var Xr=v(),Ho=(e,t,r)=>(e=new Xr(e,r),t=new Xr(t,r),e.intersects(t,r));Vr.exports=Ho});var Hr=m((qc,_r)=>{"use strict";var Wo=B(),Yo=x();_r.exports=(e,t,r)=>{let n=[],s=null,o=null,i=e.sort((h,p)=>Yo(h,p,r));for(let h of i)Wo(h,t,r)?(o=h,s||(s=h)):(o&&n.push([s,o]),o=null,s=null);s&&n.push([s,null]);let a=[];for(let[h,p]of n)h===p?a.push(h):!p&&h===i[0]?a.push("*"):p?h===i[0]?a.push(`<=${p}`):a.push(`${h} - ${p}`):a.push(`>=${h}`);let c=a.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return c.length{"use strict";var Wr=v(),Ue=X(),{ANY:De}=Ue,_=B(),ze=x(),Jo=(e,t,r={})=>{if(e===t)return!0;e=new Wr(e,r),t=new Wr(t,r);let n=!1;e:for(let s of e.set){for(let o of t.set){let i=Ko(s,o,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},Zo=[new Ue(">=0.0.0-0")],Yr=[new Ue(">=0.0.0")],Ko=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===De){if(t.length===1&&t[0].semver===De)return!0;r.includePrerelease?e=Zo:e=Yr}if(t.length===1&&t[0].semver===De){if(r.includePrerelease)return!0;t=Yr}let n=new Set,s,o;for(let d of e)d.operator===">"||d.operator===">="?s=Jr(s,d,r):d.operator==="<"||d.operator==="<="?o=Zr(o,d,r):n.add(d.semver);if(n.size>1)return null;let i;if(s&&o){if(i=ze(s.semver,o.semver,r),i>0)return null;if(i===0&&(s.operator!==">="||o.operator!=="<="))return null}for(let d of n){if(s&&!_(d,String(s),r)||o&&!_(d,String(o),r))return null;for(let C of t)if(!_(d,String(C),r))return!1;return!0}let a,c,l,h,p=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,E=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;p&&p.prerelease.length===1&&o.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let d of t){if(h=h||d.operator===">"||d.operator===">=",l=l||d.operator==="<"||d.operator==="<=",s){if(E&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===E.major&&d.semver.minor===E.minor&&d.semver.patch===E.patch&&(E=!1),d.operator===">"||d.operator===">="){if(a=Jr(s,d,r),a===d&&a!==s)return!1}else if(s.operator===">="&&!_(s.semver,String(d),r))return!1}if(o){if(p&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===p.major&&d.semver.minor===p.minor&&d.semver.patch===p.patch&&(p=!1),d.operator==="<"||d.operator==="<="){if(c=Zr(o,d,r),c===d&&c!==o)return!1}else if(o.operator==="<="&&!_(o.semver,String(d),r))return!1}if(!d.operator&&(o||s)&&i!==0)return!1}return!(s&&l&&!o&&i!==0||o&&h&&!s&&i!==0||E||p)},Jr=(e,t,r)=>{if(!e)return t;let n=ze(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},Zr=(e,t,r)=>{if(!e)return t;let n=ze(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};Kr.exports=Jo});var P=m((Cc,rn)=>{"use strict";var Fe=U(),en=F(),Qo=y(),tn=xe(),ei=A(),ti=St(),ri=Lt(),ni=At(),si=jt(),oi=Dt(),ii=zt(),ai=Gt(),ci=Xt(),li=x(),ui=Ht(),fi=Yt(),pi=se(),hi=Qt(),di=tr(),mi=M(),wi=oe(),Ei=Se(),gi=ke(),$i=ie(),yi=ae(),Ri=Le(),Oi=ur(),Ii=X(),xi=v(),vi=B(),bi=vr(),Si=Sr(),ki=Lr(),Li=Ar(),Ni=qr(),Ti=ue(),Ai=Fr(),Pi=Mr(),qi=Br(),ji=Hr(),Ci=Qr();rn.exports={parse:ei,valid:ti,clean:ri,inc:ni,diff:si,major:oi,minor:ii,patch:ai,prerelease:ci,compare:li,rcompare:ui,compareLoose:fi,compareBuild:pi,sort:hi,rsort:di,gt:mi,lt:wi,eq:Ei,neq:gi,gte:$i,lte:yi,cmp:Ri,coerce:Oi,Comparator:Ii,Range:xi,satisfies:vi,toComparators:bi,maxSatisfying:Si,minSatisfying:ki,minVersion:Li,validRange:Ni,outside:Ti,gtr:Ai,ltr:Pi,intersects:qi,simplifyRange:ji,subset:Ci,SemVer:Qo,re:Fe.re,src:Fe.src,tokens:Fe.t,SEMVER_SPEC_VERSION:en.SEMVER_SPEC_VERSION,RELEASE_TYPES:en.RELEASE_TYPES,compareIdentifiers:tn.compareIdentifiers,rcompareIdentifiers:tn.rcompareIdentifiers}});var Re=new TextDecoder;function K(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function ft(e,t){let r=String(t??"").split(/\s+/).filter(o=>o.startsWith("sha512-")).map(o=>o.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,o=>String.fromCharCode(o)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function pt(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let o=await r.read();!o.done;o=await r.read()){if(s+=o.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(o.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function z(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return Re.decode(s<0?n:n.subarray(0,s))}function ht(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,o)=>s*256+o,e[t]&127);let n=z(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function Cn(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if(ht(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function Dn(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let o=Re.decode(e.subarray(n+1,r+s-1)),i=o.indexOf("=");t[o.slice(0,i)]=o.slice(i+1),r+=s}return t}function Un(e,t){let r=e.subarray(t,t+512);Cn(r);let n=ht(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function zn(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function Fn(e){let t=z(e,0,100),r=z(e,257,5)==="ustar"?z(e,345,155):"";return r?`${r}/${t}`:t}var ut={x:(e,t)=>({...e,pax:Dn(t).path}),L:(e,t)=>({...e,long:z(t,0,t.length)}),g:e=>e};function dt(e){let t=[],r={};for(let n=0;!zn(e,n);){let{header:s,type:o,data:i,next:a}=Un(e,n);if(n=a,Object.hasOwn(ut,o)){r=ut[o](r,i);continue}(o==="0"||o==="7")&&t.push({path:r.pax??r.long??Fn(s),bytes:i}),r={}}return t}var de=D(P(),1);var b=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function fe(e,t){let r=[],n=0;for(;;){let s=await b(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function Ge(e,{id:t,path:r,bytes:n},s){for(let o=0;o{}),a}}async function Di(e,t){let r=[],n=0;for(;;){let{done:s,value:o}=await e.read();if(s)return r;if(n+=o.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(o)}}async function Ui(e,t){try{return await Di(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function nn(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await Ui(e.body.getReader(),t)).arrayBuffer())}var zi=/[\\\0:*?"<>|]/,Fi=e=>e.split("/").some(t=>!t||t==="."||t==="..");function Gi(e){return typeof e!="string"||!e||zi.test(e)?!0:Fi(e)}function q(e){if(Gi(e))throw new Error(`Unsafe package path: ${e}`);return e}var Mi=new TextDecoder,Xi=["preinstall","install","postinstall"];async function sn(e){let t=new Map;for(let r of dt(await pt(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=q(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var Vi=e=>Xi.some(t=>e.scripts?.[t]),Bi=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function _i(e,t){return Vi(e)||e.gypfile?!0:Bi(t)}function on(e,t,r){let n=JSON.parse(Mi.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(_i(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}function W(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var S="webfront.project.json",Y=1,Me=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,Hi=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,Wi=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,an=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,Xe=/^[A-Za-z_][A-Za-z0-9_]*$/,cn=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],Yi=["files","publish","fetch"],$=e=>{throw new Error(`${S}: ${e}`)};function T(e,t){return W(e)||$(`${t} must be an object`),e}function Ve(e,t,r){for(let n of Object.keys(e))t.includes(n)||$(`unknown key "${n}" in ${r}`)}function pe(e,t){typeof e!="string"&&$(`${t} must be a project path`);try{return q(e)}catch{return $(`${t} is not a safe project-relative path: ${e}`)}}function ln(e,t){return(!Array.isArray(e)||e.length>256)&&$(`${t} must be an array of at most 256 paths`),e.map((r,n)=>pe(r,`${t}[${n}]`))}function Ji(e){let t=T(e,"dependencies");for(let[r,n]of Object.entries(t))Me.test(r)||$(`invalid npm package name "${r}"`),(typeof n!="string"||!Wi.test(n)||n!==n.trim())&&$(`invalid version range for "${r}"`);return t}var Be=e=>e.startsWith("/")&&!e.startsWith("//")&&!e.includes("\\");function Zi(e){if(typeof e!="string"&&$("registry must be a URL"),Be(e))return e;let t;try{t=new URL(e)}catch{return $("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&$("registry must use https"),e}function Ki(e){let t=T(e,"scripts");for(let[r,n]of Object.entries(t))(!an.test(r)||typeof n!="string"||!n||n.length>1024)&&$(`invalid script "${r}"`);return t}function Qi(e){let t=T(e,"entries");for(let[r,n]of Object.entries(t))an.test(r)||$(`invalid entry name "${r}"`),pe(n,`entries.${r}`);return t}function ea(e,t){let r=T(e,"providers");for(let[n,s]of Object.entries(r))Xe.test(n)||$(`invalid provider name "${n}"`),T(s,`providers.${n}`),Ve(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&$(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||pe(s.entry,`providers.${n}.entry`),pe(s.output,`providers.${n}.output`).endsWith(".hpp")||$(`providers.${n}.output must be a .hpp file`);return r}function ta(e){let t=T(e,"test");return Ve(t,["specs"],"test"),t.specs!==void 0&&ln(t.specs,"test.specs"),t}function ra(e,t){let r;try{r=new URL(e)}catch{return $(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&$(`${t} must be an https origin without a path`),e}function na(e){let t=T(e,"permissions");for(let r of Object.keys(t))Yi.includes(r)||$(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&ln(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&$("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>ra(r,`permissions.fetch[${n}]`))),t}function sa(e){(typeof e.name!="string"||!Me.test(e.name))&&$("name must be a lower-case npm package name"),(typeof e.version!="string"||!Hi.test(e.version))&&$("version must be a semantic version")}function oa(e){e.format!==Y&&(Number.isInteger(e.format)&&e.format>Y&&$(`format ${e.format} is not supported by this environment (it reads format ${Y}); update the environment`),$(`format must be ${Y}`))}function J(e){T(e,"the manifest"),oa(e),Ve(e,cn,"the manifest"),sa(e);let t=e.entries===void 0?{}:Qi(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:Ji(e.dependencies),entries:t,providers:e.providers===void 0?{}:ea(e.providers,t),...e.registry===void 0?{}:{registry:Zi(e.registry)},...e.scripts===void 0?{}:{scripts:Ki(e.scripts)},...e.test===void 0?{}:{test:ta(e.test)},...e.permissions===void 0?{}:{permissions:na(e.permissions)}}}function _e(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return $("not valid JSON")}return{source:t,manifest:J(t)}}function Wc(e){return _e(e).manifest}function He(e){let t={};for(let r of cn)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` +`}function un(e){return{format:Y,name:e,version:"0.1.0",dependencies:{}}}function fn(e){let r=(String(e??"").split("/").filter(Boolean).pop()??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"");return Me.test(r)?r:"webfront-app"}async function he(e){let t=JSON.stringify(Object.entries(e).sort(([n],[s])=>ns?1:0)),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(r)].map(n=>n.toString(16).padStart(2,"0")).join("")}var We=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),me=(e,t)=>`${e.replace("/","+")}@${t}`,Ye=(e,t,r)=>`${me(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function ia(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function aa(e,t){let r=e["dist-tags"]?.[t];return r||(de.default.valid(t)?t:de.default.maxSatisfying(Object.keys(e.versions??{}),t))}function ca(e,t,r){let n=r||"latest",s=aa(e,n),o=e.versions?.[s];if(!o||!de.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:o}}async function la(e,t,r,{fetchImpl:n,signal:s}){let o=new URL(t.dist?.tarball,r);if(o.protocol!=="https:"&&o.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let i=await n(o,{signal:s});if(!i.ok)throw new Error(`Package download for ${e}: HTTP ${i.status}`);let a=await nn(i);return{bytes:a,integrity:await ft(a,t.dist.integrity)}}function Je(e){let t=new URL(e,globalThis.location?.href),r=t.origin===globalThis.location?.origin;if(e.startsWith("/")?!Be(e)||!r:t.protocol!=="https:"&&!r)throw new Error(`The npm registry must use HTTPS or the application origin: ${e}`);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function j(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!We(e))throw new Error(`Unsupported npm package name: ${e}`);let o=Je(r),i={fetchImpl:n,signal:s},{version:a,manifest:c}=ca(await ia(e,o,i),e,t),{bytes:l,integrity:h}=await la(e,c,o,i),p=await sn(l),E=on(p,e,a);return{id:me(e,a),key:Ye(e,a,h),manifest:E,integrity:h,files:p}}var we=D(P(),1);function ua(e,t,r){let n=e?.roots?.[t];return n?.requested===r&&e.packages[n.id]?e.packages[n.id]:we.default.validRange(r)?Object.values(e?.packages??{}).filter(o=>o.name===t&&we.default.satisfies(o.version,r)).sort((o,i)=>we.default.rcompare(o.version,i.version))[0]??null:null}function pn({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=j,previous:s}){let o=new Map;return async(i,a)=>{let c=`${i}@${a}`;if(o.has(c))return o.get(c);let l=ua(s,i,a),h=await n(i,l?.version??a,{registry:e,fetchImpl:t,signal:r});if(l&&h.integrity!==l.integrity)throw new Error(`${h.id} no longer matches the integrity recorded in the lock`);return o.set(c,h),h}}var hn=D(P(),1),dn=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function fa(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw dn(e,t,r)}function pa(e,[t,r],{nodes:n,roots:s}){let o=s[t]?.id??e.dependencies[t];if(!o)return fa(e,t,r);if(!hn.default.satisfies(n[o].version,r))throw dn(e,t,r);return o}function ha(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=pa(e,r,t);n&&(e.dependencies[r[0]]=n)}}function mn(e,t){for(let r of Object.values(e))ha(r,{nodes:e,roots:t})}var wn=D(P(),1);function da(e,t){return!We(t.name)||!wn.default.valid(t.version)?!1:e===me(t.name,t.version)}function ma(e){return e.integrity?.startsWith("sha512-")?e.key===Ye(e.name,e.version,e.integrity):!1}function wa(e,t,r){if(!da(t,r)||!ma(r))throw new Error("Invalid locked package");for(let n of r.files)q(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function Ea(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function Ze(e){if(!Ea(e))throw new Error("Unsupported package lock");if(Object.keys(e.packages).length>512)throw new Error("The package lock exceeds 512 packages");for(let[t,r]of Object.entries(e.packages))wa(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function ga(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function $a(e,t){let r={};for(let n of e){let{name:s,version:o}=K(n);r[s]={requested:o||"latest",id:await t(s,o||"latest")}}return r}async function En(e,t={}){let r=pn(t),n={nodes:{},downloads:new Map,total:0},s=async(i,a)=>{t.signal?.throwIfAborted();let c=await r(i,a);if(n.nodes[c.id])return c.id;ga(n,i,c);for(let[l,h]of Object.entries(c.manifest.dependencies??{}).sort())n.nodes[c.id].dependencies[l]=await s(l,h);return c.id},o=await $a(e,s);return mn(n.nodes,o),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:o,packages:n.nodes},downloads:n.downloads}}var Ke=D(P(),1);var k="webfront-packages.lock.json",Qe=".webfront/developer/packages",ya=new TextDecoder,Ra=new TextEncoder,Ee="No webfront.project.json: run wf init",ge="The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again";async function gn(e,t){try{return await fe(e,t)}catch(r){if(r.message.includes("Cannot read project file:"))return null;throw r}}function Oa(e,t,r){return t?r===t.requested?!0:Ke.default.validRange(r)!==null&&Ke.default.satisfies(e.packages[t.id].version,r):!1}function Ia(e,t){let r=Object.keys(t);return r.length===Object.keys(e.roots).length&&r.every(n=>Oa(e,e.roots[n],t[n]))}function xa(e,t,r){return e?t?t.manifestDigest===void 0?Ia(t,e.dependencies)?"legacy":"desynchronized":t.manifestDigest===r?"consistent":"desynchronized":"unlocked":"no-manifest"}async function Z(e){let t=await b(e,"state",`${S} +${k}`),r=await gn(e,S),n=await gn(e,k),{source:s,manifest:o}=r?_e(r):{source:null,manifest:null},i=n?Ze(JSON.parse(ya.decode(n))):null,a=o?await he(o.dependencies):null;return{manifest:o,source:s,lock:i,token:t,status:xa(o,i,a),digest:a}}var yn=e=>e.status==="desynchronized"?`Warning: ${ge}.\r +`:"";async function Rn(e,t,r,{signal:n}={}){let s=[];try{for(let[o,i]of t){n?.throwIfAborted();let a=await b(e,"begin",o,!1);s.push(a),await Ge(e,{id:a,path:"output",bytes:i},n)}n?.throwIfAborted(),await b(e,"commitGroup",s.join(` `),`${S} -${k}`,r.token)}catch(o){for(let i of s)await b(e,"abort",i).catch(()=>{});throw o}}function gn(e,t,r){let n=e?.entries??{};if(t!==void 0)return Object.hasOwn(n,t)?n[t]:t;if(Object.hasOwn(n,"main"))return n.main;let s=Object.keys(n);if(s.length===1)return n[s[0]];throw new Error(`Usage: ${r} (declare entries.main in ${S} to omit the entry)`)}function ml(e,[t,r,n,...s]){if(t&&Object.hasOwn(e?.providers??{},t)&&r===void 0){let i=e.providers[t];return{entry:gn(e,i.entry),output:i.output,className:t}}if(!t||r!=="--output"||s.length||!n?.endsWith(".hpp"))throw new Error("wf embed requires or --output ");let o=n.split("/").pop().slice(0,-4);if(!He.test(o))throw new Error(`wf embed: ${o} is not a C++ class name; name the output .hpp`);return{entry:gn(e,t),output:n,className:o}}var $e=e=>ya.encode(e);var nt=D(P(),1);var Rn=e=>`${Ke}/${e.key}`,On=e=>`${Ke}/${e.key}.json`,va=new TextEncoder,ba=new TextDecoder,In=e=>e.message.includes("Cannot read project file:");async function xn(e){return[...new Uint8Array(await crypto.subtle.digest("SHA-256",e))].map(r=>r.toString(16).padStart(2,"0")).join("")}async function ye(e,t,r,{signal:n}={}){let s={};for(let i of[...r.keys()].sort())s[i]=await xn(r.get(i));await H(e,Rn(t),r,{signal:n});let o=JSON.stringify({format:1,integrity:t.integrity,files:s},null,2)+` -`;await H(e,On(t),new Map([["output",va.encode(o)]]),{directory:!1,signal:n})}async function Sa(e,t){try{return JSON.parse(ba.decode(await fe(e,On(t))))}catch(r){return In(r)?null:{}}}var ka=(e,t)=>Object.keys(e.files).sort().join(` +${k}`,r.token)}catch(o){for(let i of s)await b(e,"abort",i).catch(()=>{});throw o}}function $n(e,t,r){let n=e?.entries??{};if(t!==void 0)return Object.hasOwn(n,t)?n[t]:t;if(Object.hasOwn(n,"main"))return n.main;let s=Object.keys(n);if(s.length===1)return n[s[0]];throw new Error(`Usage: ${r} (declare entries.main in ${S} to omit the entry)`)}function El(e,[t,r,n,...s]){if(t&&Object.hasOwn(e?.providers??{},t)&&r===void 0){let i=e.providers[t];return{entry:$n(e,i.entry),output:i.output,className:t}}if(!t||r!=="--output"||s.length||!n?.endsWith(".hpp"))throw new Error("wf embed requires or --output ");let o=n.split("/").pop().slice(0,-4);if(!Xe.test(o))throw new Error(`wf embed: ${o} is not a C++ class name; name the output .hpp`);return{entry:$n(e,t),output:n,className:o}}var $e=e=>Ra.encode(e);var st=D(P(),1);var On=e=>`${Qe}/${e.key}`,In=e=>`${Qe}/${e.key}.json`,ba=new TextEncoder,Sa=new TextDecoder,xn=e=>e.message.includes("Cannot read project file:");async function vn(e){return[...new Uint8Array(await crypto.subtle.digest("SHA-256",e))].map(r=>r.toString(16).padStart(2,"0")).join("")}async function ye(e,t,r,{signal:n}={}){let s={};for(let i of[...r.keys()].sort())s[i]=await vn(r.get(i));await H(e,On(t),r,{signal:n});let o=JSON.stringify({format:1,integrity:t.integrity,files:s},null,2)+` +`;await H(e,In(t),new Map([["output",ba.encode(o)]]),{directory:!1,signal:n})}async function ka(e,t){let r;try{r=await fe(e,In(t))}catch(n){if(xn(n))return null;throw n}try{return JSON.parse(Sa.decode(r))}catch{return{}}}var La=(e,t)=>Object.keys(e.files).sort().join(` `)===[...t.files].sort().join(` -`);async function La(e,t,r){let n=[],s=0;for(;;){let o;try{o=await b(e,"read",t,s)}catch(i){if(In(i))return null;throw i}if(s+=o.length,s>r)return null;if(n.push(o),o.length<262144)return new Uint8Array(await new Blob(n).arrayBuffer())}}async function Qe(e,t,{signal:r,limit:n=1/0}={}){let s=await Sa(e,t);if(!s)return{state:"missing",size:0};if(s.integrity!==t.integrity||!W(s.files)||!ka(s,t))return{state:"corrupted",size:0};let o=0;for(let i of t.files){r?.throwIfAborted();let a=await La(e,`${Rn(t)}/${i}`,n-o);if(!a||await xn(a)!==s.files[i])return{state:"corrupted",size:0};o+=a.length}return{state:"valid",size:o}}var yl=async(e,t,r)=>(await Qe(e,t,r)).state;var Na="https://registry.npmjs.org/";function Ta({registry:e,registryExplicit:t}={},r){return t&&e?{url:e,source:"application option"}:r?.registry?{url:r.registry,source:S}:{url:e||Na,source:"default"}}function et(e,t){let r=Ta(e,t);return Ve(r.url),r}var tt=({url:e,source:t})=>`Registry: ${e} (${t})`,Aa=256*1024*1024,Pa=e=>[...e.values()].reduce((t,r)=>t+r.length,0),qa=e=>new Error(`The locked packages exceed ${e/(1024*1024)} MiB unpacked`);async function ja(e,t,{signal:r,limit:n}){let s=[],o=0;for(let[i,a]of Object.entries(t.packages)){r?.throwIfAborted();let c=await Qe(e,a,{signal:r,limit:n-o});o+=c.size,s.push({id:i,node:a,state:c.state})}return{states:s,size:o}}async function rt(e,t,{registry:r,offline:n=!1,signal:s,progress:o=()=>{},fetchImpl:i=fetch,limit:a=Aa}){let{states:c,size:l}=await ja(e,t,{signal:s,limit:a}),h=l,p={verified:c.filter(({state:E})=>E==="valid").length,restored:0,problems:[]};for(let{id:E,node:d,state:C}of c.filter(({state:L})=>L!=="valid")){if(n){p.problems.push(`${E} (${C})`);continue}o(`Restoring ${E}${C==="corrupted"?" (corrupted in the cache)":""}`);let L=await j(d.name,d.version,{registry:r,fetchImpl:i,signal:s});if(L.integrity!==d.integrity)throw new Error(`${E} no longer matches the integrity recorded in the lock`);if(h+=Pa(L.files),h>a)throw qa(a);await ye(e,d,L.files,{signal:s}),p.restored++}if(p.problems.length)throw new Error(`The cache does not match ${k}; missing or corrupted, nothing downloaded:\r +`);async function Na(e,t,r){let n=[],s=0;for(;;){let o;try{o=await b(e,"read",t,s)}catch(i){if(xn(i))return null;throw i}if(s+=o.length,s>r)return null;if(n.push(o),o.length<262144)return new Uint8Array(await new Blob(n).arrayBuffer())}}async function et(e,t,{signal:r,limit:n=1/0}={}){let s=await ka(e,t);if(!s)return{state:"missing",size:0};if(s.integrity!==t.integrity||!W(s.files)||!La(s,t))return{state:"corrupted",size:0};let o=0;for(let i of t.files){r?.throwIfAborted();let a=await Na(e,`${On(t)}/${i}`,n-o);if(!a||await vn(a)!==s.files[i])return{state:"corrupted",size:0};o+=a.length}return{state:"valid",size:o}}var Ol=async(e,t,r)=>(await et(e,t,r)).state;var Ta="https://registry.npmjs.org/";function Aa({registry:e,registryExplicit:t}={},r){return t&&e?{url:e,source:"application option"}:r?.registry?{url:r.registry,source:S}:{url:e||Ta,source:"default"}}function tt(e,t){let r=Aa(e,t);return Je(r.url),r}var rt=({url:e,source:t})=>`Registry: ${e} (${t})`,Pa=256*1024*1024,qa=e=>[...e.values()].reduce((t,r)=>t+r.length,0),ja=e=>new Error(`The locked packages exceed ${e/(1024*1024)} MiB unpacked`);async function Ca(e,t,{signal:r,limit:n}){let s=[],o=0;for(let[i,a]of Object.entries(t.packages)){r?.throwIfAborted();let c=await et(e,a,{signal:r,limit:n-o});o+=c.size,s.push({id:i,node:a,state:c.state})}return{states:s,size:o}}async function nt(e,t,{registry:r,offline:n=!1,signal:s,progress:o=()=>{},fetchImpl:i=fetch,limit:a=Pa}){let{states:c,size:l}=await Ca(e,t,{signal:s,limit:a}),h=l,p={verified:c.filter(({state:E})=>E==="valid").length,restored:0,problems:[]};for(let{id:E,node:d,state:C}of c.filter(({state:L})=>L!=="valid")){if(n){p.problems.push(`${E} (${C})`);continue}o(`Restoring ${E}${C==="corrupted"?" (corrupted in the cache)":""}`);let L=await j(d.name,d.version,{registry:r,fetchImpl:i,signal:s});if(L.integrity!==d.integrity)throw new Error(`${E} no longer matches the integrity recorded in the lock`);if(h+=qa(L.files),h>a)throw ja(a);await ye(e,d,L.files,{signal:s}),p.restored++}if(p.problems.length)throw new Error(`The cache does not match ${k}; missing or corrupted, nothing downloaded:\r ${p.problems.join(`\r `)}\r -Run wf restore to download them.`);return p}function Ca(e){let t=e.includes("--offline");if(e.some(r=>r!=="--offline"))throw new Error("Usage: wf restore [--offline]");return{offline:t}}async function bl(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}={}){let{offline:a}=Ca(t),c=await Z(e);if(!c.manifest)throw new Error(Ee);if(!c.lock)throw new Error(`No ${k}: run wf install to resolve the dependencies`);let l=a?null:et({registry:r,registryExplicit:n},c.manifest);o(a?"Offline: no registry is contacted":tt(l));let h=await rt(e,c.lock,{registry:l?.url,offline:a,signal:s,progress:o,fetchImpl:i}),p=Object.keys(c.lock.packages).length,E=a?`Cache verified offline: ${p} packages match ${k}.`:`Restored ${h.restored} of ${p} packages (${h.verified} already in the cache). Lock: ${k}`;return{...h,registry:l,text:$n(c)+E}}var Sn=e=>{let{name:t,version:r}=K(e);return[t,r||void 0]};function Da(e,t){let{version:r}=e.packages[t.id];return!(nt.default.valid(t.requested)!==null)&&t.requested!=="latest"&&nt.default.validRange(t.requested)!==null?t.requested:`^${r}`}async function jl(e,[t,...r],{signal:n}={}){if(r.length)throw new Error("Usage: wf init [name]");let{lock:s}=await Z(e),o=mn(t??wn(""));s&&(o.dependencies=Object.fromEntries(Object.entries(s.roots).map(([a,c])=>[a,Da(s,c)]))),J(o),await H(e,S,new Map([["output",$e(Je(o))]]),{directory:!1,replace:!1,signal:n});let i=s?` with the ${Object.keys(o.dependencies).length} dependencies of ${k}`:"";return`Created ${S}${i}. Add libraries with wf install .`}function Ua(e,t){let r={...e.manifest.dependencies},n=new Set;for(let s of t){let[o,i]=Sn(s);r[o]=i??"latest",i&&i!=="latest"&&n.add(o)}return J({...e.source,dependencies:r}),{dependencies:r,explicit:n}}function za(e,t){let r={...e.source,dependencies:t};return J(r),r}function Fa({dependencies:e,explicit:t},r,n){let s={...e};for(let o of n){let i=Sn(o)[0];t.has(i)||(s[i]=`^${r.packages[r.roots[i].id].version}`)}return s}async function Ga(e,t,r){let n=Object.entries(e).map(([i,a])=>`${i}@${a}`),{lock:s,downloads:o}=await fn(n,{registry:r.registry,signal:r.signal,fetchImpl:r.fetchImpl,previous:t,download:async(...i)=>(r.progress(`Resolving ${i[0]}@${i[1]}`),j(...i))});return{lock:s,downloads:o}}async function Ma(e,t,r,{signal:n,progress:s}){for(let[o,i]of r)s(`Storing ${o}`),await ye(e,t.packages[o],i,{signal:n})}function Xa(e){let t=e.includes("--update"),r=e.filter(n=>n!=="--update");if(r.some(n=>n.startsWith("-")))throw new Error("Usage: wf install [--update] [[@range] ...]");return{update:t,specs:r}}async function vn(e,t,{manifest:r,lock:n},s){let o=new Map([[k,$e(JSON.stringify(n,null,2)+` -`)]]);r&&o.set(S,$e(Je(r))),await yn(e,o,t,s)}var bn=async(e,t)=>({format:e.format,manifestDigest:await we(t),...e});async function Cl(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}){let{update:a,specs:c}=Xa(t),l=await Z(e);if(!l.manifest)throw new Error(Ee);let h=et({registry:r,registryExplicit:n},l.manifest),p={registry:h.url,signal:s,fetchImpl:i,progress:o};if(c.length&&a)throw new Error("Usage: wf install --update does not take packages");if(c.length&&l.status==="desynchronized")throw new Error(ge);if(!c.length&&!a&&l.status==="desynchronized")throw new Error(ge);o(tt(h));let E=l.status==="consistent"||l.status==="legacy";if(!c.length&&!a&&E){let{restored:it}=await rt(e,l.lock,p);if(l.status==="consistent")return{lock:l.lock,restored:it,registry:h};let at=await bn(l.lock,l.manifest.dependencies);return await vn(e,l,{manifest:null,lock:at},{signal:s}),{lock:at,restored:it,registry:h}}let d=Ua(l,c),C=E&&!a?l.lock:void 0,L=await Ga(d.dependencies,C,p),st=Fa(d,L.lock,c);await Ma(e,L.lock,L.downloads,{signal:s,progress:o});let ot=await bn(L.lock,st),kn=c.length?za(l,st):null;return await vn(e,l,{manifest:kn,lock:ot},{signal:s}),{lock:ot,restored:0,registry:h}}export{yl as cacheState,Na as defaultRegistry,we as dependenciesDigest,tt as describeRegistry,ge as desynchronized,j as downloadPackage,Ta as effectiveRegistry,ml as embedTarget,ia as exactVersion,He as identifier,jl as initProject,Qe as inspectCache,Cl as install,Z as loadProject,k as lockPath,Oa as locksDependencies,Y as manifestFormat,wn as manifestName,S as manifestPath,mn as newManifest,Ee as noManifest,_e as npmName,Rn as packageDirectory,Ke as packageRoot,ul as parseManifest,yn as publishTogether,Ye as readManifest,On as recordPath,gn as resolveEntry,fn as resolvePackages,bl as restore,rt as restorePackages,q as safePackagePath,Je as serializeManifest,ye as storePackage,$n as syncNotice,$e as textBytes,Aa as unpackedLimit,et as usableRegistry,Be as validateLock,J as validateManifest}; +Run wf restore to download them.`);return p}function Da(e){let t=e.includes("--offline");if(e.some(r=>r!=="--offline"))throw new Error("Usage: wf restore [--offline]");return{offline:t}}async function kl(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}={}){let{offline:a}=Da(t),c=await Z(e);if(!c.manifest)throw new Error(Ee);if(!c.lock)throw new Error(`No ${k}: run wf install to resolve the dependencies`);let l=a?null:tt({registry:r,registryExplicit:n},c.manifest);o(a?"Offline: no registry is contacted":rt(l));let h=await nt(e,c.lock,{registry:l?.url,offline:a,signal:s,progress:o,fetchImpl:i}),p=Object.keys(c.lock.packages).length,E=a?`Cache verified offline: ${p} packages match ${k}.`:`Restored ${h.restored} of ${p} packages (${h.verified} already in the cache). Lock: ${k}`;return{...h,registry:l,text:yn(c)+E}}var kn=e=>{let{name:t,version:r}=K(e);return[t,r||void 0]};function Ua(e,t){let{version:r}=e.packages[t.id];return!(st.default.valid(t.requested)!==null)&&t.requested!=="latest"&&st.default.validRange(t.requested)!==null?t.requested:`^${r}`}async function Dl(e,[t,...r],{signal:n}={}){if(r.length)throw new Error("Usage: wf init [name]");let{lock:s}=await Z(e),o=un(t??fn(""));s&&(o.dependencies=Object.fromEntries(Object.entries(s.roots).map(([a,c])=>[a,Ua(s,c)]))),J(o),await H(e,S,new Map([["output",$e(He(o))]]),{directory:!1,replace:!1,signal:n});let i=s?` with the ${Object.keys(o.dependencies).length} dependencies of ${k}`:"";return`Created ${S}${i}. Add libraries with wf install .`}function za(e,t){let r={...e.manifest.dependencies},n=new Set;for(let s of t){let[o,i]=kn(s);r[o]=i??"latest",i&&i!=="latest"&&n.add(o)}return J({...e.source,dependencies:r}),{dependencies:r,explicit:n}}function Fa(e,t){let r={...e.source,dependencies:t};return J(r),r}function Ga({dependencies:e,explicit:t},r,n){let s={...e};for(let o of n){let i=kn(o)[0];t.has(i)||(s[i]=`^${r.packages[r.roots[i].id].version}`)}return s}async function Ma(e,t,r){let n=Object.entries(e).map(([i,a])=>`${i}@${a}`),{lock:s,downloads:o}=await En(n,{registry:r.registry,signal:r.signal,fetchImpl:r.fetchImpl,previous:t,download:async(...i)=>(r.progress(`Resolving ${i[0]}@${i[1]}`),j(...i))});return{lock:s,downloads:o}}async function Xa(e,t,r,{signal:n,progress:s}){for(let[o,i]of r)s(`Storing ${o}`),await ye(e,t.packages[o],i,{signal:n})}function Va(e){let t=e.includes("--update"),r=e.filter(n=>n!=="--update");if(r.some(n=>n.startsWith("-")))throw new Error("Usage: wf install [--update] [[@range] ...]");return{update:t,specs:r}}async function bn(e,t,{manifest:r,lock:n},s){let o=new Map([[k,$e(JSON.stringify(n,null,2)+` +`)]]);r&&o.set(S,$e(He(r))),await Rn(e,o,t,s)}var Sn=async(e,t)=>({format:e.format,manifestDigest:await he(t),...e});async function Ul(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}){let{update:a,specs:c}=Va(t),l=await Z(e);if(!l.manifest)throw new Error(Ee);let h=tt({registry:r,registryExplicit:n},l.manifest),p={registry:h.url,signal:s,fetchImpl:i,progress:o};if(c.length&&a)throw new Error("Usage: wf install --update does not take packages");if(c.length&&l.status==="desynchronized")throw new Error(ge);if(!c.length&&!a&&l.status==="desynchronized")throw new Error(ge);o(rt(h));let E=l.status==="consistent"||l.status==="legacy";if(!c.length&&!a&&E){let{restored:at}=await nt(e,l.lock,p);if(l.status==="consistent")return{lock:l.lock,restored:at,registry:h};let ct=await Sn(l.lock,l.manifest.dependencies);return await bn(e,l,{manifest:null,lock:ct},{signal:s}),{lock:ct,restored:at,registry:h}}let d=za(l,c),C=E&&!a?l.lock:void 0,L=await Ma(d.dependencies,C,p),ot=Ga(d,L.lock,c);await Xa(e,L.lock,L.downloads,{signal:s,progress:o});let it=await Sn(L.lock,ot),Ln=c.length?Fa(l,ot):null;return await bn(e,l,{manifest:Ln,lock:it},{signal:s}),{lock:it,restored:0,registry:h}}export{Ol as cacheState,Ta as defaultRegistry,he as dependenciesDigest,rt as describeRegistry,ge as desynchronized,j as downloadPackage,Aa as effectiveRegistry,El as embedTarget,Hi as exactVersion,Xe as identifier,Dl as initProject,et as inspectCache,Ul as install,Z as loadProject,k as lockPath,Ia as locksDependencies,Y as manifestFormat,fn as manifestName,S as manifestPath,un as newManifest,Ee as noManifest,Me as npmName,On as packageDirectory,Qe as packageRoot,Wc as parseManifest,Rn as publishTogether,_e as readManifest,In as recordPath,$n as resolveEntry,En as resolvePackages,kl as restore,nt as restorePackages,q as safePackagePath,Be as sameOriginPath,He as serializeManifest,ye as storePackage,yn as syncNotice,$e as textBytes,Pa as unpackedLimit,tt as usableRegistry,Ze as validateLock,J as validateManifest}; diff --git a/js/developer/environment/registry.mjs b/js/developer/environment/registry.mjs index adf15642..66704627 100644 --- a/js/developer/environment/registry.mjs +++ b/js/developer/environment/registry.mjs @@ -3,6 +3,7 @@ import semver from 'semver'; import {responseBytes} from './io.mjs'; import {verifyIntegrity} from '../components/tools/wf.mjs'; import {readArchive, checkedManifest} from './archive.mjs'; +import {sameOriginPath} from './manifest.mjs'; export const safeName = name => /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(name); export const idOf = (name, version) => `${name.replace('/', '+')}@${version}`; @@ -40,9 +41,11 @@ async function fetchTarball(name, manifest, base, {fetchImpl, signal}) { } // Like the environment archive: HTTPS, or the application's own origin for a local mirror. +// A path must also resolve on that origin, whatever the parser makes of it. export function registryBase(registry) { const base = new URL(registry, globalThis.location?.href); - if (base.protocol !== 'https:' && base.origin !== globalThis.location?.origin) + const local = base.origin === globalThis.location?.origin; + if (registry.startsWith('/') ? !sameOriginPath(registry) || !local : base.protocol !== 'https:' && !local) throw new Error(`The npm registry must use HTTPS or the application origin: ${registry}`); if (!base.pathname.endsWith('/')) base.pathname += '/'; return base; diff --git a/js/developer/tools/manifest-check.mjs b/js/developer/tools/manifest-check.mjs index d9ed3339..a7d59424 100644 --- a/js/developer/tools/manifest-check.mjs +++ b/js/developer/tools/manifest-check.mjs @@ -40,6 +40,7 @@ test('invalid manifests are explicit errors, never silent fallbacks', () => { [{...minimal, dependencies: {'../x': '1.0.0'}}, /invalid npm package name/], [{...minimal, dependencies: {react: 'file:../react'}}, /invalid version range/], [{...minimal, registry: 'http://insecure.test/'}, /registry must use https/], + [{...minimal, registry: '/\\registry.test/'}, /registry must be an https URL or an absolute path/], [{...minimal, entries: {main: '../outside.tsx'}}, /safe project-relative path/], [{...minimal, entries: {main: '/etc/passwd'}}, /safe project-relative path/], [{...minimal, providers: {'not valid': {entry: 'a.tsx', output: 'a.hpp'}}}, /invalid provider name/], diff --git a/js/developer/tools/restore-check.mjs b/js/developer/tools/restore-check.mjs index 7ca4ca5d..8938c316 100644 --- a/js/developer/tools/restore-check.mjs +++ b/js/developer/tools/restore-check.mjs @@ -2,7 +2,7 @@ // node:assert, they use only browser APIs, so that they can move to wf test. import {test, before} from 'node:test'; import assert from 'node:assert/strict'; -import {install, initProject, restore, restorePackages, effectiveRegistry, cacheState, validateLock, lockPath, manifestPath, packageRoot} from '../environment/packages.bundle.mjs'; +import {install, initProject, restore, restorePackages, effectiveRegistry, usableRegistry, cacheState, validateLock, lockPath, manifestPath, packageRoot} from '../environment/packages.bundle.mjs'; import {syntheticPackages, registryFiles} from './registry-fixture.mjs'; import {memoryBridge} from './memory-bridge.mjs'; @@ -116,6 +116,29 @@ test('the application registry takes precedence over the manifest one, which tak await assert.rejects(restore(bridge, [], {registry: 'http://plain.test/', registryExplicit: true, fetchImpl: mirror.fetchImpl}), /HTTPS or the application origin/); }); +test('a registry path never leaves the application origin, however a URL parser reads it', () => { + // On an HTTPS page, "/\\host" resolves to https://host/, which an HTTPS check alone would accept. + globalThis.location = new URL('https://app.test/webfront-bootstrap.html'); + try { + assert.equal(usableRegistry({registry: '/mirror/', registryExplicit: true}).url, '/mirror/'); + for (const registry of ['//registry.test/', '/\\registry.test/', '/\\\\registry.test/', 'http://registry.test/']) + assert.throws(() => usableRegistry({registry, registryExplicit: true}), /HTTPS or the application origin/, registry); + assert.equal(usableRegistry({registry: 'https://registry.test/', registryExplicit: true}).url, 'https://registry.test/'); + } finally { delete globalThis.location; } +}); + +test('a bridge failure while reading a record is reported, not taken for a corrupted cache', async () => { + const {bridge} = await lockedProject(); + const failing = {cppFunction: name => async (...args) => { + if (name.endsWith('.read') && args[0].endsWith('.json') && args[0].includes('.webfront/')) throw new Error('Bridge disconnected'); + return bridge.cppFunction(name)(...args); + }}; + const source = served(registries.local); + await assert.rejects(restore(failing, ['--offline'], {}), /Bridge disconnected/); + await assert.rejects(restore(failing, [], explicit(source)), /Bridge disconnected/); + assert.equal(source.requests.length, 0, 'a valid package is not downloaded again'); +}); + test('a changed archive or a package missing from the registry fails and keeps lock and valid cache intact', async () => { const {bridge, storage} = await lockedProject(registries.genuine, ['webfront-fixture-lib@1.0.0', 'webfront-fixture-tampered@1.0.0']); const lock = json(storage, lockPath); diff --git a/test/unit/DeveloperTests.cpp b/test/unit/DeveloperTests.cpp index 28a35062..a230d731 100644 --- a/test/unit/DeveloperTests.cpp +++ b/test/unit/DeveloperTests.cpp @@ -340,7 +340,7 @@ SCENARIO("The developer application needs an explicit project and a trusted envi REQUIRE_THROWS_AS(app.bootstrap("developer", trusted), std::logic_error); } THEN("a registry that is neither HTTPS nor same-origin is refused") { - for (const auto* registry : {"http://registry.test/", "//registry.test/", "registry/", ""}) { + for (const auto* registry : {"http://registry.test/", "//registry.test/", "/\\registry.test/", "/mirror\\..\\x/", "registry/", ""}) { auto options = trusted; options.registry = registry; REQUIRE_THROWS_AS(app.bootstrap("developer", options), std::invalid_argument); From bdfe29bae803f3b8febb5d183a2c7e15d6d3b254 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 17:12:56 +0200 Subject: [PATCH 020/134] Read the refused publication inside its thread in the concurrent opener test [#306] The competing publication's exception crossed threads through std::future; ThreadSanitizer on libc++ reports the shared exception object as a data race because libc++abi's reference counting is not instrumented. The thread now returns the message, and the test also checks that the first publication won. --- test/unit/DeveloperTests.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/unit/DeveloperTests.cpp b/test/unit/DeveloperTests.cpp index a230d731..2ffe21a8 100644 --- a/test/unit/DeveloperTests.cpp +++ b/test/unit/DeveloperTests.cpp @@ -724,16 +724,24 @@ SCENARIO("A second opener of the project waits for a publication in progress ins } } WHEN("another store tries to publish from the state read before the first publication") { - auto competing = std::async(std::launch::async, [&] { - developer::Store other{project.path()}; - publishPair(other, "manifest-3", "lock-3", before); + // The refusal is read in its own thread: an exception object shared across threads by a future is + // reported as a race by ThreadSanitizer, whose runtime does not see libc++abi's reference counting. + auto competing = std::async(std::launch::async, [&]() -> std::string { + try { + developer::Store other{project.path()}; + publishPair(other, "manifest-3", "lock-3", before); + return "published"; + } catch (const std::exception& error) { + return error.what(); + } }); const auto waiting = competing.wait_for(std::chrono::milliseconds(300)); release.open(); publication.get(); THEN("its precondition is checked after the first publication, which wins") { CHECK(waiting == std::future_status::timeout); - REQUIRE_THROWS_WITH(competing.get(), Catch::Matchers::ContainsSubstring("changed since it was read")); + REQUIRE_THAT(competing.get(), Catch::Matchers::ContainsSubstring("changed since it was read")); + REQUIRE(projectState(publisher) == "manifest-2|lock-2"); } } } From a22c55e6063c6a69b25c1a607d7b38d87ed9eb56 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 17:47:52 +0200 Subject: [PATCH 021/134] Add wf run and wf exec: WebFront scripts in a Worker under the manifest permissions [#307] Scripts of the manifest and webfront.bin entries of locked packages are bundled by esbuild-wasm and run in a dedicated Worker with a bounded context API (args, signal, console, project read/list/write, packages.resolve, fetch, exit). The page applies the manifest permissions to context operations and publishes each write with developer::Store. Ctrl+C or the time limit aborts the script's signal, then terminates the Worker after a grace period; staged writes are aborted and committed ones complete. npm's bin is never run and Node.js imports are refused while loading. Store::list backs context.project.list. --- .github/workflows/DeveloperDistribution.yml | 2 +- docs/CHANGELOG.md | 8 + docs/DEVELOPER_ENVIRONMENT.md | 54 ++++- docs/PROJECT_STATUS.md | 3 +- include/webfront/DeveloperApp.hpp | 1 + include/webfront/system/DeveloperFiles.hpp | 1 + include/webfront/system/DeveloperStore.hpp | 31 +++ js/core/WebFrontAssets.cmake | 2 +- js/developer/environment/bundler.mjs | 45 +++- js/developer/environment/bundles.json | 15 +- js/developer/environment/compiler.mjs | 6 +- js/developer/environment/packages-entry.mjs | 3 + js/developer/environment/packages.bundle.mjs | 26 ++- js/developer/environment/permissions.mjs | 42 ++++ js/developer/environment/runtime.mjs | 50 ++++- js/developer/environment/script-worker.mjs | 77 +++++++ js/developer/environment/scripts.mjs | 217 +++++++++++++++++++ js/developer/tools/build.mjs | 7 +- js/developer/tools/memory-bridge.mjs | 8 + js/developer/tools/registry-fixture.mjs | 17 +- js/developer/tools/scripts-check.mjs | 216 ++++++++++++++++++ test/unit/DeveloperTests.cpp | 34 +++ test/web/developer-specs.mjs | 67 +++++- 23 files changed, 895 insertions(+), 37 deletions(-) create mode 100644 js/developer/environment/permissions.mjs create mode 100644 js/developer/environment/script-worker.mjs create mode 100644 js/developer/environment/scripts.mjs create mode 100644 js/developer/tools/scripts-check.mjs diff --git a/.github/workflows/DeveloperDistribution.yml b/.github/workflows/DeveloperDistribution.yml index 7c175075..c7f9fec1 100644 --- a/.github/workflows/DeveloperDistribution.yml +++ b/.github/workflows/DeveloperDistribution.yml @@ -69,7 +69,7 @@ jobs: echo "::notice::Sources build $building; DeveloperReleaseData.hpp still pins the published $pinned." node js/developer/tools/pin-check.mjs fi - node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs js/developer/tools/manifest-check.mjs js/developer/tools/restore-check.mjs + node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs js/developer/tools/manifest-check.mjs js/developer/tools/restore-check.mjs js/developer/tools/scripts-check.mjs - name: Check the dedicated release tag if: startsWith(github.ref, 'refs/tags/developer-v') env: diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index fde9409f..385c6eb2 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -21,6 +21,14 @@ print it with its origin. A reproducible local npm registry fixture (`js/developer/tools/registry-fixture.mjs`) serves the tests. +- `wf run [--timeout ] + + diff --git a/test/web/developer-session.mjs b/test/web/developer-session.mjs new file mode 100644 index 00000000..77c8d0fb --- /dev/null +++ b/test/web/developer-session.mjs @@ -0,0 +1,6 @@ +// A second browser session for developer-specs.mjs: its own WebFront connection, the same environment runtime. +globalThis.session = (async () => { + await webFront.ready; + const runtime = await import('/webfront/developer/environment/runtime.mjs'); + return {runtime, bridge: webFront, cppCommands: await runtime.discoverCommands(webFront)}; +})(); diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index 31f2bbd3..78d17dfa 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -335,7 +335,182 @@ try { assert(JSON.stringify([await listing(''), await listing('check')]) === JSON.stringify(before), 'A check must not write any project file'); assert(JSON.parse(await listing('.webfront/developer/staging')).length === 0, 'A check must leave no staged files'); assert(/typescript@6\.0\.3/.test(await runtime.execute(['list'], context)), 'The terminal must stay usable after a stopped check'); - await webFront.cppFunction('test.report')(true, 'WASM + npm + TSX + PI + Life animation + deterministic headers + scripts + type check passed'); + // The terminal: the application's C++ commands, run in this browser's session. + const cppCommands = await runtime.discoverCommands(webFront); + assert(['echo', 'fail', 'linger', 'status', 'stream', 'wait'].every(name => cppCommands.has(name)) && cppCommands.get('echo') === 'Write its arguments', + `The C++ commands must be discovered with their help: ${[...cppCommands.keys()]}`); + const commandState = tag => webFront.cppFunction('test.command')(tag); + const waitState = async (tag, state) => { + for (let attempt = 0; (await commandState(tag)) !== state; ++attempt) { + if (attempt === 200) throw new Error(`Command ${tag} did not reach ${state}: ${await commandState(tag)}`); + await delay(25); + } + }; + const lineContext = (signal = new AbortController().signal, chunks = []) => ({...context, cppCommands, signal, write: text => chunks.push(text)}); + const streamed = []; + assert(await runtime.runLine('stream', lineContext(undefined, streamed)) === '', 'A C++ command resolves once it returns'); + assert(streamed.length >= 3 && streamed.join('') === 'é'.repeat(75000) + '\r\n', `Long C++ output must stream in pieces under the bridge limit: ${streamed.length}`); + const thrown = await failure(runtime.runLine('fail', lineContext())); + assert(thrown?.message === 'command failed on purpose' && thrown.exitCode === 1, `A C++ exception must reject the command: ${thrown}`); + const exitCode = await failure(runtime.runLine('status 3', lineContext())); + assert(exitCode?.exitCode === 3 && /exited with code 3/.test(exitCode.message), `A C++ exit code must be reported: ${exitCode}`); + assert(/Unknown command: absent/.test((await failure(runtime.runLine('absent', lineContext())))?.message), 'An unknown command must be refused'); + // Ctrl+C: the terminal stops waiting at once, the next command answers while the first is still ending in C++. + const interruptLinger = new AbortController(); + const lingering = failure(runtime.runLine('linger first', lineContext(interruptLinger.signal))); + await waitState('first', 'running'); + interruptLinger.abort(new Error('Interrupted')); + assert((await lingering)?.exitCode === 130, 'An interrupted C++ command must end with exit code 130'); + const echoed = []; + await runtime.runLine('echo "after Ctrl+C"', lineContext(undefined, echoed)); + assert(echoed.join('') === 'after Ctrl+C\r\n', `The next command must run normally: ${echoed}`); + assert(['running', 'stopping'].includes(await commandState('first')), 'The second command must answer before the first one ends'); + await waitState('first', 'stopping'); + await waitState('first', 'cancelled'); + // Sessions: a second browser has its own commands; a long command there does not delay this one, Ctrl+C here does + // not stop it, and its disconnection does. + const sessionFrame = document.createElement('iframe'); + sessionFrame.src = '/fixtures/session.html'; + document.body.append(sessionFrame); + for (let attempt = 0; !sessionFrame.contentWindow?.session; ++attempt) { + if (attempt === 200) throw new Error('The second session did not load'); + await delay(25); + } + const second = await sessionFrame.contentWindow.session; + const secondWait = failure(second.runtime.runLine('wait second', {bridge: second.bridge, cppCommands: second.cppCommands, signal: new AbortController().signal})); + await waitState('second', 'running'); + const interruptFirst = new AbortController(); + const firstWait = failure(runtime.runLine('wait here', lineContext(interruptFirst.signal))); + await waitState('here', 'running'); + const echoStarted = performance.now(); + await runtime.runLine('echo isolated', lineContext()); + assert(performance.now() - echoStarted < 2000, 'A command in another session must not delay this one'); + interruptFirst.abort(new Error('Interrupted')); + await firstWait; + await waitState('here', 'cancelled'); + assert(await commandState('second') === 'running', 'Ctrl+C in one browser must not stop the command of another'); + sessionFrame.remove(); + await waitState('second', 'cancelled'); + void secondWait; + // The terminal itself, mounted in this page with a real xterm.js. + const host = document.createElement('div'); + host.style.cssText = 'width:640px;height:240px'; + document.body.append(host); + let exitedWith = null; + const mounted = async () => runtime.mount({bridge: webFront, config, terminal: host, preview: context.preview, onExit: code => { exitedWith = code; }}); + const {terminal, editor} = await mounted(); + const buffer = () => terminal.buffer.active; + const rendered = () => new Promise(resolve => terminal.write('', resolve)); + // Like xterm.js, one input per key; text may come as one input. + const type = async (...inputs) => { + for (const data of inputs) { + terminal.input(data); + await editor.whenIdle(); + } + await rendered(); + }; + const rows = () => { + const lines = []; + for (let y = 0; y < buffer().length; ++y) lines.push(buffer().getLine(y).translateToString(true)); + return lines; + }; + const cursorRow = () => buffer().baseY + buffer().cursorY; + const lastRows = count => rows().slice(cursorRow() - count + 1, cursorRow() + 1); + await type('echo hello\r'); + assert(JSON.stringify(lastRows(3)) === JSON.stringify(['> echo hello', 'hello', '> ']), `A C++ command must run from the terminal: ${lastRows(3)}`); + // Cell widths: CJK, emoji, a flag, a ZWJ sequence and a combining mark. + await type('漢字😀🇫🇷👨‍👩‍👧éx'); + assert(buffer().cursorX === 2 + 2 + 2 + 2 + 2 + 2 + 1 + 1, `Wide characters must take two cells: ${buffer().cursorX}`); + // xterm.js draws each cluster where the editor placed it. + const drawn = buffer().getLine(cursorRow()); + const cellsDrawn = [[2, '漢', 2], [4, '字', 2], [6, '😀', 2], [8, '🇫🇷', 2], [10, '👨‍👩‍👧', 2], [12, 'e\u0301', 1], [13, 'x', 1]] + .map(([column, chars, width]) => [drawn.getCell(column).getChars() === chars, drawn.getCell(column).getWidth() === width]).flat(); + assert(cellsDrawn.every(Boolean), `xterm.js must draw the clusters with the editor's widths: ${cellsDrawn}`); + await type('\x7f', '\x7f'); + assert(buffer().cursorX === 12 && editor.line === '漢字😀🇫🇷👨‍👩‍👧', `Backspace must erase whole clusters: ${buffer().cursorX} ${editor.line}`); + await type('\x1b[D', '\x1b[D'); + assert(buffer().cursorX === 8, `The cursor must move over whole clusters: ${buffer().cursorX}`); + await type('\x03'); + assert(lastRows(2)[0].endsWith('^C') && lastRows(1)[0] === '> ' && editor.line === '', 'Ctrl+C must drop the line'); + // A line over several rows: wrapping, editing in the middle, a row filled exactly and a wide character at a row end. + terminal.resize(20, 12); + await rendered(); + await type('echo ' + 'a'.repeat(40)); + let top = cursorRow() - 2; + assert(buffer().cursorX === 7 && JSON.stringify(rows().slice(top, top + 3)) === JSON.stringify(['> echo ' + 'a'.repeat(13), 'a'.repeat(20), 'a'.repeat(7)]), + `A long line must wrap: ${rows().slice(top, top + 3)}`); + await type('\x01', 'X'); + assert(cursorRow() === top && buffer().cursorX === 3 && JSON.stringify(rows().slice(top, top + 3)) === JSON.stringify(['> Xecho ' + 'a'.repeat(12), 'a'.repeat(20), 'a'.repeat(8)]), + `Editing the start of a long line must redraw its rows: ${rows().slice(top, top + 3)}`); + await type('\x05', 'b'.repeat(12)); + assert(cursorRow() === top + 3 && buffer().cursorX === 0, `A line filling its last row exactly must leave the cursor on the next row: ${cursorRow() - top} ${buffer().cursorX}`); + await type('\x7f', '漢'); + assert(cursorRow() === top + 3 && buffer().cursorX === 2 && rows()[top + 2] === 'a'.repeat(8) + 'b'.repeat(11) && rows()[top + 3] === '漢', + `A wide character must not split at a row end: ${buffer().cursorX} ${rows().slice(top + 2, top + 4)}`); + await type('\x15'); + assert(cursorRow() === top && buffer().cursorX === 2 && rows()[top + 1] === '', 'Erasing a long line must clear its rows'); + terminal.resize(80, 12); + await rendered(); + // Exit codes, errors and clear. + await type('status 3\r'); + assert(editor.status === 3 && lastRows(2)[0] === 'Error: Command status exited with code 3 (exit code 3)', `An exit code must be shown: ${lastRows(2)}`); + await type('fail\r'); + assert(editor.status === 1 && lastRows(2)[0] === 'Error: command failed on purpose', `A C++ exception must be shown as an error: ${lastRows(2)}`); + await type('echo ok\r'); + assert(editor.status === 0, 'A successful command must reset the status'); + // Ctrl+C in the terminal: the prompt comes back at once, and a command typed then runs while the first one ends. + terminal.input('linger terminal\r'); + await waitState('terminal', 'running'); + await type('\x03'); + await type('echo next\r'); + const lingerState = await commandState('terminal'); + assert(editor.status === 0 && lastRows(2)[0] === 'next' && ['running', 'stopping'].includes(lingerState), `Ctrl+C must interrupt a C++ command: ${lastRows(3)} ${editor.status} ${lingerState}`); + await waitState('terminal', 'stopping'); + // Pasted lines run one after the other; the last one, without a line break, waits on the prompt. + terminal.paste('echo one\necho two\necho three'); + await editor.whenIdle(); + await rendered(); + assert(JSON.stringify(lastRows(5)) === JSON.stringify(['> echo one', 'one', '> echo two', 'two', '> echo three']), `A multi-line paste must run line by line: ${lastRows(5)}`); + await type('\r'); + assert(lastRows(2)[0] === 'three', 'The pasted last line must run once submitted'); + // Completion of command names, wf subcommands, manifest scripts and project paths. + const completed = async (text, expected) => { + await type(text, '\t'); + assert(editor.line === expected, `${JSON.stringify(text)} must complete to ${JSON.stringify(expected)}: ${JSON.stringify(editor.line)}`); + await type('\x03'); + }; + await completed('ec', 'echo '); + await completed('wf ru', 'wf run '); + await completed('wf run ge', 'wf run gen '); + await completed('echo too', 'echo tools/'); + await completed('echo tools/js', 'echo tools/jsx.tsx '); + await completed('hi', 'history '); + await type('h', '\t'); + assert(editor.line === 'h' && lastRows(2)[0].includes('help') && lastRows(2)[0].includes('history'), `Several candidates must be listed: ${lastRows(2)}`); + await type('\x03'); + await type('clear\r'); + assert(buffer().length === terminal.rows && rows()[0] === '> ', `clear must empty the screen and the scrollback: ${rows()[0]}`); + // The history is kept per project: a new terminal recalls it. + await runtime.historySaved(); + const saved = JSON.parse(new TextDecoder().decode(await readFile(runtime.historyPath))); + assert(saved.at(-1) === 'clear' && saved.includes('echo three'), `The history must be saved in the project: ${saved.slice(-3)}`); + await type('exit 4\r'); + assert(exitedWith === 4 && editor.closed && lastRows(2)[0] === 'Session ended.', `exit must end the session with its code: ${exitedWith}`); + terminal.input('echo ignored\r'); + assert(!editor.busy, 'A closed session must ignore input'); + await runtime.historySaved(); + terminal.dispose(); + host.replaceChildren(); + const again = await mounted(); + again.terminal.input('\x1b[A'); + await new Promise(resolve => again.terminal.write('', resolve)); + assert(again.editor.line === 'exit 4', `A new terminal must recall the project's history: ${again.editor.line}`); + again.terminal.dispose(); + host.remove(); + // The application stops while this command runs: its shutdown must drain it (checked in C++). + void failure(runtime.runLine('wait final', lineContext())); + await waitState('final', 'running'); + await webFront.cppFunction('test.report')(true, 'WASM + npm + TSX + PI + Life animation + deterministic headers + scripts + type check + terminal passed'); } catch (error) { console.error(error); await webFront.cppFunction('test.report')(false, String(error.stack ?? error)); From 92f1305573e31fbf8c025814e7b6a7d9604f30b3 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 23:33:17 +0200 Subject: [PATCH 032/134] Keep keys typed during a completion and start the prompt on a fresh line [#308] Keys typed while a Tab completion was pending were dropped, and Enter was queued and never run: they are now applied once the completion is inserted. A command whose streamed output did not end its line left the prompt after it, and the next redraw erased that output: the editor now tracks whether the cursor is at the start of a row and ends the line before the prompt. --- js/developer/environment/bundles.json | 4 +-- js/developer/environment/runtime.mjs | 2 +- js/developer/environment/terminal.mjs | 41 +++++++++++++++++++++++---- test/web/DeveloperTest.cpp | 4 +++ test/web/developer-specs.mjs | 15 ++++++++++ 5 files changed, 57 insertions(+), 9 deletions(-) diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index c5dddb28..cedf0ece 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -16,8 +16,8 @@ "js/developer/environment/packages.mjs": "faed29500a34c6ce24756d07bd4b47b9168ccec4bd49d12f00096a869637d74d", "js/developer/environment/starter.mjs": "048cf2af36b407bc075323f78a1195b4be91ad7da51f6ce941d9fb230f314ff9", "js/developer/environment/paths.mjs": "3b6114df78eb193161c5c84499dda084cb7ff91c56a4496371c30295d00880e3", - "js/developer/environment/runtime.mjs": "b49fd7e7d4f9fbbe4123f27c2fcf0df5ed50141c016ed00c80cd946d4e89fb05", - "js/developer/environment/terminal.mjs": "7532b94e7fd3f9548ae549ada48542387cea12c566265177b099bc2efdd5287f", + "js/developer/environment/runtime.mjs": "415873b66a70581f7e45df521bd78f80254114d8d28bf1482d51d4801241eff0", + "js/developer/environment/terminal.mjs": "1c76bfb4eea764f0d7910beaabaa1c27bcc427e73c7d0c132758e9d03a7131f6", "js/developer/environment/commands.mjs": "ec40553e36171ac920ee31521863f175d8d191a71fbb947a81946f609aae6a2e", "js/developer/environment/compiler.mjs": "cc6fbe8cabbd94750045cebfdf942234247519099a192ef9cdda6ccbdbfbb6a4", "js/developer/environment/bundler.mjs": "c2f55056a4702d57207203a29226f98a95a31ae615596bf21338b7dfabe83ed9", diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index f4893ccf..8dc43706 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -344,7 +344,7 @@ export async function mount({bridge, config, terminal: element, preview, onExit} const context = {bridge, config, preview, cppCommands, onExit}; const editor = new LineEditor({write, columns: () => terminal.cols, prompt: '> ', history: await readHistory(bridge), saveHistory: lines => saveHistory(bridge, lines), - run: (line, signal) => runLine(line, {...context, editor, signal, write}), + run: (line, signal) => runLine(line, {...context, editor, signal, write: text => editor.write(text)}), complete: line => complete(line, context)}); terminal.onResize(() => editor.resized()); new ResizeObserver(() => fit.fit()).observe(element); diff --git a/js/developer/environment/terminal.mjs b/js/developer/environment/terminal.mjs index 5dc5fd80..260e1c49 100644 --- a/js/developer/environment/terminal.mjs +++ b/js/developer/environment/terminal.mjs @@ -180,7 +180,7 @@ const keyActions = new Map([ ['\x05', editor => editor.moveTo(editor.cells.length)], ['\x1b[A', editor => editor.recall(-1)], ['\x1b[B', editor => editor.recall(1)], - ['\t', editor => editor.track(editor.completeLine())], + ['\t', editor => editor.track(editor.completeThenReplay())], ['\x03', editor => editor.cancelLine()], ['\x0c', editor => editor.clearScreen()], ['\x15', editor => editor.killBeforeCursor()], @@ -201,7 +201,15 @@ export const historyLimit = 500; */ export class LineEditor { constructor({write, columns = () => 80, run, complete = async () => ({word: '', candidates: []}), prompt = '> ', history = [], saveHistory = () => {}}) { - Object.assign(this, {write, columns, run, complete, saveHistory}); + Object.assign(this, {columns, run, complete, saveHistory}); + // Whether the cursor is at the start of a row: output streamed without a final line break is followed by one + // before the prompt. + this.atLineStart = true; + this.write = text => { + if (!text) return; + this.atLineStart = /\n$|\x1b\[H$/.test(text); + write(text); + }; this.setPrompt(prompt); this.cells = []; this.cursor = 0; @@ -212,6 +220,8 @@ export class LineEditor { this.status = 0; this.abort = null; this.busy = null; + this.running = false; + this.completing = null; // input received while a completion is pending, replayed after it this.closed = false; } @@ -235,7 +245,8 @@ export class LineEditor { handle(data) { if (this.closed) return; - if (this.busy) return this.whileBusy(data); + if (this.completing) return void this.completing.push(data); + if (this.running) return this.whileBusy(data); const action = keyActions.get(data); if (action) return action(this); if (!data.startsWith('\x1b')) return this.insertText(data); @@ -373,7 +384,10 @@ export class LineEditor { this.cells = []; this.cursor = 0; this.row = 0; - return this.track(this.runLines(line)); + this.running = true; + const done = this.runLines(line).finally(() => { this.running = false; }); + // A submission replayed after a completion is already tracked by it. + return this.busy ? done : this.track(done); } async runLines(line) { @@ -402,8 +416,7 @@ export class LineEditor { try { const output = await this.run(line, signal); this.status = 0; - // The prompt starts on a new line, unless the output already ends one or leaves the cursor at home. - if (output) this.write(output.endsWith('\n') || output.endsWith('\x1b[H') ? output : output + '\r\n'); + this.write(output); } catch (error) { this.status = error?.exitCode ?? (signal.aborted ? 130 : 1); const message = String(error?.message ?? error); @@ -412,6 +425,22 @@ export class LineEditor { this.write(ansi.red(`Error: ${message}${this.status !== 1 ? ` (exit code ${this.status})` : ''}`).replace(/(?& commands, const std::shared_ptr webfront::Task { + context.write("partial"); + co_return; + }); commands.add("fail", "Throw", [](Context) -> webfront::Task { throw std::runtime_error("command failed on purpose"); }); diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index 78d17dfa..5576657a 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -456,6 +456,21 @@ try { assert(editor.status === 3 && lastRows(2)[0] === 'Error: Command status exited with code 3 (exit code 3)', `An exit code must be shown: ${lastRows(2)}`); await type('fail\r'); assert(editor.status === 1 && lastRows(2)[0] === 'Error: command failed on purpose', `A C++ exception must be shown as an error: ${lastRows(2)}`); + await type('partial\r', 'x'); + assert(JSON.stringify(lastRows(2)) === JSON.stringify(['partial', '> x']), `Output without a final line break must not hold the prompt: ${lastRows(2)}`); + await type('\x03'); + // Keys typed while a completion is pending are applied after it, Enter included. + terminal.input('ec'); + terminal.input('\t'); + terminal.input('ho'); + terminal.input(' typed-ahead\r'); + for (let attempt = 0; editor.busy || lastRows(2)[0] !== 'ho typed-ahead'; ++attempt) { + if (attempt === 200) throw new Error(`Keys typed during a completion must be kept: ${lastRows(3)}`); + await editor.whenIdle(); + await rendered(); + await delay(10); + } + assert(lastRows(3)[0] === '> echo ho typed-ahead' && editor.queue.length === 0, `The completed line must run once: ${lastRows(3)}`); await type('echo ok\r'); assert(editor.status === 0, 'A successful command must reset the status'); // Ctrl+C in the terminal: the prompt comes back at once, and a command typed then runs while the first one ends. From 0a6d9a00827d553631493d94580ae002e345beb8 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 23:37:49 +0200 Subject: [PATCH 033/134] Let the test terminal fit its element before resizing it [#308] The terminal's ResizeObserver reports once after mount and fits the terminal to its element; on the CEF Clang job it ran after the test had resized the terminal to 20 columns, so the wrapping checks saw 80 columns. The test waits two frames before resizing and checks the width it set. --- test/web/developer-specs.mjs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index 5576657a..6e1e7ce7 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -399,6 +399,9 @@ try { let exitedWith = null; const mounted = async () => runtime.mount({bridge: webFront, config, terminal: host, preview: context.preview, onExit: code => { exitedWith = code; }}); const {terminal, editor} = await mounted(); + // The terminal fits its element when its ResizeObserver first reports: let that happen before resizing it. + const frames = () => new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve))); + await frames(); const buffer = () => terminal.buffer.active; const rendered = () => new Promise(resolve => terminal.write('', resolve)); // Like xterm.js, one input per key; text may come as one input. @@ -435,6 +438,7 @@ try { // A line over several rows: wrapping, editing in the middle, a row filled exactly and a wide character at a row end. terminal.resize(20, 12); await rendered(); + assert(terminal.cols === 20, `The terminal must keep the width the test gives it: ${terminal.cols}`); await type('echo ' + 'a'.repeat(40)); let top = cursorRow() - 2; assert(buffer().cursorX === 7 && JSON.stringify(rows().slice(top, top + 3)) === JSON.stringify(['> echo ' + 'a'.repeat(13), 'a'.repeat(20), 'a'.repeat(7)]), From 84358811fca33a1ca44fdf48d864c19a4b24be63 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 23:44:38 +0200 Subject: [PATCH 034/134] Cut output that is not UTF-8 at the piece limit instead of looping [#308] chunks() moved its cut back over continuation bytes to stay on a character boundary. A piece made only of continuation bytes brought the cut to zero: the loop then added empty pieces forever on the server thread. Without a character start in the piece, it is now cut at the limit. --- include/webfront/Commands.hpp | 5 ++++- test/unit/CommandsTests.cpp | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/webfront/Commands.hpp b/include/webfront/Commands.hpp index cf8be006..7ac4237d 100644 --- a/include/webfront/Commands.hpp +++ b/include/webfront/Commands.hpp @@ -43,13 +43,16 @@ namespace detail { namespace ex = networking::ex; -/// Splits text into pieces of at most maxBytes (at least 4), never inside a UTF-8 character. +/// Splits text into pieces of at most maxBytes (at least 4), never inside a UTF-8 character. Bytes that are not +/// UTF-8, with no character start in a piece, are cut at maxBytes. inline std::vector chunks(std::string_view text, std::size_t maxBytes = maxChunkBytes) { std::vector pieces; while (text.size() > maxBytes) { std::size_t cut = maxBytes; while (cut > 0 && (static_cast(text[cut]) & 0xC0) == 0x80) --cut; + if (cut == 0) + cut = maxBytes; pieces.push_back(text.substr(0, cut)); text.remove_prefix(cut); } diff --git a/test/unit/CommandsTests.cpp b/test/unit/CommandsTests.cpp index 6b183e4d..94f675d1 100644 --- a/test/unit/CommandsTests.cpp +++ b/test/unit/CommandsTests.cpp @@ -247,6 +247,15 @@ SCENARIO("Command output is split under the bridge string limit on character bou } } } + GIVEN("bytes that are not UTF-8: continuation bytes only") { + const string bytes(10, '\x80'); + WHEN("they are split") { + const auto pieces = commands::detail::chunks(bytes, 4); + THEN("the split still ends, in pieces of the limit") { + CHECK(pieces == vector{string_view(bytes).substr(0, 4), string_view(bytes).substr(4, 4), string_view(bytes).substr(8)}); + } + } + } GIVEN("short and empty texts") { CHECK(commands::detail::chunks("").empty()); CHECK(commands::detail::chunks("abc") == vector{"abc"}); From 10fecf24bc20cd963daf748adf0e1ec4f02ea5fc Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 00:31:49 +0200 Subject: [PATCH 035/134] Release closed connections, pace command output and report stopped commands as interrupted [#308] BasicWF kept every closed connection, with its socket and buffers, until the application was destroyed. It now releases it by a task on the server context, outside the link's own handler. A call to a browser that is gone no longer throws std::out_of_range: an untyped jsFunction call is dropped, a typed one returns a failed future, a jsFunctionSender reports an error when started. co_await Context::print(text) writes like write(), then suspends the command while more than 32 frames wait for a slow browser, which bounds the write queue and gives Ctrl+C a point to stop the command. UI::pendingWrites() and BasicWF::connectedBrowsers() expose what it and the tests need. A command that returned normally after a stop request reported exit code 0: it now reports 130, like one unwound while awaiting. --- include/webfront/Commands.hpp | 20 ++++++++- include/webfront/JsFunction.hpp | 34 ++++++++++----- include/webfront/JsFunctionSender.hpp | 9 ++-- include/webfront/WebFront.hpp | 35 +++++++++++++--- test/unit/CommandsTests.cpp | 60 ++++++++++++++++++++++++++- test/web/DeveloperTest.cpp | 3 ++ 6 files changed, 137 insertions(+), 24 deletions(-) diff --git a/include/webfront/Commands.hpp b/include/webfront/Commands.hpp index 7ac4237d..a9fe9197 100644 --- a/include/webfront/Commands.hpp +++ b/include/webfront/Commands.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +34,9 @@ namespace commands { /// Bridge strings carry a 16-bit length: output is sent in pieces of at most this many bytes. inline constexpr std::size_t maxChunkBytes = 60000; +/// Frames that print() lets wait for the network before it suspends the command. +inline constexpr std::size_t maxPendingOutput = 32; + /// Exit code of a command stopped by Ctrl+C, a disconnection or the application's shutdown. inline constexpr int interruptedExitCode = 130; @@ -138,6 +142,16 @@ class Context { return; } + /// Writes like write(), then suspends the command while more than maxPendingOutput frames wait for a browser that + /// reads slower than the command writes. Each wait is a point where Ctrl+C stops the command. Prefer it to write() + /// for large or unbounded output. + [[nodiscard]] Task print(std::string text) const { + const auto command = run; + write(text); + while (!command->stop.stop_requested() && command->ui.pendingWrites() > maxPendingOutput) + co_await command->ui.resumeAfter(std::chrono::milliseconds(5)); + } + /// Sets the exit code reported when the command returns; 0 by default. An exception reports 1. void exit(int code) const noexcept { run->exitCode = code; @@ -300,7 +314,8 @@ class Registry : public std::enable_shared_from_this> { } if (auto owner = registry.lock()) owner->finished(Key{run->ui.id(), run->id}, run); - const int code = stopped ? interruptedExitCode : !error.empty() ? 1 : run->exitCode; + // A command that returns once asked to stop was interrupted too, whatever it returned. + const int code = stopped || run->stop.stop_requested() ? interruptedExitCode : !error.empty() ? 1 : run->exitCode; run->send("webfront.commands.exit", code, error.empty() ? std::string_view{} : chunks(error).front()); } }; @@ -313,7 +328,8 @@ class Registry : public std::enable_shared_from_this> { /// The constructor registers the bridge functions webfront.commands.list, .start and .cancel, through which each /// connected browser discovers the commands and runs them in its own session. A command is a coroutine, /// `webfront::Task(webfront::commands::Context)`, spawned on the server thread like ui.spawn: -/// - it streams its output with Context::write, never through one blocking reply; +/// - it streams its output with Context::write, never through one blocking reply; co_await Context::print also waits +/// while a slow browser has not read the output; /// - Ctrl+C in the terminal, the browser's disconnection or the application's shutdown requests its stop, which the /// senders it awaits observe (ui.resumeAfter, ui.jsFunctionSender, ...). The terminal does not wait for a stopped /// command: its late output and exit report are ignored, and the next command can start at once; diff --git a/include/webfront/JsFunction.hpp b/include/webfront/JsFunction.hpp index 77a87cc3..e2ba88e5 100644 --- a/include/webfront/JsFunction.hpp +++ b/include/webfront/JsFunction.hpp @@ -9,6 +9,9 @@ #include #include #include +#include +#include +#include #include #include @@ -33,17 +36,26 @@ class JsFunction { (((command.encodeParameter(std::forward(ts), frame))), ...); command.setParametersCount(static_cast(1 + sizeof...(ts))); - auto&& link = webFront.getLink(webLinkId); - if constexpr (std::is_same_v) - link.sendFrame(std::move(frame)); - else { - auto [callId, result] = link.template expectResult(); - command.setCallId(callId); - if (callId != 0) - link.sendFrame(std::move(frame)); - // Structured bindings are not implicitly movable on return, so a move-only future would be - // copied here. Newer libc++ accepts it; Apple Clang rejects it outright. - return std::move(result); + // A browser whose connection closed is gone: a call to it is dropped, and a typed call fails. + if constexpr (std::is_same_v) { + try { + webFront.getLink(webLinkId).sendFrame(std::move(frame)); + } catch (const std::out_of_range&) { } + } else { + try { + auto&& link = webFront.getLink(webLinkId); + auto [callId, result] = link.template expectResult(); + command.setCallId(callId); + if (callId != 0) + link.sendFrame(std::move(frame)); + // Structured bindings are not implicitly movable on return, so a move-only future would be + // copied here. Newer libc++ accepts it; Apple Clang rejects it outright. + return std::move(result); + } catch (const std::out_of_range&) { + std::promise closed; + closed.set_exception(std::make_exception_ptr(std::runtime_error("Browser connection closed"))); + return closed.get_future(); + } } } diff --git a/include/webfront/JsFunctionSender.hpp b/include/webfront/JsFunctionSender.hpp index cabcbf4c..1b585594 100644 --- a/include/webfront/JsFunctionSender.hpp +++ b/include/webfront/JsFunctionSender.hpp @@ -237,10 +237,13 @@ class JsFunctionSender { std::weak_ptr> socket; public: + /// The connection of a browser that is gone leaves the references empty: started calls report an error. JsFunctionSender(std::string_view functionName, WebFront& wf, WebLinkId id) : name(functionName) { - auto& link = wf.getLink(id); - pending = link.pendingResults(); - socket = link.socket(); + try { + auto& link = wf.getLink(id); + pending = link.pendingResults(); + socket = link.socket(); + } catch (const std::out_of_range&) { } } auto operator()(auto&&... arguments) const { diff --git a/include/webfront/WebFront.hpp b/include/webfront/WebFront.hpp index d09c12be..e007c6a0 100644 --- a/include/webfront/WebFront.hpp +++ b/include/webfront/WebFront.hpp @@ -47,7 +47,8 @@ class BasicUI { public: BasicUI(WebFront& wf, WebLinkId id) : webFront(wf), webLinkId(id) {} - /// Identifies this browser's connection among those of the application. + /// Identifies this browser's connection among those connected. The 16-bit identifier of a released connection + /// is only reused after 65,536 later connections. [[nodiscard]] WebLinkId id() const noexcept { return webLinkId; } @@ -65,6 +66,15 @@ class BasicUI { } } + /// The frames queued for this browser and not yet written to the network; 0 once its connection is gone. + [[nodiscard]] std::size_t pendingWrites() const { + try { + return webFront.getLink(webLinkId).pendingWrites(); + } catch (const std::out_of_range&) { + return 0; + } + } + /** * @brief Creates a Javascript function object. * @@ -381,16 +391,23 @@ class BasicWF { return uiSubscribers->subscribe(std::move(handler)); } - /// Adds a handler called on the server thread when a browser closes its connection, or the connection fails, - /// while the returned subscription lives. Its UI no longer reaches the browser. Application shutdown, which - /// stops every connection itself, notifies no handler. + /// Adds a handler called on the server thread when a browser closes its connection, or the connection fails + /// (a failed write included), while the returned subscription lives. Its UI no longer reaches the browser: the + /// connection is released after the handlers, then calls to it are dropped and typed calls fail. Application + /// shutdown, which stops every connection itself, notifies no handler. [[nodiscard]] UISubscription subscribeUIClosed(std::function handler) { return uiClosedSubscribers->subscribe(std::move(handler)); } + /// The link of a connected browser; throws std::out_of_range once its connection closed and was released. WebLink& getLink(WebLinkId id) { return webLinks.at(id); } + /// The browsers connected now, as seen from the server thread: a closed connection is released shortly after. + [[nodiscard]] std::size_t connectedBrowsers() const { + return webLinks.size(); + } + /** * @brief Registers a function which will be callable from Javascript. * @@ -505,6 +522,11 @@ class BasicWF { serverThread.join(); } + Task releaseLink(WebLinkId id) { + webLinks.erase(id); + co_return; + } + template void registerWithCaller(std::string functionName, auto&& function) { auto adapted = detail::adaptCaller(std::forward(function)); @@ -538,9 +560,10 @@ class BasicWF { uiSubscribers->notify(UI{*this, event.webLinkId}); break; case WebLinkEvent::Code::closed: - // The link stays until the application is destroyed: UI objects of a closed browser keep a - // valid, closed link instead of an identifier that a later browser could reuse. uiClosedSubscribers->notify(UI{*this, event.webLinkId}); + // The link is running this handler: it is released afterwards, by a task on the server context. + // During shutdown the task is refused and the link goes with the application. + static_cast(httpServer.startTask(releaseLink(event.webLinkId))); break; case WebLinkEvent::Code::cppFunctionCalled: if (auto function = cppFunctions.find(event.text); function != cppFunctions.end()) diff --git a/test/unit/CommandsTests.cpp b/test/unit/CommandsTests.cpp index 94f675d1..4b3ec15e 100644 --- a/test/unit/CommandsTests.cpp +++ b/test/unit/CommandsTests.cpp @@ -1,8 +1,11 @@ #include "InjectableNetworking.hpp" #include +#include #include #include +#include +#include #include #include #include @@ -47,8 +50,10 @@ struct FakeUI { [[nodiscard]] int id() const noexcept { return link; } - TaskHandle spawn(Task task) const; - auto jsFunction(string_view name) const; + TaskHandle spawn(Task task) const; + auto jsFunction(string_view name) const; + size_t pendingWrites() const; + auto resumeAfter(chrono::milliseconds) const; }; // Records the bridge functions that Commands registers, like BasicWF::cppFunction, and the browser calls. @@ -95,6 +100,8 @@ struct FakeApp { } vector registered; + size_t backlog = 0; // frames waiting for the network; each pause lets the browser read 10 + int pauses = 0; // Destroyed first: draining its tasks lets the commands report through the members above. RealApp real{WebFrontConfig{.port = "0"}}; }; @@ -103,6 +110,17 @@ TaskHandle FakeUI::spawn(Task task) const { return app->real.spawn(std::move(task)); } +size_t FakeUI::pendingWrites() const { + return app->backlog; +} + +auto FakeUI::resumeAfter(chrono::milliseconds) const { + return networking::ex::just() | networking::ex::then([app = app] { + ++app->pauses; + app->backlog -= min(app->backlog, 10); + }); +} + auto FakeUI::jsFunction(string_view name) const { return [app = app, link = link, function = string(name)](uint32_t id, const auto&... values) { if (app->gone.contains(link)) @@ -262,6 +280,25 @@ SCENARIO("Command output is split under the bridge string limit on character bou } } +SCENARIO("Printing waits while the browser has not read the output") { + GIVEN("a browser that has 55 frames to read") { + FakeApp app; + Commands commands{app}; + commands.add("print", "", [](Context context) -> Task { + co_await context.print("line\n"); + }); + app.backlog = 55; + WHEN("a command prints") { + app.start(app.ui(1), 1, "print", "[]"); + THEN("it waits until no more than the allowed frames are pending, then ends") { + CHECK(app.pauses == 3); + CHECK(app.backlog <= commands::maxPendingOutput); + CHECK(app.callsOf(1).back().values == vector{"0", ""}); + } + } + } +} + SCENARIO("Ctrl+C stops a running command and the next one runs at once") { GIVEN("a command waiting in a browser") { Fixture fixture; @@ -272,6 +309,17 @@ SCENARIO("Ctrl+C stops a running command and the next one runs at once") { THEN("its number cannot start another command") { CHECK_THROWS_AS(app.start(app.ui(1), 1, "greet", "[]"), invalid_argument); } + WHEN("a command that returns once asked to stop is cancelled") { + fixture.commands.add("polite", "", [](Context context) -> Task { + co_await (testing::ManualSender([](auto) { }) | networking::ex::upon_stopped([] { return size_t{}; })); + context.exit(0); + }); + app.start(app.ui(1), 9, "polite", "[]"); + app.cancel(app.ui(1), 9); + THEN("it reports exit code 130, not success") { + CHECK(app.callsOf(1).back().values == vector{"130", ""}); + } + } WHEN("the browser cancels it") { app.cancel(app.ui(1), 1); THEN("the command unwinds and reports exit code 130") { @@ -369,5 +417,13 @@ SCENARIO("BasicWF provides the application facilities of commands") { auto subscription = app.subscribeUIClosed([](RealApp::UI) { }); CHECK(subscription.active()); } + THEN("calls to a browser that is gone are dropped, and typed calls fail") { + const RealApp::UI gone(app, 42); + CHECK(app.connectedBrowsers() == 0); + CHECK_NOTHROW(gone.jsFunction("console.log")("dropped")); + auto result = gone.jsFunction("Math.abs")(-1); + CHECK_THROWS_WITH(result.get(), "Browser connection closed"); + CHECK_NOTHROW(gone.jsFunctionSender("Math.abs")(-1)); + } } } diff --git a/test/web/DeveloperTest.cpp b/test/web/DeveloperTest.cpp index 188ada9b..caa02d0d 100644 --- a/test/web/DeveloperTest.cpp +++ b/test/web/DeveloperTest.cpp @@ -203,6 +203,9 @@ int main(int argc, char** argv) { app.cppFunction("test.command", [states](std::string tag) { return states->get(tag); }); + app.cppFunction("test.browsers", [&app] { + return static_cast(app.connectedBrowsers()); + }); bootstrapApp(app, argc == 4 ? std::string_view(argv[3]) : std::string_view{}, integrity); auto subscription = app.subscribeUIStarted([injected = false](App::UI ui) mutable { if (!std::exchange(injected, true)) From d6fdd4e6d959309d83578d6e249754760b4c219a Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 00:31:49 +0200 Subject: [PATCH 036/134] Complete quoted paths, share the history and restart the session after exit [#308] - Completion reads the word at the end of the line like tokenize(): escaped spaces and open quotes no longer stop it, and the completion is escaped the same way and closes the quote. - wf preview and wf embed read the manifest names and the project paths in parallel; the manifest is kept while its project state token is unchanged. - Each history line is added to the file as it is now, so the terminals of two pages on the same project no longer erase each other's lines. - exit ends the session; when the browser keeps the window open, Enter starts a new one instead of leaving a terminal without input. - A bridge that throws instead of rejecting no longer leaves a C++ command registered with its abort listener. - mount() takes fitToElement: false, which the test uses so that the element's observer no longer races with the sizes it sets. --- docs/ASYNC_EXECUTION.md | 12 +++-- docs/CHANGELOG.md | 14 ++++-- docs/DEVELOPER_ENVIRONMENT.md | 24 ++++++---- docs/PROJECT_STATUS.md | 2 +- js/developer/environment/bundles.json | 6 +-- js/developer/environment/commands.mjs | 3 +- js/developer/environment/runtime.mjs | 58 +++++++++++++++-------- js/developer/environment/terminal.mjs | 66 ++++++++++++++++++++++----- test/web/developer-specs.mjs | 44 +++++++++++++++--- 9 files changed, 169 insertions(+), 60 deletions(-) diff --git a/docs/ASYNC_EXECUTION.md b/docs/ASYNC_EXECUTION.md index 882ea780..07ca4f08 100644 --- a/docs/ASYNC_EXECUTION.md +++ b/docs/ASYNC_EXECUTION.md @@ -81,10 +81,14 @@ completes on the server context once the duration has elapsed. Awaited in a task it observes the task's stop token: `TaskHandle::requestStop()` or shutdown completes it stopped at once, so a waiting coroutine never delays shutdown. `app.subscribeUIClosed(handler)` calls the handler on the server thread when a -browser closes its connection or the connection fails, for as long as the -returned `UISubscription` lives; shutdown, which stops every connection itself, -notifies no handler. The UI of a closed browser keeps its link object until the -application is destroyed, and its calls no longer reach the browser. +browser closes its connection or the connection fails (a failed write included), +for as long as the returned `UISubscription` lives; shutdown, which stops every +connection itself, notifies no handler. The connection is then released by a task +on the server context. Afterwards, an untyped `jsFunction` call to that UI is +dropped, a typed call returns a future that throws `Browser connection closed`, +a `jsFunctionSender` completes with an error when started, and `addScript` throws +`ConnectionError`. The 16-bit identifier of a released connection is reused only +after 65,536 later connections. `app.spawn(task)` and `ui.spawn(task)` may be called from any thread while the application object remains alive, including concurrently with stop/shutdown. diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d977c8f9..dcd3c6f9 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -43,8 +43,9 @@ `webfront::Commands` (``) adds an application's C++ commands to it: coroutines spawned per browser session through the bridge functions `webfront.commands.list`, `.start` and `.cancel`, streaming their output, stopped by Ctrl+C, the browser's disconnection or shutdown; the terminal does not wait for a stopped - command. New `app.resumeAfter(duration)`/`ui.resumeAfter(duration)` timer sender, `app.subscribeUIClosed(handler)`, - `UI::id()` and `json::Reader::array`. + command; `co_await context.print(text)` waits for a slow browser. New `app.resumeAfter(duration)`/ + `ui.resumeAfter(duration)` timer sender, `app.subscribeUIClosed(handler)`, `app.connectedBrowsers()`, `UI::id()`, + `UI::pendingWrites()` and `json::Reader::array`. ### Changed @@ -67,9 +68,12 @@ ### Fixed -- A browser's disconnection is now reported: `WebLink` emits its `closed` event once when the browser closes the - connection or it fails. The event was never emitted before, so nothing observed disconnections and `BasicWF`'s - removal of the link was unreachable; the link is now kept until the application is destroyed. +- A browser's disconnection is now reported and its connection released: `WebLink` emits its `closed` event once when + the browser closes the connection or it fails. The event was never emitted before, so nothing observed + disconnections and every closed connection (socket, buffers) stayed until the application was destroyed. `BasicWF` + now releases it by a task on the server context; afterwards untyped `jsFunction` calls to that browser are + dropped, typed ones fail and `jsFunctionSender` reports an error when started, instead of throwing + `std::out_of_range`. - Linux CEF builds: the runtime files, resources and locales are copied once per destination directory by a shared copy target, instead of by every CEF target's post-build step, which made parallel builds fail intermittently ("Error copying directory ... locales"). The destination is the target's output directory diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 52f136b7..bdbf8ecf 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -337,18 +337,21 @@ wf check The terminal of the environment (developer distribution 0.5.0, #308) is the only WebFront terminal; it is served from the environment archive with xterm.js, never from a C++ header. It runs `wf` commands, the application's C++ commands and its own: `help`, `clear` (screen and scrollback), `history` (`history -c` clears it) and -`exit [code]`, which ends the session and closes the window. No system shell is exposed. +`exit [code]`, which ends the session and closes the window; when the browser keeps a window that a script did not +open, Enter starts a new session. No system shell is exposed. - **Editing:** left/right, Home/End (Ctrl+A/Ctrl+E), Backspace/Delete, Ctrl+U/Ctrl+K, Ctrl+L, up/down through the history. A line wider than the terminal wraps over several rows and is redrawn in place. The editor moves over grapheme clusters: CJK characters and emoji (ZWJ sequences, flags, skin tones, presentation selector) take two cells, combining marks none. The same widths are registered in xterm.js, so both always agree. -- **History:** kept per project in `.webfront/developer/history.json` (500 lines), restored by the next terminal. +- **History:** kept per project in `.webfront/developer/history.json` (500 lines), restored by the next terminal. Each + line is added to the file as it is, so terminals of several pages on the same project keep each other's lines. - **Paste:** a multi-line paste runs its lines one after the other; a last line without a line break waits on the prompt. Ctrl+C drops the lines still waiting. - **Completion (Tab):** command names, `wf` subcommands, the manifest's scripts after `wf run`, its entries and - providers after `wf preview` and `wf embed`, and project paths. Several candidates are completed to their common - prefix, or listed. + providers after `wf preview` and `wf embed`, and project paths, also when the word is escaped (`my\ dir/`) or + quoted (`"my dir/`); the completion is written the same way and closes the quote. Several candidates are completed + to their common prefix, or listed. - **Exit codes:** a failed command prints `Error: `, with `(exit code N)` when N is not 1. Ctrl+C gives 130. - **Output streams** while a command runs, for `wf` and C++ commands alike, without a size limit: C++ output is sent in pieces below the 65,535-byte limit of bridge strings. @@ -364,7 +367,7 @@ webfront::Commands commands{app}; commands.add("count", "Count to N, once a second", [](webfront::Commands::Context context) -> webfront::Task { using namespace std::chrono_literals; for (int i = 1; i <= std::stoi(context.args().at(0)); ++i) { - context.write(std::to_string(i) + "\n"); + co_await context.print(std::to_string(i) + "\n"); co_await context.ui().resumeAfter(1s); } }); @@ -375,8 +378,10 @@ app.show(); The terminal discovers the commands through the bridge (`webfront.commands.list`) and runs each one in the session of its browser with `webfront.commands.start`. In C++, the command is spawned like `ui.spawn` on the server thread: -- `context.write(text)` streams output with fire-and-forget calls; `context.args()` holds the words after the - command name, split like a shell line; `context.exit(code)` sets the exit code. +- `context.write(text)` streams output with fire-and-forget calls; `co_await context.print(text)` also suspends the + command while more than 32 frames wait for a browser that reads slower, and is a point where Ctrl+C stops it. + `context.args()` holds the words after the command name, split like a shell line; `context.exit(code)` sets the + exit code. A command that returns once asked to stop reports 130, whatever it returned. - Ctrl+C sends `webfront.commands.cancel`: the command's stop token is requested, which the senders it awaits observe (`ui.resumeAfter`, `ui.jsFunctionSender`, ...); loops check `context.stopRequested()`. The terminal does not wait for the command to end: the prompt returns at once and the next command runs, while the first one @@ -387,8 +392,9 @@ of its browser with `webfront.commands.start`. In C++, the command is spawned li - A command must not block the server thread, which serves every browser: a handler that does not return `webfront::Task` does not compile. Long computations belong on another thread. -The names `wf`, `clear`, `exit`, `help` and `history` are reserved. C++ output has no flow control yet: a command -writing faster than the browser reads grows the connection's write queue. +The names `wf`, `clear`, `exit`, `help` and `history` are reserved. `context.write` has no flow control: a command +writing large output with it, faster than the browser reads, grows the connection's write queue; use +`context.print` for such output. ## Dependencies, storage and limitations diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index 158b0c48..44fe2bf2 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -455,7 +455,7 @@ Local verification on 2026-07-19 completed successfully: the CEF-off build passe - Result values are currently limited to the bridge's existing scalar, string, tuple, numeric typed-array and packed bitset parameter types; richer object/DOM values remain out of scope. - `webfront::Task`, `app.spawn(task)`/`ui.spawn(task)` and per-task `TaskHandle::requestStop()` provide application-owned coroutine lifetime without exposing an execution context. The compiled `WebFrontAwaitBrowser` example matches the README; `app.shutdown()` stops and joins before returning; spawn is callable from any thread while the application lives and returns a stopped handle if shutdown rejects it. Destruction keeps owners alive and logs/waits if an external operation delays the join, whereas explicit shutdown reports absent context progress. - `ui.jsFunctionSender(name)(...)` (default `R = void`) adds lazy, awaitable typed calls, with value/error/stopped completion and local receiver-token cancellation. Futures and JavaScript Promises remain supported without cancellation. JavaScript already dispatched continues; late replies are discarded. See [execution design](ASYNC_EXECUTION.md). -- Terminal commands (`webfront::Commands`) stream output with fire-and-forget calls and no flow control: a command writing faster than its browser reads grows the connection's write queue. +- Terminal commands (`webfront::Commands`) stream output with fire-and-forget calls: `context.write` has no flow control, `co_await context.print` waits while the browser has more than 32 frames to read. - Repeated cancellation of JavaScript functions that never respond reserves their 16-bit IDs until disconnection. Enough such calls exhaust IDs and subsequent calls fail with `Too many outstanding WebFront calls`. Calls have no automatic timeout or per-write delivery acknowledgement. - Server-owned counting scopes track HTTP, WebSocket and application operations through destruction. Shutdown drains until scope join completes, independently of unrelated context work. Regression tests cover pending reads, connection lifetime, sender errors, cancellation and result/stop races; the shared Jasmine suite exercises sender value/void/error and late-result cancellation. - Ordinary JavaScript arrays encode as tuple-like parameters; only numeric typed arrays use the homogeneous array wire representation. diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index cedf0ece..4b9380f6 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -16,9 +16,9 @@ "js/developer/environment/packages.mjs": "faed29500a34c6ce24756d07bd4b47b9168ccec4bd49d12f00096a869637d74d", "js/developer/environment/starter.mjs": "048cf2af36b407bc075323f78a1195b4be91ad7da51f6ce941d9fb230f314ff9", "js/developer/environment/paths.mjs": "3b6114df78eb193161c5c84499dda084cb7ff91c56a4496371c30295d00880e3", - "js/developer/environment/runtime.mjs": "415873b66a70581f7e45df521bd78f80254114d8d28bf1482d51d4801241eff0", - "js/developer/environment/terminal.mjs": "1c76bfb4eea764f0d7910beaabaa1c27bcc427e73c7d0c132758e9d03a7131f6", - "js/developer/environment/commands.mjs": "ec40553e36171ac920ee31521863f175d8d191a71fbb947a81946f609aae6a2e", + "js/developer/environment/runtime.mjs": "199cef36c3b9c8ba2d4f5953c0a70ca801b7e7cf45e1f54fb630cb28def2a5ab", + "js/developer/environment/terminal.mjs": "a58bd088b74526bce41062d5b370ee46041a251964ad0e8907ede9c02f5f7bdc", + "js/developer/environment/commands.mjs": "6b340518341753a4b71ca504da4788ac6be3cea2a6144e5c735dfb9f75d1d19e", "js/developer/environment/compiler.mjs": "cc6fbe8cabbd94750045cebfdf942234247519099a192ef9cdda6ccbdbfbb6a4", "js/developer/environment/bundler.mjs": "c2f55056a4702d57207203a29226f98a95a31ae615596bf21338b7dfabe83ed9", "js/developer/environment/entry.mjs": "b2b942443e3c74ae2c008392ba244d9b7e91db70ba1b4ebbe1357c455ebf51bb", diff --git a/js/developer/environment/commands.mjs b/js/developer/environment/commands.mjs index c1f33d55..4080cc1e 100644 --- a/js/developer/environment/commands.mjs +++ b/js/developer/environment/commands.mjs @@ -54,7 +54,8 @@ export function runCommand(bridge, name, args, {signal, write = () => {}} = {}) else reject(failure(error || `Command ${name} exited with code ${code}`, code)); }}); signal?.addEventListener('abort', interrupt, {once: true}); - bridge.cppFunction('webfront.commands.start')(id, name, JSON.stringify(args)).catch(error => { + // A bridge that throws instead of rejecting must not leave the command registered. + Promise.resolve().then(() => bridge.cppFunction('webfront.commands.start')(id, name, JSON.stringify(args))).catch(error => { if (!running.has(id)) return; finish(); reject(error); diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index 8dc43706..06735561 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -1,6 +1,7 @@ import {Terminal} from '../../../third_party/xterm/xterm.mjs'; import {FitAddon} from '../../../third_party/xterm/addon-fit.mjs'; -import {LineEditor, tokenize, unicodeProvider, clearScreen} from './terminal.mjs'; +import {LineEditor, tokenize, wordAtEnd, unicodeProvider, clearScreen, historyLimit} from './terminal.mjs'; +import {manifestPath} from './manifest.mjs'; import {discoverCommands, runCommand} from './commands.mjs'; export {discoverCommands}; import {validateLock} from './packages.mjs'; @@ -222,12 +223,17 @@ async function readHistory(bridge) { } catch { return []; } } -// The history is written after each command, one write at a time; a failed write keeps the terminal usable. +// The history is written after each command, one write at a time; a failed write keeps the terminal usable. Each line +// is added to the file as it is now, so the terminals of other pages on the project keep theirs. let historyWrites = Promise.resolve(); -function saveHistory(bridge, lines) { - historyWrites = historyWrites.then(() => publish(bridge, historyPath, textFile(JSON.stringify(lines)), {directory: false})).catch(() => {}); +function writeHistory(bridge, change) { + historyWrites = historyWrites.then(async () => { + const lines = change(await readHistory(bridge)).slice(-historyLimit); + await publish(bridge, historyPath, textFile(JSON.stringify(lines)), {directory: false}); + }).catch(() => {}); return historyWrites; } +const rememberLine = (bridge, line) => writeHistory(bridge, lines => lines.at(-1) === line ? lines : [...lines, line]); /** Resolves once the history written so far is in the project. */ export const historySaved = () => historyWrites; @@ -243,11 +249,11 @@ const builtins = { 'Ctrl+C interrupts a command. No system shell is exposed.'].join('\n'); }, clear: () => clearScreen, - history: (args, {editor}) => { + history: async (args, {editor, bridge}) => { if (args.length === 1 && args[0] === '-c') { editor.history.length = 0; editor.historyIndex = 0; - editor.saveHistory([]); + await writeHistory(bridge, () => []); return ''; } if (args.length) throw new Error('Usage: history [-c]'); @@ -258,7 +264,8 @@ const builtins = { const code = args.length ? Number(args[0]) : editor?.status ?? 0; editor?.close(); onExit(code); - return 'Session ended.'; + // A window that a script did not open stays open: the terminal then waits for a new session. + return 'Session ended. Press Enter to start a new session.'; }, }; @@ -288,38 +295,53 @@ async function projectPaths(bridge, word) { } catch { return []; } } +// The manifest as last read, kept while the project's state token for it does not change. +let manifestCache = {token: null, manifest: null}; +async function cachedManifest(bridge) { + const token = await call(bridge, 'state', manifestPath); + if (token !== manifestCache.token) { + let manifest = null; + try { manifest = JSON.parse(decoder.decode(await readProject(bridge, manifestPath))); } + catch { /* no manifest, or one that wf commands report */ } + manifestCache = {token, manifest}; + } + return manifestCache.manifest; +} + // The names that the manifest declares for the first argument of a wf command. async function manifestNames(bridge, command) { const section = {run: 'scripts', preview: 'entries', embed: 'providers'}[command]; if (!section) return []; - try { return Object.keys((await loadProject(bridge)).manifest?.[section] ?? {}); } + try { return Object.keys((await cachedManifest(bridge))?.[section] ?? {}); } catch { return []; } } /** - * Completes the word at the end of a line: command names first, then wf subcommands, the manifest's scripts after - * wf run, its entries and providers after wf preview and wf embed, and project paths. Resolves with {word, candidates}. + * Completes the word at the end of a line, escaped or quoted: command names first, then wf subcommands, the manifest's + * scripts after wf run, its entries and providers after wf preview and wf embed, and project paths. Resolves with + * {word, candidates}, the word's value and the full words that can replace it. */ export async function complete(line, {bridge, cppCommands = new Map()}) { - const start = Math.max(line.lastIndexOf(' '), line.lastIndexOf('\t')) + 1; - const word = line.slice(start); + const typed = wordAtEnd(line); + const word = typed?.value ?? ''; const matching = names => ({word, candidates: [...new Set(names)].filter(name => name.startsWith(word)).sort()}); + if (!typed) return matching([]); let before; - try { before = tokenize(line.slice(0, start)); } + try { before = tokenize(line.slice(0, typed.start)); } catch { return matching([]); } - if (/['"\\]/.test(word)) return matching([]); if (!before.length) return matching(['wf', ...Object.keys(builtins), ...cppCommands.keys()]); if (before[0] === 'wf' && before.length === 1) return matching(Object.keys(commands)); if (before[0] === 'wf' && before.length === 2 && before[1] === 'run') return matching(await manifestNames(bridge, 'run')); - if (before[0] === 'wf' && before.length === 2) return matching([...await manifestNames(bridge, before[1]), ...await projectPaths(bridge, word)]); + if (before[0] === 'wf' && before.length === 2) return matching((await Promise.all([manifestNames(bridge, before[1]), projectPaths(bridge, word)])).flat()); return matching(await projectPaths(bridge, word)); } /** * Mounts the terminal in `element`. Each page has its own session: its history comes from the project, its C++ * commands run in this browser's session. `onExit(code)` ends the session after exit (by default, closes the window). + * `fitToElement: false` keeps the terminal's size as set by terminal.resize() instead of following the element's. */ -export async function mount({bridge, config, terminal: element, preview, onExit}) { +export async function mount({bridge, config, terminal: element, preview, onExit, fitToElement = true}) { const link = document.createElement('link'); link.rel = 'stylesheet'; link.href = new URL('./xterm.css', import.meta.url).href; @@ -343,11 +365,11 @@ export async function mount({bridge, config, terminal: element, preview, onExit} }); const context = {bridge, config, preview, cppCommands, onExit}; const editor = new LineEditor({write, columns: () => terminal.cols, prompt: '> ', history: await readHistory(bridge), - saveHistory: lines => saveHistory(bridge, lines), + remember: line => rememberLine(bridge, line), run: (line, signal) => runLine(line, {...context, editor, signal, write: text => editor.write(text)}), complete: line => complete(line, context)}); terminal.onResize(() => editor.resized()); - new ResizeObserver(() => fit.fit()).observe(element); + if (fitToElement) new ResizeObserver(() => fit.fit()).observe(element); terminal.onData(data => editor.handle(data)); editor.showPrompt(); terminal.focus(); diff --git a/js/developer/environment/terminal.mjs b/js/developer/environment/terminal.mjs index 260e1c49..ae646393 100644 --- a/js/developer/environment/terminal.mjs +++ b/js/developer/environment/terminal.mjs @@ -154,6 +154,35 @@ export function tokenize(line) { /** A word as typed on a line: whitespace, quotes and backslashes escaped. */ export const escapeWord = word => word.replace(/[\s'"\\]/g, '\\$&'); +/** + * The word being typed at the end of a line, read like tokenize(): where it starts, its value and the quote it leaves + * open ("'", '"' or null). Null after a backslash that escapes nothing yet. + */ +export function wordAtEnd(line) { + let start = 0, quote = null, escaped = false; + for (let index = 0; index < line.length; ++index) { + const char = line[index]; + if (escaped) escaped = false; + else if (quote) { + if (char === quote) quote = null; + else if (char === '\\' && quote === '"') escaped = true; + } + else if (char === '\\') escaped = true; + else if (char === "'" || char === '"') quote = char; + else if (char === ' ' || char === '\t') start = index + 1; + } + if (escaped) return null; + const typed = line.slice(start); + return {start, quote, value: typed ? tokenize(typed + (quote ?? ''))[0] : ''}; +} + +/** Text added to a word, escaped for the quote left open in it; null when it cannot be written there. */ +export function escapeFor(text, quote) { + if (quote === "'") return text.includes("'") ? null : text; + if (quote === '"') return text.replace(/["\\]/g, '\\$&'); + return escapeWord(text); +} + function commonPrefix(words) { return words.reduce((prefix, word) => { let length = 0; @@ -194,14 +223,14 @@ export const historyLimit = 500; * write(text): displays text; columns(): the terminal's width; * run(line, signal): a Promise of the command's output; it rejects with an Error whose exitCode (1 by default, 130 * once Ctrl+C aborted `signal`) becomes the status; - * complete(line): a Promise of {word, candidates}, the word being completed at the end of the line and the full words - * that can replace it; - * saveHistory(lines): persists the history after each command. + * complete(line): a Promise of {candidates}, the full words that can replace the word at the end of the line (its + * value as wordAtEnd reads it); + * remember(line): persists a line added to the history. * Commands run one at a time; lines pasted together run one after the other. */ export class LineEditor { - constructor({write, columns = () => 80, run, complete = async () => ({word: '', candidates: []}), prompt = '> ', history = [], saveHistory = () => {}}) { - Object.assign(this, {columns, run, complete, saveHistory}); + constructor({write, columns = () => 80, run, complete = async () => ({candidates: []}), prompt = '> ', history = [], remember = () => {}}) { + Object.assign(this, {columns, run, complete, persist: remember}); // Whether the cursor is at the start of a row: output streamed without a final line break is followed by one // before the prompt. this.atLineStart = true; @@ -244,7 +273,7 @@ export class LineEditor { } handle(data) { - if (this.closed) return; + if (this.closed) return data === '\r' ? this.reopen() : undefined; if (this.completing) return void this.completing.push(data); if (this.running) return this.whileBusy(data); const action = keyActions.get(data); @@ -373,7 +402,7 @@ export class LineEditor { if (line.trim() === '' || this.history.at(-1) === line) return; this.history.push(line); if (this.history.length > historyLimit) this.history.splice(0, this.history.length - historyLimit); - try { this.saveHistory(this.history.slice()); } catch { /* the history is a convenience */ } + try { this.persist(line); } catch { /* the history is a convenience */ } } // Moves below the line, runs it, then the pasted lines queued after it. @@ -446,27 +475,40 @@ export class LineEditor { // Completes the word before the cursor, at the end of the line: one candidate is inserted whole, several by their // common prefix, or listed when they share nothing more. + // The completion is escaped like the word it extends; a complete word also closes the quote it opened. async completeLine() { if (this.cursor !== this.cells.length) return; const line = this.line; - let word, candidates; - try { ({word, candidates} = await this.complete(line)); } + const word = wordAtEnd(line); + if (!word) return; + let candidates; + try { ({candidates} = await this.complete(line)); } catch { return; } if (!candidates?.length || this.line !== line) return; + const extend = (text, end = '') => { + const escaped = escapeFor(text.slice(word.value.length), word.quote); + if (escaped !== null && (escaped || end)) this.insert(escaped + end); + }; if (candidates.length === 1) { const [candidate] = candidates; - return this.insert(escapeWord(candidate.slice(word.length)) + (candidate.endsWith('/') ? '' : ' ')); + return extend(candidate, candidate.endsWith('/') ? '' : (word.quote ?? '') + ' '); } const prefix = commonPrefix(candidates); - if (prefix.length > word.length) return this.insert(escapeWord(prefix.slice(word.length))); + if (prefix.length > word.value.length) return extend(prefix); this.moveTo(this.cells.length); this.write('\r\n' + candidates.join(' ') + '\r\n'); this.showPrompt(); } - /** Ends the session: the editor no longer reads input. */ + /** Ends the session: the editor reads no more input until Enter starts a new session. */ close() { this.closed = true; this.queue = []; } + + reopen() { + this.closed = false; + this.status = 0; + this.showPrompt(); + } } diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index 6e1e7ce7..49451c50 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -389,19 +389,22 @@ try { await firstWait; await waitState('here', 'cancelled'); assert(await commandState('second') === 'running', 'Ctrl+C in one browser must not stop the command of another'); + const browsers = await webFront.cppFunction('test.browsers')(); sessionFrame.remove(); await waitState('second', 'cancelled'); + for (let attempt = 0; await webFront.cppFunction('test.browsers')() !== browsers - 1; ++attempt) + if (attempt === 200) throw new Error('The connection of a closed browser must be released'); + else await delay(25); void secondWait; // The terminal itself, mounted in this page with a real xterm.js. const host = document.createElement('div'); host.style.cssText = 'width:640px;height:240px'; document.body.append(host); let exitedWith = null; - const mounted = async () => runtime.mount({bridge: webFront, config, terminal: host, preview: context.preview, onExit: code => { exitedWith = code; }}); + // The test sets the terminal's size itself: an observer following the element would race with it. + const mounted = async () => runtime.mount({bridge: webFront, config, terminal: host, preview: context.preview, onExit: code => { exitedWith = code; }, fitToElement: false}); const {terminal, editor} = await mounted(); - // The terminal fits its element when its ResizeObserver first reports: let that happen before resizing it. - const frames = () => new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve))); - await frames(); + terminal.resize(80, 12); const buffer = () => terminal.buffer.active; const rendered = () => new Promise(resolve => terminal.write('', resolve)); // Like xterm.js, one input per key; text may come as one input. @@ -504,6 +507,14 @@ try { await completed('echo too', 'echo tools/'); await completed('echo tools/js', 'echo tools/jsx.tsx '); await completed('hi', 'history '); + // Paths with spaces and quotes: the completion reads the escaped or quoted word and extends it the same way. + await writeFile("my dir/file one's.txt", 'x'); + await completed('echo my\\ d', 'echo my\\ dir/'); + await completed('echo my\\ dir/f', "echo my\\ dir/file\\ one\\'s.txt "); + await completed('echo "my d', 'echo "my dir/'); + await completed('echo "my dir/f', `echo "my dir/file one's.txt" `); + // A single quote cannot be written between single quotes: nothing is inserted. + await completed("echo 'my dir/f", "echo 'my dir/f"); await type('h', '\t'); assert(editor.line === 'h' && lastRows(2)[0].includes('help') && lastRows(2)[0].includes('history'), `Several candidates must be listed: ${lastRows(2)}`); await type('\x03'); @@ -514,9 +525,12 @@ try { const saved = JSON.parse(new TextDecoder().decode(await readFile(runtime.historyPath))); assert(saved.at(-1) === 'clear' && saved.includes('echo three'), `The history must be saved in the project: ${saved.slice(-3)}`); await type('exit 4\r'); - assert(exitedWith === 4 && editor.closed && lastRows(2)[0] === 'Session ended.', `exit must end the session with its code: ${exitedWith}`); - terminal.input('echo ignored\r'); - assert(!editor.busy, 'A closed session must ignore input'); + assert(exitedWith === 4 && editor.closed && lastRows(2)[0] === 'Session ended. Press Enter to start a new session.', `exit must end the session with its code: ${exitedWith}`); + await type('echo ignored'); + assert(!editor.busy && editor.line === '', 'A closed session must ignore input'); + // The window stays open when the browser refuses to close it: Enter starts a new session. + await type('\r'); + assert(!editor.closed && editor.status === 0 && lastRows(1)[0] === '> ', `Enter must start a new session after exit: ${lastRows(2)}`); await runtime.historySaved(); terminal.dispose(); host.replaceChildren(); @@ -524,6 +538,22 @@ try { again.terminal.input('\x1b[A'); await new Promise(resolve => again.terminal.write('', resolve)); assert(again.editor.line === 'exit 4', `A new terminal must recall the project's history: ${again.editor.line}`); + again.terminal.input('\x03'); + // Two terminals on the same project: each one adds its lines to the history, neither erases the other's. + const otherHost = document.createElement('div'); + otherHost.style.cssText = 'width:640px;height:240px'; + document.body.append(otherHost); + const other = await runtime.mount({bridge: webFront, config, terminal: otherHost, preview: context.preview, onExit: () => {}}); + for (const [session, line] of [[again, 'echo from-first'], [other, 'echo from-second'], [again, 'echo first-again']]) { + session.terminal.input(line + '\r'); + await session.editor.whenIdle(); + } + await runtime.historySaved(); + const shared = JSON.parse(new TextDecoder().decode(await readFile(runtime.historyPath))); + assert(JSON.stringify(shared.slice(-3)) === JSON.stringify(['echo from-first', 'echo from-second', 'echo first-again']), + `Terminals must not erase each other's history: ${shared.slice(-4)}`); + other.terminal.dispose(); + otherHost.remove(); again.terminal.dispose(); host.remove(); // The application stops while this command runs: its shutdown must drain it (checked in C++). From e205ffa35445bb2f59aa149a19cca0316d75225c Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 00:48:20 +0200 Subject: [PATCH 037/134] Pace printed output between its pieces [#308] print() sent every piece of its text before checking the write queue, so a long text could overfill it and Ctrl+C took effect only once it was sent. It now waits after each piece that leaves too many frames queued, and stops sending once the command is asked to stop. --- docs/DEVELOPER_ENVIRONMENT.md | 5 +++-- include/webfront/Commands.hpp | 15 +++++++++------ test/unit/CommandsTests.cpp | 25 +++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index bdbf8ecf..7f96248d 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -378,8 +378,9 @@ app.show(); The terminal discovers the commands through the bridge (`webfront.commands.list`) and runs each one in the session of its browser with `webfront.commands.start`. In C++, the command is spawned like `ui.spawn` on the server thread: -- `context.write(text)` streams output with fire-and-forget calls; `co_await context.print(text)` also suspends the - command while more than 32 frames wait for a browser that reads slower, and is a point where Ctrl+C stops it. +- `context.write(text)` streams output with fire-and-forget calls; `co_await context.print(text)` sends it piece by + piece and, after each piece, suspends the command while more than 32 frames wait for a browser that reads slower; + each wait is a point where Ctrl+C stops it. `context.args()` holds the words after the command name, split like a shell line; `context.exit(code)` sets the exit code. A command that returns once asked to stop reports 130, whatever it returned. - Ctrl+C sends `webfront.commands.cancel`: the command's stop token is requested, which the senders it awaits diff --git a/include/webfront/Commands.hpp b/include/webfront/Commands.hpp index a9fe9197..e0baf096 100644 --- a/include/webfront/Commands.hpp +++ b/include/webfront/Commands.hpp @@ -142,14 +142,17 @@ class Context { return; } - /// Writes like write(), then suspends the command while more than maxPendingOutput frames wait for a browser that - /// reads slower than the command writes. Each wait is a point where Ctrl+C stops the command. Prefer it to write() - /// for large or unbounded output. + /// Writes like write(), one piece at a time: after each piece, the command is suspended while more than + /// maxPendingOutput frames wait for a browser that reads slower than the command writes. Each wait is a point where + /// Ctrl+C stops the command. Prefer it to write() for large or unbounded output. [[nodiscard]] Task print(std::string text) const { const auto command = run; - write(text); - while (!command->stop.stop_requested() && command->ui.pendingWrites() > maxPendingOutput) - co_await command->ui.resumeAfter(std::chrono::milliseconds(5)); + for (const auto piece : detail::chunks(text)) { + if (command->stop.stop_requested() || !command->send("webfront.commands.output", piece)) + co_return; + while (!command->stop.stop_requested() && command->ui.pendingWrites() > maxPendingOutput) + co_await command->ui.resumeAfter(std::chrono::milliseconds(5)); + } } /// Sets the exit code reported when the command returns; 0 by default. An exception reports 1. diff --git a/test/unit/CommandsTests.cpp b/test/unit/CommandsTests.cpp index 4b3ec15e..57683951 100644 --- a/test/unit/CommandsTests.cpp +++ b/test/unit/CommandsTests.cpp @@ -102,6 +102,8 @@ struct FakeApp { vector registered; size_t backlog = 0; // frames waiting for the network; each pause lets the browser read 10 int pauses = 0; + bool queueing = false; // each browser call adds a frame to the backlog + vector paced; // "send" and "pause", in order // Destroyed first: draining its tasks lets the commands report through the members above. RealApp real{WebFrontConfig{.port = "0"}}; }; @@ -117,6 +119,7 @@ size_t FakeUI::pendingWrites() const { auto FakeUI::resumeAfter(chrono::milliseconds) const { return networking::ex::just() | networking::ex::then([app = app] { ++app->pauses; + app->paced.push_back("pause"); app->backlog -= min(app->backlog, 10); }); } @@ -126,6 +129,10 @@ auto FakeUI::jsFunction(string_view name) const { if (app->gone.contains(link)) throw out_of_range("Connection closed"); app->calls.push_back(BrowserCall{link, function, id, {text(values)...}}); + if (app->queueing) { + ++app->backlog; + app->paced.push_back("send"); + } }; } @@ -299,6 +306,24 @@ SCENARIO("Printing waits while the browser has not read the output") { } } +SCENARIO("Printing a long text waits between its pieces") { + GIVEN("a browser with as many frames to read as allowed") { + FakeApp app; + Commands commands{app}; + commands.add("print", "", [](Context context) -> Task { + co_await context.print(string(2 * commands::maxChunkBytes + 1, 'x')); + }); + app.backlog = commands::maxPendingOutput; + app.queueing = true; + WHEN("a command prints a text of three pieces") { + app.start(app.ui(1), 1, "print", "[]"); + THEN("it waits after the piece that overfills the queue, before sending the next") { + CHECK(app.paced == vector{"send", "pause", "send", "send", "send"}); + } + } + } +} + SCENARIO("Ctrl+C stops a running command and the next one runs at once") { GIVEN("a command waiting in a browser") { Fixture fixture; From c0730d937f0c263f5f040ce0875b7268c0833ebc Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 06:47:05 +0200 Subject: [PATCH 038/134] Draw tall lines a screen at a time, interrupt replayed commands and publish the history conditionally [#308] - A line taller than the terminal was redrawn from rows that had left the screen, which cursor moves cannot reach: Home duplicated part of it and misplaced the cursor. The editor now draws a screen of rows around the cursor, moving that window only when the cursor leaves it. - Enter then Ctrl+C typed during a completion: the replay waited for the command before handling Ctrl+C. A Ctrl+C typed after a replayed submission now interrupts its command at once. The start of a C++ command is sent synchronously again, so that its cancel can never reach C++ first. - Two pages could read the same history and the second publication was refused while the first one was being written, losing a line. Each change is now committed only if the file did not change since it was read, and is tried again on such a conflict. --- docs/DEVELOPER_ENVIRONMENT.md | 6 ++- js/developer/environment/bundles.json | 6 +-- js/developer/environment/commands.mjs | 9 ++-- js/developer/environment/runtime.mjs | 33 +++++++++---- js/developer/environment/terminal.mjs | 67 ++++++++++++++++++++------- test/web/developer-specs.mjs | 57 ++++++++++++++++++++++- 6 files changed, 144 insertions(+), 34 deletions(-) diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 7f96248d..d1bf8737 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -341,11 +341,13 @@ commands and its own: `help`, `clear` (screen and scrollback), `history` (`histo open, Enter starts a new session. No system shell is exposed. - **Editing:** left/right, Home/End (Ctrl+A/Ctrl+E), Backspace/Delete, Ctrl+U/Ctrl+K, Ctrl+L, up/down through the - history. A line wider than the terminal wraps over several rows and is redrawn in place. The editor moves over + history. A line wider than the terminal wraps over several rows and is redrawn in place; a line taller than the + terminal is drawn a screen of rows at a time around the cursor, since rows that left the screen cannot be rewritten. The editor moves over grapheme clusters: CJK characters and emoji (ZWJ sequences, flags, skin tones, presentation selector) take two cells, combining marks none. The same widths are registered in xterm.js, so both always agree. - **History:** kept per project in `.webfront/developer/history.json` (500 lines), restored by the next terminal. Each - line is added to the file as it is, so terminals of several pages on the same project keep each other's lines. + line is added to the file as it is, with a conditional publication tried again on conflict, so terminals of several + pages on the same project keep each other's lines. - **Paste:** a multi-line paste runs its lines one after the other; a last line without a line break waits on the prompt. Ctrl+C drops the lines still waiting. - **Completion (Tab):** command names, `wf` subcommands, the manifest's scripts after `wf run`, its entries and diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 4b9380f6..39b4e9c2 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -16,9 +16,9 @@ "js/developer/environment/packages.mjs": "faed29500a34c6ce24756d07bd4b47b9168ccec4bd49d12f00096a869637d74d", "js/developer/environment/starter.mjs": "048cf2af36b407bc075323f78a1195b4be91ad7da51f6ce941d9fb230f314ff9", "js/developer/environment/paths.mjs": "3b6114df78eb193161c5c84499dda084cb7ff91c56a4496371c30295d00880e3", - "js/developer/environment/runtime.mjs": "199cef36c3b9c8ba2d4f5953c0a70ca801b7e7cf45e1f54fb630cb28def2a5ab", - "js/developer/environment/terminal.mjs": "a58bd088b74526bce41062d5b370ee46041a251964ad0e8907ede9c02f5f7bdc", - "js/developer/environment/commands.mjs": "6b340518341753a4b71ca504da4788ac6be3cea2a6144e5c735dfb9f75d1d19e", + "js/developer/environment/runtime.mjs": "d8074509404492863b1737ce36615a69033a55b258b767bdd5e784cb98f34bd1", + "js/developer/environment/terminal.mjs": "9701ba85fbc8b7966d501a9db8d658ae386db68113bc3db3b13c52a14d9aeb5e", + "js/developer/environment/commands.mjs": "964770e4ca02c1044319b17ed76b7f6006427ac6751bd4c789ae58cbb850b071", "js/developer/environment/compiler.mjs": "cc6fbe8cabbd94750045cebfdf942234247519099a192ef9cdda6ccbdbfbb6a4", "js/developer/environment/bundler.mjs": "c2f55056a4702d57207203a29226f98a95a31ae615596bf21338b7dfabe83ed9", "js/developer/environment/entry.mjs": "b2b942443e3c74ae2c008392ba244d9b7e91db70ba1b4ebbe1357c455ebf51bb", diff --git a/js/developer/environment/commands.mjs b/js/developer/environment/commands.mjs index 4080cc1e..da60c9cb 100644 --- a/js/developer/environment/commands.mjs +++ b/js/developer/environment/commands.mjs @@ -54,11 +54,14 @@ export function runCommand(bridge, name, args, {signal, write = () => {}} = {}) else reject(failure(error || `Command ${name} exited with code ${code}`, code)); }}); signal?.addEventListener('abort', interrupt, {once: true}); - // A bridge that throws instead of rejecting must not leave the command registered. - Promise.resolve().then(() => bridge.cppFunction('webfront.commands.start')(id, name, JSON.stringify(args))).catch(error => { + const failed = error => { if (!running.has(id)) return; finish(); reject(error); - }); + }; + // The start is sent now, before any cancel that Ctrl+C sends; a bridge that throws instead of rejecting must + // not leave the command registered. + try { bridge.cppFunction('webfront.commands.start')(id, name, JSON.stringify(args)).catch(failed); } + catch (error) { failed(error); } }); } diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index 06735561..509f9f9a 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -5,7 +5,7 @@ import {manifestPath} from './manifest.mjs'; import {discoverCommands, runCommand} from './commands.mjs'; export {discoverCommands}; import {validateLock} from './packages.mjs'; -import {call, readProject, publish} from './io.mjs'; +import {call, readProject, publish, writeChunks} from './io.mjs'; import {isUnsafe} from './paths.mjs'; import {createStarter} from './starter.mjs'; import {install, initProject} from './installer.mjs'; @@ -223,14 +223,31 @@ async function readHistory(bridge) { } catch { return []; } } -// The history is written after each command, one write at a time; a failed write keeps the terminal usable. Each line -// is added to the file as it is now, so the terminals of other pages on the project keep theirs. +// The history is written after each command, one write at a time; a failed write keeps the terminal usable. Each change +// applies to the file as it is now, and is committed only if the file did not change since it was read: the terminals +// of other pages on the project, or of other applications, keep their lines. let historyWrites = Promise.resolve(); +// Another page writing the history, or having changed it since it was read: the change is tried again, shortly after. +const historyConflict = /changed since it was read|already being written/; +async function changeHistory(bridge, change) { + for (let attempt = 1; ; ++attempt) { + let id = null; + try { + const token = await call(bridge, 'state', historyPath); + const lines = change(await readHistory(bridge)).slice(-historyLimit); + id = await call(bridge, 'begin', historyPath, false); + await writeChunks(bridge, {id, path: 'output', bytes: encoder.encode(JSON.stringify(lines))}); + await call(bridge, 'commitGroup', id, historyPath, token); + return; + } catch (error) { + if (id !== null) await call(bridge, 'abort', id).catch(() => {}); + if (attempt === 20 || !historyConflict.test(error?.message)) throw error; + await new Promise(resolve => setTimeout(resolve, 10 + Math.random() * 40)); + } + } +} function writeHistory(bridge, change) { - historyWrites = historyWrites.then(async () => { - const lines = change(await readHistory(bridge)).slice(-historyLimit); - await publish(bridge, historyPath, textFile(JSON.stringify(lines)), {directory: false}); - }).catch(() => {}); + historyWrites = historyWrites.then(() => changeHistory(bridge, change)).catch(() => {}); return historyWrites; } const rememberLine = (bridge, line) => writeHistory(bridge, lines => lines.at(-1) === line ? lines : [...lines, line]); @@ -364,7 +381,7 @@ export async function mount({bridge, config, terminal: element, preview, onExit, return new Map(); }); const context = {bridge, config, preview, cppCommands, onExit}; - const editor = new LineEditor({write, columns: () => terminal.cols, prompt: '> ', history: await readHistory(bridge), + const editor = new LineEditor({write, columns: () => terminal.cols, rows: () => terminal.rows, prompt: '> ', history: await readHistory(bridge), remember: line => rememberLine(bridge, line), run: (line, signal) => runLine(line, {...context, editor, signal, write: text => editor.write(text)}), complete: line => complete(line, context)}); diff --git a/js/developer/environment/terminal.mjs b/js/developer/environment/terminal.mjs index ae646393..87e77e4f 100644 --- a/js/developer/environment/terminal.mjs +++ b/js/developer/environment/terminal.mjs @@ -220,7 +220,7 @@ export const historyLimit = 500; /** * Line editor driven by the terminal's input data. - * write(text): displays text; columns(): the terminal's width; + * write(text): displays text; columns() and rows(): the terminal's size; * run(line, signal): a Promise of the command's output; it rejects with an Error whose exitCode (1 by default, 130 * once Ctrl+C aborted `signal`) becomes the status; * complete(line): a Promise of {candidates}, the full words that can replace the word at the end of the line (its @@ -229,8 +229,8 @@ export const historyLimit = 500; * Commands run one at a time; lines pasted together run one after the other. */ export class LineEditor { - constructor({write, columns = () => 80, run, complete = async () => ({candidates: []}), prompt = '> ', history = [], remember = () => {}}) { - Object.assign(this, {columns, run, complete, persist: remember}); + constructor({write, columns = () => 80, rows = () => 24, run, complete = async () => ({candidates: []}), prompt = '> ', history = [], remember = () => {}}) { + Object.assign(this, {columns, rows, run, complete, persist: remember}); // Whether the cursor is at the start of a row: output streamed without a final line break is followed by one // before the prompt. this.atLineStart = true; @@ -242,7 +242,10 @@ export class LineEditor { this.setPrompt(prompt); this.cells = []; this.cursor = 0; - this.row = 0; // the cursor's row below the prompt's first row + // The line's rows that fit the screen are drawn from row `first` of its layout; the cursor is `row` rows below + // the first one drawn. Rows above the screen are in the scrollback, which cursor moves cannot reach. + this.first = 0; + this.row = 0; this.history = history.slice(-historyLimit); this.historyIndex = this.history.length; this.queue = []; // pasted lines waiting for the running command: {text, submit} @@ -267,7 +270,7 @@ export class LineEditor { } showPrompt() { - this.row = 0; + this.row = this.first = 0; this.write(this.prompt); if (this.cells.length) this.redraw(); } @@ -372,17 +375,37 @@ export class LineEditor { this.showPrompt(); } - // Rewrites the prompt and the line from the prompt's first row, then places the cursor. A line that exactly fills - // its last row leaves xterm.js's cursor waiting to wrap: a line break moves it where the layout expects it. + // The rows of the line to draw: all of them when they fit the screen, else a screen of rows around the cursor, + // which stays where it was drawn while the cursor stays in it. + window(cursorRow, lastRow) { + const height = Math.max(1, this.rows()); + let first = this.first; + if (lastRow < height) first = 0; + else if (cursorRow < first) first = cursorRow; + else if (cursorRow >= first + height) first = cursorRow - height + 1; + first = Math.max(0, Math.min(first, lastRow - height + 1)); + return {first, last: Math.min(lastRow, first + height - 1)}; + } + + // Rewrites the line from its first drawn row, then places the cursor. A line taller than the screen is drawn a + // screen at a time: its rows above the screen cannot be rewritten. A line that exactly fills its last row leaves + // xterm.js's cursor waiting to wrap: a line break moves it where the layout expects it. redraw() { const columns = Math.max(1, this.columns()); const all = [...this.promptCells, ...this.cells]; const {starts, end} = layout(all, columns); const cursor = this.cursor === this.cells.length ? end : starts[this.promptCells.length + this.cursor]; - let text = ansi.up(this.row) + '\r' + ansi.clearBelow + this.prompt + this.line; - if (end.column === 0 && end.row > 0) text += '\r\n'; - text += ansi.up(end.row - cursor.row) + '\r' + ansi.right(cursor.column); - this.row = cursor.row; + const {first, last} = this.window(cursor.row, end.row); + let text = ansi.up(this.row) + '\r' + ansi.clearBelow; + text += all.filter((cell, index) => starts[index].row >= first && starts[index].row <= last).map(cell => cell.text).join(''); + let written = last; + if (end.row <= last) { + written = end.row; + if (end.column === 0 && end.row > first) text += '\r\n'; + } + text += ansi.up(written - cursor.row) + '\r' + ansi.right(cursor.column); + this.first = first; + this.row = cursor.row - first; this.write(text); } @@ -390,7 +413,9 @@ export class LineEditor { resized() { const columns = Math.max(1, this.columns()); const {starts, end} = layout([...this.promptCells, ...this.cells], columns); - this.row = (this.cursor === this.cells.length ? end : starts[this.promptCells.length + this.cursor]).row; + const cursor = this.cursor === this.cells.length ? end : starts[this.promptCells.length + this.cursor]; + this.first = this.window(cursor.row, end.row).first; + this.row = cursor.row - this.first; } track(promise) { @@ -412,7 +437,7 @@ export class LineEditor { this.write('\r\n'); this.cells = []; this.cursor = 0; - this.row = 0; + this.row = this.first = 0; this.running = true; const done = this.runLines(line).finally(() => { this.running = false; }); // A submission replayed after a completion is already tracked by it. @@ -434,7 +459,7 @@ export class LineEditor { line = next.text; this.cells = []; this.cursor = 0; - this.row = 0; + this.row = this.first = 0; } } @@ -466,9 +491,17 @@ export class LineEditor { finally { const typed = this.completing; this.completing = null; - for (const data of typed) { - const result = this.handle(data); - if (this.running) await result; // a replayed submission: the next keys follow its command + let keys = typed; + while (keys.length) { + const result = this.handle(keys.shift()); + if (!this.running) continue; + // A replayed submission: a Ctrl+C typed after it interrupts its command now; the other keys follow it. + const interrupt = keys.lastIndexOf('\x03'); + if (interrupt >= 0) { + keys = keys.slice(interrupt + 1); + this.interrupt(); + } + await result; } } } diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index 49451c50..50a9e19e 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -520,10 +520,44 @@ try { await type('\x03'); await type('clear\r'); assert(buffer().length === terminal.rows && rows()[0] === '> ', `clear must empty the screen and the scrollback: ${rows()[0]}`); + // A line taller than the screen is drawn a screen at a time around the cursor, never duplicated on it. + terminal.resize(20, 4); + await rendered(); + const digits = '0123456789'.repeat(10).slice(0, 95); + const tall = '> echo ' + digits; + const layoutRow = index => tall.slice(20 * index, 20 * index + 20); + const screen = () => rows().slice(buffer().baseY, buffer().baseY + terminal.rows); + const shows = (first, cursorY, cursorX, message) => { + const expected = [0, 1, 2, 3].map(index => layoutRow(first + index)); + assert(JSON.stringify(screen()) === JSON.stringify(expected) && buffer().cursorY === cursorY && buffer().cursorX === cursorX, + `${message}: ${JSON.stringify(screen())} at ${buffer().cursorY},${buffer().cursorX}`); + }; + await type('echo ' + digits); + shows(2, 3, 2, 'The end of a tall line must be on screen'); + await type('\x01'); + shows(0, 0, 2, 'Home must show the start of a tall line, once'); + await type('\x05'); + shows(2, 3, 2, 'End must show the end of a tall line again'); + await type('\r'); + assert(lastRows(2)[0] === digits.slice(80) && lastRows(1)[0] === '> ', `A tall line must run: ${screen()}`); + terminal.resize(80, 12); + await type('clear\r'); + // Enter and Ctrl+C typed while a completion is pending: the command starts, then is interrupted at once. + terminal.input('lin'); + terminal.input('\t'); + terminal.input('replay'); + terminal.input('\r'); + terminal.input('\x03'); + await waitState('replay', 'stopping'); + for (let attempt = 0; editor.busy; ++attempt) { + if (attempt === 100) throw new Error(`Ctrl+C typed during a completion must interrupt the replayed command: ${lastRows(3)}`); + await delay(20); + } + assert(editor.status === 130 && lastRows(3)[0] === '> linger replay', `The replayed command must be interrupted: ${lastRows(3)} ${editor.status}`); // The history is kept per project: a new terminal recalls it. await runtime.historySaved(); const saved = JSON.parse(new TextDecoder().decode(await readFile(runtime.historyPath))); - assert(saved.at(-1) === 'clear' && saved.includes('echo three'), `The history must be saved in the project: ${saved.slice(-3)}`); + assert(saved.at(-1) === 'linger replay' && saved.includes('clear') && saved.includes('echo three'), `The history must be saved in the project: ${saved.slice(-3)}`); await type('exit 4\r'); assert(exitedWith === 4 && editor.closed && lastRows(2)[0] === 'Session ended. Press Enter to start a new session.', `exit must end the session with its code: ${exitedWith}`); await type('echo ignored'); @@ -554,6 +588,27 @@ try { `Terminals must not erase each other's history: ${shared.slice(-4)}`); other.terminal.dispose(); otherHost.remove(); + // Two pages, each with its own runtime module, write their histories at the same time: no line is lost. + const historyFrame = document.createElement('iframe'); + historyFrame.src = '/fixtures/session.html'; + document.body.append(historyFrame); + for (let attempt = 0; !historyFrame.contentWindow?.session; ++attempt) { + if (attempt === 200) throw new Error('The second page did not load'); + await delay(25); + } + const page = await historyFrame.contentWindow.session; + const pageTerminal = await page.runtime.mount({bridge: page.bridge, config, terminal: historyFrame.contentDocument.getElementById('terminal'), + preview: context.preview, onExit: () => {}, fitToElement: false}); + const lines = page => [1, 2, 3, 4, 5].map(index => `echo ${page}${index}`); + again.terminal.paste(lines('here').join('\n') + '\n'); + pageTerminal.terminal.paste(lines('there').join('\n') + '\n'); + await Promise.all([again.editor.whenIdle(), pageTerminal.editor.whenIdle()]); + await Promise.all([runtime.historySaved(), page.runtime.historySaved()]); + const merged = JSON.parse(new TextDecoder().decode(await readFile(runtime.historyPath))); + const missing = [...lines('here'), ...lines('there')].filter(line => !merged.includes(line)); + assert(missing.length === 0, `Concurrent pages must keep every history line: ${missing}`); + pageTerminal.terminal.dispose(); + historyFrame.remove(); again.terminal.dispose(); host.remove(); // The application stops while this command runs: its shutdown must drain it (checked in C++). From e39b83085e3166b0d4973d9f23140bf08fc86edc Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 07:07:46 +0200 Subject: [PATCH 039/134] Share links under a lock, keep the command context alive and refuse a second Commands [#308] - Links are now released while the application runs, and UI calls may come from any thread: webLinks is guarded by a mutex and holds shared links. findLink() hands a caller its own reference, so a release on the server thread cannot destroy a link while jsFunction, jsFunctionSender, addScript or pendingWrites uses it; links are created and destroyed outside the lock. - The wrapper of a command handler is a coroutine owning its Context: a handler taking it by reference no longer reads a destroyed parameter after its first suspension (stack-use-after-return under ASan). - cppFunction returns false when the name is taken; a second Commands on an application throws std::logic_error instead of registering nothing. - json::Reader::array takes its callback as a template parameter. --- docs/ASYNC_EXECUTION.md | 3 +- docs/CHANGELOG.md | 3 +- include/webfront/Commands.hpp | 15 ++-- include/webfront/JsFunction.hpp | 26 +++--- include/webfront/JsFunctionSender.hpp | 9 +- include/webfront/WebFront.hpp | 124 +++++++++++++++++--------- include/webfront/utils/Json.hpp | 2 +- test/unit/CommandsTests.cpp | 31 ++++++- test/unit/JSFunctionTests.cpp | 4 +- test/unit/JsFunctionSenderTests.cpp | 4 +- 10 files changed, 145 insertions(+), 76 deletions(-) diff --git a/docs/ASYNC_EXECUTION.md b/docs/ASYNC_EXECUTION.md index 07ca4f08..f7cec46c 100644 --- a/docs/ASYNC_EXECUTION.md +++ b/docs/ASYNC_EXECUTION.md @@ -84,7 +84,8 @@ completes it stopped at once, so a waiting coroutine never delays shutdown. browser closes its connection or the connection fails (a failed write included), for as long as the returned `UISubscription` lives; shutdown, which stops every connection itself, notifies no handler. The connection is then released by a task -on the server context. Afterwards, an untyped `jsFunction` call to that UI is +on the server context; a call made meanwhile on another thread keeps the link alive +until it returns (`findLink` shares it). Afterwards, an untyped `jsFunction` call to that UI is dropped, a typed call returns a future that throws `Browser connection closed`, a `jsFunctionSender` completes with an error when started, and `addScript` throws `ConnectionError`. The 16-bit identifier of a released connection is reused only diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index dcd3c6f9..f6bbb151 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -45,7 +45,8 @@ output, stopped by Ctrl+C, the browser's disconnection or shutdown; the terminal does not wait for a stopped command; `co_await context.print(text)` waits for a slow browser. New `app.resumeAfter(duration)`/ `ui.resumeAfter(duration)` timer sender, `app.subscribeUIClosed(handler)`, `app.connectedBrowsers()`, `UI::id()`, - `UI::pendingWrites()` and `json::Reader::array`. + `UI::pendingWrites()`, `app.findLink(id)` and `json::Reader::array`. `cppFunction` returns false when the name was + already registered. ### Changed diff --git a/include/webfront/Commands.hpp b/include/webfront/Commands.hpp index e0baf096..8e353d18 100644 --- a/include/webfront/Commands.hpp +++ b/include/webfront/Commands.hpp @@ -338,22 +338,24 @@ class Registry : public std::enable_shared_from_this> { /// command: its late output and exit report are ignored, and the next command can start at once; /// - an exception it throws is shown as an error in the terminal, with exit code 1. /// A command must not block the server thread, which serves every browser: synchronous handlers are refused at -/// compile time, and long computations belong on another thread. Create one Commands object per application; the -/// registered bridge functions own the commands, so the object may be destroyed before the application. +/// compile time, and long computations belong on another thread. Create one Commands object per application (a second +/// one throws); the registered bridge functions own the commands, so the object may be destroyed before the application. template class Commands { public: using UI = typename App::UI; using Context = commands::Context; + /// Throws std::logic_error if the application already has a Commands object: its bridge functions are taken. explicit Commands(App& app) : registry(std::make_shared>()) { + if (!app.template cppFunction("webfront.commands.list", [owner = registry] { + return owner->list(); + })) + throw std::logic_error("This application already has webfront::Commands: create one per application"); registry->keep(app.subscribeUIClosed([weak = std::weak_ptr(registry)](UI ui) { if (auto owner = weak.lock()) owner->closed(ui); })); - app.template cppFunction("webfront.commands.list", [owner = registry] { - return owner->list(); - }); app.template cppFunction( "webfront.commands.start", [owner = registry](UI ui, std::uint32_t id, const std::string& name, const std::string& arguments) { owner->start(std::move(ui), id, name, arguments); @@ -371,8 +373,9 @@ class Commands { "webfront::Commands::add: a command is a coroutine returning webfront::Task and taking a " "webfront::commands::Context; a synchronous handler would block the server thread."); auto callable = std::make_shared>(std::forward(handler)); + // A coroutine, so that the context outlives the handler's task: a handler may take it by reference. registry->add(std::move(name), std::move(help), [callable](Context context) -> Task { - return std::invoke(*callable, std::move(context)); + co_await std::invoke(*callable, context); }); return *this; } diff --git a/include/webfront/JsFunction.hpp b/include/webfront/JsFunction.hpp index e2ba88e5..989c5fa1 100644 --- a/include/webfront/JsFunction.hpp +++ b/include/webfront/JsFunction.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -37,25 +38,24 @@ class JsFunction { command.setParametersCount(static_cast(1 + sizeof...(ts))); // A browser whose connection closed is gone: a call to it is dropped, and a typed call fails. + // The link is shared while used: a release on the server thread cannot destroy it meanwhile. + const auto link = webFront.findLink(webLinkId); if constexpr (std::is_same_v) { - try { - webFront.getLink(webLinkId).sendFrame(std::move(frame)); - } catch (const std::out_of_range&) { } + if (link) + link->sendFrame(std::move(frame)); } else { - try { - auto&& link = webFront.getLink(webLinkId); - auto [callId, result] = link.template expectResult(); - command.setCallId(callId); - if (callId != 0) - link.sendFrame(std::move(frame)); - // Structured bindings are not implicitly movable on return, so a move-only future would be - // copied here. Newer libc++ accepts it; Apple Clang rejects it outright. - return std::move(result); - } catch (const std::out_of_range&) { + if (!link) { std::promise closed; closed.set_exception(std::make_exception_ptr(std::runtime_error("Browser connection closed"))); return closed.get_future(); } + auto [callId, result] = link->template expectResult(); + command.setCallId(callId); + if (callId != 0) + link->sendFrame(std::move(frame)); + // Structured bindings are not implicitly movable on return, so a move-only future would be + // copied here. Newer libc++ accepts it; Apple Clang rejects it outright. + return std::move(result); } } diff --git a/include/webfront/JsFunctionSender.hpp b/include/webfront/JsFunctionSender.hpp index 1b585594..180c00f2 100644 --- a/include/webfront/JsFunctionSender.hpp +++ b/include/webfront/JsFunctionSender.hpp @@ -239,11 +239,10 @@ class JsFunctionSender { public: /// The connection of a browser that is gone leaves the references empty: started calls report an error. JsFunctionSender(std::string_view functionName, WebFront& wf, WebLinkId id) : name(functionName) { - try { - auto& link = wf.getLink(id); - pending = link.pendingResults(); - socket = link.socket(); - } catch (const std::out_of_range&) { } + if (const auto link = wf.findLink(id)) { + pending = link->pendingResults(); + socket = link->socket(); + } } auto operator()(auto&&... arguments) const { diff --git a/include/webfront/WebFront.hpp b/include/webfront/WebFront.hpp index e007c6a0..dc8bd10b 100644 --- a/include/webfront/WebFront.hpp +++ b/include/webfront/WebFront.hpp @@ -59,20 +59,16 @@ class BasicUI { * @param script */ void addScript(std::string_view script) const { - try { - webFront.getLink(webLinkId).sendCommand(msg::TextCommand(msg::TxtOpcode::injectScript, script)); - } catch (const std::out_of_range&) { + const auto link = webFront.findLink(webLinkId); + if (!link) throw ConnectionError("Connection with client lost"); - } + link->sendCommand(msg::TextCommand(msg::TxtOpcode::injectScript, script)); } /// The frames queued for this browser and not yet written to the network; 0 once its connection is gone. [[nodiscard]] std::size_t pendingWrites() const { - try { - return webFront.getLink(webLinkId).pendingWrites(); - } catch (const std::out_of_range&) { - return 0; - } + const auto link = webFront.findLink(webLinkId); + return link ? link->pendingWrites() : 0; } /** @@ -238,8 +234,8 @@ struct ApplyArgs; template struct ApplyArgs> { template - static void invoke(Self& self, std::string functionName, Function&& function) { - self.template cppFunction(std::move(functionName), std::forward(function)); + static bool invoke(Self& self, std::string functionName, Function&& function) { + return self.template cppFunction(std::move(functionName), std::forward(function)); } }; @@ -316,16 +312,20 @@ class BasicWF { httpDocRoot(config.documentRoot), contentPolicy(std::move(config.contentPolicy)), idsCounter(0) { + // Links are created on the server thread, outside the lock: identifiers are only assigned here. httpServer.onUpgrade([this](typename Net::Socket&& socket) { - for (bool inserted = false; !inserted; ++idsCounter) - std::tie(std::ignore, inserted) = webLinks.try_emplace( - idsCounter, - std::move(socket), - idsCounter, - [this](WebLinkEvent event) { - onEvent(event); - }, - httpServer.taskScope()); + WebLinkId id{}; + { + std::scoped_lock lock{linksMutex}; + while (webLinks.contains(idsCounter)) + ++idsCounter; + id = idsCounter++; + } + auto link = std::make_shared>(std::move(socket), id, [this](WebLinkEvent event) { + onEvent(event); + }, httpServer.taskScope()); + std::scoped_lock lock{linksMutex}; + webLinks.emplace(id, std::move(link)); }); } @@ -338,7 +338,7 @@ class BasicWF { stopAndJoinServer(); // Coroutine cleanup may use its UI, so links stay alive through the join. httpServer.drainUntilJoined(); - webLinks.clear(); + releaseLinks(); } /** @brief Stops and joins owned work before returning. Call outside server callbacks, @@ -348,7 +348,7 @@ class BasicWF { stopAndJoinServer(); // Application coroutine cleanup may still use its UI: retain links until join. httpServer.drain(); - webLinks.clear(); + releaseLinks(); } /** @brief Thread-safe while the application lives. Starts on the server thread. @@ -398,13 +398,25 @@ class BasicWF { [[nodiscard]] UISubscription subscribeUIClosed(std::function handler) { return uiClosedSubscribers->subscribe(std::move(handler)); } - /// The link of a connected browser; throws std::out_of_range once its connection closed and was released. - WebLink& getLink(WebLinkId id) { - return webLinks.at(id); + /// The link of a connected browser, shared with the caller so that it stays valid while used, from any thread; + /// null once its connection closed and was released. + [[nodiscard]] std::shared_ptr> findLink(WebLinkId id) const { + std::scoped_lock lock{linksMutex}; + const auto found = webLinks.find(id); + return found == webLinks.end() ? nullptr : found->second; + } + + /// The link of a connected browser; throws std::out_of_range once its connection closed and was released. The + /// reference is only safe on the server thread, which releases links: elsewhere, use findLink(). + WebLink& getLink(WebLinkId id) { + if (auto link = findLink(id)) + return *link; + throw std::out_of_range("Browser connection closed"); } - /// The browsers connected now, as seen from the server thread: a closed connection is released shortly after. + /// The browsers connected now: a closed connection is released shortly after its closure. [[nodiscard]] std::size_t connectedBrowsers() const { + std::scoped_lock lock{linksMutex}; return webLinks.size(); } @@ -418,18 +430,21 @@ class BasicWF { * @tparam Args parameters of the CppFunction * @param functionName * @param function + * @return false when a function of that name was already registered, which stays registered */ template - void cppFunction(std::string functionName, auto&& function) { + bool cppFunction(std::string functionName, auto&& function) { if constexpr (detail::takes_caller::value) - registerWithCaller(std::move(functionName), std::forward(function)); + return registerWithCaller(std::move(functionName), std::forward(function)); else { auto callable = detail::makeCppFunctionHandler(std::forward(function)); auto responder = detail::makeCppFunctionResponder(std::move(callable)); - cppFunctions.try_emplace(std::move(functionName), - [responder](std::span data, WebLink& link, msg::CallId callId, UI) mutable { - responder(data, link, callId); - }); + return cppFunctions + .try_emplace(std::move(functionName), + [responder](std::span data, WebLink& link, msg::CallId callId, UI) mutable { + responder(data, link, callId); + }) + .second; } } @@ -444,9 +459,10 @@ class BasicWF { * * @param functionName * @param function + * @return false when a function of that name was already registered, which stays registered */ template - void cppFunction(std::string functionName, Function&& function) { + bool cppFunction(std::string functionName, Function&& function) { using Callable = std::remove_cvref_t; static_assert(detail::has_callable_traits, "webfront::BasicWF::cppFunction: could not deduce this callable's signature. Generic " @@ -454,7 +470,7 @@ class BasicWF { "cppFunction(name, callable)."); using Traits = detail::callable_traits; using Args = typename detail::caller_aware_args::type; - detail::ApplyArgs::invoke(*this, std::move(functionName), std::forward(function)); + return detail::ApplyArgs::invoke(*this, std::move(functionName), std::forward(function)); } enum class WindowAction { none, closeWindow }; @@ -522,20 +538,36 @@ class BasicWF { serverThread.join(); } + // A released link is destroyed outside the lock, by its last owner: a call on another thread may still use it. Task releaseLink(WebLinkId id) { - webLinks.erase(id); + std::shared_ptr> released; + { + std::scoped_lock lock{linksMutex}; + if (auto found = webLinks.find(id); found != webLinks.end()) { + released = std::move(found->second); + webLinks.erase(found); + } + } co_return; } + void releaseLinks() { + std::map>> released; + std::scoped_lock lock{linksMutex}; + released.swap(webLinks); + } + template - void registerWithCaller(std::string functionName, auto&& function) { + bool registerWithCaller(std::string functionName, auto&& function) { auto adapted = detail::adaptCaller(std::forward(function)); auto callable = detail::makeCppFunctionHandler(std::move(adapted)); auto responder = detail::makeCppFunctionResponder(std::move(callable)); - cppFunctions.try_emplace(std::move(functionName), - [responder](std::span data, WebLink& link, msg::CallId callId, UI caller) mutable { - responder(data, link, callId, caller); - }); + return cppFunctions + .try_emplace(std::move(functionName), + [responder](std::span data, WebLink& link, msg::CallId callId, UI caller) mutable { + responder(data, link, callId, caller); + }) + .second; } http::Server httpServer; @@ -543,7 +575,8 @@ class BasicWF { std::string httpPort; std::filesystem::path httpDocRoot; ContentPolicy contentPolicy; - std::map> webLinks; + mutable std::mutex linksMutex; // guards webLinks, read from any thread + std::map>> webLinks; WebLinkId idsCounter{0}; std::function uiStartedHandler; std::shared_ptr> uiSubscribers = std::make_shared>(); @@ -565,12 +598,15 @@ class BasicWF { // During shutdown the task is refused and the link goes with the application. static_cast(httpServer.startTask(releaseLink(event.webLinkId))); break; - case WebLinkEvent::Code::cppFunctionCalled: + case WebLinkEvent::Code::cppFunctionCalled: { + // The calling link is running this handler: it is registered and cannot be released meanwhile. + const auto link = findLink(event.webLinkId); if (auto function = cppFunctions.find(event.text); function != cppFunctions.end()) - function->second(event.data, getLink(event.webLinkId), event.callId, UI{*this, event.webLinkId}); + function->second(event.data, *link, event.callId, UI{*this, event.webLinkId}); else - getLink(event.webLinkId).sendError(event.callId, "C++ function '" + event.text + "' was not found"); + link->sendError(event.callId, "C++ function '" + event.text + "' was not found"); break; + } } } }; diff --git a/include/webfront/utils/Json.hpp b/include/webfront/utils/Json.hpp index 704cc1dc..2847116a 100644 --- a/include/webfront/utils/Json.hpp +++ b/include/webfront/utils/Json.hpp @@ -128,7 +128,7 @@ class Reader { } /// Reads an array, calling onElement() for each element; onElement must consume the value. - void array(const std::function& onElement) { + void array(auto&& onElement) { expect('['); if (consumeIf(']')) return; diff --git a/test/unit/CommandsTests.cpp b/test/unit/CommandsTests.cpp index 57683951..c72a43ac 100644 --- a/test/unit/CommandsTests.cpp +++ b/test/unit/CommandsTests.cpp @@ -68,7 +68,9 @@ struct FakeApp { set gone; // links whose browser calls throw, like a closed connection template - void cppFunction(string name, auto&& function) { + bool cppFunction(string name, auto&& function) { + if (std::ranges::find(registered, name) != registered.end()) + return false; if constexpr (sizeof...(Args) == 0) list = std::forward(function); else if constexpr (sizeof...(Args) == 2) @@ -76,6 +78,7 @@ struct FakeApp { else start = std::forward(function); registered.push_back(std::move(name)); + return true; } UISubscription subscribeUIClosed(function handler) { @@ -190,6 +193,9 @@ SCENARIO("Commands register their bridge functions and list the commands") { == R"([{"name":"code","help":"Exit with 3"},)" R"({"name":"fail","help":"Throw"},{"name":"greet","help":"Greet someone"},{"name":"wait","help":"Wait until stopped"}])"); } + THEN("a second Commands object on the application is refused") { + CHECK_THROWS_AS(Commands{fixture.app}, logic_error); + } THEN("invalid, reserved and duplicate names are refused") { for (const auto* name : {"", "two words", "quo'te", "back\\slash", "tab\t", "wf", "clear", "exit", "help", "history", "greet"}) CHECK_THROWS_AS(fixture.commands.add(name, "", greet), invalid_argument); @@ -420,6 +426,23 @@ SCENARIO("Shutdown drains running commands") { } } +SCENARIO("A command may take its context by reference") { + GIVEN("a command whose coroutine keeps a reference to its context across a suspension") { + FakeApp app; + Commands commands{app}; + commands.add("late", "", [](const Context& context) -> Task { + co_await context.ui().resumeAfter(chrono::milliseconds(1)); + context.write("after the pause\n"); + }); + WHEN("it runs") { + app.start(app.ui(1), 1, "late", "[]"); + THEN("its context is still valid after the suspension") { + CHECK(app.callsOf(1).front().values == vector{"after the pause\n"}); + } + } + } +} + SCENARIO("Commands may outlive their registering object") { GIVEN("commands whose Commands object is gone") { FakeApp app; @@ -442,6 +465,12 @@ SCENARIO("BasicWF provides the application facilities of commands") { auto subscription = app.subscribeUIClosed([](RealApp::UI) { }); CHECK(subscription.active()); } + THEN("a second Commands object is refused, and cppFunction tells a taken name") { + Commands commands{app}; + CHECK_THROWS_AS(Commands{app}, logic_error); + CHECK_FALSE(app.cppFunction("webfront.commands.list", [] { return 0; })); + CHECK(app.cppFunction("another", [] { return 0; })); + } THEN("calls to a browser that is gone are dropped, and typed calls fail") { const RealApp::UI gone(app, 42); CHECK(app.connectedBrowsers() == 0); diff --git a/test/unit/JSFunctionTests.cpp b/test/unit/JSFunctionTests.cpp index 31af9308..8955306f 100644 --- a/test/unit/JSFunctionTests.cpp +++ b/test/unit/JSFunctionTests.cpp @@ -86,8 +86,8 @@ struct WebLinkMock { struct WebFrontMock { using Net = networking::NetworkingMock; using BufferPolicy = http::DefaultBuffersPolicy; - WebLinkMock getLink(WebLinkId id) { - return WebLinkMock{id, *this}; + std::shared_ptr> findLink(WebLinkId id) { + return std::make_shared>(id, *this); } }; diff --git a/test/unit/JsFunctionSenderTests.cpp b/test/unit/JsFunctionSenderTests.cpp index fff79df8..51e53b21 100644 --- a/test/unit/JsFunctionSenderTests.cpp +++ b/test/unit/JsFunctionSenderTests.cpp @@ -18,8 +18,8 @@ struct SenderApp { using Net = InjectableNetworking; using BufferPolicy = http::DefaultBuffersPolicy; WebLink& link; - auto& getLink(WebLinkId) { - return link; + auto findLink(WebLinkId) { + return std::shared_ptr>(std::shared_ptr>{}, &link); // not owned } }; struct Observed { From 3c9ab73ea3ff70634f2649f48e4419c3afbcce7c Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 07:07:46 +0200 Subject: [PATCH 040/134] Keep keys typed during a command and never replace an unreadable history [#308] - Keys typed while a command ran were dropped unless they held a line break, so a command typed key by key ran as an empty line. Every key but Ctrl+C is now kept and applied after the command, like a paste, line by line. - The editor tracks each command and completion it waits for: the end of one no longer marks it idle while another is pending. - An unreadable or malformed history was read as empty and replaced by the lines of one terminal. Only a missing file is empty now; otherwise the history is shown empty and left unchanged. --- docs/DEVELOPER_ENVIRONMENT.md | 9 +-- js/developer/environment/bundles.json | 4 +- js/developer/environment/runtime.mjs | 18 +++-- js/developer/environment/terminal.mjs | 96 +++++++++++++++------------ test/web/DeveloperTest.cpp | 3 + test/web/developer-specs.mjs | 14 +++- 6 files changed, 90 insertions(+), 54 deletions(-) diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index d1bf8737..2c2ed3fb 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -347,9 +347,9 @@ open, Enter starts a new session. No system shell is exposed. cells, combining marks none. The same widths are registered in xterm.js, so both always agree. - **History:** kept per project in `.webfront/developer/history.json` (500 lines), restored by the next terminal. Each line is added to the file as it is, with a conditional publication tried again on conflict, so terminals of several - pages on the same project keep each other's lines. -- **Paste:** a multi-line paste runs its lines one after the other; a last line without a line break waits on the - prompt. Ctrl+C drops the lines still waiting. + pages on the same project keep each other's lines. A history file that cannot be read is never replaced. +- **Typing ahead and paste:** keys typed or pasted while a command runs are applied after it, line by line; a last + line without a line break waits on the prompt. Ctrl+C drops the keys still waiting. - **Completion (Tab):** command names, `wf` subcommands, the manifest's scripts after `wf run`, its entries and providers after `wf preview` and `wf embed`, and project paths, also when the word is escaped (`my\ dir/`) or quoted (`"my dir/`); the completion is written the same way and closes the quote. Several candidates are completed @@ -395,7 +395,8 @@ of its browser with `webfront.commands.start`. In C++, the command is spawned li - A command must not block the server thread, which serves every browser: a handler that does not return `webfront::Task` does not compile. Long computations belong on another thread. -The names `wf`, `clear`, `exit`, `help` and `history` are reserved. `context.write` has no flow control: a command +A second `webfront::Commands` on the same application throws `std::logic_error`. The names `wf`, `clear`, `exit`, +`help` and `history` are reserved. `context.write` has no flow control: a command writing large output with it, faster than the browser reads, grows the connection's write queue; use `context.print` for such output. diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 39b4e9c2..390c9ce7 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -16,8 +16,8 @@ "js/developer/environment/packages.mjs": "faed29500a34c6ce24756d07bd4b47b9168ccec4bd49d12f00096a869637d74d", "js/developer/environment/starter.mjs": "048cf2af36b407bc075323f78a1195b4be91ad7da51f6ce941d9fb230f314ff9", "js/developer/environment/paths.mjs": "3b6114df78eb193161c5c84499dda084cb7ff91c56a4496371c30295d00880e3", - "js/developer/environment/runtime.mjs": "d8074509404492863b1737ce36615a69033a55b258b767bdd5e784cb98f34bd1", - "js/developer/environment/terminal.mjs": "9701ba85fbc8b7966d501a9db8d658ae386db68113bc3db3b13c52a14d9aeb5e", + "js/developer/environment/runtime.mjs": "832fdd4c0b222c752d4a94667dd86fa70a5bf19223a966de7f8d0aa51b522f2e", + "js/developer/environment/terminal.mjs": "defa716b5b83c3e1fd64a985f3778104d35fa1ff91b379578675aa0c4056d0a0", "js/developer/environment/commands.mjs": "964770e4ca02c1044319b17ed76b7f6006427ac6751bd4c789ae58cbb850b071", "js/developer/environment/compiler.mjs": "cc6fbe8cabbd94750045cebfdf942234247519099a192ef9cdda6ccbdbfbb6a4", "js/developer/environment/bundler.mjs": "c2f55056a4702d57207203a29226f98a95a31ae615596bf21338b7dfabe83ed9", diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index 509f9f9a..cf9f6189 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -216,11 +216,19 @@ export async function execute(args, context) { export const historyPath = '.webfront/developer/history.json'; const toTerminalText = text => String(text).replace(/(? typeof line === 'string' && !/[\r\n]/.test(line)) : []; - } catch { return []; } + let bytes; + try { bytes = await readProject(bridge, historyPath); } + catch (error) { + if (error?.message?.includes('Cannot read project file:')) return []; + throw error; + } + let lines; + try { lines = JSON.parse(decoder.decode(bytes)); } catch { lines = null; } + if (!Array.isArray(lines)) throw new Error(`${historyPath} is not a JSON array of lines; it is left unchanged`); + return lines.filter(line => typeof line === 'string' && !/[\r\n]/.test(line)); } // The history is written after each command, one write at a time; a failed write keeps the terminal usable. Each change @@ -381,7 +389,7 @@ export async function mount({bridge, config, terminal: element, preview, onExit, return new Map(); }); const context = {bridge, config, preview, cppCommands, onExit}; - const editor = new LineEditor({write, columns: () => terminal.cols, rows: () => terminal.rows, prompt: '> ', history: await readHistory(bridge), + const editor = new LineEditor({write, columns: () => terminal.cols, rows: () => terminal.rows, prompt: '> ', history: await readHistory(bridge).catch(() => []), remember: line => rememberLine(bridge, line), run: (line, signal) => runLine(line, {...context, editor, signal, write: text => editor.write(text)}), complete: line => complete(line, context)}); diff --git a/js/developer/environment/terminal.mjs b/js/developer/environment/terminal.mjs index 87e77e4f..8c3bfdb9 100644 --- a/js/developer/environment/terminal.mjs +++ b/js/developer/environment/terminal.mjs @@ -248,10 +248,10 @@ export class LineEditor { this.row = 0; this.history = history.slice(-historyLimit); this.historyIndex = this.history.length; - this.queue = []; // pasted lines waiting for the running command: {text, submit} + this.ahead = []; // keys typed or pasted while a command runs, applied after it; '\r' ends a line this.status = 0; this.abort = null; - this.busy = null; + this.pending = new Set(); // commands and completions in progress this.running = false; this.completing = null; // input received while a completion is pending, replayed after it this.closed = false; @@ -264,7 +264,12 @@ export class LineEditor { ({clusters: this.promptCells, preceding: this.promptState} = cells(prompt)); } - /** Resolves once no command, queued line or completion is pending. */ + /** A Promise settled once the commands and completions now in progress are; null when there is none. */ + get busy() { + return this.pending.size ? Promise.allSettled([...this.pending]) : null; + } + + /** Resolves once no command, typed-ahead line or completion is pending. */ async whenIdle() { while (this.busy) await this.busy; } @@ -284,32 +289,56 @@ export class LineEditor { if (!data.startsWith('\x1b')) return this.insertText(data); } - // While a command runs, Ctrl+C aborts it and drops the pasted lines waiting for it; pasted lines wait their turn. + // While a command runs, Ctrl+C aborts it and drops the keys typed after it; other keys, typed or pasted, wait for + // the command and are applied after it. whileBusy(data) { if (data === '\x03') return this.interrupt(); - if (/[\r\n]/.test(data)) this.enqueue(data.split(/\r\n?|\n/)); + this.typeAhead(data); + } + + // Keeps input for later, each line break as its own '\r'. + typeAhead(data) { + data.split(/\r\n?|\n/).forEach((part, index) => { + if (index > 0) this.ahead.push('\r'); + if (part) this.ahead.push(part); + }); + } + + // Applies the keys typed ahead to the line, up to a line break: returns the line it submits, or null once the keys + // are used up, leaving what they typed on the line. Tab, which would wait for a completion, is ignored there. + readAhead() { + while (this.ahead.length) { + const data = this.ahead.shift(); + if (data === '\r') { + this.moveTo(this.cells.length); + const line = this.line; + this.write('\r\n'); + this.cells = []; + this.cursor = 0; + this.row = this.first = 0; + return line; + } + const action = keyActions.get(data); + if (action && data !== '\t') action(this); + else if (!action && !data.startsWith('\x1b')) this.insert(data); + } + return null; } interrupt() { - this.queue = []; + this.ahead = []; if (this.abort?.signal.aborted !== false) return; this.write('^C\r\n'); this.abort.abort(new Error('Interrupted')); } - enqueue([...segments]) { - const last = segments.pop(); - for (const text of segments) this.queue.push({text, submit: true}); - if (last) this.queue.push({text: last, submit: false}); - } - // Typed or pasted text: printable characters are inserted; each line break submits the line, and the lines after // the first wait for the command before them. insertText(data) { const [first, ...rest] = data.split(/\r\n?|\n/); this.insert(first); if (!rest.length) return; - this.enqueue(rest); + this.typeAhead(rest.join('\n')); return this.submit(); } @@ -419,8 +448,9 @@ export class LineEditor { } track(promise) { - this.busy = promise.finally(() => { this.busy = null; }); - return this.busy; + const tracked = promise.finally(() => this.pending.delete(tracked)); + this.pending.add(tracked); + return tracked; } remember(line) { @@ -430,7 +460,7 @@ export class LineEditor { try { this.persist(line); } catch { /* the history is a convenience */ } } - // Moves below the line, runs it, then the pasted lines queued after it. + // Moves below the line, runs it, then the lines typed or pasted ahead. submit() { this.moveTo(this.cells.length); const line = this.line; @@ -439,9 +469,7 @@ export class LineEditor { this.cursor = 0; this.row = this.first = 0; this.running = true; - const done = this.runLines(line).finally(() => { this.running = false; }); - // A submission replayed after a completion is already tracked by it. - return this.busy ? done : this.track(done); + return this.track(this.runLines(line).finally(() => { this.running = false; })); } async runLines(line) { @@ -451,15 +479,9 @@ export class LineEditor { await this.execute(line); if (this.closed) return; this.showPrompt(); - const next = this.queue.shift(); - if (!next) return; - this.setLine(next.text); - if (!next.submit) return; - this.write('\r\n'); - line = next.text; - this.cells = []; - this.cursor = 0; - this.row = this.first = 0; + const next = this.readAhead(); + if (next === null) return; + line = next; } } @@ -484,25 +506,15 @@ export class LineEditor { } } - // Keys typed while the completion is pending are kept and applied once it is inserted, in order. + // Keys typed while the completion is pending are kept and applied once it is inserted, in order: once one of them + // submits the line, the next ones act on its command like keys typed while it runs (Ctrl+C interrupts it). async completeThenReplay() { this.completing = []; try { await this.completeLine(); } finally { const typed = this.completing; this.completing = null; - let keys = typed; - while (keys.length) { - const result = this.handle(keys.shift()); - if (!this.running) continue; - // A replayed submission: a Ctrl+C typed after it interrupts its command now; the other keys follow it. - const interrupt = keys.lastIndexOf('\x03'); - if (interrupt >= 0) { - keys = keys.slice(interrupt + 1); - this.interrupt(); - } - await result; - } + for (const data of typed) this.handle(data); } } @@ -536,7 +548,7 @@ export class LineEditor { /** Ends the session: the editor reads no more input until Enter starts a new session. */ close() { this.closed = true; - this.queue = []; + this.ahead = []; } reopen() { diff --git a/test/web/DeveloperTest.cpp b/test/web/DeveloperTest.cpp index caa02d0d..229a6195 100644 --- a/test/web/DeveloperTest.cpp +++ b/test/web/DeveloperTest.cpp @@ -145,6 +145,9 @@ void registerCommands(webfront::Commands& commands, const std::shared_ptr webfront::Task { + co_await context.ui().resumeAfter(std::chrono::milliseconds(std::stoi(context.args().at(0)))); + }); commands.add("partial", "Write without a final line break", [](Context context) -> webfront::Task { context.write("partial"); co_return; diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index 50a9e19e..b0dd2be3 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -477,7 +477,7 @@ try { await rendered(); await delay(10); } - assert(lastRows(3)[0] === '> echo ho typed-ahead' && editor.queue.length === 0, `The completed line must run once: ${lastRows(3)}`); + assert(lastRows(3)[0] === '> echo ho typed-ahead' && editor.ahead.length === 0, `The completed line must run once: ${lastRows(3)}`); await type('echo ok\r'); assert(editor.status === 0, 'A successful command must reset the status'); // Ctrl+C in the terminal: the prompt comes back at once, and a command typed then runs while the first one ends. @@ -489,6 +489,12 @@ try { assert(editor.status === 0 && lastRows(2)[0] === 'next' && ['running', 'stopping'].includes(lingerState), `Ctrl+C must interrupt a C++ command: ${lastRows(3)} ${editor.status} ${lingerState}`); await waitState('terminal', 'stopping'); // Pasted lines run one after the other; the last one, without a line break, waits on the prompt. + // Keys typed one by one while a command runs are applied after it, Enter included. + terminal.input('sleep 300\r'); + for (const key of [...'echo ahead', '\r']) terminal.input(key); + await editor.whenIdle(); + await rendered(); + assert(JSON.stringify(lastRows(4)) === JSON.stringify(['> sleep 300', '> echo ahead', 'ahead', '> ']), `Keys typed during a command must be kept: ${lastRows(4)}`); terminal.paste('echo one\necho two\necho three'); await editor.whenIdle(); await rendered(); @@ -607,6 +613,12 @@ try { const merged = JSON.parse(new TextDecoder().decode(await readFile(runtime.historyPath))); const missing = [...lines('here'), ...lines('there')].filter(line => !merged.includes(line)); assert(missing.length === 0, `Concurrent pages must keep every history line: ${missing}`); + // A history that cannot be read is never replaced by the lines of one terminal. + await writeFile(runtime.historyPath, '{broken'); + again.terminal.input('echo kept\r'); + await again.editor.whenIdle(); + await runtime.historySaved(); + assert(new TextDecoder().decode(await readFile(runtime.historyPath)) === '{broken', 'A malformed history must be left unchanged'); pageTerminal.terminal.dispose(); historyFrame.remove(); again.terminal.dispose(); From a455f03b63b271456a8bc280921f16583a16c081 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 07:39:51 +0200 Subject: [PATCH 041/134] Wake paced output on writes, ignore shutdown closures and free sessions at disconnection [#308] - Shutdown cancels the connections' writes, which then fail and report a closure: BasicWF no longer notifies subscribeUIClosed handlers or releases links then, as documented. - A call dispatched for a link that is not registered is dropped instead of dereferencing a null link. getLink(), whose reference could outlive a released link, is removed in favor of findLink(). - Commands checks the registration of all three bridge functions. - Run::send no longer relies on an exception the bridge stopped throwing: the disconnection flag set by Registry::closed decides. - Registry::closed removes the browser's commands at once, so that a later browser given the same 16-bit identifier is neither refused nor written to by a command that ignores its stop. - print() no longer polls: ui.writesAtMost(limit) is a sender woken by the write that brings the link's queue down to the limit (WebSocket::onWritten, WebLink::whenWritesAtMost), and stopped by its stop token. --- docs/ASYNC_EXECUTION.md | 5 + docs/CHANGELOG.md | 5 +- docs/DEVELOPER_ENVIRONMENT.md | 4 +- docs/PROJECT_STATUS.md | 2 +- include/webfront/Commands.hpp | 66 +++++++------ include/webfront/WebFront.hpp | 22 +++-- include/webfront/http/WebSocket.hpp | 8 +- include/webfront/weblink/WebLink.hpp | 142 +++++++++++++++++++++++++++ test/unit/CommandsTests.cpp | 54 ++++++++-- test/unit/WebLinkTests.cpp | 49 +++++++++ 10 files changed, 301 insertions(+), 56 deletions(-) diff --git a/docs/ASYNC_EXECUTION.md b/docs/ASYNC_EXECUTION.md index f7cec46c..6f450e05 100644 --- a/docs/ASYNC_EXECUTION.md +++ b/docs/ASYNC_EXECUTION.md @@ -76,6 +76,11 @@ auto handle = app.spawn(showSquareRoot(ui)); handle.requestStop(); ``` +`ui.writesAtMost(limit)` returns a sender completing once at most `limit` frames +wait for the network on that browser's connection, woken by the write that brings +them down (no polling), or at once when the browser is gone; it observes the +task's stop token. It paces output to a browser that reads slower than written. + `app.resumeAfter(duration)` and `ui.resumeAfter(duration)` return a sender that completes on the server context once the duration has elapsed. Awaited in a task, it observes the task's stop token: `TaskHandle::requestStop()` or shutdown diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f6bbb151..b4db7c82 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -45,11 +45,14 @@ output, stopped by Ctrl+C, the browser's disconnection or shutdown; the terminal does not wait for a stopped command; `co_await context.print(text)` waits for a slow browser. New `app.resumeAfter(duration)`/ `ui.resumeAfter(duration)` timer sender, `app.subscribeUIClosed(handler)`, `app.connectedBrowsers()`, `UI::id()`, - `UI::pendingWrites()`, `app.findLink(id)` and `json::Reader::array`. `cppFunction` returns false when the name was + `UI::pendingWrites()`, `UI::writesAtMost(limit)` (woken by the write that drains the queue), `app.findLink(id)` and + `json::Reader::array`. `cppFunction` returns false when the name was already registered. ### Changed +- **Breaking:** `BasicWF::getLink(id)`, whose reference could outlive a released connection, is replaced by + `findLink(id)`, which shares the link with the caller (null once the browser is gone). - `DeveloperBootstrapOptions::registry` is now `std::optional`: unset, the manifest's registry applies; set, it must be HTTPS or a same-origin path and takes precedence over the manifest. The environment configuration gains `registryExplicit`; earlier environments keep reading `registry`. diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 2c2ed3fb..2aa1d5ea 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -381,8 +381,8 @@ The terminal discovers the commands through the bridge (`webfront.commands.list` of its browser with `webfront.commands.start`. In C++, the command is spawned like `ui.spawn` on the server thread: - `context.write(text)` streams output with fire-and-forget calls; `co_await context.print(text)` sends it piece by - piece and, after each piece, suspends the command while more than 32 frames wait for a browser that reads slower; - each wait is a point where Ctrl+C stops it. + piece and, after each piece, suspends the command while more than 32 frames wait for a browser that reads slower + (`ui.writesAtMost`, woken by the write that drains the queue); each wait is a point where Ctrl+C stops it. `context.args()` holds the words after the command name, split like a shell line; `context.exit(code)` sets the exit code. A command that returns once asked to stop reports 130, whatever it returned. - Ctrl+C sends `webfront.commands.cancel`: the command's stop token is requested, which the senders it awaits diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index 44fe2bf2..1fcd1647 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -455,7 +455,7 @@ Local verification on 2026-07-19 completed successfully: the CEF-off build passe - Result values are currently limited to the bridge's existing scalar, string, tuple, numeric typed-array and packed bitset parameter types; richer object/DOM values remain out of scope. - `webfront::Task`, `app.spawn(task)`/`ui.spawn(task)` and per-task `TaskHandle::requestStop()` provide application-owned coroutine lifetime without exposing an execution context. The compiled `WebFrontAwaitBrowser` example matches the README; `app.shutdown()` stops and joins before returning; spawn is callable from any thread while the application lives and returns a stopped handle if shutdown rejects it. Destruction keeps owners alive and logs/waits if an external operation delays the join, whereas explicit shutdown reports absent context progress. - `ui.jsFunctionSender(name)(...)` (default `R = void`) adds lazy, awaitable typed calls, with value/error/stopped completion and local receiver-token cancellation. Futures and JavaScript Promises remain supported without cancellation. JavaScript already dispatched continues; late replies are discarded. See [execution design](ASYNC_EXECUTION.md). -- Terminal commands (`webfront::Commands`) stream output with fire-and-forget calls: `context.write` has no flow control, `co_await context.print` waits while the browser has more than 32 frames to read. +- Terminal commands (`webfront::Commands`) stream output with fire-and-forget calls: `context.write` has no flow control, `co_await context.print` waits, without polling, while the browser has more than 32 frames to read. - Repeated cancellation of JavaScript functions that never respond reserves their 16-bit IDs until disconnection. Enough such calls exhaust IDs and subsequent calls fail with `Too many outstanding WebFront calls`. Calls have no automatic timeout or per-write delivery acknowledgement. - Server-owned counting scopes track HTTP, WebSocket and application operations through destruction. Shutdown drains until scope join completes, independently of unrelated context work. Regression tests cover pending reads, connection lifetime, sender errors, cancellation and result/stop races; the shared Jasmine suite exercises sender value/void/error and late-result cancellation. - Ordinary JavaScript arrays encode as tuple-like parameters; only numeric typed arrays use the homogeneous array wire representation. diff --git a/include/webfront/Commands.hpp b/include/webfront/Commands.hpp index 8e353d18..1ddb49fa 100644 --- a/include/webfront/Commands.hpp +++ b/include/webfront/Commands.hpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -98,18 +97,13 @@ struct Run { Run(UI caller, std::uint32_t commandId, std::vector args) : ui(std::move(caller)), id(commandId), arguments(std::move(args)) { } - /// Calls a browser function of the terminal, unless the browser is gone. Returns false when the call could not - /// be made. + /// Calls a browser function of the terminal, unless the browser disconnected (Registry::closed): its connection + /// is gone, and a later browser may get its identifier. Returns false when the call was not made. bool send(std::string_view function, auto&&... values) { if (disconnected.load()) return false; - try { - ui.jsFunction(function)(id, std::forward(values)...); - return true; - } catch (const std::exception&) { - disconnected = true; // the link is gone: nothing more reaches this browser - return false; - } + ui.jsFunction(function)(id, std::forward(values)...); + return true; } }; @@ -150,8 +144,8 @@ class Context { for (const auto piece : detail::chunks(text)) { if (command->stop.stop_requested() || !command->send("webfront.commands.output", piece)) co_return; - while (!command->stop.stop_requested() && command->ui.pendingWrites() > maxPendingOutput) - co_await command->ui.resumeAfter(std::chrono::milliseconds(5)); + if (command->ui.pendingWrites() > maxPendingOutput) + co_await command->ui.writesAtMost(maxPendingOutput); // woken by the write that drains the queue } } @@ -248,18 +242,21 @@ class Registry : public std::enable_shared_from_this> { handle->requestStop(); // outside the lock: the command may complete inline and unregister itself } - /// A disconnected browser: its commands are stopped and never write to the connection again. + /// A disconnected browser: its commands are stopped, never write to the connection again and leave the session at + /// once, so that a later browser given the same identifier starts afresh even if one of them ignores its stop. void closed(const UI& ui) { std::vector handles; { std::scoped_lock lock{mutex}; - for (auto& [key, command] : running) { - if (key.first != ui.id()) + for (auto command = running.begin(); command != running.end();) { + if (command->first.first != ui.id()) { + ++command; continue; - command.run->disconnected = true; - command.cancelRequested = true; - if (command.handle) - handles.push_back(*command.handle); + } + command->second.run->disconnected = true; + if (command->second.handle) + handles.push_back(*command->second.handle); + command = running.erase(command); } } for (const auto& handle : handles) @@ -319,7 +316,9 @@ class Registry : public std::enable_shared_from_this> { owner->finished(Key{run->ui.id(), run->id}, run); // A command that returns once asked to stop was interrupted too, whatever it returned. const int code = stopped || run->stop.stop_requested() ? interruptedExitCode : !error.empty() ? 1 : run->exitCode; - run->send("webfront.commands.exit", code, error.empty() ? std::string_view{} : chunks(error).front()); + try { + run->send("webfront.commands.exit", code, error.empty() ? std::string_view{} : chunks(error).front()); + } catch (...) { } // nothing is left to report it to } }; @@ -346,23 +345,26 @@ class Commands { using UI = typename App::UI; using Context = commands::Context; - /// Throws std::logic_error if the application already has a Commands object: its bridge functions are taken. + /// Throws std::logic_error if one of its bridge functions is already registered, as by another Commands object. explicit Commands(App& app) : registry(std::make_shared>()) { - if (!app.template cppFunction("webfront.commands.list", [owner = registry] { - return owner->list(); - })) - throw std::logic_error("This application already has webfront::Commands: create one per application"); - registry->keep(app.subscribeUIClosed([weak = std::weak_ptr(registry)](UI ui) { - if (auto owner = weak.lock()) - owner->closed(ui); + const auto registered = [](bool added) { + if (!added) + throw std::logic_error("The webfront.commands bridge functions are taken: create one webfront::Commands per application"); + }; + registered(app.template cppFunction("webfront.commands.list", [owner = registry] { + return owner->list(); })); - app.template cppFunction( + registered(app.template cppFunction( "webfront.commands.start", [owner = registry](UI ui, std::uint32_t id, const std::string& name, const std::string& arguments) { owner->start(std::move(ui), id, name, arguments); - }); - app.template cppFunction("webfront.commands.cancel", [owner = registry](UI ui, std::uint32_t id) { + })); + registered(app.template cppFunction("webfront.commands.cancel", [owner = registry](UI ui, std::uint32_t id) { owner->cancel(ui, id); - }); + })); + registry->keep(app.subscribeUIClosed([weak = std::weak_ptr(registry)](UI ui) { + if (auto owner = weak.lock()) + owner->closed(ui); + })); } /// Registers a command. Throws std::invalid_argument for an empty name, one with whitespace, quotes or diff --git a/include/webfront/WebFront.hpp b/include/webfront/WebFront.hpp index dc8bd10b..d8573142 100644 --- a/include/webfront/WebFront.hpp +++ b/include/webfront/WebFront.hpp @@ -91,6 +91,13 @@ class BasicUI { return webFront.spawn(std::move(task)); } + /// A sender completing once at most `limit` frames await the network for this browser, or at once when it is gone; + /// co_await propagates the task's stop token. It paces output to a browser that reads slower than it is written. + [[nodiscard]] auto writesAtMost(std::size_t limit) const { + using Link = typename decltype(webFront.findLink(webLinkId))::element_type; + return detail::WritesAtMost{webFront.findLink(webLinkId), limit}; + } + /// A sender completing on the server context after the duration; see BasicWF::resumeAfter. template [[nodiscard]] auto resumeAfter(std::chrono::duration duration) const { @@ -406,14 +413,6 @@ class BasicWF { return found == webLinks.end() ? nullptr : found->second; } - /// The link of a connected browser; throws std::out_of_range once its connection closed and was released. The - /// reference is only safe on the server thread, which releases links: elsewhere, use findLink(). - WebLink& getLink(WebLinkId id) { - if (auto link = findLink(id)) - return *link; - throw std::out_of_range("Browser connection closed"); - } - /// The browsers connected now: a closed connection is released shortly after its closure. [[nodiscard]] std::size_t connectedBrowsers() const { std::scoped_lock lock{linksMutex}; @@ -593,14 +592,19 @@ class BasicWF { uiSubscribers->notify(UI{*this, event.webLinkId}); break; case WebLinkEvent::Code::closed: + // Shutdown cancels the connections' writes, which then fail and report a closure: not a disconnection. + if (httpServer.taskScope().stopRequested()) + break; uiClosedSubscribers->notify(UI{*this, event.webLinkId}); // The link is running this handler: it is released afterwards, by a task on the server context. // During shutdown the task is refused and the link goes with the application. static_cast(httpServer.startTask(releaseLink(event.webLinkId))); break; case WebLinkEvent::Code::cppFunctionCalled: { - // The calling link is running this handler: it is registered and cannot be released meanwhile. + // The calling link is normally registered: the server thread registers it before it can read anything. const auto link = findLink(event.webLinkId); + if (!link) + break; if (auto function = cppFunctions.find(event.text); function != cppFunctions.end()) function->second(event.data, *link, event.callId, UI{*this, event.webLinkId}); else diff --git a/include/webfront/http/WebSocket.hpp b/include/webfront/http/WebSocket.hpp index 74451772..6fffe172 100644 --- a/include/webfront/http/WebSocket.hpp +++ b/include/webfront/http/WebSocket.hpp @@ -338,6 +338,8 @@ class WebSocket : public std::enable_shared_from_this> { /// Called on every failed write, before its diagnostic and even after stop(): frames queued /// before stopping still fail, and their producer must be detached rather than fed the error. void onWriteError(std::function&& handler) { writeErrorHandler = std::move(handler); } + /// Called, outside the write lock, each time the queue shrinks: a frame was written, or a failure dropped them all. + void onWritten(std::function&& handler) { writtenHandler = std::move(handler); } void write(std::string_view text) { writeData(Frame(text)); } void write(std::span data) { writeData(Frame(data)); } void write(std::span data, std::span data2) { writeData(Frame(data, data2)); } @@ -360,6 +362,7 @@ class WebSocket : public std::enable_shared_from_this> { std::function)> binaryHandler; std::function closeHandler; std::function writeErrorHandler; + std::function writtenHandler; mutable std::mutex writeMutex; std::deque>> writeQueue; // the first frame is the one being written networking::TaskScope& taskScope; @@ -531,9 +534,11 @@ class WebSocket : public std::enable_shared_from_this> { // Writes the queued frames in order and ends when the queue is empty. networking::Task writeFrames(std::shared_ptr) { try { - for (auto frame = nextFrame(false); frame; frame = nextFrame(true)) { + for (auto frame = nextFrame(false); frame;) { // A stopped WebSocket cancels the write: it fails like a write on a closed connection. co_await networking::ex::stopped_as_error(Net::Send(socket, frame->toBuffers()), std::make_error_code(std::errc::operation_canceled)); + frame = nextFrame(true); + if (writtenHandler) writtenHandler(); } } catch (const std::system_error& error) { @@ -541,6 +546,7 @@ class WebSocket : public std::enable_shared_from_this> { std::lock_guard lock(writeMutex); writeQueue.clear(); } + if (writtenHandler) writtenHandler(); onWriteFailed(error.code()); } } diff --git a/include/webfront/weblink/WebLink.hpp b/include/webfront/weblink/WebLink.hpp index 911554fe..98c146fd 100644 --- a/include/webfront/weblink/WebLink.hpp +++ b/include/webfront/weblink/WebLink.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -132,6 +133,7 @@ class WebLink { ws->onMessage([this, guard = handlers](std::span data) { guard->run([&] { onBinaryMessage(data); }); }); // Retire the transport before the WebSocket logs the write error, so it is never fed its own failure. ws->onWriteError([this, guard = handlers](std::error_code) { guard->run([&] { detachTransport(true); }); }); + ws->onWritten([this, guard = handlers] { guard->run([&] { wakeWriters(); }); }); ws->onClose([this, guard = handlers](websocket::CloseEvent event) { guard->run([&] { const log::ContextScope context(linkContext()); @@ -169,6 +171,28 @@ class WebLink { [[nodiscard]] std::uint64_t droppedLogFrames() const { return droppedLogs.load(std::memory_order_relaxed); } [[nodiscard]] std::size_t pendingWrites() const { return ws->pendingWrites(); } + /// Returns 0 when at most `limit` frames await the network. Otherwise registers `ready`, called once they do, on + /// the thread that writes the frame bringing them down, and returns its identifier for cancelWrites(). A waiter + /// left when the link is destroyed is never called. + std::uint64_t whenWritesAtMost(std::size_t limit, std::function ready) { + std::lock_guard lock(writersMutex); + if (ws->pendingWrites() <= limit) + return 0; + const auto waiter = ++lastWriter; + writers.emplace(waiter, Writer{limit, std::move(ready)}); + return waiter; + } + + /// Forgets a waiter of whenWritesAtMost() that was not called yet. + void cancelWrites(std::uint64_t waiter) { + std::function removed; // destroyed outside the lock + std::lock_guard lock(writersMutex); + if (auto found = writers.find(waiter); found != writers.end()) { + removed = std::move(found->second.ready); + writers.erase(found); + } + } + void sendCommand(auto message) { ws->write(message.header(), message.payload()); } void sendFrame(websocket::Frame frame) { ws->write(std::move(frame)); } @@ -279,6 +303,35 @@ class WebLink { } private: + struct Writer { + std::size_t limit; + std::function ready; + }; + std::mutex writersMutex; + std::map writers; // waiters of whenWritesAtMost(), by identifier + std::uint64_t lastWriter = 0; + + // The queue shrank: the waiters it now satisfies are removed, then called outside the lock. + void wakeWriters() { + std::vector> ready; + { + std::lock_guard lock(writersMutex); + if (writers.empty()) + return; + const auto queued = ws->pendingWrites(); + for (auto writer = writers.begin(); writer != writers.end();) { + if (queued > writer->second.limit) { + ++writer; + continue; + } + ready.push_back(std::move(writer->second.ready)); + writer = writers.erase(writer); + } + } + for (auto& call : ready) + call(); + } + /// Context for link-level logs outside any call; operationId stays empty. [[nodiscard]] log::Context linkContext() const { return {.component = "weblink", .webLinkId = idText.view(), .direction = log::CallDirection::None, .callId = {}}; @@ -328,4 +381,93 @@ class WebLink { } }; + +namespace detail { +/// Completes once at most `limit` frames await the network on a link (WebLink::whenWritesAtMost), or stopped by the +/// receiver's stop token. A link that is gone completes it at once: nothing is left to wait for. +template +class WritesAtMost { +public: + using sender_concept = networking::ex::sender_t; + using completion_signatures = networking::ex::completion_signatures; + + WritesAtMost(std::weak_ptr waited, std::size_t pending) : link(std::move(waited)), limit(pending) {} + + template + class Operation { + using StopToken = networking::ex::stop_token_of_t>; + // Shared with the link's waiter, which may run on another thread after a stop completed the operation. + struct State { + std::atomic done{false}; + std::atomic waiter{0}; + Operation* operation; + }; + struct OnStop { + Operation* operation; + void operator()() noexcept { operation->stopped(); } + }; + + Receiver receiver; + std::weak_ptr link; + std::size_t limit; + std::shared_ptr state; + std::optional> stopCallback; + + void stopped() noexcept { + if (state->done.exchange(true)) + return; + if (auto waited = link.lock()) + waited->cancelWrites(state->waiter); + networking::ex::set_stopped(std::move(receiver)); // may destroy this operation + } + + public: + Operation(Receiver r, std::weak_ptr waited, std::size_t pending) + : receiver(std::move(r)), link(std::move(waited)), limit(pending), state(std::make_shared()) { + state->operation = this; + } + Operation(Operation&&) = delete; + + void start() noexcept { + auto token = networking::ex::get_stop_token(networking::ex::get_env(receiver)); + auto waited = link.lock(); + if (token.stop_requested()) { + state->done = true; + return networking::ex::set_stopped(std::move(receiver)); + } + if (!waited) { + state->done = true; + return networking::ex::set_value(std::move(receiver)); + } + stopCallback.emplace(std::move(token), OnStop{this}); + const auto shared = state; // the operation may be gone once the waiter or a stop completed it + std::uint64_t waiter = 0; + try { + waiter = waited->whenWritesAtMost(limit, [shared] { + if (shared->done.exchange(true)) + return; // stopped first + auto* operation = shared->operation; + operation->stopCallback.reset(); // waits for a stop callback running on another thread + networking::ex::set_value(std::move(operation->receiver)); + }); + } catch (...) { } // registering failed: there is nothing to wait for + shared->waiter = waiter; + if (waiter == 0 && !shared->done.exchange(true)) { + stopCallback.reset(); + networking::ex::set_value(std::move(receiver)); + } + } + }; + + template + Operation connect(Receiver receiver) const { + return Operation(std::move(receiver), link, limit); + } + +private: + std::weak_ptr link; + std::size_t limit; +}; +} // namespace detail + } // namespace webfront diff --git a/test/unit/CommandsTests.cpp b/test/unit/CommandsTests.cpp index c72a43ac..692df361 100644 --- a/test/unit/CommandsTests.cpp +++ b/test/unit/CommandsTests.cpp @@ -53,6 +53,7 @@ struct FakeUI { TaskHandle spawn(Task task) const; auto jsFunction(string_view name) const; size_t pendingWrites() const; + auto writesAtMost(size_t limit) const; auto resumeAfter(chrono::milliseconds) const; }; @@ -65,7 +66,6 @@ struct FakeApp { function cancel; shared_ptr> closed = make_shared>(); vector calls; - set gone; // links whose browser calls throw, like a closed connection template bool cppFunction(string name, auto&& function) { @@ -89,8 +89,8 @@ struct FakeApp { return FakeUI{this, link}; } + // The calls to a disconnected browser are still recorded, as if a later browser had been given its identifier. void disconnect(int link) { - gone.insert(link); closed->notify(ui(link)); } @@ -119,18 +119,21 @@ size_t FakeUI::pendingWrites() const { return app->backlog; } -auto FakeUI::resumeAfter(chrono::milliseconds) const { - return networking::ex::just() | networking::ex::then([app = app] { +// The browser reads until the queue is down to half the limit. +auto FakeUI::writesAtMost(size_t limit) const { + return networking::ex::just() | networking::ex::then([app = app, limit] { ++app->pauses; app->paced.push_back("pause"); - app->backlog -= min(app->backlog, 10); + app->backlog = min(app->backlog, limit / 2); }); } +auto FakeUI::resumeAfter(chrono::milliseconds) const { + return networking::ex::just(); +} + auto FakeUI::jsFunction(string_view name) const { return [app = app, link = link, function = string(name)](uint32_t id, const auto&... values) { - if (app->gone.contains(link)) - throw out_of_range("Connection closed"); app->calls.push_back(BrowserCall{link, function, id, {text(values)...}}); if (app->queueing) { ++app->backlog; @@ -294,7 +297,7 @@ SCENARIO("Command output is split under the bridge string limit on character bou } SCENARIO("Printing waits while the browser has not read the output") { - GIVEN("a browser that has 55 frames to read") { + GIVEN("a browser that has more frames to read than allowed") { FakeApp app; Commands commands{app}; commands.add("print", "", [](Context context) -> Task { @@ -303,8 +306,8 @@ SCENARIO("Printing waits while the browser has not read the output") { app.backlog = 55; WHEN("a command prints") { app.start(app.ui(1), 1, "print", "[]"); - THEN("it waits until no more than the allowed frames are pending, then ends") { - CHECK(app.pauses == 3); + THEN("it waits once, until no more than the allowed frames are pending, then ends") { + CHECK(app.pauses == 1); CHECK(app.backlog <= commands::maxPendingOutput); CHECK(app.callsOf(1).back().values == vector{"0", ""}); } @@ -405,6 +408,37 @@ SCENARIO("Each browser has its own commands") { } } +SCENARIO("A browser given the identifier of a disconnected one starts afresh") { + GIVEN("a command that ignores its stop, in a browser that disconnects") { + Fixture fixture; + auto& app = fixture.app; + auto finish = make_shared(); + fixture.commands.add("deaf", "", [finish](Context) -> Task { + co_await networking::ex::write_env(testing::ManualSender([finish](auto completion) { *finish = std::move(completion); }), + networking::ex::prop{networking::ex::get_stop_token, networking::ex::never_stop_token{}}); + }); + app.start(app.ui(2), 1, "deaf", "[]"); + app.disconnect(2); + WHEN("a new browser with the same identifier runs a command with the same number") { + app.start(app.ui(2), 1, "greet", R"(["again"])"); + THEN("it runs, and only its own messages reach the new browser") { + const auto calls = app.callsOf(2); + REQUIRE(calls.size() == 2); + CHECK(calls[0].values == vector{"Hello again\n"}); + CHECK(calls[1].values == vector{"0", ""}); + } + AND_WHEN("the deaf command ends at last") { + finish->complete({}, 0); + THEN("its exit report does not reach the new browser either") { + CHECK(app.callsOf(2).size() == 2); + } + } + } + if (finish->complete) + finish->complete({}, 0); // lets the shutdown drain it + } +} + SCENARIO("Shutdown drains running commands") { GIVEN("a waiting command") { Fixture fixture; diff --git a/test/unit/WebLinkTests.cpp b/test/unit/WebLinkTests.cpp index d1ef48c1..996c8b6e 100644 --- a/test/unit/WebLinkTests.cpp +++ b/test/unit/WebLinkTests.cpp @@ -346,3 +346,52 @@ SCENARIO("A browser that stops reading bounds the diagnostic frames queued for i CHECK(link.pendingWrites() == 0); log::setLogLevel(log::Disabled); } + +namespace { +template +networking::Task waitWrites(Writes writes, bool& woken) { + co_await std::move(writes); + woken = true; +} +} // namespace + +SCENARIO("A link wakes a writer once its write queue drains") { + InjectableSocket::reset(); + InlineTaskScope scope; + auto link = make_shared>(InjectableSocket{}, 12, [](WebLinkEvent) { }, scope); + InjectableSocket::deferWrites(); + for (msg::CallId call = 1; call <= 3; ++call) + link->sendError(call, "queued"); + REQUIRE(link->pendingWrites() == 3); + using Writes = webfront::detail::WritesAtMost>; + bool woken = false; + GIVEN("a task waiting for at most one queued frame") { + networking::Spawn(scope, networking::ex::inline_scheduler{}, waitWrites(Writes{link, 1}, woken)); + THEN("it wakes when the second write ends, not before") { + CHECK_FALSE(woken); + InjectableSocket::completeDeferredWrites(); + CHECK_FALSE(woken); + InjectableSocket::completeDeferredWrites(); + CHECK(woken); + } + } + GIVEN("a waiting task that is stopped") { + networking::ex::inplace_stop_source stop; + networking::Spawn(scope, networking::ex::inline_scheduler{}, stop.get_token(), waitWrites(Writes{link, 0}, woken)); + stop.request_stop(); + THEN("it unwinds, and the drained queue does not call it") { + while (InjectableSocket::completeDeferredWrites() > 0) { } + CHECK_FALSE(woken); + CHECK(link->pendingWrites() == 0); + } + } + GIVEN("a link that is gone") { + std::weak_ptr> gone; + networking::Spawn(scope, networking::ex::inline_scheduler{}, waitWrites(Writes{gone, 0}, woken)); + THEN("the task does not wait") { + CHECK(woken); + } + } + InjectableSocket::deferWrites(false); + while (InjectableSocket::completeDeferredWrites() > 0) { } +} From 79c49a65e0cb3f1dbc942ccb16def3416893e2ef Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 07:39:51 +0200 Subject: [PATCH 042/134] Load the terminal in parallel, keep early keys and state an exit code once [#308] - mount() reads the C++ commands and the history in parallel, and keeps the keys typed meanwhile for the editor. - An error message that already gives its exit code ("exited with code 3") is no longer followed by "(exit code 3)". --- js/developer/environment/bundles.json | 4 ++-- js/developer/environment/runtime.mjs | 17 ++++++++++++----- js/developer/environment/terminal.mjs | 6 ++++-- test/web/developer-specs.mjs | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 390c9ce7..bc24dfba 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -16,8 +16,8 @@ "js/developer/environment/packages.mjs": "faed29500a34c6ce24756d07bd4b47b9168ccec4bd49d12f00096a869637d74d", "js/developer/environment/starter.mjs": "048cf2af36b407bc075323f78a1195b4be91ad7da51f6ce941d9fb230f314ff9", "js/developer/environment/paths.mjs": "3b6114df78eb193161c5c84499dda084cb7ff91c56a4496371c30295d00880e3", - "js/developer/environment/runtime.mjs": "832fdd4c0b222c752d4a94667dd86fa70a5bf19223a966de7f8d0aa51b522f2e", - "js/developer/environment/terminal.mjs": "defa716b5b83c3e1fd64a985f3778104d35fa1ff91b379578675aa0c4056d0a0", + "js/developer/environment/runtime.mjs": "e4f16cd2f5f95f73fee329b1360525475d04f4e49b24bd804e876ea2f3ef79a1", + "js/developer/environment/terminal.mjs": "7ffcf7ac6ef63c35cdf5ef70284b384525b13ba18422af069289e53b6c4f6be1", "js/developer/environment/commands.mjs": "964770e4ca02c1044319b17ed76b7f6006427ac6751bd4c789ae58cbb850b071", "js/developer/environment/compiler.mjs": "cc6fbe8cabbd94750045cebfdf942234247519099a192ef9cdda6ccbdbfbb6a4", "js/developer/environment/bundler.mjs": "c2f55056a4702d57207203a29226f98a95a31ae615596bf21338b7dfabe83ed9", diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index cf9f6189..4a51fc38 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -384,12 +384,18 @@ export async function mount({bridge, config, terminal: element, preview, onExit, fit.fit(); const write = text => terminal.write(text); write('WebFront browser-powered developer environment. Type help.\r\n'); - const cppCommands = await discoverCommands(bridge).catch(error => { - write(`\x1b[31mThe application's commands are unavailable: ${error?.message ?? error}\x1b[0m\r\n`); - return new Map(); - }); + // Keys typed while the commands and the history load are applied once the editor is ready. + const early = []; + const earlyInput = terminal.onData(data => early.push(data)); + const [cppCommands, history] = await Promise.all([ + discoverCommands(bridge).catch(error => { + write(`\x1b[31mThe application's commands are unavailable: ${error?.message ?? error}\x1b[0m\r\n`); + return new Map(); + }), + readHistory(bridge).catch(() => [])]); + earlyInput.dispose(); const context = {bridge, config, preview, cppCommands, onExit}; - const editor = new LineEditor({write, columns: () => terminal.cols, rows: () => terminal.rows, prompt: '> ', history: await readHistory(bridge).catch(() => []), + const editor = new LineEditor({write, columns: () => terminal.cols, rows: () => terminal.rows, prompt: '> ', history, remember: line => rememberLine(bridge, line), run: (line, signal) => runLine(line, {...context, editor, signal, write: text => editor.write(text)}), complete: line => complete(line, context)}); @@ -397,6 +403,7 @@ export async function mount({bridge, config, terminal: element, preview, onExit, if (fitToElement) new ResizeObserver(() => fit.fit()).observe(element); terminal.onData(data => editor.handle(data)); editor.showPrompt(); + for (const data of early) editor.handle(data); terminal.focus(); return {terminal, editor}; } diff --git a/js/developer/environment/terminal.mjs b/js/developer/environment/terminal.mjs index 8c3bfdb9..e843d129 100644 --- a/js/developer/environment/terminal.mjs +++ b/js/developer/environment/terminal.mjs @@ -496,9 +496,11 @@ export class LineEditor { } catch (error) { this.status = error?.exitCode ?? (signal.aborted ? 130 : 1); const message = String(error?.message ?? error); - // Ctrl+C already shows ^C: a bare interruption adds nothing. + // Ctrl+C already shows ^C: a bare interruption adds nothing. A code other than 1 is shown, unless the + // message already gives it ("exited with code 3"). + const stated = this.status === 1 || new RegExp(`\\bcode ${this.status}\\b`).test(message); if (!(signal.aborted && message === 'Interrupted')) - this.write(ansi.red(`Error: ${message}${this.status !== 1 ? ` (exit code ${this.status})` : ''}`).replace(/(? Date: Fri, 23 Oct 2026 07:50:13 +0200 Subject: [PATCH 043/134] Pass a WebLinkId to the link of the writes test [#308] MSVC warns (C4242, an error with /WX) about the int converted to WebLinkId inside make_shared. --- test/unit/WebLinkTests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/WebLinkTests.cpp b/test/unit/WebLinkTests.cpp index 996c8b6e..39901a4f 100644 --- a/test/unit/WebLinkTests.cpp +++ b/test/unit/WebLinkTests.cpp @@ -358,7 +358,7 @@ networking::Task waitWrites(Writes writes, bool& woken) { SCENARIO("A link wakes a writer once its write queue drains") { InjectableSocket::reset(); InlineTaskScope scope; - auto link = make_shared>(InjectableSocket{}, 12, [](WebLinkEvent) { }, scope); + auto link = make_shared>(InjectableSocket{}, WebLinkId{12}, [](WebLinkEvent) { }, scope); InjectableSocket::deferWrites(); for (msg::CallId call = 1; call <= 3; ++call) link->sendError(call, "queued"); From a2ca90c5b0524bd0252564d3a4da10a3546cc0aa Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 08:19:23 +0200 Subject: [PATCH 044/134] Make writesAtMost safe from start to link end, own the command's stop source and register Commands atomically [#308] - WritesAtMost: a stop or a wake-up that happens while start() runs, also inside the stop callback's registration, is recorded and delivered by start() once it no longer touches the operation. - The writers waiting on a link resume when its connection closes, after the closure was reported, and when it is destroyed, instead of waiting for the application's shutdown. A failed write reports the closure before waking them, so print() stops rather than writing to a dead socket. - A command observes its own stop source, owned with its Context and fed by its task: a copy of the Context outliving the command reads a valid source, and the command sees its stop before the senders it awaits resume it. - Commands checks its three bridge names (hasCppFunction) before registering any, so a refused construction leaves nothing behind. - A link is registered before it starts reading, so that every call it dispatches finds it. - print() waits through writesAtMost alone: one link lookup per piece. --- docs/ASYNC_EXECUTION.md | 5 +- docs/CHANGELOG.md | 2 +- docs/DEVELOPER_ENVIRONMENT.md | 4 +- include/webfront/Commands.hpp | 29 +++++++--- include/webfront/WebFront.hpp | 18 ++++-- include/webfront/http/WebSocket.hpp | 2 +- include/webfront/weblink/WebLink.hpp | 87 ++++++++++++++++++++++------ test/unit/CommandsTests.cpp | 45 ++++++++++++-- test/unit/WebLinkTests.cpp | 35 +++++++++++ 9 files changed, 185 insertions(+), 42 deletions(-) diff --git a/docs/ASYNC_EXECUTION.md b/docs/ASYNC_EXECUTION.md index 6f450e05..ab8aee6f 100644 --- a/docs/ASYNC_EXECUTION.md +++ b/docs/ASYNC_EXECUTION.md @@ -78,8 +78,9 @@ handle.requestStop(); `ui.writesAtMost(limit)` returns a sender completing once at most `limit` frames wait for the network on that browser's connection, woken by the write that brings -them down (no polling), or at once when the browser is gone; it observes the -task's stop token. It paces output to a browser that reads slower than written. +them down (no polling), or at once when the browser is gone. A closing connection +or a released link also completes it, after the closure was reported; it observes +the task's stop token. It paces output to a browser that reads slower than written. `app.resumeAfter(duration)` and `ui.resumeAfter(duration)` return a sender that completes on the server context once the duration has elapsed. Awaited in a task, diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index b4db7c82..d88d0611 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -47,7 +47,7 @@ `ui.resumeAfter(duration)` timer sender, `app.subscribeUIClosed(handler)`, `app.connectedBrowsers()`, `UI::id()`, `UI::pendingWrites()`, `UI::writesAtMost(limit)` (woken by the write that drains the queue), `app.findLink(id)` and `json::Reader::array`. `cppFunction` returns false when the name was - already registered. + already registered, and `hasCppFunction(name)` tells whether it is. ### Changed diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 2aa1d5ea..8da1c0b7 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -395,7 +395,9 @@ of its browser with `webfront.commands.start`. In C++, the command is spawned li - A command must not block the server thread, which serves every browser: a handler that does not return `webfront::Task` does not compile. Long computations belong on another thread. -A second `webfront::Commands` on the same application throws `std::logic_error`. The names `wf`, `clear`, `exit`, +A second `webfront::Commands` on the same application throws `std::logic_error` and registers nothing. A copy of a +`Context` may outlive its command (a detached task): its stop token stays valid and its writes are dropped once the +browser is gone. The names `wf`, `clear`, `exit`, `help` and `history` are reserved. `context.write` has no flow control: a command writing large output with it, faster than the browser reads, grows the connection's write queue; use `context.print` for such output. diff --git a/include/webfront/Commands.hpp b/include/webfront/Commands.hpp index 1ddb49fa..9ea1e11a 100644 --- a/include/webfront/Commands.hpp +++ b/include/webfront/Commands.hpp @@ -92,7 +92,9 @@ struct Run { std::uint32_t id; std::vector arguments; int exitCode = 0; - ex::inplace_stop_token stop{}; + // The command's own stop source, requested with its task's: a copy of the Context that outlives the task still + // reads a valid source. + ex::inplace_stop_source stop; std::atomic disconnected{false}; Run(UI caller, std::uint32_t commandId, std::vector args) : ui(std::move(caller)), id(commandId), arguments(std::move(args)) { } @@ -144,8 +146,7 @@ class Context { for (const auto piece : detail::chunks(text)) { if (command->stop.stop_requested() || !command->send("webfront.commands.output", piece)) co_return; - if (command->ui.pendingWrites() > maxPendingOutput) - co_await command->ui.writesAtMost(maxPendingOutput); // woken by the write that drains the queue + co_await command->ui.writesAtMost(maxPendingOutput); // at once if the queue is short, else woken as it drains } } @@ -160,8 +161,9 @@ class Context { return run->stop.stop_requested(); } + /// Valid as long as a copy of this Context lives. [[nodiscard]] networking::ex::inplace_stop_token stopToken() const noexcept { - return run->stop; + return run->stop.get_token(); } private: @@ -298,12 +300,21 @@ class Registry : public std::enable_shared_from_this> { // Runs the command, then reports its exit code and error message to the browser, which ignores the report of a // command it stopped waiting for. A stopped command still reports: its coroutine was unwound, not this one. + struct ForwardStop { + Run* run; + void operator()() noexcept { run->stop.request_stop(); } + }; + static Task execute(std::weak_ptr registry, std::shared_ptr handler, std::shared_ptr> run) { - run->stop = co_await ex::read_env(ex::get_stop_token); + const auto taskStop = co_await ex::read_env(ex::get_stop_token); + // Forwards the task's stop request (Ctrl+C, disconnection, shutdown) to the command's source while it runs. + const ex::stop_callback_for_t, ForwardStop> forward{taskStop, ForwardStop{run.get()}}; bool stopped = false; std::string error; try { - co_await ex::let_stopped((*handler)(Context{run}), [&stopped]() noexcept { + // The command observes its own source: requested before the senders it awaits are stopped. + co_await ex::let_stopped(ex::write_env((*handler)(Context{run}), ex::prop{ex::get_stop_token, run->stop.get_token()}), + [&stopped]() noexcept { stopped = true; return ex::just(); }); @@ -345,8 +356,12 @@ class Commands { using UI = typename App::UI; using Context = commands::Context; - /// Throws std::logic_error if one of its bridge functions is already registered, as by another Commands object. + /// Throws std::logic_error, registering nothing, if one of its bridge functions is already registered, as by + /// another Commands object. explicit Commands(App& app) : registry(std::make_shared>()) { + for (const auto* name : {"webfront.commands.list", "webfront.commands.start", "webfront.commands.cancel"}) + if (app.hasCppFunction(name)) + throw std::logic_error(std::string(name) + " is taken: create one webfront::Commands per application"); const auto registered = [](bool added) { if (!added) throw std::logic_error("The webfront.commands bridge functions are taken: create one webfront::Commands per application"); diff --git a/include/webfront/WebFront.hpp b/include/webfront/WebFront.hpp index d8573142..8aef5f1b 100644 --- a/include/webfront/WebFront.hpp +++ b/include/webfront/WebFront.hpp @@ -330,9 +330,12 @@ class BasicWF { } auto link = std::make_shared>(std::move(socket), id, [this](WebLinkEvent event) { onEvent(event); - }, httpServer.taskScope()); - std::scoped_lock lock{linksMutex}; - webLinks.emplace(id, std::move(link)); + }, httpServer.taskScope(), false); + { + std::scoped_lock lock{linksMutex}; + webLinks.emplace(id, link); + } + link->start(); // registered first: every event it dispatches finds it }); } @@ -419,6 +422,11 @@ class BasicWF { return webLinks.size(); } + /// Whether a C++ function of that name is registered. + [[nodiscard]] bool hasCppFunction(std::string_view functionName) const { + return cppFunctions.contains(functionName); + } + /** * @brief Registers a function which will be callable from Javascript. * @@ -580,7 +588,7 @@ class BasicWF { std::function uiStartedHandler; std::shared_ptr> uiSubscribers = std::make_shared>(); std::shared_ptr> uiClosedSubscribers = std::make_shared>(); - std::map, WebLink&, msg::CallId, UI)>> cppFunctions; + std::map, WebLink&, msg::CallId, UI)>, std::less<>> cppFunctions; std::thread serverThread; // Background thread running the HTTP server private: @@ -601,7 +609,7 @@ class BasicWF { static_cast(httpServer.startTask(releaseLink(event.webLinkId))); break; case WebLinkEvent::Code::cppFunctionCalled: { - // The calling link is normally registered: the server thread registers it before it can read anything. + // Links are registered before they read, and released after their closure: the caller is registered. const auto link = findLink(event.webLinkId); if (!link) break; diff --git a/include/webfront/http/WebSocket.hpp b/include/webfront/http/WebSocket.hpp index 6fffe172..3276d419 100644 --- a/include/webfront/http/WebSocket.hpp +++ b/include/webfront/http/WebSocket.hpp @@ -546,8 +546,8 @@ class WebSocket : public std::enable_shared_from_this> { std::lock_guard lock(writeMutex); writeQueue.clear(); } + onWriteFailed(error.code()); // reports the closure before the waiters for the queue resume if (writtenHandler) writtenHandler(); - onWriteFailed(error.code()); } } diff --git a/include/webfront/weblink/WebLink.hpp b/include/webfront/weblink/WebLink.hpp index 98c146fd..8f609692 100644 --- a/include/webfront/weblink/WebLink.hpp +++ b/include/webfront/weblink/WebLink.hpp @@ -124,7 +124,9 @@ class WebLink { std::shared_ptr> pending{std::make_shared>()}; public: - WebLink(typename Net::Socket&& socket, WebLinkId webLinkId, std::function eventHandler, networking::TaskScope& scope) + /// Starts reading at once, unless `startNow` is false: start() then begins, once the owner can dispatch its events. + WebLink(typename Net::Socket&& socket, WebLinkId webLinkId, std::function eventHandler, networking::TaskScope& scope, + bool startNow = true) : ws(websocket::WebSocket::create(std::move(socket), scope)), id(webLinkId), eventsHandler(eventHandler) { log::debug("New WebLink created with id:{}", id); @@ -142,11 +144,16 @@ class WebLink { rejectPending(std::make_exception_ptr(std::runtime_error(message))); // The WebSocket reports its closure once, and never when it is stopped by the server or the link. eventsHandler({WebLinkEvent::Code::closed, id}); + wakeAllWriters(); // after the closure is known: nothing will be written any more }); }); - ws->start(); + if (startNow) + ws->start(); } + + /// Starts reading, for a link constructed with `startNow` false. + void start() { ws->start(); } WebLink(const WebLink&) = delete; WebLink(WebLink&&) = delete; WebLink& operator=(const WebLink&) = delete; @@ -164,6 +171,7 @@ class WebLink { const log::ContextScope context(linkContext()); log::debug("WebLink destructor"); rejectPending(std::make_exception_ptr(std::runtime_error("Browser connection closed"))); + wakeAllWriters(); } /// Diagnostic frames are refused once this many frames of any kind await the network. @@ -172,8 +180,8 @@ class WebLink { [[nodiscard]] std::size_t pendingWrites() const { return ws->pendingWrites(); } /// Returns 0 when at most `limit` frames await the network. Otherwise registers `ready`, called once they do, on - /// the thread that writes the frame bringing them down, and returns its identifier for cancelWrites(). A waiter - /// left when the link is destroyed is never called. + /// the thread that writes the frame bringing them down, and returns its identifier for cancelWrites(). The waiters + /// are also called when the connection closes or the link is destroyed: nothing is left to wait for. std::uint64_t whenWritesAtMost(std::size_t limit, std::function ready) { std::lock_guard lock(writersMutex); if (ws->pendingWrites() <= limit) @@ -332,6 +340,16 @@ class WebLink { call(); } + void wakeAllWriters() { + std::map ready; + { + std::lock_guard lock(writersMutex); + ready.swap(writers); + } + for (auto& [waiter, writer] : ready) + writer.ready(); + } + /// Context for link-level logs outside any call; operationId stays empty. [[nodiscard]] log::Context linkContext() const { return {.component = "weblink", .webLinkId = idText.view(), .direction = log::CallDirection::None, .callId = {}}; @@ -396,11 +414,25 @@ class WritesAtMost { template class Operation { using StopToken = networking::ex::stop_token_of_t>; - // Shared with the link's waiter, which may run on another thread after a stop completed the operation. + enum class Completion { none, value, stopped }; + // Shared with the link's waiter and the stop callback, which may run on other threads, also during start(). + // The first of them to finish the operation completes it, unless start() is still running: it then records + // the completion, which start() delivers once it no longer touches the operation. struct State { std::atomic done{false}; std::atomic waiter{0}; + std::mutex mutex; + bool starting = true; + Completion completion = Completion::none; Operation* operation; + + // True when start() will deliver the completion itself. + bool record(Completion finished) { + std::lock_guard lock(mutex); + if (starting) + completion = finished; + return starting; + } }; struct OnStop { Operation* operation; @@ -418,6 +450,8 @@ class WritesAtMost { return; if (auto waited = link.lock()) waited->cancelWrites(state->waiter); + if (state->record(Completion::stopped)) + return; networking::ex::set_stopped(std::move(receiver)); // may destroy this operation } @@ -439,23 +473,38 @@ class WritesAtMost { state->done = true; return networking::ex::set_value(std::move(receiver)); } - stopCallback.emplace(std::move(token), OnStop{this}); - const auto shared = state; // the operation may be gone once the waiter or a stop completed it + const auto shared = state; + stopCallback.emplace(std::move(token), OnStop{this}); // a stop requested meanwhile is recorded at once std::uint64_t waiter = 0; - try { - waiter = waited->whenWritesAtMost(limit, [shared] { - if (shared->done.exchange(true)) - return; // stopped first - auto* operation = shared->operation; - operation->stopCallback.reset(); // waits for a stop callback running on another thread - networking::ex::set_value(std::move(operation->receiver)); - }); - } catch (...) { } // registering failed: there is nothing to wait for + if (!shared->done) { + try { + waiter = waited->whenWritesAtMost(limit, [shared] { + if (shared->done.exchange(true) || shared->record(Completion::value)) + return; // stopped first, or start() delivers it + auto* operation = shared->operation; + operation->stopCallback.reset(); // waits for a stop callback running on another thread + networking::ex::set_value(std::move(operation->receiver)); + }); + } catch (...) { } // registering failed: there is nothing to wait for + } shared->waiter = waiter; - if (waiter == 0 && !shared->done.exchange(true)) { - stopCallback.reset(); - networking::ex::set_value(std::move(receiver)); + Completion completion; + { + std::lock_guard lock(shared->mutex); + shared->starting = false; + completion = shared->completion; } + if (completion == Completion::none && waiter == 0 && !shared->done.exchange(true)) + completion = Completion::value; // already at most `limit` frames queued + if (completion == Completion::none) + return; // the waiter or the stop callback completes it + if (waiter != 0) + waited->cancelWrites(waiter); + stopCallback.reset(); + if (completion == Completion::value) + networking::ex::set_value(std::move(receiver)); + else + networking::ex::set_stopped(std::move(receiver)); } }; diff --git a/test/unit/CommandsTests.cpp b/test/unit/CommandsTests.cpp index 692df361..8870c6c3 100644 --- a/test/unit/CommandsTests.cpp +++ b/test/unit/CommandsTests.cpp @@ -52,7 +52,6 @@ struct FakeUI { } TaskHandle spawn(Task task) const; auto jsFunction(string_view name) const; - size_t pendingWrites() const; auto writesAtMost(size_t limit) const; auto resumeAfter(chrono::milliseconds) const; }; @@ -67,6 +66,10 @@ struct FakeApp { shared_ptr> closed = make_shared>(); vector calls; + [[nodiscard]] bool hasCppFunction(string_view name) const { + return std::ranges::find(registered, name) != registered.end(); + } + template bool cppFunction(string name, auto&& function) { if (std::ranges::find(registered, name) != registered.end()) @@ -115,13 +118,11 @@ TaskHandle FakeUI::spawn(Task task) const { return app->real.spawn(std::move(task)); } -size_t FakeUI::pendingWrites() const { - return app->backlog; -} - -// The browser reads until the queue is down to half the limit. +// Completes at once when the queue is short enough; else the browser reads until it is down to half the limit. auto FakeUI::writesAtMost(size_t limit) const { return networking::ex::just() | networking::ex::then([app = app, limit] { + if (app->backlog <= limit) + return; ++app->pauses; app->paced.push_back("pause"); app->backlog = min(app->backlog, limit / 2); @@ -199,11 +200,20 @@ SCENARIO("Commands register their bridge functions and list the commands") { THEN("a second Commands object on the application is refused") { CHECK_THROWS_AS(Commands{fixture.app}, logic_error); } + THEN("invalid, reserved and duplicate names are refused") { for (const auto* name : {"", "two words", "quo'te", "back\\slash", "tab\t", "wf", "clear", "exit", "help", "history", "greet"}) CHECK_THROWS_AS(fixture.commands.add(name, "", greet), invalid_argument); } } + GIVEN("an application where only webfront.commands.cancel is taken") { + FakeApp app; + app.cppFunction("webfront.commands.cancel", [](FakeUI, uint32_t) { }); + THEN("Commands is refused and registers nothing") { + CHECK_THROWS_AS(Commands{app}, logic_error); + CHECK(app.registered == vector{"webfront.commands.cancel"}); + } + } } SCENARIO("A command streams its output and reports its exit") { @@ -477,6 +487,29 @@ SCENARIO("A command may take its context by reference") { } } +SCENARIO("A copy of a context may outlive its command") { + GIVEN("a command that keeps a copy of its context") { + FakeApp app; + Commands commands{app}; + auto kept = make_shared>(); + commands.add("keep", "", [kept](Context context) -> Task { + kept->emplace(context); + co_return; + }); + app.start(app.ui(1), 1, "keep", "[]"); + WHEN("the command has ended") { + THEN("the copy still reads its stop state, and writes nothing") { + REQUIRE(kept->has_value()); + CHECK_FALSE((*kept)->stopRequested()); + CHECK_FALSE((*kept)->stopToken().stop_requested()); + const auto calls = app.callsOf(1).size(); + (*kept)->write("late\n"); + CHECK(app.callsOf(1).size() == calls + 1); + } + } + } +} + SCENARIO("Commands may outlive their registering object") { GIVEN("commands whose Commands object is gone") { FakeApp app; diff --git a/test/unit/WebLinkTests.cpp b/test/unit/WebLinkTests.cpp index 39901a4f..fe7c2c56 100644 --- a/test/unit/WebLinkTests.cpp +++ b/test/unit/WebLinkTests.cpp @@ -353,6 +353,13 @@ networking::Task waitWrites(Writes writes, bool& woken) { co_await std::move(writes); woken = true; } + +// Records the events the link had reported when the writer resumed. +template +networking::Task waitWritesSeeing(Writes writes, const vector& events, vector& seen) { + co_await std::move(writes); + seen = events; +} } // namespace SCENARIO("A link wakes a writer once its write queue drains") { @@ -385,6 +392,13 @@ SCENARIO("A link wakes a writer once its write queue drains") { CHECK(link->pendingWrites() == 0); } } + GIVEN("a link destroyed while a task waits") { + networking::Spawn(scope, networking::ex::inline_scheduler{}, waitWrites(Writes{link, 0}, woken)); + link.reset(); + THEN("the task resumes: nothing is left to wait for") { + CHECK(woken); + } + } GIVEN("a link that is gone") { std::weak_ptr> gone; networking::Spawn(scope, networking::ex::inline_scheduler{}, waitWrites(Writes{gone, 0}, woken)); @@ -395,3 +409,24 @@ SCENARIO("A link wakes a writer once its write queue drains") { InjectableSocket::deferWrites(false); while (InjectableSocket::completeDeferredWrites() > 0) { } } + +SCENARIO("A writer resumes after a failed write reported the closure") { + InjectableSocket::reset(); + InlineTaskScope scope; + vector events; + auto link = make_shared>(InjectableSocket{}, WebLinkId{13}, [&events](WebLinkEvent event) { events.push_back(event.code); }, scope); + InjectableSocket::deferWrites(); + for (msg::CallId call = 1; call <= 3; ++call) + link->sendError(call, "queued"); + vector seen{WebLinkEvent::Code::linked}; // replaced when the writer resumes + networking::Spawn(scope, networking::ex::inline_scheduler{}, waitWritesSeeing(webfront::detail::WritesAtMost>{link, 0}, events, seen)); + WHEN("the write fails") { + InjectableSocket::failWrites(make_error_code(errc::broken_pipe)); + InjectableSocket::deferWrites(false); + InjectableSocket::completeDeferredWrites(); + THEN("the writer resumes once the closure was reported") { + CHECK(seen == vector{WebLinkEvent::Code::closed}); + } + } + InjectableSocket::reset(); +} From 0f90ca37e0839e93cd966d326b041d94374d23a8 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 08:19:23 +0200 Subject: [PATCH 045/134] Keep a CRLF split between output pieces and complete project paths only [#308] - Line endings are converted per command, across its streamed pieces: a "\r\n" split between two pieces no longer becomes "\r\r\n". - An absolute path is not completed: project paths are relative. --- js/developer/environment/bundles.json | 2 +- js/developer/environment/runtime.mjs | 16 +++++++++++++++- test/web/DeveloperTest.cpp | 5 +++++ test/web/developer-specs.mjs | 4 ++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index bc24dfba..a30d134b 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -16,7 +16,7 @@ "js/developer/environment/packages.mjs": "faed29500a34c6ce24756d07bd4b47b9168ccec4bd49d12f00096a869637d74d", "js/developer/environment/starter.mjs": "048cf2af36b407bc075323f78a1195b4be91ad7da51f6ce941d9fb230f314ff9", "js/developer/environment/paths.mjs": "3b6114df78eb193161c5c84499dda084cb7ff91c56a4496371c30295d00880e3", - "js/developer/environment/runtime.mjs": "e4f16cd2f5f95f73fee329b1360525475d04f4e49b24bd804e876ea2f3ef79a1", + "js/developer/environment/runtime.mjs": "056a4e77bc4f0293acaf98e0913f5efe8d85c6000c6bc57a3e82967da3c8f390", "js/developer/environment/terminal.mjs": "7ffcf7ac6ef63c35cdf5ef70284b384525b13ba18422af069289e53b6c4f6be1", "js/developer/environment/commands.mjs": "964770e4ca02c1044319b17ed76b7f6006427ac6751bd4c789ae58cbb850b071", "js/developer/environment/compiler.mjs": "cc6fbe8cabbd94750045cebfdf942234247519099a192ef9cdda6ccbdbfbb6a4", diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index 4a51fc38..3271a0ec 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -214,7 +214,19 @@ export async function execute(args, context) { // --- Terminal ---------------------------------------------------------------------------------------------------- export const historyPath = '.webfront/developer/history.json'; -const toTerminalText = text => String(text).replace(/(? { + let converted = ''; + for (const char of String(text)) { + if (char === '\n' && !carriage) converted += '\r'; + converted += char; + carriage = char === '\r'; + } + return converted; + }; +} // The history's lines; none when the project has no history yet. A history that cannot be read or is not a JSON array // of lines throws: it is shown as empty, but never replaced. @@ -302,6 +314,7 @@ const builtins = { export async function runLine(line, context) { const [command, ...args] = tokenize(line); if (command === undefined) return ''; + const toTerminalText = terminalText(); // one per command: its streamed pieces, then its result const write = text => context.write?.(toTerminalText(text)); if (command === 'wf') return toTerminalText(await execute(args, {...context, write})); if (Object.hasOwn(builtins, command)) return toTerminalText(await builtins[command](args, context)); @@ -311,6 +324,7 @@ export async function runLine(line, context) { // The entries of the project directory a partial path names, as completions of that path. async function projectPaths(bridge, word) { + if (word.startsWith('/')) return []; // project paths are relative const directory = word.slice(0, word.lastIndexOf('/') + 1); if (directory && isUnsafe(directory.slice(0, -1))) return []; try { diff --git a/test/web/DeveloperTest.cpp b/test/web/DeveloperTest.cpp index 229a6195..a5157f2d 100644 --- a/test/web/DeveloperTest.cpp +++ b/test/web/DeveloperTest.cpp @@ -148,6 +148,11 @@ void registerCommands(webfront::Commands& commands, const std::shared_ptr webfront::Task { co_await context.ui().resumeAfter(std::chrono::milliseconds(std::stoi(context.args().at(0)))); }); + commands.add("crlf", "Split a CRLF between two writes", [](Context context) -> webfront::Task { + context.write("one\r"); + context.write("\ntwo\n"); + co_return; + }); commands.add("partial", "Write without a final line break", [](Context context) -> webfront::Task { context.write("partial"); co_return; diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index d89d5b88..77da461c 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -350,6 +350,9 @@ try { const streamed = []; assert(await runtime.runLine('stream', lineContext(undefined, streamed)) === '', 'A C++ command resolves once it returns'); assert(streamed.length >= 3 && streamed.join('') === 'é'.repeat(75000) + '\r\n', `Long C++ output must stream in pieces under the bridge limit: ${streamed.length}`); + const crlf = []; + await runtime.runLine('crlf', lineContext(undefined, crlf)); + assert(crlf.join('') === 'one\r\ntwo\r\n', `A CRLF split between two writes must stay one line break: ${JSON.stringify(crlf.join(''))}`); const thrown = await failure(runtime.runLine('fail', lineContext())); assert(thrown?.message === 'command failed on purpose' && thrown.exitCode === 1, `A C++ exception must reject the command: ${thrown}`); const exitCode = await failure(runtime.runLine('status 3', lineContext())); @@ -513,6 +516,7 @@ try { await completed('echo too', 'echo tools/'); await completed('echo tools/js', 'echo tools/jsx.tsx '); await completed('hi', 'history '); + await completed('echo /to', 'echo /to'); // project paths are relative: an absolute one is not completed // Paths with spaces and quotes: the completion reads the escaped or quoted word and extends it the same way. await writeFile("my dir/file one's.txt", 'x'); await completed('echo my\\ d', 'echo my\\ dir/'); From b72dcfd90082f1b8f0000d4d96fc78bf6c44fc57 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 08:32:27 +0200 Subject: [PATCH 046/134] Move the shared path and tarball helpers into the developer environment and bundle xterm.js from its lock [#313] Prerequisites of the removal of the terminal component and the tool manager: - fs::safeRelativePath moves from ToolStore.hpp to SafePath.hpp; the developer headers include what they use instead of relying on ToolStore.hpp. - parseSpec, verifyIntegrity, gunzip and readTar move from the tool manager's wf.mjs to js/developer/environment/tarball.mjs, with Node tests; the bootstrap and packages bundles are rebuilt (release pin unchanged). - The environment imports @xterm/xterm and @xterm/addon-fit, locked in js/developer/vendor, instead of third_party/xterm, whose files are the same. --- .../system/DeveloperBootstrapData.hpp | 254 +++++++++--------- include/webfront/system/DeveloperFS.hpp | 8 + include/webfront/system/DeveloperFiles.hpp | 9 + include/webfront/system/DeveloperJournal.hpp | 12 + include/webfront/system/DeveloperPaths.hpp | 8 +- include/webfront/system/DeveloperStore.hpp | 17 +- include/webfront/system/SafePath.hpp | 51 ++++ js/core/bootstrap/bootstrap.bundle.mjs | 2 +- js/developer/environment/archive.mjs | 2 +- js/developer/environment/bootstrap.mjs | 2 +- js/developer/environment/bundles.json | 22 +- js/developer/environment/installer.mjs | 2 +- js/developer/environment/packages.bundle.mjs | 22 +- js/developer/environment/packages.mjs | 2 +- js/developer/environment/registry.mjs | 2 +- js/developer/environment/runtime.mjs | 4 +- js/developer/environment/starter.mjs | 2 +- js/developer/environment/tarball.mjs | 146 ++++++++++ js/developer/tools/build.mjs | 11 +- js/developer/tools/check.mjs | 21 ++ 20 files changed, 431 insertions(+), 168 deletions(-) create mode 100644 include/webfront/system/SafePath.hpp create mode 100644 js/developer/environment/tarball.mjs diff --git a/include/webfront/system/DeveloperBootstrapData.hpp b/include/webfront/system/DeveloperBootstrapData.hpp index 2f438be5..0f656918 100644 --- a/include/webfront/system/DeveloperBootstrapData.hpp +++ b/include/webfront/system/DeveloperBootstrapData.hpp @@ -11,161 +11,161 @@ struct DeveloperBootstrapData { static constexpr std::string_view encoding{}; static constexpr std::size_t dataSize{6195}; static constexpr std::array data{ - 0x76617220753d6e65, 0x7720546578744465, 0x636f6465723b6173, 0x796e632066756e63, 0x74696f6e20702874, - 0x2c65297b6c657420, 0x6e3d537472696e67, 0x28653f3f2222292e, 0x73706c6974282f5c, 0x732b2f292e66696c, + 0x766172206c3d6e65, 0x7720546578744465, 0x636f6465723b6173, 0x796e632066756e63, 0x74696f6e20682865, + 0x2c74297b6c657420, 0x723d537472696e67, 0x28743f3f2222292e, 0x73706c6974282f5c, 0x732b2f292e66696c, 0x74657228613d3e61, 0x2e73746172747357, 0x6974682822736861, 0x3531322d2229292e, 0x6d617028613d3e61, - 0x2e73706c69742822, 0x3f22295b305d293b, 0x6966286e2e6c656e, 0x6774683d3d3d3029, 0x7468726f77206e65, + 0x2e73706c69742822, 0x3f22295b305d293b, 0x696628722e6c656e, 0x6774683d3d3d3029, 0x7468726f77206e65, 0x77204572726f7228, 0x2254686520706163, 0x6b61676520686173, 0x206e6f205348412d, 0x35313220696e7465, 0x677269747922293b, 0x69662821676c6f62, 0x616c546869732e63, 0x727970746f3f2e73, 0x7562746c65297468, 0x726f77206e657720, 0x4572726f72282249, 0x6e74656772697479, 0x20636865636b7320, 0x6e65656420612073, 0x656375726520636f, 0x6e74657874202868, 0x74747073206f7220, 0x6c6f63616c686f73, 0x742922293b6c6574, - 0x20723d6e65772055, 0x696e743841727261, 0x7928617761697420, 0x63727970746f2e73, 0x7562746c652e6469, - 0x6765737428225348, 0x412d353132222c74, 0x29292c6f3d227368, 0x613531322d222b62, 0x746f612841727261, - 0x792e66726f6d2872, 0x2c613d3e53747269, 0x6e672e66726f6d43, 0x686172436f646528, 0x6129292e6a6f696e, - 0x28222229293b6966, 0x28216e2e696e636c, 0x75646573286f2929, 0x7468726f77206e65, 0x77204572726f7228, - 0x60496e7465677269, 0x747920636865636b, 0x206661696c65643a, 0x2065787065637465, 0x6420247b6e5b305d, - 0x7d2c20676f742024, 0x7b6f7d60293b7265, 0x7475726e206f7d61, 0x73796e632066756e, 0x6374696f6e206428, - 0x742c653d32363834, 0x3335343536297b6c, 0x6574206e3d6e6577, 0x20426c6f62285b74, 0x5d292e7374726561, + 0x206e3d6e65772055, 0x696e743841727261, 0x7928617761697420, 0x63727970746f2e73, 0x7562746c652e6469, + 0x6765737428225348, 0x412d353132222c65, 0x29292c6f3d227368, 0x613531322d222b62, 0x746f612841727261, + 0x792e66726f6d286e, 0x2c613d3e53747269, 0x6e672e66726f6d43, 0x686172436f646528, 0x6129292e6a6f696e, + 0x28222229293b6966, 0x2821722e696e636c, 0x75646573286f2929, 0x7468726f77206e65, 0x77204572726f7228, + 0x60496e7465677269, 0x747920636865636b, 0x206661696c65643a, 0x2065787065637465, 0x6420247b725b305d, + 0x7d2c20676f742024, 0x7b6f7d60293b7265, 0x7475726e206f7d61, 0x73796e632066756e, 0x6374696f6e207028, + 0x652c743d32363834, 0x3335343536297b6c, 0x657420723d6e6577, 0x20426c6f62285b65, 0x5d292e7374726561, 0x6d28292e70697065, 0x5468726f75676828, 0x6e6577204465636f, 0x6d7072657373696f, 0x6e53747265616d28, - 0x22677a6970222929, 0x2e67657452656164, 0x657228292c723d5b, 0x5d2c6f3d303b666f, 0x72286c657420613d, - 0x6177616974206e2e, 0x7265616428293b21, 0x612e646f6e653b61, 0x3d6177616974206e, 0x2e72656164282929, - 0x7b6966286f2b3d61, 0x2e76616c75652e6c, 0x656e6774682c6f3e, 0x65297468726f7720, 0x6177616974206e2e, + 0x22677a6970222929, 0x2e67657452656164, 0x657228292c6e3d5b, 0x5d2c6f3d303b666f, 0x72286c657420613d, + 0x617761697420722e, 0x7265616428293b21, 0x612e646f6e653b61, 0x3d61776169742072, 0x2e72656164282929, + 0x7b6966286f2b3d61, 0x2e76616c75652e6c, 0x656e6774682c6f3e, 0x74297468726f7720, 0x617761697420722e, 0x63616e63656c2829, 0x2c6e657720457272, 0x6f72286054686520, 0x74617262616c6c20, 0x756e7061636b7320, - 0x746f206d6f726520, 0x7468616e20247b65, 0x7d20627974657360, 0x293b722e70757368, 0x28612e76616c7565, - 0x297d72657475726e, 0x206e65772055696e, 0x7438417272617928, 0x6177616974206e65, 0x7720426c6f622872, - 0x292e617272617942, 0x7566666572282929, 0x7d66756e6374696f, 0x6e206c28742c652c, 0x6e297b6c65742072, - 0x3d742e7375626172, 0x72617928652c652b, 0x6e292c6f3d722e69, 0x6e6465784f662830, 0x293b72657475726e, - 0x20752e6465636f64, 0x65286f3c303f723a, 0x722e737562617272, 0x617928302c6f2929, 0x7d66756e6374696f, - 0x6e207928742c652c, 0x6e297b696628745b, 0x655d263132382972, 0x657475726e20742e, 0x7375626172726179, - 0x28652b312c652b6e, 0x292e726564756365, 0x28286f2c61293d3e, 0x6f2a3235362b612c, 0x745b655d26313237, - 0x293b6c657420723d, 0x6c28742c652c6e29, 0x2e7472696d28293b, 0x696628212f5e5b30, 0x2d375d2a242f2e74, - 0x6573742872292974, 0x68726f77206e6577, 0x204572726f722822, 0x436f727275707420, 0x7461722068656164, - 0x657222293b726574, 0x75726e20723d3d3d, 0x22223f303a706172, 0x7365496e7428722c, 0x38297d66756e6374, - 0x696f6e2054287429, 0x7b6c657420653d30, 0x3b666f72286c6574, 0x206e3d303b6e3c35, 0x31323b2b2b6e2965, - 0x2b3d6e3e3d313438, 0x26266e3c3135363f, 0x33323a745b6e5d3b, 0x6966287928742c31, 0x34382c3829213d3d, - 0x65297468726f7720, 0x6e6577204572726f, 0x722822436f727275, 0x7074207461722068, 0x6561646572206368, - 0x65636b73756d2229, 0x7d66756e6374696f, 0x6e20532874297b6c, 0x657420653d7b7d2c, 0x6e3d303b666f7228, - 0x3b6e3c742e6c656e, 0x6774683b297b6c65, 0x7420723d742e696e, 0x6465784f66283332, 0x2c6e292c6f3d723c, - 0x303f4e614e3a4e75, 0x6d62657228752e64, 0x65636f646528742e, 0x7375626172726179, 0x286e2c722929293b, - 0x69662821286f3e30, 0x297c7c6e2b6f3e74, 0x2e6c656e67746829, 0x7468726f77206e65, 0x77204572726f7228, - 0x22436f7272757074, 0x2070617820686561, 0x64657222293b6c65, 0x7420613d752e6465, 0x636f646528742e73, - 0x7562617272617928, 0x722b312c6e2b6f2d, 0x3129292c693d612e, 0x696e6465784f6628, 0x223d22293b655b61, - 0x2e736c6963652830, 0x2c69295d3d612e73, 0x6c69636528692b31, 0x292c6e2b3d6f7d72, 0x657475726e20657d, - 0x66756e6374696f6e, 0x207a28742c65297b, 0x6c6574206e3d742e, 0x7375626172726179, 0x28652c652b353132, - 0x293b54286e293b6c, 0x657420723d79286e, 0x2c3132342c313229, 0x2c6f3d652b353132, 0x3b6966286f2b723e, - 0x742e6c656e677468, 0x297468726f77206e, 0x6577204572726f72, 0x28225472756e6361, 0x7465642074617220, - 0x6172636869766522, 0x293b72657475726e, 0x7b6865616465723a, 0x6e2c747970653a6e, 0x5b3135365d3d3d3d, - 0x303f2230223a5374, 0x72696e672e66726f, 0x6d43686172436f64, 0x65286e5b3135365d, 0x292c646174613a74, - 0x2e73756261727261, 0x79286f2c6f2b7229, 0x2c6e6578743a6f2b, 0x4d6174682e636569, 0x6c28722f35313229, - 0x2a3531327d7d6675, 0x6e6374696f6e2055, 0x28742c65297b7265, 0x7475726e20652b35, 0x31323e742e6c656e, - 0x6774687c7c742e73, 0x7562617272617928, 0x652c652b35313229, 0x2e6576657279286e, 0x3d3e6e3d3d3d3029, - 0x7d66756e6374696f, 0x6e20492874297b6c, 0x657420653d6c2874, 0x2c302c313030292c, 0x6e3d6c28742c3235, - 0x372c35293d3d3d22, 0x7573746172223f6c, 0x28742c3334352c31, 0x3535293a22223b72, 0x657475726e206e3f, - 0x60247b6e7d2f247b, 0x657d603a657d7661, 0x7220683d7b783a28, 0x742c65293d3e287b, 0x2e2e2e742c706178, - 0x3a532865292e7061, 0x74687d292c4c3a28, 0x742c65293d3e287b, 0x2e2e2e742c6c6f6e, 0x673a6c28652c302c, - 0x652e6c656e677468, 0x297d292c673a743d, 0x3e747d3b66756e63, 0x74696f6e206d2874, 0x297b6c657420653d, - 0x5b5d2c6e3d7b7d3b, 0x666f72286c657420, 0x723d303b21552874, 0x2c72293b297b6c65, 0x747b686561646572, - 0x3a6f2c747970653a, 0x612c646174613a69, 0x2c6e6578743a737d, 0x3d7a28742c72293b, 0x696628723d732c4f, - 0x626a6563742e6861, 0x734f776e28682c61, 0x29297b6e3d685b61, 0x5d286e2c69293b63, 0x6f6e74696e75657d, - 0x28613d3d3d223022, 0x7c7c613d3d3d2237, 0x22292626652e7075, 0x7368287b70617468, 0x3a6e2e7061783f3f, - 0x6e2e6c6f6e673f3f, 0x49286f292c627974, 0x65733a697d292c6e, 0x3d7b7d7d72657475, 0x726e20657d766172, - 0x20633d28742c652c, 0x2e2e2e6e293d3e74, 0x2e63707046756e63, 0x74696f6e28607765, 0x6266726f6e742e64, - 0x6576656c6f706572, 0x2e247b657d602928, 0x2e2e2e6e293b6173, 0x796e632066756e63, 0x74696f6e20672874, - 0x2c65297b6c657420, 0x6e3d5b5d2c723d30, 0x3b666f72283b3b29, 0x7b6c6574206f3d61, 0x7761697420632874, - 0x2c2272656164222c, 0x652c72293b696628, 0x6e2e70757368286f, 0x292c722b3d6f2e6c, 0x656e6774682c6f2e, - 0x6c656e6774683c32, 0x3632313434296272, 0x65616b3b69662872, 0x3e3235362a313032, 0x342a313032342974, + 0x746f206d6f726520, 0x7468616e20247b74, 0x7d20627974657360, 0x293b6e2e70757368, 0x28612e76616c7565, + 0x297d72657475726e, 0x206e65772055696e, 0x7438417272617928, 0x6177616974206e65, 0x7720426c6f62286e, + 0x292e617272617942, 0x7566666572282929, 0x7d66756e6374696f, 0x6e207528652c742c, 0x72297b6c6574206e, + 0x3d652e7375626172, 0x72617928742c742b, 0x72292c6f3d6e2e69, 0x6e6465784f662830, 0x293b72657475726e, + 0x206c2e6465636f64, 0x65286f3c303f6e3a, 0x6e2e737562617272, 0x617928302c6f2929, 0x7d66756e6374696f, + 0x6e207928652c742c, 0x72297b696628655b, 0x745d263132382972, 0x657475726e20652e, 0x7375626172726179, + 0x28742b312c742b72, 0x292e726564756365, 0x28286f2c61293d3e, 0x6f2a3235362b612c, 0x655b745d26313237, + 0x293b6c6574206e3d, 0x7528652c742c7229, 0x2e7472696d28293b, 0x696628212f5e5b30, 0x2d375d2a242f2e74, + 0x657374286e292974, 0x68726f77206e6577, 0x204572726f722822, 0x436f727275707420, 0x7461722068656164, + 0x657222293b726574, 0x75726e206e3d3d3d, 0x22223f303a706172, 0x7365496e74286e2c, 0x38297d66756e6374, + 0x696f6e207a286529, 0x7b6c657420743d30, 0x3b666f72286c6574, 0x20723d303b723c35, 0x31323b2b2b722974, + 0x2b3d723e3d313438, 0x2626723c3135363f, 0x33323a655b725d3b, 0x6966287928652c31, 0x34382c3829213d3d, + 0x74297468726f7720, 0x6e6577204572726f, 0x722822436f727275, 0x7074207461722068, 0x6561646572206368, + 0x65636b73756d2229, 0x7d66756e6374696f, 0x6e20422865297b6c, 0x657420743d7b7d2c, 0x723d303b666f7228, + 0x3b723c652e6c656e, 0x6774683b297b6c65, 0x74206e3d652e696e, 0x6465784f66283332, 0x2c72292c6f3d6e3c, + 0x303f4e614e3a4e75, 0x6d626572286c2e64, 0x65636f646528652e, 0x7375626172726179, 0x28722c6e2929293b, + 0x69662821286f3e30, 0x297c7c722b6f3e65, 0x2e6c656e67746829, 0x7468726f77206e65, 0x77204572726f7228, + 0x22436f7272757074, 0x2070617820686561, 0x64657222293b6c65, 0x7420613d6c2e6465, 0x636f646528652e73, + 0x7562617272617928, 0x6e2b312c722b6f2d, 0x3129292c693d612e, 0x696e6465784f6628, 0x223d22293b745b61, + 0x2e736c6963652830, 0x2c69295d3d612e73, 0x6c69636528692b31, 0x292c722b3d6f7d72, 0x657475726e20747d, + 0x66756e6374696f6e, 0x205428652c74297b, 0x6c657420723d652e, 0x7375626172726179, 0x28742c742b353132, + 0x293b7a2872293b6c, 0x6574206e3d792872, 0x2c3132342c313229, 0x2c6f3d742b353132, 0x3b6966286f2b6e3e, + 0x652e6c656e677468, 0x297468726f77206e, 0x6577204572726f72, 0x28225472756e6361, 0x7465642074617220, + 0x6172636869766522, 0x293b72657475726e, 0x7b6865616465723a, 0x722c747970653a72, 0x5b3135365d3d3d3d, + 0x303f2230223a5374, 0x72696e672e66726f, 0x6d43686172436f64, 0x6528725b3135365d, 0x292c646174613a65, + 0x2e73756261727261, 0x79286f2c6f2b6e29, 0x2c6e6578743a6f2b, 0x4d6174682e636569, 0x6c286e2f35313229, + 0x2a3531327d7d6675, 0x6e6374696f6e2043, 0x28652c74297b7265, 0x7475726e20742b35, 0x31323e652e6c656e, + 0x6774687c7c652e73, 0x7562617272617928, 0x742c742b35313229, 0x2e65766572792872, 0x3d3e723d3d3d3029, + 0x7d66756e6374696f, 0x6e20492865297b6c, 0x657420743d752865, 0x2c302c313030292c, 0x723d7528652c3235, + 0x372c35293d3d3d22, 0x7573746172223f75, 0x28652c3334352c31, 0x3535293a22223b72, 0x657475726e20723f, + 0x60247b727d2f247b, 0x747d603a747d7661, 0x7220773d7b783a28, 0x652c74293d3e287b, 0x2e2e2e652c706178, + 0x3a422874292e7061, 0x74687d292c4c3a28, 0x652c74293d3e287b, 0x2e2e2e652c6c6f6e, 0x673a7528742c302c, + 0x742e6c656e677468, 0x297d292c673a653d, 0x3e657d3b66756e63, 0x74696f6e206d2865, 0x297b6c657420743d, + 0x5b5d2c723d7b7d3b, 0x666f72286c657420, 0x6e3d303b21432865, 0x2c6e293b297b6c65, 0x747b686561646572, + 0x3a6f2c747970653a, 0x612c646174613a69, 0x2c6e6578743a737d, 0x3d5428652c6e293b, 0x6966286e3d732c4f, + 0x626a6563742e6861, 0x734f776e28772c61, 0x29297b723d775b61, 0x5d28722c69293b63, 0x6f6e74696e75657d, + 0x28613d3d3d223022, 0x7c7c613d3d3d2237, 0x22292626742e7075, 0x7368287b70617468, 0x3a722e7061783f3f, + 0x722e6c6f6e673f3f, 0x49286f292c627974, 0x65733a697d292c72, 0x3d7b7d7d72657475, 0x726e20747d766172, + 0x20633d28652c742c, 0x2e2e2e72293d3e65, 0x2e63707046756e63, 0x74696f6e28607765, 0x6266726f6e742e64, + 0x6576656c6f706572, 0x2e247b747d602928, 0x2e2e2e72293b6173, 0x796e632066756e63, 0x74696f6e20672865, + 0x2c74297b6c657420, 0x723d5b5d2c6e3d30, 0x3b666f72283b3b29, 0x7b6c6574206f3d61, 0x7761697420632865, + 0x2c2272656164222c, 0x742c6e293b696628, 0x722e70757368286f, 0x292c6e2b3d6f2e6c, 0x656e6774682c6f2e, + 0x6c656e6774683c32, 0x3632313434296272, 0x65616b3b6966286e, 0x3e3235362a313032, 0x342a313032342974, 0x68726f77206e6577, 0x204572726f722822, 0x50726f6a65637420, 0x66696c6520697320, 0x746f6f206c617267, 0x6522297d72657475, 0x726e206e65772055, 0x696e743841727261, 0x7928617761697420, 0x6e657720426c6f62, - 0x286e292e61727261, 0x7942756666657228, 0x29297d6173796e63, 0x2066756e6374696f, 0x6e206a28742c7b69, - 0x643a652c70617468, 0x3a6e2c6279746573, 0x3a727d2c6f297b66, 0x6f72286c65742061, 0x3d303b613c722e6c, + 0x2872292e61727261, 0x7942756666657228, 0x29297d6173796e63, 0x2066756e6374696f, 0x6e205528652c7b69, + 0x643a742c70617468, 0x3a722c6279746573, 0x3a6e7d2c6f297b66, 0x6f72286c65742061, 0x3d303b613c6e2e6c, 0x656e6774687c7c61, 0x3d3d3d303b612b3d, 0x323632313434296f, 0x3f2e7468726f7749, 0x6641626f72746564, - 0x28292c6177616974, 0x206328742c227772, 0x697465222c652c6e, 0x2c612c722e737562, 0x617272617928612c, - 0x612b323632313434, 0x29297d6173796e63, 0x2066756e6374696f, 0x6e206628742c652c, 0x6e2c7b6469726563, - 0x746f72793a723d21, 0x302c7369676e616c, 0x3a6f2c7265706c61, 0x63653a613d21307d, 0x3d7b7d297b6c6574, - 0x20693d6177616974, 0x206328742c613f22, 0x626567696e223a22, 0x626567696e4e6577, 0x222c652c72293b74, - 0x72797b666f72286c, 0x65745b732c245d6f, 0x66206e2961776169, 0x74206a28742c7b69, 0x643a692c70617468, - 0x3a732c6279746573, 0x3a247d2c6f293b6f, 0x3f2e7468726f7749, 0x6641626f72746564, 0x28292c6177616974, - 0x206328742c22636f, 0x6d6d6974222c6929, 0x7d63617463682873, 0x297b7468726f7720, 0x6177616974206328, - 0x742c2261626f7274, 0x222c69292e636174, 0x63682828293d3e7b, 0x7d292c737d7d6173, 0x796e632066756e63, - 0x74696f6e20422874, 0x2c65297b6c657420, 0x6e3d5b5d2c723d30, 0x3b666f72283b3b29, 0x7b6c65747b646f6e, - 0x653a6f2c76616c75, 0x653a617d3d617761, 0x697420742e726561, 0x6428293b6966286f, 0x2972657475726e20, - 0x6e3b696628722b3d, 0x612e6c656e677468, 0x2c723e6529746872, 0x6f77206e65772045, 0x72726f722822436f, + 0x28292c6177616974, 0x206328652c227772, 0x697465222c742c72, 0x2c612c6e2e737562, 0x617272617928612c, + 0x612b323632313434, 0x29297d6173796e63, 0x2066756e6374696f, 0x6e206628652c742c, 0x722c7b6469726563, + 0x746f72793a6e3d21, 0x302c7369676e616c, 0x3a6f2c7265706c61, 0x63653a613d21307d, 0x3d7b7d297b6c6574, + 0x20693d6177616974, 0x206328652c613f22, 0x626567696e223a22, 0x626567696e4e6577, 0x222c742c6e293b74, + 0x72797b666f72286c, 0x65745b732c535d6f, 0x6620722961776169, 0x74205528652c7b69, 0x643a692c70617468, + 0x3a732c6279746573, 0x3a537d2c6f293b6f, 0x3f2e7468726f7749, 0x6641626f72746564, 0x28292c6177616974, + 0x206328652c22636f, 0x6d6d6974222c6929, 0x7d63617463682873, 0x297b7468726f7720, 0x6177616974206328, + 0x652c2261626f7274, 0x222c69292e636174, 0x63682828293d3e7b, 0x7d292c737d7d6173, 0x796e632066756e63, + 0x74696f6e20502865, 0x2c74297b6c657420, 0x723d5b5d2c6e3d30, 0x3b666f72283b3b29, 0x7b6c65747b646f6e, + 0x653a6f2c76616c75, 0x653a617d3d617761, 0x697420652e726561, 0x6428293b6966286f, 0x2972657475726e20, + 0x723b6966286e2b3d, 0x612e6c656e677468, 0x2c6e3e7429746872, 0x6f77206e65772045, 0x72726f722822436f, 0x6d70726573736564, 0x20646f776e6c6f61, 0x6420657863656564, 0x7320697473206279, 0x7465206c696d6974, - 0x22293b6e2e707573, 0x682861297d7d6173, 0x796e632066756e63, 0x74696f6e20462874, 0x2c65297b7472797b, - 0x72657475726e2061, 0x7761697420422874, 0x2c65297d63617463, 0x68286e297b746872, 0x6f77206177616974, - 0x20742e63616e6365, 0x6c28292e63617463, 0x682828293d3e7b7d, 0x292c6e7d66696e61, 0x6c6c797b742e7265, - 0x6c656173654c6f63, 0x6b28297d7d617379, 0x6e632066756e6374, 0x696f6e206228742c, 0x653d36342a313032, - 0x342a31303234297b, 0x69662821742e6f6b, 0x297468726f77206e, 0x6577204572726f72, 0x2860446f776e6c6f, - 0x61643a2048545450, 0x20247b742e737461, 0x7475737d60293b69, 0x66284e756d626572, 0x28742e6865616465, - 0x72732e6765742822, 0x636f6e74656e742d, 0x6c656e6774682229, 0x293e65297468726f, 0x77206e6577204572, + 0x22293b722e707573, 0x682861297d7d6173, 0x796e632066756e63, 0x74696f6e20242865, 0x2c74297b7472797b, + 0x72657475726e2061, 0x7761697420502865, 0x2c74297d63617463, 0x682872297b746872, 0x6f77206177616974, + 0x20652e63616e6365, 0x6c28292e63617463, 0x682828293d3e7b7d, 0x292c727d66696e61, 0x6c6c797b652e7265, + 0x6c656173654c6f63, 0x6b28297d7d617379, 0x6e632066756e6374, 0x696f6e206228652c, 0x743d36342a313032, + 0x342a31303234297b, 0x69662821652e6f6b, 0x297468726f77206e, 0x6577204572726f72, 0x2860446f776e6c6f, + 0x61643a2048545450, 0x20247b652e737461, 0x7475737d60293b69, 0x66284e756d626572, 0x28652e6865616465, + 0x72732e6765742822, 0x636f6e74656e742d, 0x6c656e6774682229, 0x293e74297468726f, 0x77206e6577204572, 0x726f722822436f6d, 0x7072657373656420, 0x646f776e6c6f6164, 0x2065786365656473, 0x2069747320627974, 0x65206c696d697422, 0x293b72657475726e, 0x206e65772055696e, 0x7438417272617928, 0x6177616974206e65, - 0x7720426c6f622861, 0x7761697420462874, 0x2e626f64792e6765, 0x7452656164657228, 0x292c6529292e6172, - 0x7261794275666665, 0x722829297d766172, 0x204f3d2f5b5c5c5c, 0x303a2a3f223c3e7c, 0x5d2f2c433d743d3e, - 0x742e73706c697428, 0x222f22292e736f6d, 0x6528653d3e21657c, 0x7c653d3d3d222e22, 0x7c7c653d3d3d222e, - 0x2e22293b66756e63, 0x74696f6e20762874, 0x297b72657475726e, 0x20747970656f6620, 0x74213d2273747269, - 0x6e67227c7c21747c, 0x7c4f2e7465737428, 0x74293f21303a4328, 0x74297d7661722077, 0x3d743d3e21762874, - 0x292c503d6e657720, 0x546578744465636f, 0x6465723b66756e63, 0x74696f6e20412874, 0x2c65297b69662821, - 0x652e706174682e73, 0x7461727473576974, 0x6828227061636b61, 0x67652f2229297468, 0x726f77206e657720, + 0x7720426c6f622861, 0x7761697420242865, 0x2e626f64792e6765, 0x7452656164657228, 0x292c7429292e6172, + 0x7261794275666665, 0x722829297d766172, 0x206a3d2f5b5c5c5c, 0x303a2a3f223c3e7c, 0x5d2f2c413d653d3e, + 0x652e73706c697428, 0x222f22292e736f6d, 0x6528743d3e21747c, 0x7c743d3d3d222e22, 0x7c7c743d3d3d222e, + 0x2e22293b66756e63, 0x74696f6e20762865, 0x297b72657475726e, 0x20747970656f6620, 0x65213d2273747269, + 0x6e67227c7c21657c, 0x7c6a2e7465737428, 0x65293f21303a4128, 0x65297d7661722064, 0x3d653d3e21762865, + 0x292c4f3d6e657720, 0x546578744465636f, 0x6465723b66756e63, 0x74696f6e20462865, 0x2c74297b69662821, + 0x742e706174682e73, 0x7461727473576974, 0x6828227061636b61, 0x67652f2229297468, 0x726f77206e657720, 0x4572726f72282249, 0x6e76616c69642065, 0x6e7669726f6e6d65, 0x6e74206172636869, 0x766520726f6f7422, - 0x293b6c6574206e3d, 0x652e706174682e73, 0x6c6963652838293b, 0x6966282177286e29, 0x7c7c742e68617328, - 0x6e29297468726f77, 0x206e657720457272, 0x6f722822496e7661, 0x6c6964206f722064, 0x75706c6963617465, - 0x20656e7669726f6e, 0x6d656e7420706174, 0x6822293b742e7365, 0x74286e2c652e6279, 0x746573297d66756e, - 0x6374696f6e204c28, 0x74297b6c65742065, 0x3d6e6577204d6170, 0x3b666f72286c6574, 0x206e206f66206d28, - 0x7429294128652c6e, 0x293b72657475726e, 0x20657d66756e6374, 0x696f6e205228742c, 0x65297b7265747572, - 0x6e20742e70726f74, 0x6f636f6c213d3d31, 0x7c7c217728742e65, 0x6e747279293f2131, 0x3a652e6861732874, - 0x2e656e747279297d, 0x6173796e63206675, 0x6e6374696f6e2078, 0x28742c65297b6177, 0x616974207028742c, - 0x65293b6c6574206e, 0x3d4c286177616974, 0x2064287429293b69, 0x6628216e2e686173, 0x2822656e7669726f, + 0x293b6c657420723d, 0x742e706174682e73, 0x6c6963652838293b, 0x6966282164287229, 0x7c7c652e68617328, + 0x7229297468726f77, 0x206e657720457272, 0x6f722822496e7661, 0x6c6964206f722064, 0x75706c6963617465, + 0x20656e7669726f6e, 0x6d656e7420706174, 0x6822293b652e7365, 0x7428722c742e6279, 0x746573297d66756e, + 0x6374696f6e204c28, 0x65297b6c65742074, 0x3d6e6577204d6170, 0x3b666f72286c6574, 0x2072206f66206d28, + 0x6529294628742c72, 0x293b72657475726e, 0x20747d66756e6374, 0x696f6e204e28652c, 0x74297b7265747572, + 0x6e20652e70726f74, 0x6f636f6c213d3d31, 0x7c7c216428652e65, 0x6e747279293f2131, 0x3a742e6861732865, + 0x2e656e747279297d, 0x6173796e63206675, 0x6e6374696f6e2078, 0x28652c74297b6177, 0x616974206828652c, + 0x74293b6c65742072, 0x3d4c286177616974, 0x2070286529293b69, 0x662821722e686173, 0x2822656e7669726f, 0x6e6d656e742e6a73, 0x6f6e222929746872, 0x6f77206e65772045, 0x72726f722822456e, 0x7669726f6e6d656e, 0x7420617263686976, 0x6520686173206e6f, 0x20656e7669726f6e, 0x6d656e742e6a736f, 0x6e22293b6c657420, - 0x723d4a534f4e2e70, 0x6172736528502e64, 0x65636f6465286e2e, 0x6765742822656e76, 0x69726f6e6d656e74, - 0x2e6a736f6e222929, 0x293b696628215228, 0x722c6e2929746872, 0x6f77206e65772045, 0x72726f722822556e, + 0x6e3d4a534f4e2e70, 0x61727365284f2e64, 0x65636f646528722e, 0x6765742822656e76, 0x69726f6e6d656e74, + 0x2e6a736f6e222929, 0x293b696628214e28, 0x6e2c722929746872, 0x6f77206e65772045, 0x72726f722822556e, 0x737570706f727465, 0x642057656246726f, 0x6e7420646576656c, 0x6f70657220656e76, 0x69726f6e6d656e74, - 0x22293b7265747572, 0x6e7b66696c65733a, 0x6e2c6d616e696665, 0x73743a727d7d7661, 0x72206b3d222e7765, + 0x22293b7265747572, 0x6e7b66696c65733a, 0x722c6d616e696665, 0x73743a6e7d7d7661, 0x7220453d222e7765, 0x6266726f6e742f64, 0x6576656c6f706572, 0x2f656e7669726f6e, 0x6d656e742e74677a, 0x223b6173796e6320, - 0x66756e6374696f6e, 0x204e28742c65297b, 0x7472797b6c657420, 0x6e3d617761697420, 0x6728742c6b293b72, - 0x657475726e206177, 0x6169742078286e2c, 0x65292c6e7d636174, 0x63687b7265747572, 0x6e206e756c6c7d7d, - 0x6173796e63206675, 0x6e6374696f6e2057, 0x28742c65297b6c65, 0x74206e3d6e657720, 0x55524c28742e656e, - 0x7669726f6e6d656e, 0x742c6c6f63617469, 0x6f6e2e6872656629, 0x3b6966286e2e7072, 0x6f746f636f6c213d, - 0x3d2268747470733a, 0x2226266e2e6f7269, 0x67696e213d3d6c6f, 0x636174696f6e2e6f, 0x726967696e297468, + 0x66756e6374696f6e, 0x205228652c74297b, 0x7472797b6c657420, 0x723d617761697420, 0x6728652c45293b72, + 0x657475726e206177, 0x616974207828722c, 0x74292c727d636174, 0x63687b7265747572, 0x6e206e756c6c7d7d, + 0x6173796e63206675, 0x6e6374696f6e2044, 0x28652c74297b6c65, 0x7420723d6e657720, 0x55524c28652e656e, + 0x7669726f6e6d656e, 0x742c6c6f63617469, 0x6f6e2e6872656629, 0x3b696628722e7072, 0x6f746f636f6c213d, + 0x3d2268747470733a, 0x222626722e6f7269, 0x67696e213d3d6c6f, 0x636174696f6e2e6f, 0x726967696e297468, 0x726f77206e657720, 0x4572726f72282254, 0x686520656e766972, 0x6f6e6d656e74206d, 0x7573742075736520, - 0x4854545053206f72, 0x2074686520617070, 0x6c69636174696f6e, 0x206f726967696e22, 0x293b6c657420723d, - 0x6177616974206528, 0x6e293b6966282172, 0x2e6f6b297468726f, 0x77206e6577204572, 0x726f722860456e76, - 0x69726f6e6d656e74, 0x20646f776e6c6f61, 0x643a204854545020, 0x247b722e73746174, 0x75737d60293b7265, - 0x7475726e20622872, 0x297d66756e637469, 0x6f6e20442874297b, 0x72657475726e2174, 0x7c7c217728742e61, - 0x726368697665293f, 0x21313a537472696e, 0x6728742e696e7465, 0x6772697479292e73, 0x7461727473576974, - 0x6828227368613531, 0x322d22297d66756e, 0x6374696f6e204828, 0x742c65297b726574, 0x75726e204f626a65, - 0x63742e66726f6d45, 0x6e7472696573284f, 0x626a6563742e656e, 0x747269657328742e, 0x7374617274657273, - 0x3f3f7b7d292e6d61, 0x7028285b6e2c725d, 0x293d3e7b69662821, 0x4428722929746872, 0x6f77206e65772045, + 0x4854545053206f72, 0x2074686520617070, 0x6c69636174696f6e, 0x206f726967696e22, 0x293b6c6574206e3d, + 0x6177616974207428, 0x72293b696628216e, 0x2e6f6b297468726f, 0x77206e6577204572, 0x726f722860456e76, + 0x69726f6e6d656e74, 0x20646f776e6c6f61, 0x643a204854545020, 0x247b6e2e73746174, 0x75737d60293b7265, + 0x7475726e2062286e, 0x297d66756e637469, 0x6f6e20482865297b, 0x72657475726e2165, 0x7c7c216428652e61, + 0x726368697665293f, 0x21313a537472696e, 0x6728652e696e7465, 0x6772697479292e73, 0x7461727473576974, + 0x6828227368613531, 0x322d22297d66756e, 0x6374696f6e205728, 0x652c74297b726574, 0x75726e204f626a65, + 0x63742e66726f6d45, 0x6e7472696573284f, 0x626a6563742e656e, 0x747269657328652e, 0x7374617274657273, + 0x3f3f7b7d292e6d61, 0x7028285b722c6e5d, 0x293d3e7b69662821, 0x48286e2929746872, 0x6f77206e65772045, 0x72726f722822496e, 0x76616c6964207069, 0x6e6e656420737461, 0x72746572206d6574, 0x616461746122293b, - 0x72657475726e5b6e, 0x2c7b75726c3a6e65, 0x772055524c28722e, 0x617263686976652c, 0x65292e687265662c, - 0x696e746567726974, 0x793a722e696e7465, 0x67726974797d5d7d, 0x29297d6173796e63, 0x2066756e6374696f, - 0x6e204528742c652c, 0x6e3d66657463682c, 0x723d28293d3e7b7d, 0x297b6c6574206f3d, 0x6177616974204e28, - 0x742c652e696e7465, 0x6772697479293b6f, 0x3f7228225573696e, 0x6720766572696669, 0x6564206361636865, - 0x6420646576656c6f, 0x70657220656e7669, 0x726f6e6d656e7422, 0x293a28722822446f, 0x776e6c6f6164696e, - 0x6720646576656c6f, 0x70657220656e7669, 0x726f6e6d656e7422, 0x292c6f3d61776169, 0x74205728652c6e29, - 0x293b6c65747b6669, 0x6c65733a612c6d61, 0x6e69666573743a69, 0x7d3d617761697420, 0x78286f2c652e696e, - 0x7465677269747929, 0x2c733d4828692c6e, 0x65772055524c2865, 0x2e656e7669726f6e, 0x6d656e742c6c6f63, - 0x6174696f6e2e6872, 0x656629293b726574, 0x75726e2061776169, 0x74206628742c222e, 0x77656266726f6e74, - 0x2f646576656c6f70, 0x65722f656e766972, 0x6f6e6d656e74222c, 0x61292c6177616974, 0x206628742c6b2c6e, + 0x72657475726e5b72, 0x2c7b75726c3a6e65, 0x772055524c286e2e, 0x617263686976652c, 0x74292e687265662c, + 0x696e746567726974, 0x793a6e2e696e7465, 0x67726974797d5d7d, 0x29297d6173796e63, 0x2066756e6374696f, + 0x6e206b28652c742c, 0x723d66657463682c, 0x6e3d28293d3e7b7d, 0x297b6c6574206f3d, 0x6177616974205228, + 0x652c742e696e7465, 0x6772697479293b6f, 0x3f6e28225573696e, 0x6720766572696669, 0x6564206361636865, + 0x6420646576656c6f, 0x70657220656e7669, 0x726f6e6d656e7422, 0x293a286e2822446f, 0x776e6c6f6164696e, + 0x6720646576656c6f, 0x70657220656e7669, 0x726f6e6d656e7422, 0x292c6f3d61776169, 0x74204428742c7229, + 0x293b6c65747b6669, 0x6c65733a612c6d61, 0x6e69666573743a69, 0x7d3d617761697420, 0x78286f2c742e696e, + 0x7465677269747929, 0x2c733d5728692c6e, 0x65772055524c2874, 0x2e656e7669726f6e, 0x6d656e742c6c6f63, + 0x6174696f6e2e6872, 0x656629293b726574, 0x75726e2061776169, 0x74206628652c222e, 0x77656266726f6e74, + 0x2f646576656c6f70, 0x65722f656e766972, 0x6f6e6d656e74222c, 0x61292c6177616974, 0x206628652c452c6e, 0x6577204d6170285b, 0x5b226f7574707574, 0x222c6f5d5d292c7b, 0x6469726563746f72, 0x793a21317d292c7b, 0x75726c3a602f7765, 0x6266726f6e742f64, 0x6576656c6f706572, 0x2f656e7669726f6e, 0x6d656e742f247b69, - 0x2e656e7472797d60, 0x2c636f6e6669673a, 0x7b2e2e2e652c7374, 0x6172746572733a73, 0x7d7d7d6966287479, + 0x2e656e7472797d60, 0x2c636f6e6669673a, 0x7b2e2e2e742c7374, 0x6172746572733a73, 0x7d7d7d6966287479, 0x70656f6620646f63, 0x756d656e743c2275, 0x222626646f63756d, 0x656e742e67657445, 0x6c656d656e744279, - 0x4964282272657472, 0x792229297b6c6574, 0x20743d646f63756d, 0x656e742e67657445, 0x6c656d656e744279, - 0x4964282273746174, 0x757322292c653d64, 0x6f63756d656e742e, 0x676574456c656d65, 0x6e74427949642822, - 0x726574727922292c, 0x6e3d6173796e6328, 0x293d3e7b652e6869, 0x6464656e3d21303b, 0x7472797b61776169, - 0x742077656246726f, 0x6e742e7265616479, 0x3b6c657420723d4a, 0x534f4e2e70617273, 0x6528617761697420, + 0x4964282272657472, 0x792229297b6c6574, 0x20653d646f63756d, 0x656e742e67657445, 0x6c656d656e744279, + 0x4964282273746174, 0x757322292c743d64, 0x6f63756d656e742e, 0x676574456c656d65, 0x6e74427949642822, + 0x726574727922292c, 0x723d6173796e6328, 0x293d3e7b742e6869, 0x6464656e3d21303b, 0x7472797b61776169, + 0x742077656246726f, 0x6e742e7265616479, 0x3b6c6574206e3d4a, 0x534f4e2e70617273, 0x6528617761697420, 0x632877656246726f, 0x6e742c22636f6e66, 0x69672229292c7b75, 0x726c3a6f2c636f6e, 0x6669673a617d3d61, - 0x7761697420452877, 0x656246726f6e742c, 0x722c66657463682c, 0x733d3e7b742e7465, 0x7874436f6e74656e, + 0x77616974206b2877, 0x656246726f6e742c, 0x6e2c66657463682c, 0x733d3e7b652e7465, 0x7874436f6e74656e, 0x743d737d293b6177, 0x6169742861776169, 0x7420696d706f7274, 0x286f29292e6d6f75, 0x6e74287b62726964, 0x67653a7765624672, 0x6f6e742c636f6e66, 0x69673a612c746572, 0x6d696e616c3a646f, 0x63756d656e742e67, 0x6574456c656d656e, 0x7442794964282274, 0x65726d696e616c22, 0x292c707265766965, 0x773a646f63756d65, - 0x6e742e676574456c, 0x656d656e74427949, 0x6428227072657669, 0x657722297d292c74, 0x2e74657874436f6e, + 0x6e742e676574456c, 0x656d656e74427949, 0x6428227072657669, 0x657722297d292c65, 0x2e74657874436f6e, 0x74656e743d224465, 0x76656c6f70657220, 0x656e7669726f6e6d, 0x656e742072656164, 0x792e205479706520, - 0x77662068656c702e, 0x227d636174636828, 0x72297b742e746578, 0x74436f6e74656e74, 0x3d60426f6f747374, - 0x726170206661696c, 0x65643a20247b722e, 0x6d6573736167657d, 0x602c652e68696464, 0x656e3d21317d7d3b, - 0x652e616464457665, 0x6e744c697374656e, 0x65722822636c6963, 0x6b222c6e292c6e28, 0x297d0a0000000000 + 0x77662068656c702e, 0x227d636174636828, 0x6e297b652e746578, 0x74436f6e74656e74, 0x3d60426f6f747374, + 0x726170206661696c, 0x65643a20247b6e2e, 0x6d6573736167657d, 0x602c742e68696464, 0x656e3d21317d7d3b, + 0x742e616464457665, 0x6e744c697374656e, 0x65722822636c6963, 0x6b222c72292c7228, 0x297d0a0000000000 }; }; diff --git a/include/webfront/system/DeveloperFS.hpp b/include/webfront/system/DeveloperFS.hpp index f8ac16cf..a475e34d 100644 --- a/include/webfront/system/DeveloperFS.hpp +++ b/include/webfront/system/DeveloperFS.hpp @@ -6,6 +6,14 @@ #include "DeveloperStore.hpp" #include "IndexFS.hpp" +#include +#include +#include +#include +#include +#include +#include + namespace webfront::fs { class DeveloperFS { diff --git a/include/webfront/system/DeveloperFiles.hpp b/include/webfront/system/DeveloperFiles.hpp index ec974ba6..c8ca64ce 100644 --- a/include/webfront/system/DeveloperFiles.hpp +++ b/include/webfront/system/DeveloperFiles.hpp @@ -5,7 +5,16 @@ #include #include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include namespace webfront::developer { diff --git a/include/webfront/system/DeveloperJournal.hpp b/include/webfront/system/DeveloperJournal.hpp index 72ce233e..e82e56a3 100644 --- a/include/webfront/system/DeveloperJournal.hpp +++ b/include/webfront/system/DeveloperJournal.hpp @@ -4,12 +4,24 @@ #include "WindowsCompat.hpp" #include "DeveloperPaths.hpp" +#include +#include +#include +#include #include +#include +#include +#include #include #include #include #include +#include +#include #include +#include +#include +#include #if !defined(_WIN32) #include diff --git a/include/webfront/system/DeveloperPaths.hpp b/include/webfront/system/DeveloperPaths.hpp index 36c87403..338620cf 100644 --- a/include/webfront/system/DeveloperPaths.hpp +++ b/include/webfront/system/DeveloperPaths.hpp @@ -1,13 +1,17 @@ /// @brief Path containment helpers of the developer store. #pragma once -#include "ToolStore.hpp" +#include "SafePath.hpp" + +#include +#include +#include namespace webfront::developer { // Resolve existing parents too: a symlink must never turn a relative project path into an escape. inline std::filesystem::path projectPath(const std::filesystem::path& root, std::string_view relative) { - const auto path = root / fs::tools::safeRelativePath(relative); + const auto path = root / fs::safeRelativePath(relative); const auto resolved = std::filesystem::weakly_canonical(path); auto base = root.begin(); auto part = resolved.begin(); diff --git a/include/webfront/system/DeveloperStore.hpp b/include/webfront/system/DeveloperStore.hpp index 51189cf0..be6629eb 100644 --- a/include/webfront/system/DeveloperStore.hpp +++ b/include/webfront/system/DeveloperStore.hpp @@ -7,8 +7,23 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include +#include +#include +#include +#include +#include +#include +#include namespace webfront::developer { @@ -423,7 +438,7 @@ class Store { static std::filesystem::path checkedChunk(const Transaction& tx, const std::string& path, std::size_t size) { if (!tx.directory && path != "output") throw std::invalid_argument("Expected output file"); - auto relative = fs::tools::safeRelativePath(path); + auto relative = fs::safeRelativePath(path); requireWithinLimits(tx, size); return relative; } diff --git a/include/webfront/system/SafePath.hpp b/include/webfront/system/SafePath.hpp new file mode 100644 index 00000000..92b2a2df --- /dev/null +++ b/include/webfront/system/SafePath.hpp @@ -0,0 +1,51 @@ +/// @brief Relative paths received from the browser, checked to stay inside the directory they name a file of. +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace webfront::fs { + +namespace detail { + +inline std::filesystem::path fromUtf8(std::string_view text) { + return std::filesystem::path(std::u8string(reinterpret_cast(text.data()), text.size())); +} + +// The HTTP server rejects every URL containing "..", so a path containing it could be written but never served. +inline bool hasSafeCharacters(std::string_view path) { + using namespace std::string_view_literals; + if (path.size() > 4096 || path.find("..") != std::string_view::npos) + return false; + return path.find_first_of("\\:*?\"<>|\0"sv) == std::string_view::npos; +} + +// Appends a component unless it is empty, "." or ".." (or "...", which no path needs). +inline bool appendComponent(std::filesystem::path& path, std::string_view component) { + if (component.find_first_not_of('.') == std::string_view::npos) + return false; + path /= fromUtf8(component); + return true; +} + +} // namespace detail + +/// Converts a '/'-separated path received from the browser into a relative path that stays inside +/// its directory. Rejects empty and absolute paths, empty, "." and ".." components, backslashes, +/// colons (drive letters and alternate streams), the other characters Windows forbids in file names +/// (*?"<>|) and NUL, on every platform, with std::invalid_argument. +inline std::filesystem::path safeRelativePath(std::string_view path) { + std::filesystem::path result; + bool safe = detail::hasSafeCharacters(path); + for (const auto part : std::views::split(path, '/')) + safe = safe && detail::appendComponent(result, std::string_view(part.begin(), part.end())); + if (!safe || result.empty()) + throw std::invalid_argument("Unsafe path '" + std::string(path) + "'"); + return result; +} + +} // namespace webfront::fs diff --git a/js/core/bootstrap/bootstrap.bundle.mjs b/js/core/bootstrap/bootstrap.bundle.mjs index 3b130c47..6aa88502 100644 --- a/js/core/bootstrap/bootstrap.bundle.mjs +++ b/js/core/bootstrap/bootstrap.bundle.mjs @@ -1 +1 @@ -var u=new TextDecoder;async function p(t,e){let n=String(e??"").split(/\s+/).filter(a=>a.startsWith("sha512-")).map(a=>a.split("?")[0]);if(n.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let r=new Uint8Array(await crypto.subtle.digest("SHA-512",t)),o="sha512-"+btoa(Array.from(r,a=>String.fromCharCode(a)).join(""));if(!n.includes(o))throw new Error(`Integrity check failed: expected ${n[0]}, got ${o}`);return o}async function d(t,e=268435456){let n=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),r=[],o=0;for(let a=await n.read();!a.done;a=await n.read()){if(o+=a.value.length,o>e)throw await n.cancel(),new Error(`The tarball unpacks to more than ${e} bytes`);r.push(a.value)}return new Uint8Array(await new Blob(r).arrayBuffer())}function l(t,e,n){let r=t.subarray(e,e+n),o=r.indexOf(0);return u.decode(o<0?r:r.subarray(0,o))}function y(t,e,n){if(t[e]&128)return t.subarray(e+1,e+n).reduce((o,a)=>o*256+a,t[e]&127);let r=l(t,e,n).trim();if(!/^[0-7]*$/.test(r))throw new Error("Corrupt tar header");return r===""?0:parseInt(r,8)}function T(t){let e=0;for(let n=0;n<512;++n)e+=n>=148&&n<156?32:t[n];if(y(t,148,8)!==e)throw new Error("Corrupt tar header checksum")}function S(t){let e={},n=0;for(;n0)||n+o>t.length)throw new Error("Corrupt pax header");let a=u.decode(t.subarray(r+1,n+o-1)),i=a.indexOf("=");e[a.slice(0,i)]=a.slice(i+1),n+=o}return e}function z(t,e){let n=t.subarray(e,e+512);T(n);let r=y(n,124,12),o=e+512;if(o+r>t.length)throw new Error("Truncated tar archive");return{header:n,type:n[156]===0?"0":String.fromCharCode(n[156]),data:t.subarray(o,o+r),next:o+Math.ceil(r/512)*512}}function U(t,e){return e+512>t.length||t.subarray(e,e+512).every(n=>n===0)}function I(t){let e=l(t,0,100),n=l(t,257,5)==="ustar"?l(t,345,155):"";return n?`${n}/${e}`:e}var h={x:(t,e)=>({...t,pax:S(e).path}),L:(t,e)=>({...t,long:l(e,0,e.length)}),g:t=>t};function m(t){let e=[],n={};for(let r=0;!U(t,r);){let{header:o,type:a,data:i,next:s}=z(t,r);if(r=s,Object.hasOwn(h,a)){n=h[a](n,i);continue}(a==="0"||a==="7")&&e.push({path:n.pax??n.long??I(o),bytes:i}),n={}}return e}var c=(t,e,...n)=>t.cppFunction(`webfront.developer.${e}`)(...n);async function g(t,e){let n=[],r=0;for(;;){let o=await c(t,"read",e,r);if(n.push(o),r+=o.length,o.length<262144)break;if(r>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(n).arrayBuffer())}async function j(t,{id:e,path:n,bytes:r},o){for(let a=0;a{}),s}}async function B(t,e){let n=[],r=0;for(;;){let{done:o,value:a}=await t.read();if(o)return n;if(r+=a.length,r>e)throw new Error("Compressed download exceeds its byte limit");n.push(a)}}async function F(t,e){try{return await B(t,e)}catch(n){throw await t.cancel().catch(()=>{}),n}finally{t.releaseLock()}}async function b(t,e=64*1024*1024){if(!t.ok)throw new Error(`Download: HTTP ${t.status}`);if(Number(t.headers.get("content-length"))>e)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await F(t.body.getReader(),e)).arrayBuffer())}var O=/[\\\0:*?"<>|]/,C=t=>t.split("/").some(e=>!e||e==="."||e==="..");function v(t){return typeof t!="string"||!t||O.test(t)?!0:C(t)}var w=t=>!v(t),P=new TextDecoder;function A(t,e){if(!e.path.startsWith("package/"))throw new Error("Invalid environment archive root");let n=e.path.slice(8);if(!w(n)||t.has(n))throw new Error("Invalid or duplicate environment path");t.set(n,e.bytes)}function L(t){let e=new Map;for(let n of m(t))A(e,n);return e}function R(t,e){return t.protocol!==1||!w(t.entry)?!1:e.has(t.entry)}async function x(t,e){await p(t,e);let n=L(await d(t));if(!n.has("environment.json"))throw new Error("Environment archive has no environment.json");let r=JSON.parse(P.decode(n.get("environment.json")));if(!R(r,n))throw new Error("Unsupported WebFront developer environment");return{files:n,manifest:r}}var k=".webfront/developer/environment.tgz";async function N(t,e){try{let n=await g(t,k);return await x(n,e),n}catch{return null}}async function W(t,e){let n=new URL(t.environment,location.href);if(n.protocol!=="https:"&&n.origin!==location.origin)throw new Error("The environment must use HTTPS or the application origin");let r=await e(n);if(!r.ok)throw new Error(`Environment download: HTTP ${r.status}`);return b(r)}function D(t){return!t||!w(t.archive)?!1:String(t.integrity).startsWith("sha512-")}function H(t,e){return Object.fromEntries(Object.entries(t.starters??{}).map(([n,r])=>{if(!D(r))throw new Error("Invalid pinned starter metadata");return[n,{url:new URL(r.archive,e).href,integrity:r.integrity}]}))}async function E(t,e,n=fetch,r=()=>{}){let o=await N(t,e.integrity);o?r("Using verified cached developer environment"):(r("Downloading developer environment"),o=await W(e,n));let{files:a,manifest:i}=await x(o,e.integrity),s=H(i,new URL(e.environment,location.href));return await f(t,".webfront/developer/environment",a),await f(t,k,new Map([["output",o]]),{directory:!1}),{url:`/webfront/developer/environment/${i.entry}`,config:{...e,starters:s}}}if(typeof document<"u"&&document.getElementById("retry")){let t=document.getElementById("status"),e=document.getElementById("retry"),n=async()=>{e.hidden=!0;try{await webFront.ready;let r=JSON.parse(await c(webFront,"config")),{url:o,config:a}=await E(webFront,r,fetch,s=>{t.textContent=s});await(await import(o)).mount({bridge:webFront,config:a,terminal:document.getElementById("terminal"),preview:document.getElementById("preview")}),t.textContent="Developer environment ready. Type wf help."}catch(r){t.textContent=`Bootstrap failed: ${r.message}`,e.hidden=!1}};e.addEventListener("click",n),n()} +var l=new TextDecoder;async function h(e,t){let r=String(t??"").split(/\s+/).filter(a=>a.startsWith("sha512-")).map(a=>a.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),o="sha512-"+btoa(Array.from(n,a=>String.fromCharCode(a)).join(""));if(!r.includes(o))throw new Error(`Integrity check failed: expected ${r[0]}, got ${o}`);return o}async function p(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],o=0;for(let a=await r.read();!a.done;a=await r.read()){if(o+=a.value.length,o>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(a.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function u(e,t,r){let n=e.subarray(t,t+r),o=n.indexOf(0);return l.decode(o<0?n:n.subarray(0,o))}function y(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((o,a)=>o*256+a,e[t]&127);let n=u(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function z(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if(y(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function B(e){let t={},r=0;for(;r0)||r+o>e.length)throw new Error("Corrupt pax header");let a=l.decode(e.subarray(n+1,r+o-1)),i=a.indexOf("=");t[a.slice(0,i)]=a.slice(i+1),r+=o}return t}function T(e,t){let r=e.subarray(t,t+512);z(r);let n=y(r,124,12),o=t+512;if(o+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(o,o+n),next:o+Math.ceil(n/512)*512}}function C(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function I(e){let t=u(e,0,100),r=u(e,257,5)==="ustar"?u(e,345,155):"";return r?`${r}/${t}`:t}var w={x:(e,t)=>({...e,pax:B(t).path}),L:(e,t)=>({...e,long:u(t,0,t.length)}),g:e=>e};function m(e){let t=[],r={};for(let n=0;!C(e,n);){let{header:o,type:a,data:i,next:s}=T(e,n);if(n=s,Object.hasOwn(w,a)){r=w[a](r,i);continue}(a==="0"||a==="7")&&t.push({path:r.pax??r.long??I(o),bytes:i}),r={}}return t}var c=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function g(e,t){let r=[],n=0;for(;;){let o=await c(e,"read",t,n);if(r.push(o),n+=o.length,o.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function U(e,{id:t,path:r,bytes:n},o){for(let a=0;a{}),s}}async function P(e,t){let r=[],n=0;for(;;){let{done:o,value:a}=await e.read();if(o)return r;if(n+=a.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(a)}}async function $(e,t){try{return await P(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function b(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await $(e.body.getReader(),t)).arrayBuffer())}var j=/[\\\0:*?"<>|]/,A=e=>e.split("/").some(t=>!t||t==="."||t==="..");function v(e){return typeof e!="string"||!e||j.test(e)?!0:A(e)}var d=e=>!v(e),O=new TextDecoder;function F(e,t){if(!t.path.startsWith("package/"))throw new Error("Invalid environment archive root");let r=t.path.slice(8);if(!d(r)||e.has(r))throw new Error("Invalid or duplicate environment path");e.set(r,t.bytes)}function L(e){let t=new Map;for(let r of m(e))F(t,r);return t}function N(e,t){return e.protocol!==1||!d(e.entry)?!1:t.has(e.entry)}async function x(e,t){await h(e,t);let r=L(await p(e));if(!r.has("environment.json"))throw new Error("Environment archive has no environment.json");let n=JSON.parse(O.decode(r.get("environment.json")));if(!N(n,r))throw new Error("Unsupported WebFront developer environment");return{files:r,manifest:n}}var E=".webfront/developer/environment.tgz";async function R(e,t){try{let r=await g(e,E);return await x(r,t),r}catch{return null}}async function D(e,t){let r=new URL(e.environment,location.href);if(r.protocol!=="https:"&&r.origin!==location.origin)throw new Error("The environment must use HTTPS or the application origin");let n=await t(r);if(!n.ok)throw new Error(`Environment download: HTTP ${n.status}`);return b(n)}function H(e){return!e||!d(e.archive)?!1:String(e.integrity).startsWith("sha512-")}function W(e,t){return Object.fromEntries(Object.entries(e.starters??{}).map(([r,n])=>{if(!H(n))throw new Error("Invalid pinned starter metadata");return[r,{url:new URL(n.archive,t).href,integrity:n.integrity}]}))}async function k(e,t,r=fetch,n=()=>{}){let o=await R(e,t.integrity);o?n("Using verified cached developer environment"):(n("Downloading developer environment"),o=await D(t,r));let{files:a,manifest:i}=await x(o,t.integrity),s=W(i,new URL(t.environment,location.href));return await f(e,".webfront/developer/environment",a),await f(e,E,new Map([["output",o]]),{directory:!1}),{url:`/webfront/developer/environment/${i.entry}`,config:{...t,starters:s}}}if(typeof document<"u"&&document.getElementById("retry")){let e=document.getElementById("status"),t=document.getElementById("retry"),r=async()=>{t.hidden=!0;try{await webFront.ready;let n=JSON.parse(await c(webFront,"config")),{url:o,config:a}=await k(webFront,n,fetch,s=>{e.textContent=s});await(await import(o)).mount({bridge:webFront,config:a,terminal:document.getElementById("terminal"),preview:document.getElementById("preview")}),e.textContent="Developer environment ready. Type wf help."}catch(n){e.textContent=`Bootstrap failed: ${n.message}`,t.hidden=!1}};t.addEventListener("click",r),r()} diff --git a/js/developer/environment/archive.mjs b/js/developer/environment/archive.mjs index ee35d189..75580d32 100644 --- a/js/developer/environment/archive.mjs +++ b/js/developer/environment/archive.mjs @@ -1,5 +1,5 @@ // Reading an npm package archive: its files and the checks on its package.json. -import {gunzip, readTar} from '../components/tools/wf.mjs'; +import {gunzip, readTar} from './tarball.mjs'; import {safePackagePath} from './paths.mjs'; const text = new TextDecoder(); diff --git a/js/developer/environment/bootstrap.mjs b/js/developer/environment/bootstrap.mjs index 94c9fc08..d27284db 100644 --- a/js/developer/environment/bootstrap.mjs +++ b/js/developer/environment/bootstrap.mjs @@ -1,4 +1,4 @@ -import {gunzip, readTar, verifyIntegrity} from '../components/tools/wf.mjs'; +import {gunzip, readTar, verifyIntegrity} from './tarball.mjs'; import {readProject, publish, responseBytes} from './io.mjs'; import {isUnsafe} from './paths.mjs'; diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index a30d134b..43c65e23 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -1,7 +1,7 @@ { "js/developer/environment/manifest.mjs": "b534d152e6fb008b23d4cad00d8d72913091a9acd12603356995cbd8ed08f76c", "js/developer/environment/project.mjs": "280cced29e41bc48d5d9d69934186ababfdbbc9dc32ed9517e17af4f19d3bd73", - "js/developer/environment/installer.mjs": "f3e919535847c93f62498ee0ad3fec49ff5f7531fb657feaca80e2ccb6da1c0c", + "js/developer/environment/installer.mjs": "d4e67a246fc907d6123ff9602f09c6c263c7942d86890d4f408cbed3cc63b717", "js/developer/environment/restore.mjs": "cdd22eebd55d68bd705685cd5ee3059e228a35053eaad116ab99c4c05b908098", "js/developer/environment/cache.mjs": "6fd0e3b760dfc1070a28e2e2eb3c86621c970c775045e7a9ae665da4f6845922", "js/developer/environment/scripts.mjs": "83ae28e822db986d9b3ae547f005f1a7c94868c36f232d68ddeb6126fb0a5021", @@ -11,13 +11,14 @@ "js/developer/environment/typecheck-snapshot.mjs": "2b68ae117cb39a3f67e3fe2c0b88c479ed0aed31f793c95725488b0af7d97d54", "js/developer/environment/typecheck-worker.mjs": "7c072f7ce902ba8d6ee59015be93c3a5c358d95a5153758309ea825bd39a903e", "js/developer/environment/packages-entry.mjs": "e0b4acd4330b8b51eb0e695384c8df2b103a4be4f598ac83277838022f747e30", - "js/developer/environment/bootstrap.mjs": "534af4b3d07891338c3390e1d5e06c2fb6dd8df11ca6547735565b17f1b9cd70", + "js/developer/environment/bootstrap.mjs": "b46c9d66ea7083f17fc9b29a8cd9c350966e2420b39fd44b910e8fdd274854df", "js/developer/environment/bootstrap-entry.mjs": "ff8084f23f5acc721f97eb1ed0a454e7bfee1894de17d54f0100fa11f7ef8b77", - "js/developer/environment/packages.mjs": "faed29500a34c6ce24756d07bd4b47b9168ccec4bd49d12f00096a869637d74d", - "js/developer/environment/starter.mjs": "048cf2af36b407bc075323f78a1195b4be91ad7da51f6ce941d9fb230f314ff9", + "js/developer/environment/packages.mjs": "6636219f3fef20ea1d274dc9298d8af451ef257b86fe6c1ed0de9a7c797b11d8", + "js/developer/environment/starter.mjs": "f38e290e03aebe146623c2ca9b590d645fb91a51acdf7a98101bb00b5b88096c", "js/developer/environment/paths.mjs": "3b6114df78eb193161c5c84499dda084cb7ff91c56a4496371c30295d00880e3", - "js/developer/environment/runtime.mjs": "056a4e77bc4f0293acaf98e0913f5efe8d85c6000c6bc57a3e82967da3c8f390", + "js/developer/environment/runtime.mjs": "962ecee55408dbe504791fa64b326fa59a6bfd0f0f1dc50f5b863c497cef3088", "js/developer/environment/terminal.mjs": "7ffcf7ac6ef63c35cdf5ef70284b384525b13ba18422af069289e53b6c4f6be1", + "js/developer/environment/tarball.mjs": "1c1e1aea067910e1fec74e85b4bf9fbefed9b38187a04d8d2764f0b9a96fca39", "js/developer/environment/commands.mjs": "964770e4ca02c1044319b17ed76b7f6006427ac6751bd4c789ae58cbb850b071", "js/developer/environment/compiler.mjs": "cc6fbe8cabbd94750045cebfdf942234247519099a192ef9cdda6ccbdbfbb6a4", "js/developer/environment/bundler.mjs": "c2f55056a4702d57207203a29226f98a95a31ae615596bf21338b7dfabe83ed9", @@ -25,8 +26,8 @@ "js/developer/environment/conditions.mjs": "7f0ecba239480831e38985ccffd4c82309949924f4eb9d938e4ad1b09f5f36ed", "js/developer/environment/io.mjs": "21af39f07c7eb863908c1df768e3c31de1c6eb8ff757c2a287c4a47c76855db6", "js/developer/environment/recipe.mjs": "5e7b80cb9090dce63fafafbb852879fce9f6ed2399ac364bbe5af1cf6f4c1758", - "js/developer/environment/registry.mjs": "717b928b47d1eb8d1635cbfda60473f4a8e0918c1345d5364b6b7d2ffe199195", - "js/developer/environment/archive.mjs": "1fb8b9c3c27219858597801104639bba1104c7a7d33973609cd556b5e5f81d2d", + "js/developer/environment/registry.mjs": "42baa605f0335622470aaf4b945c5e38486d56a0ac0ef6442e5348f160aa3f88", + "js/developer/environment/archive.mjs": "5a5b135dc935c3916fc0e8ccfc0e92485e0c6e201cbceab160de68fe89cb6bba", "js/developer/environment/lock.mjs": "d69a3a877b92da52b21dcc78877345015ac31b7dec1c484ee1ff1f97f154d51f", "js/developer/environment/pins.mjs": "df07f6f01edaf86a1052d0e76f6c6745cb6e7a3309bbd256ac720ee8adc85297", "js/developer/environment/peers.mjs": "e1d999892138682fc0134ef1f4d4b19b9a9ad8d7fb16e37fc9c6c684bd853896", @@ -36,13 +37,12 @@ "js/developer/tools/starters/pi/style.css": "360e2c7ae6d3699b00e18cbf67efbae7a8d8863d88926b31139e102cf38e5abd", "examples/life/ui/main.tsx": "ed11a82aad1639eb6997af8b0fca4d5c5ed4c36422c22a74ac49ae73078d0a91", "examples/life/ui/style.css": "9bb55eb0f0a3287e5b7dc78af9d69608b87ff42c4d9c8a653bc83a52fe293c44", - "js/developer/components/tools/wf.mjs": "2a8b463b2da223deb8d54d9fdd6037fdd079afeb24e39337693df03cdbcbd0ec", "js/developer/tools/distribution.json": "12b40657d1bc34c4093cd5f793d772bf3fa6fd8615ab7b766ad1756092438f83", - "js/developer/tools/build.mjs": "b4a98c471cd48c74338badc5f3837559ddb37b39c4c6998a4e9c4ff88b1effa3", + "js/developer/tools/build.mjs": "1516d8f0be60c0dc3d6f3ae66a92558699d62b4d15714325580eb2c0d35dac7f", "js/developer/tools/site.mjs": "1827d3fd7e1e470336aab25ea8686c912c2b674a10f7be496f2f0077fbc45292", "js/developer/tools/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b", "js/developer/vendor/package-lock.json": "f6aefe8b4cb0b15f866f41eae425f6654d2c6c2d96438fd0da878c5651585616", - "js/core/bootstrap/bootstrap.bundle.mjs": "792fe7cf564bd12ac47fef419d8c71e2070925764a17706552e7d3f5d6ba2181", - "js/developer/environment/packages.bundle.mjs": "47fae31846bad6569a4f83e5fb765a8b2c01b265eb830c3c302d97d4a2d2ba68", + "js/core/bootstrap/bootstrap.bundle.mjs": "1069b307799ed2b0de53914748521731bc9796414a416d56340bbda983ef2443", + "js/developer/environment/packages.bundle.mjs": "7c5b721c9252e81a4228bbef0441576fdb77af983e40675dbeab5976da582529", "include/webfront/system/DeveloperReleaseData.hpp": "c97a8c3b21df3306c179f7b46d945159b5854f9d2810f135a4ab224c768c75d7" } diff --git a/js/developer/environment/installer.mjs b/js/developer/environment/installer.mjs index 242858bc..75e71865 100644 --- a/js/developer/environment/installer.mjs +++ b/js/developer/environment/installer.mjs @@ -1,7 +1,7 @@ // wf init and wf install: the manifest states the intent, the lock the exact resolution; both are published together. import semver from 'semver'; import {resolvePackages, downloadPackage} from './packages.mjs'; -import {parseSpec} from '../components/tools/wf.mjs'; +import {parseSpec} from './tarball.mjs'; import {publish} from './io.mjs'; import {manifestPath, newManifest, manifestName, serializeManifest, validateManifest, dependenciesDigest} from './manifest.mjs'; import {loadProject, publishTogether, lockPath, noManifest, desynchronized, textBytes} from './project.mjs'; diff --git a/js/developer/environment/packages.bundle.mjs b/js/developer/environment/packages.bundle.mjs index 26cae5fd..e9a80e18 100644 --- a/js/developer/environment/packages.bundle.mjs +++ b/js/developer/environment/packages.bundle.mjs @@ -1,16 +1,16 @@ -var Gn=Object.create;var mt=Object.defineProperty;var Mn=Object.getOwnPropertyDescriptor;var Wn=Object.getOwnPropertyNames;var _n=Object.getPrototypeOf,Bn=Object.prototype.hasOwnProperty;var w=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var Xn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Wn(t))!Bn.call(e,s)&&s!==r&&mt(e,s,{get:()=>t[s],enumerable:!(n=Mn(t,s))||n.enumerable});return e};var F=(e,t,r)=>(r=e!=null?Gn(_n(e)):{},Xn(t||!e||!e.__esModule?mt(r,"default",{value:e,enumerable:!0}):r,e));var B=w((Ec,xt)=>{"use strict";var Kn="2.0.0",Qn=Number.MAX_SAFE_INTEGER||9007199254740991,es=16,ts=250,rs=["major","premajor","minor","preminor","patch","prepatch","prerelease"];xt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:es,MAX_SAFE_BUILD_LENGTH:ts,MAX_SAFE_INTEGER:Qn,RELEASE_TYPES:rs,SEMVER_SPEC_VERSION:Kn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var X=w((gc,Rt)=>{"use strict";var ns=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Rt.exports=ns});var z=w((j,bt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Ae,MAX_SAFE_BUILD_LENGTH:ss,MAX_LENGTH:os}=B(),is=X();j=bt.exports={};var as=j.re=[],cs=j.safeRe=[],p=j.src=[],ls=j.safeSrc=[],h=j.t={},us=0,je="[a-zA-Z0-9-]",fs=[["\\s",1],["\\d",os],[je,ss]],ps=e=>{for(let[t,r]of fs)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},E=(e,t,r)=>{let n=ps(t),s=us++;is(e,s,t),h[e]=s,p[s]=t,ls[s]=n,as[s]=new RegExp(t,r?"g":void 0),cs[s]=new RegExp(n,r?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${je}*`);E("MAINVERSION",`(${p[h.NUMERICIDENTIFIER]})\\.(${p[h.NUMERICIDENTIFIER]})\\.(${p[h.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${p[h.NUMERICIDENTIFIERLOOSE]})\\.(${p[h.NUMERICIDENTIFIERLOOSE]})\\.(${p[h.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${p[h.NONNUMERICIDENTIFIER]}|${p[h.NUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${p[h.NONNUMERICIDENTIFIER]}|${p[h.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASE",`(?:-(${p[h.PRERELEASEIDENTIFIER]}(?:\\.${p[h.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${p[h.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${p[h.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${je}+`);E("BUILD",`(?:\\+(${p[h.BUILDIDENTIFIER]}(?:\\.${p[h.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${p[h.MAINVERSION]}${p[h.PRERELEASE]}?${p[h.BUILD]}?`);E("FULL",`^${p[h.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${p[h.MAINVERSIONLOOSE]}${p[h.PRERELEASELOOSE]}?${p[h.BUILD]}?`);E("LOOSE",`^${p[h.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${p[h.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${p[h.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${p[h.XRANGEIDENTIFIER]})(?:\\.(${p[h.XRANGEIDENTIFIER]})(?:\\.(${p[h.XRANGEIDENTIFIER]})(?:${p[h.PRERELEASE]})?${p[h.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${p[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${p[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${p[h.XRANGEIDENTIFIERLOOSE]})(?:${p[h.PRERELEASELOOSE]})?${p[h.BUILD]}?)?)?`);E("XRANGE",`^${p[h.GTLT]}\\s*${p[h.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${p[h.GTLT]}\\s*${p[h.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Ae}})(?:\\.(\\d{1,${Ae}}))?(?:\\.(\\d{1,${Ae}}))?`);E("COERCE",`${p[h.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",p[h.COERCEPLAIN]+`(?:${p[h.PRERELEASE]})?(?:${p[h.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",p[h.COERCE],!0);E("COERCERTLFULL",p[h.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${p[h.LONETILDE]}\\s+`,!0);j.tildeTrimReplace="$1~";E("TILDE",`^${p[h.LONETILDE]}${p[h.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${p[h.LONETILDE]}${p[h.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${p[h.LONECARET]}\\s+`,!0);j.caretTrimReplace="$1^";E("CARET",`^${p[h.LONECARET]}${p[h.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${p[h.LONECARET]}${p[h.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${p[h.GTLT]}\\s*(${p[h.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${p[h.GTLT]}\\s*(${p[h.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${p[h.GTLT]}\\s*(${p[h.LOOSEPLAIN]}|${p[h.XRANGEPLAIN]})`,!0);j.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${p[h.XRANGEPLAIN]})\\s+-\\s+(${p[h.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${p[h.XRANGEPLAINLOOSE]})\\s+-\\s+(${p[h.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ae=w(($c,Ot)=>{"use strict";var hs=Object.freeze({loose:!0}),ds=Object.freeze({}),ms=e=>e?typeof e!="object"?hs:e:ds;Ot.exports=ms});var Pe=w((yc,kt)=>{"use strict";var vt=/^[0-9]+$/,It=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:eIt(t,e);kt.exports={compareIdentifiers:It,rcompareIdentifiers:ws}});var b=w((xc,Nt)=>{"use strict";var ce=X(),{MAX_LENGTH:St,MAX_SAFE_INTEGER:le}=B(),{safeRe:ue,t:fe}=z(),Es=ae(),{compareIdentifiers:qe}=Pe(),Ce=class e{constructor(t,r){if(r=Es(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>St)throw new TypeError(`version is longer than ${St} characters`);ce("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?ue[fe.LOOSE]:ue[fe.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>le||this.major<0)throw new TypeError("Invalid major version");if(this.minor>le||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>le||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let o=+s;if(o>=0&&ot.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(ce("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return qe(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(ce("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return qe(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?ue[fe.PRERELEASELOOSE]:ue[fe.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let o=[r,s];n===!1&&(o=[r]),qe(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Nt.exports=Ce});var q=w((Rc,Tt)=>{"use strict";var Lt=b(),gs=(e,t,r=!1)=>{if(e instanceof Lt)return e;try{return new Lt(e,t)}catch(n){if(!r)return null;throw n}};Tt.exports=gs});var jt=w((bc,At)=>{"use strict";var $s=q(),ys=(e,t)=>{let r=$s(e,t);return r?r.version:null};At.exports=ys});var qt=w((Oc,Pt)=>{"use strict";var xs=q(),Rs=(e,t)=>{let r=xs(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};Pt.exports=Rs});var Ut=w((vc,Dt)=>{"use strict";var Ct=b(),bs=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new Ct(e instanceof Ct?e.version:e,r).inc(t,n,s).version}catch{return null}};Dt.exports=bs});var Gt=w((Ic,zt)=>{"use strict";var Ft=q(),Os=(e,t)=>{let r=Ft(e,null,!0),n=Ft(t,null,!0),s=r.compare(n);if(s===0)return null;let o=s>0,i=o?r:n,c=o?n:r,a=!!i.prerelease.length;if(!!c.prerelease.length&&!a){if(!c.patch&&!c.minor)return"major";if(c.compareMain(i)===0)return c.minor&&!c.patch?"minor":"patch"}let u=a?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};zt.exports=Os});var Wt=w((kc,Mt)=>{"use strict";var vs=b(),Is=(e,t)=>new vs(e,t).major;Mt.exports=Is});var Bt=w((Sc,_t)=>{"use strict";var ks=b(),Ss=(e,t)=>new ks(e,t).minor;_t.exports=Ss});var Vt=w((Nc,Xt)=>{"use strict";var Ns=b(),Ls=(e,t)=>new Ns(e,t).patch;Xt.exports=Ls});var Jt=w((Lc,Ht)=>{"use strict";var Ts=q(),As=(e,t)=>{let r=Ts(e,t);return r&&r.prerelease.length?r.prerelease:null};Ht.exports=As});var N=w((Tc,Zt)=>{"use strict";var Yt=b(),js=(e,t,r)=>new Yt(e,r).compare(new Yt(t,r));Zt.exports=js});var Qt=w((Ac,Kt)=>{"use strict";var Ps=N(),qs=(e,t,r)=>Ps(t,e,r);Kt.exports=qs});var tr=w((jc,er)=>{"use strict";var Cs=N(),Ds=(e,t)=>Cs(e,t,!0);er.exports=Ds});var pe=w((Pc,nr)=>{"use strict";var rr=b(),Us=(e,t,r)=>{let n=new rr(e,r),s=new rr(t,r);return n.compare(s)||n.compareBuild(s)};nr.exports=Us});var or=w((qc,sr)=>{"use strict";var Fs=pe(),zs=(e,t)=>e.sort((r,n)=>Fs(r,n,t));sr.exports=zs});var ar=w((Cc,ir)=>{"use strict";var Gs=pe(),Ms=(e,t)=>e.sort((r,n)=>Gs(n,r,t));ir.exports=Ms});var V=w((Dc,cr)=>{"use strict";var Ws=N(),_s=(e,t,r)=>Ws(e,t,r)>0;cr.exports=_s});var he=w((Uc,lr)=>{"use strict";var Bs=N(),Xs=(e,t,r)=>Bs(e,t,r)<0;lr.exports=Xs});var De=w((Fc,ur)=>{"use strict";var Vs=N(),Hs=(e,t,r)=>Vs(e,t,r)===0;ur.exports=Hs});var Ue=w((zc,fr)=>{"use strict";var Js=N(),Ys=(e,t,r)=>Js(e,t,r)!==0;fr.exports=Ys});var de=w((Gc,pr)=>{"use strict";var Zs=N(),Ks=(e,t,r)=>Zs(e,t,r)>=0;pr.exports=Ks});var me=w((Mc,hr)=>{"use strict";var Qs=N(),eo=(e,t,r)=>Qs(e,t,r)<=0;hr.exports=eo});var Fe=w((Wc,dr)=>{"use strict";var to=De(),ro=Ue(),no=V(),so=de(),oo=he(),io=me(),ao=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return to(e,r,n);case"!=":return ro(e,r,n);case">":return no(e,r,n);case">=":return so(e,r,n);case"<":return oo(e,r,n);case"<=":return io(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};dr.exports=ao});var wr=w((_c,mr)=>{"use strict";var co=b(),lo=q(),{safeRe:we,t:Ee}=z(),uo=(e,t)=>{if(e instanceof co)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?we[Ee.COERCEFULL]:we[Ee.COERCE]);else{let a=t.includePrerelease?we[Ee.COERCERTLFULL]:we[Ee.COERCERTL],l;for(;(l=a.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||l.index+l[0].length!==r.index+r[0].length)&&(r=l),a.lastIndex=l.index+l[1].length+l[2].length;a.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",o=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",c=t.includePrerelease&&r[6]?`+${r[6]}`:"";return lo(`${n}.${s}.${o}${i}${c}`,t)};mr.exports=uo});var gr=w((Bc,Er)=>{"use strict";var ze=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};Er.exports=ze});var L=w((Xc,Rr)=>{"use strict";var fo=/\s+/g,Ge=class e{constructor(t,r){if(r=ho(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Me)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(fo," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!yr(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&xo(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&$o)|(this.options.loose&&yo))+":"+t,s=$r.get(n);if(s)return s;let o=this.options.loose,i=o?v[O.HYPHENRANGELOOSE]:v[O.HYPHENRANGE];t=t.replace(i,To(this.options.includePrerelease)),g("hyphen replace",t),t=t.replace(v[O.COMPARATORTRIM],wo),g("comparator trim",t),t=t.replace(v[O.TILDETRIM],Eo),g("tilde trim",t),t=t.replace(v[O.CARETTRIM],go),g("caret trim",t);let c=t.split(" ").map(f=>Ro(f,this.options)).join(" ").split(/\s+/).map(f=>Lo(f,this.options));o&&(c=c.filter(f=>(g("loose invalid filter",f,this.options),!!f.match(v[O.COMPARATORLOOSE])))),g("range list",c);let a=new Map,l=c.map(f=>new Me(f,this.options));for(let f of l){if(yr(f))return[f];a.set(f.value,f)}a.size>1&&a.has("")&&a.delete("");let u=[...a.values()];return $r.set(n,u),u}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>xr(n,r)&&t.set.some(s=>xr(s,r)&&n.every(o=>s.every(i=>o.intersects(i,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new mo(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",xo=e=>e.value==="",xr=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(o=>s.intersects(o,t)),s=n.pop();return r},Ro=(e,t)=>(e=e.replace(v[O.BUILD],""),g("comp",e,t),e=vo(e,t),g("caret",e),e=bo(e,t),g("tildes",e),e=ko(e,t),g("xrange",e),e=No(e,t),g("stars",e),e),I=e=>!e||e.toLowerCase()==="x"||e==="*",bo=(e,t)=>e.trim().split(/\s+/).map(r=>Oo(r,t)).join(" "),Oo=(e,t)=>{let r=t.loose?v[O.TILDELOOSE]:v[O.TILDE];return e.replace(r,(n,s,o,i,c)=>{g("tilde",e,n,s,o,i,c);let a;return I(s)?a="":I(o)?a=`>=${s}.0.0 <${+s+1}.0.0-0`:I(i)?a=`>=${s}.${o}.0 <${s}.${+o+1}.0-0`:c?(g("replaceTilde pr",c),a=`>=${s}.${o}.${i}-${c} <${s}.${+o+1}.0-0`):a=`>=${s}.${o}.${i} <${s}.${+o+1}.0-0`,g("tilde return",a),a})},vo=(e,t)=>e.trim().split(/\s+/).map(r=>Io(r,t)).join(" "),Io=(e,t)=>{g("caret",e,t);let r=t.loose?v[O.CARETLOOSE]:v[O.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,o,i,c,a)=>{g("caret",e,s,o,i,c,a);let l;return I(o)?l="":I(i)?l=`>=${o}.0.0${n} <${+o+1}.0.0-0`:I(c)?o==="0"?l=`>=${o}.${i}.0${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.0${n} <${+o+1}.0.0-0`:a?(g("replaceCaret pr",a),o==="0"?i==="0"?l=`>=${o}.${i}.${c}-${a} <${o}.${i}.${+c+1}-0`:l=`>=${o}.${i}.${c}-${a} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${c}-${a} <${+o+1}.0.0-0`):(g("no pr"),o==="0"?i==="0"?l=`>=${o}.${i}.${c}${n} <${o}.${i}.${+c+1}-0`:l=`>=${o}.${i}.${c}${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${c} <${+o+1}.0.0-0`),g("caret return",l),l})},ko=(e,t)=>(g("replaceXRanges",e,t),e.split(/\s+/).map(r=>So(r,t)).join(" ")),So=(e,t)=>{e=e.trim();let r=t.loose?v[O.XRANGELOOSE]:v[O.XRANGE];return e.replace(r,(n,s,o,i,c,a)=>{g("xRange",e,n,s,o,i,c,a);let l=I(o),u=l||I(i),f=u||I(c),m=f;return s==="="&&m&&(s=""),a=t.includePrerelease?"-0":"",l?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&m?(u&&(i=0),c=0,s===">"?(s=">=",u?(o=+o+1,i=0,c=0):(i=+i+1,c=0)):s==="<="&&(s="<",u?o=+o+1:i=+i+1),s==="<"&&(a="-0"),n=`${s+o}.${i}.${c}${a}`):u?n=`>=${o}.0.0${a} <${+o+1}.0.0-0`:f&&(n=`>=${o}.${i}.0${a} <${o}.${+i+1}.0-0`),g("xRange return",n),n})},No=(e,t)=>(g("replaceStars",e,t),e.trim().replace(v[O.STAR],"")),Lo=(e,t)=>(g("replaceGTE0",e,t),e.trim().replace(v[t.includePrerelease?O.GTE0PRE:O.GTE0],"")),To=e=>(t,r,n,s,o,i,c,a,l,u,f,m)=>(I(n)?r="":I(s)?r=`>=${n}.0.0${e?"-0":""}`:I(o)?r=`>=${n}.${s}.0${e?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,I(l)?a="":I(u)?a=`<${+l+1}.0.0-0`:I(f)?a=`<${l}.${+u+1}.0-0`:m?a=`<=${l}.${u}.${f}-${m}`:e?a=`<${l}.${u}.${+f+1}-0`:a=`<=${a}`,`${r} ${a}`.trim()),Ao=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var H=w((Vc,Sr)=>{"use strict";var J=Symbol("SemVer ANY"),Be=class e{static get ANY(){return J}constructor(t,r){if(r=br(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),_e("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===J?this.value="":this.value=this.operator+this.semver.version,_e("comp",this)}parse(t){let r=this.options.loose?Or[vr.COMPARATORLOOSE]:Or[vr.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new Ir(n[2],this.options.loose):this.semver=J}toString(){return this.value}test(t){if(_e("Comparator.test",t,this.options.loose),this.semver===J||t===J)return!0;if(typeof t=="string")try{t=new Ir(t,this.options)}catch{return!1}return We(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new kr(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new kr(this.value,r).test(t.semver):(r=br(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||We(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||We(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Sr.exports=Be;var br=ae(),{safeRe:Or,t:vr}=z(),We=Fe(),_e=X(),Ir=b(),kr=L()});var Y=w((Hc,Nr)=>{"use strict";var jo=L(),Po=(e,t,r)=>{try{t=new jo(t,r)}catch{return!1}return t.test(e)};Nr.exports=Po});var Tr=w((Jc,Lr)=>{"use strict";var qo=L(),Co=(e,t)=>new qo(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Lr.exports=Co});var jr=w((Yc,Ar)=>{"use strict";var Do=b(),Uo=L(),Fo=(e,t,r)=>{let n=null,s=null,o=null;try{o=new Uo(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===-1)&&(n=i,s=new Do(n,r))}),n};Ar.exports=Fo});var qr=w((Zc,Pr)=>{"use strict";var zo=b(),Go=L(),Mo=(e,t,r)=>{let n=null,s=null,o=null;try{o=new Go(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===1)&&(n=i,s=new zo(n,r))}),n};Pr.exports=Mo});var Ur=w((Kc,Dr)=>{"use strict";var Xe=b(),Wo=L(),Cr=V(),_o=(e,t)=>{e=new Wo(e,t);let r=new Xe("0.0.0");if(e.test(r)||(r=new Xe("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let c=new Xe(i.semver.version);switch(i.operator){case">":c.prerelease.length===0?c.patch++:c.prerelease.push(0),c.raw=c.format();case"":case">=":(!o||Cr(c,o))&&(o=c);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||Cr(r,o))&&(r=o)}return r&&e.test(r)?r:null};Dr.exports=_o});var zr=w((Qc,Fr)=>{"use strict";var Bo=L(),Xo=(e,t)=>{try{return new Bo(e,t).range||"*"}catch{return null}};Fr.exports=Xo});var ge=w((el,_r)=>{"use strict";var Vo=b(),Wr=H(),{ANY:Ho}=Wr,Jo=L(),Yo=Y(),Gr=V(),Mr=he(),Zo=me(),Ko=de(),Qo=(e,t,r,n)=>{e=new Vo(e,n),t=new Jo(t,n);let s,o,i,c,a;switch(r){case">":s=Gr,o=Zo,i=Mr,c=">",a=">=";break;case"<":s=Mr,o=Ko,i=Gr,c="<",a="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Yo(e,t,n))return!1;for(let l=0;l{d.semver===Ho&&(d=new Wr(">=0.0.0")),f=f||d,m=m||d,s(d.semver,f.semver,n)?f=d:i(d.semver,m.semver,n)&&(m=d)}),f.operator===c||f.operator===a||(!m.operator||m.operator===c)&&o(e,m.semver))return!1;if(m.operator===a&&i(e,m.semver))return!1}return!0};_r.exports=Qo});var Xr=w((tl,Br)=>{"use strict";var ei=ge(),ti=(e,t,r)=>ei(e,t,">",r);Br.exports=ti});var Hr=w((rl,Vr)=>{"use strict";var ri=ge(),ni=(e,t,r)=>ri(e,t,"<",r);Vr.exports=ni});var Zr=w((nl,Yr)=>{"use strict";var Jr=L(),si=(e,t,r)=>(e=new Jr(e,r),t=new Jr(t,r),e.intersects(t,r));Yr.exports=si});var Qr=w((sl,Kr)=>{"use strict";var oi=Y(),ii=N();Kr.exports=(e,t,r)=>{let n=[],s=null,o=null,i=e.sort((u,f)=>ii(u,f,r));for(let u of i)oi(u,t,r)?(o=u,s||(s=u)):(o&&n.push([s,o]),o=null,s=null);s&&n.push([s,null]);let c=[];for(let[u,f]of n)u===f?c.push(u):!f&&u===i[0]?c.push("*"):f?u===i[0]?c.push(`<=${f}`):c.push(`${u} - ${f}`):c.push(`>=${u}`);let a=c.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return a.length{"use strict";var en=L(),He=H(),{ANY:Ve}=He,Z=Y(),Je=N(),ai=(e,t,r={})=>{if(e===t)return!0;e=new en(e,r),t=new en(t,r);let n=!1;e:for(let s of e.set){for(let o of t.set){let i=li(s,o,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},ci=[new He(">=0.0.0-0")],tn=[new He(">=0.0.0")],li=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Ve){if(t.length===1&&t[0].semver===Ve)return!0;r.includePrerelease?e=ci:e=tn}if(t.length===1&&t[0].semver===Ve){if(r.includePrerelease)return!0;t=tn}let n=new Set,s,o;for(let d of e)d.operator===">"||d.operator===">="?s=rn(s,d,r):d.operator==="<"||d.operator==="<="?o=nn(o,d,r):n.add(d.semver);if(n.size>1)return null;let i;if(s&&o){if(i=Je(s.semver,o.semver,r),i>0)return null;if(i===0&&(s.operator!==">="||o.operator!=="<="))return null}for(let d of n){if(s&&!Z(d,String(s),r)||o&&!Z(d,String(o),r))return null;for(let A of t)if(!Z(d,String(A),r))return!1;return!0}let c,a,l,u,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,m=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;f&&f.prerelease.length===1&&o.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(let d of t){if(u=u||d.operator===">"||d.operator===">=",l=l||d.operator==="<"||d.operator==="<=",s){if(m&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===m.major&&d.semver.minor===m.minor&&d.semver.patch===m.patch&&(m=!1),d.operator===">"||d.operator===">="){if(c=rn(s,d,r),c===d&&c!==s)return!1}else if(s.operator===">="&&!Z(s.semver,String(d),r))return!1}if(o){if(f&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===f.major&&d.semver.minor===f.minor&&d.semver.patch===f.patch&&(f=!1),d.operator==="<"||d.operator==="<="){if(a=nn(o,d,r),a===d&&a!==o)return!1}else if(o.operator==="<="&&!Z(o.semver,String(d),r))return!1}if(!d.operator&&(o||s)&&i!==0)return!1}return!(s&&l&&!o&&i!==0||o&&u&&!s&&i!==0||m||f)},rn=(e,t,r)=>{if(!e)return t;let n=Je(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},nn=(e,t,r)=>{if(!e)return t;let n=Je(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};sn.exports=ai});var C=w((il,ln)=>{"use strict";var Ye=z(),an=B(),ui=b(),cn=Pe(),fi=q(),pi=jt(),hi=qt(),di=Ut(),mi=Gt(),wi=Wt(),Ei=Bt(),gi=Vt(),$i=Jt(),yi=N(),xi=Qt(),Ri=tr(),bi=pe(),Oi=or(),vi=ar(),Ii=V(),ki=he(),Si=De(),Ni=Ue(),Li=de(),Ti=me(),Ai=Fe(),ji=wr(),Pi=H(),qi=L(),Ci=Y(),Di=Tr(),Ui=jr(),Fi=qr(),zi=Ur(),Gi=zr(),Mi=ge(),Wi=Xr(),_i=Hr(),Bi=Zr(),Xi=Qr(),Vi=on();ln.exports={parse:fi,valid:pi,clean:hi,inc:di,diff:mi,major:wi,minor:Ei,patch:gi,prerelease:$i,compare:yi,rcompare:xi,compareLoose:Ri,compareBuild:bi,sort:Oi,rsort:vi,gt:Ii,lt:ki,eq:Si,neq:Ni,gte:Li,lte:Ti,cmp:Ai,coerce:ji,Comparator:Pi,Range:qi,satisfies:Ci,toComparators:Di,maxSatisfying:Ui,minSatisfying:Fi,minVersion:zi,validRange:Gi,outside:Mi,gtr:Wi,ltr:_i,intersects:Bi,simplifyRange:Xi,subset:Vi,SemVer:ui,re:Ye.re,src:Ye.src,tokens:Ye.t,SEMVER_SPEC_VERSION:an.SEMVER_SPEC_VERSION,RELEASE_TYPES:an.RELEASE_TYPES,compareIdentifiers:cn.compareIdentifiers,rcompareIdentifiers:cn.rcompareIdentifiers}});var Te=new TextDecoder;function ie(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function Et(e,t){let r=String(t??"").split(/\s+/).filter(o=>o.startsWith("sha512-")).map(o=>o.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,o=>String.fromCharCode(o)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function gt(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let o=await r.read();!o.done;o=await r.read()){if(s+=o.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(o.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function _(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return Te.decode(s<0?n:n.subarray(0,s))}function $t(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,o)=>s*256+o,e[t]&127);let n=_(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function Vn(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if($t(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function Hn(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let o=Te.decode(e.subarray(n+1,r+s-1)),i=o.indexOf("=");t[o.slice(0,i)]=o.slice(i+1),r+=s}return t}function Jn(e,t){let r=e.subarray(t,t+512);Vn(r);let n=$t(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function Yn(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function Zn(e){let t=_(e,0,100),r=_(e,257,5)==="ustar"?_(e,345,155):"";return r?`${r}/${t}`:t}var wt={x:(e,t)=>({...e,pax:Hn(t).path}),L:(e,t)=>({...e,long:_(t,0,t.length)}),g:e=>e};function yt(e){let t=[],r={};for(let n=0;!Yn(e,n);){let{header:s,type:o,data:i,next:c}=Jn(e,n);if(n=c,Object.hasOwn(wt,o)){r=wt[o](r,i);continue}(o==="0"||o==="7")&&t.push({path:r.pax??r.long??Zn(s),bytes:i}),r={}}return t}var xe=F(C(),1);var x=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function G(e,t){let r=[],n=0;for(;;){let s=await x(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function K(e,{id:t,path:r,bytes:n},s){for(let o=0;o{}),c}}async function Hi(e,t){let r=[],n=0;for(;;){let{done:s,value:o}=await e.read();if(s)return r;if(n+=o.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(o)}}async function Ji(e,t){try{return await Hi(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function un(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await Ji(e.body.getReader(),t)).arrayBuffer())}var M=".webfront/developer/packages",Yi=/[\\\0:*?"<>|]/,Zi=e=>e.split("/").some(t=>!t||t==="."||t==="..");function Ki(e){return typeof e!="string"||!e||Yi.test(e)?!0:Zi(e)}function T(e){if(Ki(e))throw new Error(`Unsafe package path: ${e}`);return e}var Qi=new TextDecoder,ea=["preinstall","install","postinstall"];async function fn(e){let t=new Map;for(let r of yt(await gt(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=T(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var ta=e=>ea.some(t=>e.scripts?.[t]),ra=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function na(e,t){return ta(e)||e.gypfile?!0:ra(t)}function pn(e,t,r){let n=JSON.parse(Qi.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(na(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}function W(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var R="webfront.project.json",S="webfront-packages.lock.json",ee=1,Ze=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,sa=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,oa=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,hn=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,Ke=/^[A-Za-z_][A-Za-z0-9_]*$/,dn=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],ia=["files","publish","fetch"],$=e=>{throw new Error(`${R}: ${e}`)};function P(e,t){return W(e)||$(`${t} must be an object`),e}function Qe(e,t,r){for(let n of Object.keys(e))t.includes(n)||$(`unknown key "${n}" in ${r}`)}function $e(e,t){typeof e!="string"&&$(`${t} must be a project path`);try{return T(e)}catch{return $(`${t} is not a safe project-relative path: ${e}`)}}function mn(e,t){return(!Array.isArray(e)||e.length>256)&&$(`${t} must be an array of at most 256 paths`),e.map((r,n)=>$e(r,`${t}[${n}]`))}function aa(e){let t=P(e,"dependencies");for(let[r,n]of Object.entries(t))Ze.test(r)||$(`invalid npm package name "${r}"`),(typeof n!="string"||!oa.test(n)||n!==n.trim())&&$(`invalid version range for "${r}"`);return t}var et=e=>e.startsWith("/")&&!e.startsWith("//")&&!e.includes("\\");function ca(e){if(typeof e!="string"&&$("registry must be a URL"),et(e))return e;let t;try{t=new URL(e)}catch{return $("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&$("registry must use https"),e}function la(e){let t=P(e,"scripts");for(let[r,n]of Object.entries(t))(!hn.test(r)||typeof n!="string"||!n||n.length>1024)&&$(`invalid script "${r}"`);return t}function ua(e){let t=P(e,"entries");for(let[r,n]of Object.entries(t))hn.test(r)||$(`invalid entry name "${r}"`),$e(n,`entries.${r}`);return t}function fa(e,t){let r=P(e,"providers");for(let[n,s]of Object.entries(r))Ke.test(n)||$(`invalid provider name "${n}"`),P(s,`providers.${n}`),Qe(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&$(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||$e(s.entry,`providers.${n}.entry`),$e(s.output,`providers.${n}.output`).endsWith(".hpp")||$(`providers.${n}.output must be a .hpp file`);return r}function pa(e){let t=P(e,"test");return Qe(t,["specs"],"test"),t.specs!==void 0&&mn(t.specs,"test.specs"),t}function ha(e,t){let r;try{r=new URL(e)}catch{return $(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&$(`${t} must be an https origin without a path`),e}function da(e){let t=P(e,"permissions");for(let r of Object.keys(t))ia.includes(r)||$(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&mn(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&$("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>ha(r,`permissions.fetch[${n}]`))),t}function ma(e){(typeof e.name!="string"||!Ze.test(e.name))&&$("name must be a lower-case npm package name"),(typeof e.version!="string"||!sa.test(e.version))&&$("version must be a semantic version")}function wa(e){e.format!==ee&&(Number.isInteger(e.format)&&e.format>ee&&$(`format ${e.format} is not supported by this environment (it reads format ${ee}); update the environment`),$(`format must be ${ee}`))}function te(e){P(e,"the manifest"),wa(e),Qe(e,dn,"the manifest"),ma(e);let t=e.entries===void 0?{}:ua(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:aa(e.dependencies),entries:t,providers:e.providers===void 0?{}:fa(e.providers,t),...e.registry===void 0?{}:{registry:ca(e.registry)},...e.scripts===void 0?{}:{scripts:la(e.scripts)},...e.test===void 0?{}:{test:pa(e.test)},...e.permissions===void 0?{}:{permissions:da(e.permissions)}}}function tt(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return $("not valid JSON")}return{source:t,manifest:te(t)}}function gl(e){return tt(e).manifest}function rt(e){let t={};for(let r of dn)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` -`}function wn(e){return{format:ee,name:e,version:"0.1.0",dependencies:{}}}function En(e){let r=(String(e??"").split("/").filter(Boolean).pop()??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"");return Ze.test(r)?r:"webfront-app"}async function ye(e){let t=JSON.stringify(Object.entries(e).sort(([n],[s])=>ns?1:0)),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(r)].map(n=>n.toString(16).padStart(2,"0")).join("")}var nt=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),Re=(e,t)=>`${e.replace("/","+")}@${t}`,st=(e,t,r)=>`${Re(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function Ea(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function ga(e,t){let r=e["dist-tags"]?.[t];return r||(xe.default.valid(t)?t:xe.default.maxSatisfying(Object.keys(e.versions??{}),t))}function $a(e,t,r){let n=r||"latest",s=ga(e,n),o=e.versions?.[s];if(!o||!xe.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:o}}async function ya(e,t,r,{fetchImpl:n,signal:s}){let o=new URL(t.dist?.tarball,r);if(o.protocol!=="https:"&&o.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let i=await n(o,{signal:s});if(!i.ok)throw new Error(`Package download for ${e}: HTTP ${i.status}`);let c=await un(i);return{bytes:c,integrity:await Et(c,t.dist.integrity)}}function ot(e){let t=new URL(e,globalThis.location?.href),r=t.origin===globalThis.location?.origin;if(e.startsWith("/")?!et(e)||!r:t.protocol!=="https:"&&!r)throw new Error(`The npm registry must use HTTPS or the application origin: ${e}`);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function D(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!nt(e))throw new Error(`Unsupported npm package name: ${e}`);let o=ot(r),i={fetchImpl:n,signal:s},{version:c,manifest:a}=$a(await Ea(e,o,i),e,t),{bytes:l,integrity:u}=await ya(e,a,o,i),f=await fn(l),m=pn(f,e,c);return{id:Re(e,c),key:st(e,c,u),manifest:m,integrity:u,files:f}}var be=F(C(),1);function xa(e,t,r){let n=e?.roots?.[t];return n?.requested===r&&e.packages[n.id]?e.packages[n.id]:be.default.validRange(r)?Object.values(e?.packages??{}).filter(o=>o.name===t&&be.default.satisfies(o.version,r)).sort((o,i)=>be.default.rcompare(o.version,i.version))[0]??null:null}function gn({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=D,previous:s}){let o=new Map;return async(i,c)=>{let a=`${i}@${c}`;if(o.has(a))return o.get(a);let l=xa(s,i,c),u=await n(i,l?.version??c,{registry:e,fetchImpl:t,signal:r});if(l&&u.integrity!==l.integrity)throw new Error(`${u.id} no longer matches the integrity recorded in the lock`);return o.set(a,u),u}}var $n=F(C(),1),yn=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function Ra(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw yn(e,t,r)}function ba(e,[t,r],{nodes:n,roots:s}){let o=s[t]?.id??e.dependencies[t];if(!o)return Ra(e,t,r);if(!$n.default.satisfies(n[o].version,r))throw yn(e,t,r);return o}function Oa(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=ba(e,r,t);n&&(e.dependencies[r[0]]=n)}}function xn(e,t){for(let r of Object.values(e))Oa(r,{nodes:e,roots:t})}var Rn=F(C(),1);function va(e,t){return!nt(t.name)||!Rn.default.valid(t.version)?!1:e===Re(t.name,t.version)}function Ia(e){return e.integrity?.startsWith("sha512-")?e.key===st(e.name,e.version,e.integrity):!1}function ka(e,t,r){if(!va(t,r)||!Ia(r))throw new Error("Invalid locked package");for(let n of r.files)T(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function Sa(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function it(e){if(!Sa(e))throw new Error("Unsupported package lock");if(Object.keys(e.packages).length>512)throw new Error("The package lock exceeds 512 packages");for(let[t,r]of Object.entries(e.packages))ka(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function Na(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function La(e,t){let r={};for(let n of e){let{name:s,version:o}=ie(n);r[s]={requested:o||"latest",id:await t(s,o||"latest")}}return r}async function bn(e,t={}){let r=gn(t),n={nodes:{},downloads:new Map,total:0},s=async(i,c)=>{t.signal?.throwIfAborted();let a=await r(i,c);if(n.nodes[a.id])return a.id;Na(n,i,a);for(let[l,u]of Object.entries(a.manifest.dependencies??{}).sort())n.nodes[a.id].dependencies[l]=await s(l,u);return a.id},o=await La(e,s);return xn(n.nodes,o),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:o,packages:n.nodes},downloads:n.downloads}}var at=F(C(),1);var Ta=new TextDecoder,Aa=new TextEncoder,Oe="No webfront.project.json: run wf init",ve="The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again";async function On(e,t){try{return await G(e,t)}catch(r){if(r.message.includes("Cannot read project file:"))return null;throw r}}function ja(e,t,r){return t?r===t.requested?!0:at.default.validRange(r)!==null&&at.default.satisfies(e.packages[t.id].version,r):!1}function Pa(e,t){let r=Object.keys(t);return r.length===Object.keys(e.roots).length&&r.every(n=>ja(e,e.roots[n],t[n]))}function qa(e,t,r){return e?t?t.manifestDigest===void 0?Pa(t,e.dependencies)?"legacy":"desynchronized":t.manifestDigest===r?"consistent":"desynchronized":"unlocked":"no-manifest"}async function re(e){let t=await x(e,"state",`${R} -${S}`),r=await On(e,R),n=await On(e,S),{source:s,manifest:o}=r?tt(r):{source:null,manifest:null},i=n?it(JSON.parse(Ta.decode(n))):null,c=o?await ye(o.dependencies):null;return{manifest:o,source:s,lock:i,token:t,status:qa(o,i,c),digest:c}}var In=e=>e.status==="desynchronized"?`Warning: ${ve}.\r -`:"";async function kn(e,t,r,{signal:n}={}){let s=[];try{for(let[o,i]of t){n?.throwIfAborted();let c=await x(e,"begin",o,!1);s.push(c),await K(e,{id:c,path:"output",bytes:i},n)}n?.throwIfAborted(),await x(e,"commitGroup",s.join(` +var Gn=Object.create;var mt=Object.defineProperty;var Mn=Object.getOwnPropertyDescriptor;var Wn=Object.getOwnPropertyNames;var _n=Object.getPrototypeOf,Xn=Object.prototype.hasOwnProperty;var w=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var Bn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Wn(t))!Xn.call(e,s)&&s!==r&&mt(e,s,{get:()=>t[s],enumerable:!(n=Mn(t,s))||n.enumerable});return e};var z=(e,t,r)=>(r=e!=null?Gn(_n(e)):{},Bn(t||!e||!e.__esModule?mt(r,"default",{value:e,enumerable:!0}):r,e));var X=w((Ea,xt)=>{"use strict";var Kn="2.0.0",Qn=Number.MAX_SAFE_INTEGER||9007199254740991,es=16,ts=250,rs=["major","premajor","minor","preminor","patch","prepatch","prerelease"];xt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:es,MAX_SAFE_BUILD_LENGTH:ts,MAX_SAFE_INTEGER:Qn,RELEASE_TYPES:rs,SEMVER_SPEC_VERSION:Kn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var B=w((ga,Rt)=>{"use strict";var ns=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Rt.exports=ns});var F=w((P,Ot)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Te,MAX_SAFE_BUILD_LENGTH:ss,MAX_LENGTH:os}=X(),is=B();P=Ot.exports={};var cs=P.re=[],as=P.safeRe=[],p=P.src=[],ls=P.safeSrc=[],h=P.t={},us=0,Pe="[a-zA-Z0-9-]",fs=[["\\s",1],["\\d",os],[Pe,ss]],ps=e=>{for(let[t,r]of fs)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},E=(e,t,r)=>{let n=ps(t),s=us++;is(e,s,t),h[e]=s,p[s]=t,ls[s]=n,cs[s]=new RegExp(t,r?"g":void 0),as[s]=new RegExp(n,r?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Pe}*`);E("MAINVERSION",`(${p[h.NUMERICIDENTIFIER]})\\.(${p[h.NUMERICIDENTIFIER]})\\.(${p[h.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${p[h.NUMERICIDENTIFIERLOOSE]})\\.(${p[h.NUMERICIDENTIFIERLOOSE]})\\.(${p[h.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${p[h.NONNUMERICIDENTIFIER]}|${p[h.NUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${p[h.NONNUMERICIDENTIFIER]}|${p[h.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASE",`(?:-(${p[h.PRERELEASEIDENTIFIER]}(?:\\.${p[h.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${p[h.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${p[h.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${Pe}+`);E("BUILD",`(?:\\+(${p[h.BUILDIDENTIFIER]}(?:\\.${p[h.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${p[h.MAINVERSION]}${p[h.PRERELEASE]}?${p[h.BUILD]}?`);E("FULL",`^${p[h.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${p[h.MAINVERSIONLOOSE]}${p[h.PRERELEASELOOSE]}?${p[h.BUILD]}?`);E("LOOSE",`^${p[h.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${p[h.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${p[h.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${p[h.XRANGEIDENTIFIER]})(?:\\.(${p[h.XRANGEIDENTIFIER]})(?:\\.(${p[h.XRANGEIDENTIFIER]})(?:${p[h.PRERELEASE]})?${p[h.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${p[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${p[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${p[h.XRANGEIDENTIFIERLOOSE]})(?:${p[h.PRERELEASELOOSE]})?${p[h.BUILD]}?)?)?`);E("XRANGE",`^${p[h.GTLT]}\\s*${p[h.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${p[h.GTLT]}\\s*${p[h.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Te}})(?:\\.(\\d{1,${Te}}))?(?:\\.(\\d{1,${Te}}))?`);E("COERCE",`${p[h.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",p[h.COERCEPLAIN]+`(?:${p[h.PRERELEASE]})?(?:${p[h.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",p[h.COERCE],!0);E("COERCERTLFULL",p[h.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${p[h.LONETILDE]}\\s+`,!0);P.tildeTrimReplace="$1~";E("TILDE",`^${p[h.LONETILDE]}${p[h.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${p[h.LONETILDE]}${p[h.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${p[h.LONECARET]}\\s+`,!0);P.caretTrimReplace="$1^";E("CARET",`^${p[h.LONECARET]}${p[h.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${p[h.LONECARET]}${p[h.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${p[h.GTLT]}\\s*(${p[h.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${p[h.GTLT]}\\s*(${p[h.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${p[h.GTLT]}\\s*(${p[h.LOOSEPLAIN]}|${p[h.XRANGEPLAIN]})`,!0);P.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${p[h.XRANGEPLAIN]})\\s+-\\s+(${p[h.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${p[h.XRANGEPLAINLOOSE]})\\s+-\\s+(${p[h.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ce=w(($a,bt)=>{"use strict";var hs=Object.freeze({loose:!0}),ds=Object.freeze({}),ms=e=>e?typeof e!="object"?hs:e:ds;bt.exports=ms});var je=w((ya,kt)=>{"use strict";var It=/^[0-9]+$/,vt=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:evt(t,e);kt.exports={compareIdentifiers:vt,rcompareIdentifiers:ws}});var O=w((xa,Nt)=>{"use strict";var ae=B(),{MAX_LENGTH:St,MAX_SAFE_INTEGER:le}=X(),{safeRe:ue,t:fe}=F(),Es=ce(),{compareIdentifiers:qe}=je(),Ce=class e{constructor(t,r){if(r=Es(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>St)throw new TypeError(`version is longer than ${St} characters`);ae("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?ue[fe.LOOSE]:ue[fe.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>le||this.major<0)throw new TypeError("Invalid major version");if(this.minor>le||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>le||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let o=+s;if(o>=0&&ot.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(ae("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return qe(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(ae("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return qe(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?ue[fe.PRERELEASELOOSE]:ue[fe.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let o=[r,s];n===!1&&(o=[r]),qe(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Nt.exports=Ce});var q=w((Ra,At)=>{"use strict";var Lt=O(),gs=(e,t,r=!1)=>{if(e instanceof Lt)return e;try{return new Lt(e,t)}catch(n){if(!r)return null;throw n}};At.exports=gs});var Pt=w((Oa,Tt)=>{"use strict";var $s=q(),ys=(e,t)=>{let r=$s(e,t);return r?r.version:null};Tt.exports=ys});var qt=w((ba,jt)=>{"use strict";var xs=q(),Rs=(e,t)=>{let r=xs(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};jt.exports=Rs});var Ut=w((Ia,Dt)=>{"use strict";var Ct=O(),Os=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new Ct(e instanceof Ct?e.version:e,r).inc(t,n,s).version}catch{return null}};Dt.exports=Os});var Gt=w((va,Ft)=>{"use strict";var zt=q(),bs=(e,t)=>{let r=zt(e,null,!0),n=zt(t,null,!0),s=r.compare(n);if(s===0)return null;let o=s>0,i=o?r:n,a=o?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0)return a.minor&&!a.patch?"minor":"patch"}let u=c?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};Ft.exports=bs});var Wt=w((ka,Mt)=>{"use strict";var Is=O(),vs=(e,t)=>new Is(e,t).major;Mt.exports=vs});var Xt=w((Sa,_t)=>{"use strict";var ks=O(),Ss=(e,t)=>new ks(e,t).minor;_t.exports=Ss});var Vt=w((Na,Bt)=>{"use strict";var Ns=O(),Ls=(e,t)=>new Ns(e,t).patch;Bt.exports=Ls});var Yt=w((La,Ht)=>{"use strict";var As=q(),Ts=(e,t)=>{let r=As(e,t);return r&&r.prerelease.length?r.prerelease:null};Ht.exports=Ts});var N=w((Aa,Zt)=>{"use strict";var Jt=O(),Ps=(e,t,r)=>new Jt(e,r).compare(new Jt(t,r));Zt.exports=Ps});var Qt=w((Ta,Kt)=>{"use strict";var js=N(),qs=(e,t,r)=>js(t,e,r);Kt.exports=qs});var tr=w((Pa,er)=>{"use strict";var Cs=N(),Ds=(e,t)=>Cs(e,t,!0);er.exports=Ds});var pe=w((ja,nr)=>{"use strict";var rr=O(),Us=(e,t,r)=>{let n=new rr(e,r),s=new rr(t,r);return n.compare(s)||n.compareBuild(s)};nr.exports=Us});var or=w((qa,sr)=>{"use strict";var zs=pe(),Fs=(e,t)=>e.sort((r,n)=>zs(r,n,t));sr.exports=Fs});var cr=w((Ca,ir)=>{"use strict";var Gs=pe(),Ms=(e,t)=>e.sort((r,n)=>Gs(n,r,t));ir.exports=Ms});var V=w((Da,ar)=>{"use strict";var Ws=N(),_s=(e,t,r)=>Ws(e,t,r)>0;ar.exports=_s});var he=w((Ua,lr)=>{"use strict";var Xs=N(),Bs=(e,t,r)=>Xs(e,t,r)<0;lr.exports=Bs});var De=w((za,ur)=>{"use strict";var Vs=N(),Hs=(e,t,r)=>Vs(e,t,r)===0;ur.exports=Hs});var Ue=w((Fa,fr)=>{"use strict";var Ys=N(),Js=(e,t,r)=>Ys(e,t,r)!==0;fr.exports=Js});var de=w((Ga,pr)=>{"use strict";var Zs=N(),Ks=(e,t,r)=>Zs(e,t,r)>=0;pr.exports=Ks});var me=w((Ma,hr)=>{"use strict";var Qs=N(),eo=(e,t,r)=>Qs(e,t,r)<=0;hr.exports=eo});var ze=w((Wa,dr)=>{"use strict";var to=De(),ro=Ue(),no=V(),so=de(),oo=he(),io=me(),co=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return to(e,r,n);case"!=":return ro(e,r,n);case">":return no(e,r,n);case">=":return so(e,r,n);case"<":return oo(e,r,n);case"<=":return io(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};dr.exports=co});var wr=w((_a,mr)=>{"use strict";var ao=O(),lo=q(),{safeRe:we,t:Ee}=F(),uo=(e,t)=>{if(e instanceof ao)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?we[Ee.COERCEFULL]:we[Ee.COERCE]);else{let c=t.includePrerelease?we[Ee.COERCERTLFULL]:we[Ee.COERCERTL],l;for(;(l=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||l.index+l[0].length!==r.index+r[0].length)&&(r=l),c.lastIndex=l.index+l[1].length+l[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",o=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return lo(`${n}.${s}.${o}${i}${a}`,t)};mr.exports=uo});var gr=w((Xa,Er)=>{"use strict";var Fe=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};Er.exports=Fe});var L=w((Ba,Rr)=>{"use strict";var fo=/\s+/g,Ge=class e{constructor(t,r){if(r=ho(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Me)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(fo," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!yr(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&xo(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&$o)|(this.options.loose&&yo))+":"+t,s=$r.get(n);if(s)return s;let o=this.options.loose,i=o?I[b.HYPHENRANGELOOSE]:I[b.HYPHENRANGE];t=t.replace(i,Ao(this.options.includePrerelease)),g("hyphen replace",t),t=t.replace(I[b.COMPARATORTRIM],wo),g("comparator trim",t),t=t.replace(I[b.TILDETRIM],Eo),g("tilde trim",t),t=t.replace(I[b.CARETTRIM],go),g("caret trim",t);let a=t.split(" ").map(f=>Ro(f,this.options)).join(" ").split(/\s+/).map(f=>Lo(f,this.options));o&&(a=a.filter(f=>(g("loose invalid filter",f,this.options),!!f.match(I[b.COMPARATORLOOSE])))),g("range list",a);let c=new Map,l=a.map(f=>new Me(f,this.options));for(let f of l){if(yr(f))return[f];c.set(f.value,f)}c.size>1&&c.has("")&&c.delete("");let u=[...c.values()];return $r.set(n,u),u}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>xr(n,r)&&t.set.some(s=>xr(s,r)&&n.every(o=>s.every(i=>o.intersects(i,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new mo(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",xo=e=>e.value==="",xr=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(o=>s.intersects(o,t)),s=n.pop();return r},Ro=(e,t)=>(e=e.replace(I[b.BUILD],""),g("comp",e,t),e=Io(e,t),g("caret",e),e=Oo(e,t),g("tildes",e),e=ko(e,t),g("xrange",e),e=No(e,t),g("stars",e),e),v=e=>!e||e.toLowerCase()==="x"||e==="*",Oo=(e,t)=>e.trim().split(/\s+/).map(r=>bo(r,t)).join(" "),bo=(e,t)=>{let r=t.loose?I[b.TILDELOOSE]:I[b.TILDE];return e.replace(r,(n,s,o,i,a)=>{g("tilde",e,n,s,o,i,a);let c;return v(s)?c="":v(o)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:v(i)?c=`>=${s}.${o}.0 <${s}.${+o+1}.0-0`:a?(g("replaceTilde pr",a),c=`>=${s}.${o}.${i}-${a} <${s}.${+o+1}.0-0`):c=`>=${s}.${o}.${i} <${s}.${+o+1}.0-0`,g("tilde return",c),c})},Io=(e,t)=>e.trim().split(/\s+/).map(r=>vo(r,t)).join(" "),vo=(e,t)=>{g("caret",e,t);let r=t.loose?I[b.CARETLOOSE]:I[b.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,o,i,a,c)=>{g("caret",e,s,o,i,a,c);let l;return v(o)?l="":v(i)?l=`>=${o}.0.0${n} <${+o+1}.0.0-0`:v(a)?o==="0"?l=`>=${o}.${i}.0${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.0${n} <${+o+1}.0.0-0`:c?(g("replaceCaret pr",c),o==="0"?i==="0"?l=`>=${o}.${i}.${a}-${c} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}-${c} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a}-${c} <${+o+1}.0.0-0`):(g("no pr"),o==="0"?i==="0"?l=`>=${o}.${i}.${a}${n} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a} <${+o+1}.0.0-0`),g("caret return",l),l})},ko=(e,t)=>(g("replaceXRanges",e,t),e.split(/\s+/).map(r=>So(r,t)).join(" ")),So=(e,t)=>{e=e.trim();let r=t.loose?I[b.XRANGELOOSE]:I[b.XRANGE];return e.replace(r,(n,s,o,i,a,c)=>{g("xRange",e,n,s,o,i,a,c);let l=v(o),u=l||v(i),f=u||v(a),m=f;return s==="="&&m&&(s=""),c=t.includePrerelease?"-0":"",l?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&m?(u&&(i=0),a=0,s===">"?(s=">=",u?(o=+o+1,i=0,a=0):(i=+i+1,a=0)):s==="<="&&(s="<",u?o=+o+1:i=+i+1),s==="<"&&(c="-0"),n=`${s+o}.${i}.${a}${c}`):u?n=`>=${o}.0.0${c} <${+o+1}.0.0-0`:f&&(n=`>=${o}.${i}.0${c} <${o}.${+i+1}.0-0`),g("xRange return",n),n})},No=(e,t)=>(g("replaceStars",e,t),e.trim().replace(I[b.STAR],"")),Lo=(e,t)=>(g("replaceGTE0",e,t),e.trim().replace(I[t.includePrerelease?b.GTE0PRE:b.GTE0],"")),Ao=e=>(t,r,n,s,o,i,a,c,l,u,f,m)=>(v(n)?r="":v(s)?r=`>=${n}.0.0${e?"-0":""}`:v(o)?r=`>=${n}.${s}.0${e?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,v(l)?c="":v(u)?c=`<${+l+1}.0.0-0`:v(f)?c=`<${l}.${+u+1}.0-0`:m?c=`<=${l}.${u}.${f}-${m}`:e?c=`<${l}.${u}.${+f+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),To=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var H=w((Va,Sr)=>{"use strict";var Y=Symbol("SemVer ANY"),Xe=class e{static get ANY(){return Y}constructor(t,r){if(r=Or(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),_e("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===Y?this.value="":this.value=this.operator+this.semver.version,_e("comp",this)}parse(t){let r=this.options.loose?br[Ir.COMPARATORLOOSE]:br[Ir.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new vr(n[2],this.options.loose):this.semver=Y}toString(){return this.value}test(t){if(_e("Comparator.test",t,this.options.loose),this.semver===Y||t===Y)return!0;if(typeof t=="string")try{t=new vr(t,this.options)}catch{return!1}return We(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new kr(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new kr(this.value,r).test(t.semver):(r=Or(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||We(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||We(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Sr.exports=Xe;var Or=ce(),{safeRe:br,t:Ir}=F(),We=ze(),_e=B(),vr=O(),kr=L()});var J=w((Ha,Nr)=>{"use strict";var Po=L(),jo=(e,t,r)=>{try{t=new Po(t,r)}catch{return!1}return t.test(e)};Nr.exports=jo});var Ar=w((Ya,Lr)=>{"use strict";var qo=L(),Co=(e,t)=>new qo(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Lr.exports=Co});var Pr=w((Ja,Tr)=>{"use strict";var Do=O(),Uo=L(),zo=(e,t,r)=>{let n=null,s=null,o=null;try{o=new Uo(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===-1)&&(n=i,s=new Do(n,r))}),n};Tr.exports=zo});var qr=w((Za,jr)=>{"use strict";var Fo=O(),Go=L(),Mo=(e,t,r)=>{let n=null,s=null,o=null;try{o=new Go(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===1)&&(n=i,s=new Fo(n,r))}),n};jr.exports=Mo});var Ur=w((Ka,Dr)=>{"use strict";var Be=O(),Wo=L(),Cr=V(),_o=(e,t)=>{e=new Wo(e,t);let r=new Be("0.0.0");if(e.test(r)||(r=new Be("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let a=new Be(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||Cr(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||Cr(r,o))&&(r=o)}return r&&e.test(r)?r:null};Dr.exports=_o});var Fr=w((Qa,zr)=>{"use strict";var Xo=L(),Bo=(e,t)=>{try{return new Xo(e,t).range||"*"}catch{return null}};zr.exports=Bo});var ge=w((el,_r)=>{"use strict";var Vo=O(),Wr=H(),{ANY:Ho}=Wr,Yo=L(),Jo=J(),Gr=V(),Mr=he(),Zo=me(),Ko=de(),Qo=(e,t,r,n)=>{e=new Vo(e,n),t=new Yo(t,n);let s,o,i,a,c;switch(r){case">":s=Gr,o=Zo,i=Mr,a=">",c=">=";break;case"<":s=Mr,o=Ko,i=Gr,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Jo(e,t,n))return!1;for(let l=0;l{d.semver===Ho&&(d=new Wr(">=0.0.0")),f=f||d,m=m||d,s(d.semver,f.semver,n)?f=d:i(d.semver,m.semver,n)&&(m=d)}),f.operator===a||f.operator===c||(!m.operator||m.operator===a)&&o(e,m.semver))return!1;if(m.operator===c&&i(e,m.semver))return!1}return!0};_r.exports=Qo});var Br=w((tl,Xr)=>{"use strict";var ei=ge(),ti=(e,t,r)=>ei(e,t,">",r);Xr.exports=ti});var Hr=w((rl,Vr)=>{"use strict";var ri=ge(),ni=(e,t,r)=>ri(e,t,"<",r);Vr.exports=ni});var Zr=w((nl,Jr)=>{"use strict";var Yr=L(),si=(e,t,r)=>(e=new Yr(e,r),t=new Yr(t,r),e.intersects(t,r));Jr.exports=si});var Qr=w((sl,Kr)=>{"use strict";var oi=J(),ii=N();Kr.exports=(e,t,r)=>{let n=[],s=null,o=null,i=e.sort((u,f)=>ii(u,f,r));for(let u of i)oi(u,t,r)?(o=u,s||(s=u)):(o&&n.push([s,o]),o=null,s=null);s&&n.push([s,null]);let a=[];for(let[u,f]of n)u===f?a.push(u):!f&&u===i[0]?a.push("*"):f?u===i[0]?a.push(`<=${f}`):a.push(`${u} - ${f}`):a.push(`>=${u}`);let c=a.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return c.length{"use strict";var en=L(),He=H(),{ANY:Ve}=He,Z=J(),Ye=N(),ci=(e,t,r={})=>{if(e===t)return!0;e=new en(e,r),t=new en(t,r);let n=!1;e:for(let s of e.set){for(let o of t.set){let i=li(s,o,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},ai=[new He(">=0.0.0-0")],tn=[new He(">=0.0.0")],li=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Ve){if(t.length===1&&t[0].semver===Ve)return!0;r.includePrerelease?e=ai:e=tn}if(t.length===1&&t[0].semver===Ve){if(r.includePrerelease)return!0;t=tn}let n=new Set,s,o;for(let d of e)d.operator===">"||d.operator===">="?s=rn(s,d,r):d.operator==="<"||d.operator==="<="?o=nn(o,d,r):n.add(d.semver);if(n.size>1)return null;let i;if(s&&o){if(i=Ye(s.semver,o.semver,r),i>0)return null;if(i===0&&(s.operator!==">="||o.operator!=="<="))return null}for(let d of n){if(s&&!Z(d,String(s),r)||o&&!Z(d,String(o),r))return null;for(let T of t)if(!Z(d,String(T),r))return!1;return!0}let a,c,l,u,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,m=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;f&&f.prerelease.length===1&&o.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(let d of t){if(u=u||d.operator===">"||d.operator===">=",l=l||d.operator==="<"||d.operator==="<=",s){if(m&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===m.major&&d.semver.minor===m.minor&&d.semver.patch===m.patch&&(m=!1),d.operator===">"||d.operator===">="){if(a=rn(s,d,r),a===d&&a!==s)return!1}else if(s.operator===">="&&!Z(s.semver,String(d),r))return!1}if(o){if(f&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===f.major&&d.semver.minor===f.minor&&d.semver.patch===f.patch&&(f=!1),d.operator==="<"||d.operator==="<="){if(c=nn(o,d,r),c===d&&c!==o)return!1}else if(o.operator==="<="&&!Z(o.semver,String(d),r))return!1}if(!d.operator&&(o||s)&&i!==0)return!1}return!(s&&l&&!o&&i!==0||o&&u&&!s&&i!==0||m||f)},rn=(e,t,r)=>{if(!e)return t;let n=Ye(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},nn=(e,t,r)=>{if(!e)return t;let n=Ye(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};sn.exports=ci});var C=w((il,ln)=>{"use strict";var Je=F(),cn=X(),ui=O(),an=je(),fi=q(),pi=Pt(),hi=qt(),di=Ut(),mi=Gt(),wi=Wt(),Ei=Xt(),gi=Vt(),$i=Yt(),yi=N(),xi=Qt(),Ri=tr(),Oi=pe(),bi=or(),Ii=cr(),vi=V(),ki=he(),Si=De(),Ni=Ue(),Li=de(),Ai=me(),Ti=ze(),Pi=wr(),ji=H(),qi=L(),Ci=J(),Di=Ar(),Ui=Pr(),zi=qr(),Fi=Ur(),Gi=Fr(),Mi=ge(),Wi=Br(),_i=Hr(),Xi=Zr(),Bi=Qr(),Vi=on();ln.exports={parse:fi,valid:pi,clean:hi,inc:di,diff:mi,major:wi,minor:Ei,patch:gi,prerelease:$i,compare:yi,rcompare:xi,compareLoose:Ri,compareBuild:Oi,sort:bi,rsort:Ii,gt:vi,lt:ki,eq:Si,neq:Ni,gte:Li,lte:Ai,cmp:Ti,coerce:Pi,Comparator:ji,Range:qi,satisfies:Ci,toComparators:Di,maxSatisfying:Ui,minSatisfying:zi,minVersion:Fi,validRange:Gi,outside:Mi,gtr:Wi,ltr:_i,intersects:Xi,simplifyRange:Bi,subset:Vi,SemVer:ui,re:Je.re,src:Je.src,tokens:Je.t,SEMVER_SPEC_VERSION:cn.SEMVER_SPEC_VERSION,RELEASE_TYPES:cn.RELEASE_TYPES,compareIdentifiers:an.compareIdentifiers,rcompareIdentifiers:an.rcompareIdentifiers}});var Ae=new TextDecoder;function ie(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function Et(e,t){let r=String(t??"").split(/\s+/).filter(o=>o.startsWith("sha512-")).map(o=>o.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,o=>String.fromCharCode(o)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function gt(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let o=await r.read();!o.done;o=await r.read()){if(s+=o.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(o.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function _(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return Ae.decode(s<0?n:n.subarray(0,s))}function $t(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,o)=>s*256+o,e[t]&127);let n=_(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function Vn(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if($t(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function Hn(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let o=Ae.decode(e.subarray(n+1,r+s-1)),i=o.indexOf("=");t[o.slice(0,i)]=o.slice(i+1),r+=s}return t}function Yn(e,t){let r=e.subarray(t,t+512);Vn(r);let n=$t(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function Jn(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function Zn(e){let t=_(e,0,100),r=_(e,257,5)==="ustar"?_(e,345,155):"";return r?`${r}/${t}`:t}var wt={x:(e,t)=>({...e,pax:Hn(t).path}),L:(e,t)=>({...e,long:_(t,0,t.length)}),g:e=>e};function yt(e){let t=[],r={};for(let n=0;!Jn(e,n);){let{header:s,type:o,data:i,next:a}=Yn(e,n);if(n=a,Object.hasOwn(wt,o)){r=wt[o](r,i);continue}(o==="0"||o==="7")&&t.push({path:r.pax??r.long??Zn(s),bytes:i}),r={}}return t}var xe=z(C(),1);var x=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function G(e,t){let r=[],n=0;for(;;){let s=await x(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function K(e,{id:t,path:r,bytes:n},s){for(let o=0;o{}),a}}async function Hi(e,t){let r=[],n=0;for(;;){let{done:s,value:o}=await e.read();if(s)return r;if(n+=o.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(o)}}async function Yi(e,t){try{return await Hi(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function un(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await Yi(e.body.getReader(),t)).arrayBuffer())}var M=".webfront/developer/packages",Ji=/[\\\0:*?"<>|]/,Zi=e=>e.split("/").some(t=>!t||t==="."||t==="..");function Ki(e){return typeof e!="string"||!e||Ji.test(e)?!0:Zi(e)}function A(e){if(Ki(e))throw new Error(`Unsafe package path: ${e}`);return e}var Qi=new TextDecoder,ec=["preinstall","install","postinstall"];async function fn(e){let t=new Map;for(let r of yt(await gt(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=A(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var tc=e=>ec.some(t=>e.scripts?.[t]),rc=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function nc(e,t){return tc(e)||e.gypfile?!0:rc(t)}function pn(e,t,r){let n=JSON.parse(Qi.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(nc(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}function W(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var R="webfront.project.json",S="webfront-packages.lock.json",ee=1,Ze=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,sc=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,oc=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,hn=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,Ke=/^[A-Za-z_][A-Za-z0-9_]*$/,dn=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],ic=["files","publish","fetch"],$=e=>{throw new Error(`${R}: ${e}`)};function j(e,t){return W(e)||$(`${t} must be an object`),e}function Qe(e,t,r){for(let n of Object.keys(e))t.includes(n)||$(`unknown key "${n}" in ${r}`)}function $e(e,t){typeof e!="string"&&$(`${t} must be a project path`);try{return A(e)}catch{return $(`${t} is not a safe project-relative path: ${e}`)}}function mn(e,t){return(!Array.isArray(e)||e.length>256)&&$(`${t} must be an array of at most 256 paths`),e.map((r,n)=>$e(r,`${t}[${n}]`))}function cc(e){let t=j(e,"dependencies");for(let[r,n]of Object.entries(t))Ze.test(r)||$(`invalid npm package name "${r}"`),(typeof n!="string"||!oc.test(n)||n!==n.trim())&&$(`invalid version range for "${r}"`);return t}var et=e=>e.startsWith("/")&&!e.startsWith("//")&&!e.includes("\\");function ac(e){if(typeof e!="string"&&$("registry must be a URL"),et(e))return e;let t;try{t=new URL(e)}catch{return $("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&$("registry must use https"),e}function lc(e){let t=j(e,"scripts");for(let[r,n]of Object.entries(t))(!hn.test(r)||typeof n!="string"||!n||n.length>1024)&&$(`invalid script "${r}"`);return t}function uc(e){let t=j(e,"entries");for(let[r,n]of Object.entries(t))hn.test(r)||$(`invalid entry name "${r}"`),$e(n,`entries.${r}`);return t}function fc(e,t){let r=j(e,"providers");for(let[n,s]of Object.entries(r))Ke.test(n)||$(`invalid provider name "${n}"`),j(s,`providers.${n}`),Qe(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&$(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||$e(s.entry,`providers.${n}.entry`),$e(s.output,`providers.${n}.output`).endsWith(".hpp")||$(`providers.${n}.output must be a .hpp file`);return r}function pc(e){let t=j(e,"test");return Qe(t,["specs"],"test"),t.specs!==void 0&&mn(t.specs,"test.specs"),t}function hc(e,t){let r;try{r=new URL(e)}catch{return $(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&$(`${t} must be an https origin without a path`),e}function dc(e){let t=j(e,"permissions");for(let r of Object.keys(t))ic.includes(r)||$(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&mn(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&$("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>hc(r,`permissions.fetch[${n}]`))),t}function mc(e){(typeof e.name!="string"||!Ze.test(e.name))&&$("name must be a lower-case npm package name"),(typeof e.version!="string"||!sc.test(e.version))&&$("version must be a semantic version")}function wc(e){e.format!==ee&&(Number.isInteger(e.format)&&e.format>ee&&$(`format ${e.format} is not supported by this environment (it reads format ${ee}); update the environment`),$(`format must be ${ee}`))}function te(e){j(e,"the manifest"),wc(e),Qe(e,dn,"the manifest"),mc(e);let t=e.entries===void 0?{}:uc(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:cc(e.dependencies),entries:t,providers:e.providers===void 0?{}:fc(e.providers,t),...e.registry===void 0?{}:{registry:ac(e.registry)},...e.scripts===void 0?{}:{scripts:lc(e.scripts)},...e.test===void 0?{}:{test:pc(e.test)},...e.permissions===void 0?{}:{permissions:dc(e.permissions)}}}function tt(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return $("not valid JSON")}return{source:t,manifest:te(t)}}function gl(e){return tt(e).manifest}function rt(e){let t={};for(let r of dn)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` +`}function wn(e){return{format:ee,name:e,version:"0.1.0",dependencies:{}}}function En(e){let r=(String(e??"").split("/").filter(Boolean).pop()??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"");return Ze.test(r)?r:"webfront-app"}async function ye(e){let t=JSON.stringify(Object.entries(e).sort(([n],[s])=>ns?1:0)),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(r)].map(n=>n.toString(16).padStart(2,"0")).join("")}var nt=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),Re=(e,t)=>`${e.replace("/","+")}@${t}`,st=(e,t,r)=>`${Re(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function Ec(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function gc(e,t){let r=e["dist-tags"]?.[t];return r||(xe.default.valid(t)?t:xe.default.maxSatisfying(Object.keys(e.versions??{}),t))}function $c(e,t,r){let n=r||"latest",s=gc(e,n),o=e.versions?.[s];if(!o||!xe.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:o}}async function yc(e,t,r,{fetchImpl:n,signal:s}){let o=new URL(t.dist?.tarball,r);if(o.protocol!=="https:"&&o.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let i=await n(o,{signal:s});if(!i.ok)throw new Error(`Package download for ${e}: HTTP ${i.status}`);let a=await un(i);return{bytes:a,integrity:await Et(a,t.dist.integrity)}}function ot(e){let t=new URL(e,globalThis.location?.href),r=t.origin===globalThis.location?.origin;if(e.startsWith("/")?!et(e)||!r:t.protocol!=="https:"&&!r)throw new Error(`The npm registry must use HTTPS or the application origin: ${e}`);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function D(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!nt(e))throw new Error(`Unsupported npm package name: ${e}`);let o=ot(r),i={fetchImpl:n,signal:s},{version:a,manifest:c}=$c(await Ec(e,o,i),e,t),{bytes:l,integrity:u}=await yc(e,c,o,i),f=await fn(l),m=pn(f,e,a);return{id:Re(e,a),key:st(e,a,u),manifest:m,integrity:u,files:f}}var Oe=z(C(),1);function xc(e,t,r){let n=e?.roots?.[t];return n?.requested===r&&e.packages[n.id]?e.packages[n.id]:Oe.default.validRange(r)?Object.values(e?.packages??{}).filter(o=>o.name===t&&Oe.default.satisfies(o.version,r)).sort((o,i)=>Oe.default.rcompare(o.version,i.version))[0]??null:null}function gn({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=D,previous:s}){let o=new Map;return async(i,a)=>{let c=`${i}@${a}`;if(o.has(c))return o.get(c);let l=xc(s,i,a),u=await n(i,l?.version??a,{registry:e,fetchImpl:t,signal:r});if(l&&u.integrity!==l.integrity)throw new Error(`${u.id} no longer matches the integrity recorded in the lock`);return o.set(c,u),u}}var $n=z(C(),1),yn=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function Rc(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw yn(e,t,r)}function Oc(e,[t,r],{nodes:n,roots:s}){let o=s[t]?.id??e.dependencies[t];if(!o)return Rc(e,t,r);if(!$n.default.satisfies(n[o].version,r))throw yn(e,t,r);return o}function bc(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=Oc(e,r,t);n&&(e.dependencies[r[0]]=n)}}function xn(e,t){for(let r of Object.values(e))bc(r,{nodes:e,roots:t})}var Rn=z(C(),1);function Ic(e,t){return!nt(t.name)||!Rn.default.valid(t.version)?!1:e===Re(t.name,t.version)}function vc(e){return e.integrity?.startsWith("sha512-")?e.key===st(e.name,e.version,e.integrity):!1}function kc(e,t,r){if(!Ic(t,r)||!vc(r))throw new Error("Invalid locked package");for(let n of r.files)A(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function Sc(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function it(e){if(!Sc(e))throw new Error("Unsupported package lock");if(Object.keys(e.packages).length>512)throw new Error("The package lock exceeds 512 packages");for(let[t,r]of Object.entries(e.packages))kc(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function Nc(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function Lc(e,t){let r={};for(let n of e){let{name:s,version:o}=ie(n);r[s]={requested:o||"latest",id:await t(s,o||"latest")}}return r}async function On(e,t={}){let r=gn(t),n={nodes:{},downloads:new Map,total:0},s=async(i,a)=>{t.signal?.throwIfAborted();let c=await r(i,a);if(n.nodes[c.id])return c.id;Nc(n,i,c);for(let[l,u]of Object.entries(c.manifest.dependencies??{}).sort())n.nodes[c.id].dependencies[l]=await s(l,u);return c.id},o=await Lc(e,s);return xn(n.nodes,o),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:o,packages:n.nodes},downloads:n.downloads}}var ct=z(C(),1);var Ac=new TextDecoder,Tc=new TextEncoder,be="No webfront.project.json: run wf init",Ie="The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again";async function bn(e,t){try{return await G(e,t)}catch(r){if(r.message.includes("Cannot read project file:"))return null;throw r}}function Pc(e,t,r){return t?r===t.requested?!0:ct.default.validRange(r)!==null&&ct.default.satisfies(e.packages[t.id].version,r):!1}function jc(e,t){let r=Object.keys(t);return r.length===Object.keys(e.roots).length&&r.every(n=>Pc(e,e.roots[n],t[n]))}function qc(e,t,r){return e?t?t.manifestDigest===void 0?jc(t,e.dependencies)?"legacy":"desynchronized":t.manifestDigest===r?"consistent":"desynchronized":"unlocked":"no-manifest"}async function re(e){let t=await x(e,"state",`${R} +${S}`),r=await bn(e,R),n=await bn(e,S),{source:s,manifest:o}=r?tt(r):{source:null,manifest:null},i=n?it(JSON.parse(Ac.decode(n))):null,a=o?await ye(o.dependencies):null;return{manifest:o,source:s,lock:i,token:t,status:qc(o,i,a),digest:a}}var vn=e=>e.status==="desynchronized"?`Warning: ${Ie}.\r +`:"";async function kn(e,t,r,{signal:n}={}){let s=[];try{for(let[o,i]of t){n?.throwIfAborted();let a=await x(e,"begin",o,!1);s.push(a),await K(e,{id:a,path:"output",bytes:i},n)}n?.throwIfAborted(),await x(e,"commitGroup",s.join(` `),`${R} -${S}`,r.token)}catch(o){for(let i of s)await x(e,"abort",i).catch(()=>{});throw o}}function vn(e,t,r){let n=e?.entries??{};if(t!==void 0)return Object.hasOwn(n,t)?n[t]:t;if(Object.hasOwn(n,"main"))return n.main;let s=Object.keys(n);if(s.length===1)return n[s[0]];throw new Error(`Usage: ${r} (declare entries.main in ${R} to omit the entry)`)}function Gl(e,[t,r,n,...s]){if(t&&Object.hasOwn(e?.providers??{},t)&&r===void 0){let i=e.providers[t];return{entry:vn(e,i.entry),output:i.output,className:t}}if(!t||r!=="--output"||s.length||!n?.endsWith(".hpp"))throw new Error("wf embed requires or --output ");let o=n.split("/").pop().slice(0,-4);if(!Ke.test(o))throw new Error(`wf embed: ${o} is not a C++ class name; name the output .hpp`);return{entry:vn(e,t),output:n,className:o}}var Ie=e=>Aa.encode(e);var pt=F(C(),1);var Sn=e=>`${M}/${e.key}`,Nn=e=>`${M}/${e.key}.json`,Da=new TextEncoder,Ua=new TextDecoder,Ln=e=>e.message.includes("Cannot read project file:");async function Tn(e){return[...new Uint8Array(await crypto.subtle.digest("SHA-256",e))].map(r=>r.toString(16).padStart(2,"0")).join("")}async function ke(e,t,r,{signal:n}={}){let s={};for(let i of[...r.keys()].sort())s[i]=await Tn(r.get(i));await Q(e,Sn(t),r,{signal:n});let o=JSON.stringify({format:1,integrity:t.integrity,files:s},null,2)+` -`;await Q(e,Nn(t),new Map([["output",Da.encode(o)]]),{directory:!1,signal:n})}async function Fa(e,t){let r;try{r=await G(e,Nn(t))}catch(n){if(Ln(n))return null;throw n}try{return JSON.parse(Ua.decode(r))}catch{return{}}}var za=(e,t)=>Object.keys(e.files).sort().join(` +${S}`,r.token)}catch(o){for(let i of s)await x(e,"abort",i).catch(()=>{});throw o}}function In(e,t,r){let n=e?.entries??{};if(t!==void 0)return Object.hasOwn(n,t)?n[t]:t;if(Object.hasOwn(n,"main"))return n.main;let s=Object.keys(n);if(s.length===1)return n[s[0]];throw new Error(`Usage: ${r} (declare entries.main in ${R} to omit the entry)`)}function Gl(e,[t,r,n,...s]){if(t&&Object.hasOwn(e?.providers??{},t)&&r===void 0){let i=e.providers[t];return{entry:In(e,i.entry),output:i.output,className:t}}if(!t||r!=="--output"||s.length||!n?.endsWith(".hpp"))throw new Error("wf embed requires or --output ");let o=n.split("/").pop().slice(0,-4);if(!Ke.test(o))throw new Error(`wf embed: ${o} is not a C++ class name; name the output .hpp`);return{entry:In(e,t),output:n,className:o}}var ve=e=>Tc.encode(e);var pt=z(C(),1);var Sn=e=>`${M}/${e.key}`,Nn=e=>`${M}/${e.key}.json`,Dc=new TextEncoder,Uc=new TextDecoder,Ln=e=>e.message.includes("Cannot read project file:");async function An(e){return[...new Uint8Array(await crypto.subtle.digest("SHA-256",e))].map(r=>r.toString(16).padStart(2,"0")).join("")}async function ke(e,t,r,{signal:n}={}){let s={};for(let i of[...r.keys()].sort())s[i]=await An(r.get(i));await Q(e,Sn(t),r,{signal:n});let o=JSON.stringify({format:1,integrity:t.integrity,files:s},null,2)+` +`;await Q(e,Nn(t),new Map([["output",Dc.encode(o)]]),{directory:!1,signal:n})}async function zc(e,t){let r;try{r=await G(e,Nn(t))}catch(n){if(Ln(n))return null;throw n}try{return JSON.parse(Uc.decode(r))}catch{return{}}}var Fc=(e,t)=>Object.keys(e.files).sort().join(` `)===[...t.files].sort().join(` -`);async function Ga(e,t,r){let n=[],s=0;for(;;){let o;try{o=await x(e,"read",t,s)}catch(i){if(Ln(i))return null;throw i}if(s+=o.length,s>r)return null;if(n.push(o),o.length<262144)return new Uint8Array(await new Blob(n).arrayBuffer())}}async function ct(e,t,{signal:r,limit:n=1/0}={}){let s=await Fa(e,t);if(!s)return{state:"missing",size:0};if(s.integrity!==t.integrity||!W(s.files)||!za(s,t))return{state:"corrupted",size:0};let o=0;for(let i of t.files){r?.throwIfAborted();let c=await Ga(e,`${Sn(t)}/${i}`,n-o);if(!c||await Tn(c)!==s.files[i])return{state:"corrupted",size:0};o+=c.length}return{state:"valid",size:o}}var Vl=async(e,t,r)=>(await ct(e,t,r)).state;var Ma="https://registry.npmjs.org/";function Wa({registry:e,registryExplicit:t}={},r){return t&&e?{url:e,source:"application option"}:r?.registry?{url:r.registry,source:R}:{url:e||Ma,source:"default"}}function lt(e,t){let r=Wa(e,t);return ot(r.url),r}var ut=({url:e,source:t})=>`Registry: ${e} (${t})`,_a=256*1024*1024,Ba=e=>[...e.values()].reduce((t,r)=>t+r.length,0),Xa=e=>new Error(`The locked packages exceed ${e/(1024*1024)} MiB unpacked`);async function Va(e,t,{signal:r,limit:n}){let s=[],o=0;for(let[i,c]of Object.entries(t.packages)){r?.throwIfAborted();let a=await ct(e,c,{signal:r,limit:n-o});o+=a.size,s.push({id:i,node:c,state:a.state})}return{states:s,size:o}}async function ft(e,t,{registry:r,offline:n=!1,signal:s,progress:o=()=>{},fetchImpl:i=fetch,limit:c=_a}){let{states:a,size:l}=await Va(e,t,{signal:s,limit:c}),u=l,f={verified:a.filter(({state:m})=>m==="valid").length,restored:0,problems:[]};for(let{id:m,node:d,state:A}of a.filter(({state:k})=>k!=="valid")){if(n){f.problems.push(`${m} (${A})`);continue}o(`Restoring ${m}${A==="corrupted"?" (corrupted in the cache)":""}`);let k=await D(d.name,d.version,{registry:r,fetchImpl:i,signal:s});if(k.integrity!==d.integrity)throw new Error(`${m} no longer matches the integrity recorded in the lock`);if(u+=Ba(k.files),u>c)throw Xa(c);await ke(e,d,k.files,{signal:s}),f.restored++}if(f.problems.length)throw new Error(`The cache does not match ${S}; missing or corrupted, nothing downloaded:\r +`);async function Gc(e,t,r){let n=[],s=0;for(;;){let o;try{o=await x(e,"read",t,s)}catch(i){if(Ln(i))return null;throw i}if(s+=o.length,s>r)return null;if(n.push(o),o.length<262144)return new Uint8Array(await new Blob(n).arrayBuffer())}}async function at(e,t,{signal:r,limit:n=1/0}={}){let s=await zc(e,t);if(!s)return{state:"missing",size:0};if(s.integrity!==t.integrity||!W(s.files)||!Fc(s,t))return{state:"corrupted",size:0};let o=0;for(let i of t.files){r?.throwIfAborted();let a=await Gc(e,`${Sn(t)}/${i}`,n-o);if(!a||await An(a)!==s.files[i])return{state:"corrupted",size:0};o+=a.length}return{state:"valid",size:o}}var Vl=async(e,t,r)=>(await at(e,t,r)).state;var Mc="https://registry.npmjs.org/";function Wc({registry:e,registryExplicit:t}={},r){return t&&e?{url:e,source:"application option"}:r?.registry?{url:r.registry,source:R}:{url:e||Mc,source:"default"}}function lt(e,t){let r=Wc(e,t);return ot(r.url),r}var ut=({url:e,source:t})=>`Registry: ${e} (${t})`,_c=256*1024*1024,Xc=e=>[...e.values()].reduce((t,r)=>t+r.length,0),Bc=e=>new Error(`The locked packages exceed ${e/(1024*1024)} MiB unpacked`);async function Vc(e,t,{signal:r,limit:n}){let s=[],o=0;for(let[i,a]of Object.entries(t.packages)){r?.throwIfAborted();let c=await at(e,a,{signal:r,limit:n-o});o+=c.size,s.push({id:i,node:a,state:c.state})}return{states:s,size:o}}async function ft(e,t,{registry:r,offline:n=!1,signal:s,progress:o=()=>{},fetchImpl:i=fetch,limit:a=_c}){let{states:c,size:l}=await Vc(e,t,{signal:s,limit:a}),u=l,f={verified:c.filter(({state:m})=>m==="valid").length,restored:0,problems:[]};for(let{id:m,node:d,state:T}of c.filter(({state:k})=>k!=="valid")){if(n){f.problems.push(`${m} (${T})`);continue}o(`Restoring ${m}${T==="corrupted"?" (corrupted in the cache)":""}`);let k=await D(d.name,d.version,{registry:r,fetchImpl:i,signal:s});if(k.integrity!==d.integrity)throw new Error(`${m} no longer matches the integrity recorded in the lock`);if(u+=Xc(k.files),u>a)throw Bc(a);await ke(e,d,k.files,{signal:s}),f.restored++}if(f.problems.length)throw new Error(`The cache does not match ${S}; missing or corrupted, nothing downloaded:\r ${f.problems.join(`\r `)}\r -Run wf restore to download them.`);return f}function Ha(e){let t=e.includes("--offline");if(e.some(r=>r!=="--offline"))throw new Error("Usage: wf restore [--offline]");return{offline:t}}async function Ql(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}={}){let{offline:c}=Ha(t),a=await re(e);if(!a.manifest)throw new Error(Oe);if(!a.lock)throw new Error(`No ${S}: run wf install to resolve the dependencies`);let l=c?null:lt({registry:r,registryExplicit:n},a.manifest);o(c?"Offline: no registry is contacted":ut(l));let u=await ft(e,a.lock,{registry:l?.url,offline:c,signal:s,progress:o,fetchImpl:i}),f=Object.keys(a.lock.packages).length,m=c?`Cache verified offline: ${f} packages match ${S}.`:`Restored ${u.restored} of ${f} packages (${u.verified} already in the cache). Lock: ${S}`;return{...u,registry:l,text:In(a)+m}}var Pn=e=>{let{name:t,version:r}=ie(e);return[t,r||void 0]};function Ja(e,t){let{version:r}=e.packages[t.id];return!(pt.default.valid(t.requested)!==null)&&t.requested!=="latest"&&pt.default.validRange(t.requested)!==null?t.requested:`^${r}`}async function cu(e,[t,...r],{signal:n}={}){if(r.length)throw new Error("Usage: wf init [name]");let{lock:s}=await re(e),o=wn(t??En(""));s&&(o.dependencies=Object.fromEntries(Object.entries(s.roots).map(([c,a])=>[c,Ja(s,a)]))),te(o),await Q(e,R,new Map([["output",Ie(rt(o))]]),{directory:!1,replace:!1,signal:n});let i=s?` with the ${Object.keys(o.dependencies).length} dependencies of ${S}`:"";return`Created ${R}${i}. Add libraries with wf install .`}function Ya(e,t){let r={...e.manifest.dependencies},n=new Set;for(let s of t){let[o,i]=Pn(s);r[o]=i??"latest",i&&i!=="latest"&&n.add(o)}return te({...e.source,dependencies:r}),{dependencies:r,explicit:n}}function Za(e,t){let r={...e.source,dependencies:t};return te(r),r}function Ka({dependencies:e,explicit:t},r,n){let s={...e};for(let o of n){let i=Pn(o)[0];t.has(i)||(s[i]=`^${r.packages[r.roots[i].id].version}`)}return s}async function Qa(e,t,r){let n=Object.entries(e).map(([i,c])=>`${i}@${c}`),{lock:s,downloads:o}=await bn(n,{registry:r.registry,signal:r.signal,fetchImpl:r.fetchImpl,previous:t,download:async(...i)=>(r.progress(`Resolving ${i[0]}@${i[1]}`),D(...i))});return{lock:s,downloads:o}}async function ec(e,t,r,{signal:n,progress:s}){for(let[o,i]of r)s(`Storing ${o}`),await ke(e,t.packages[o],i,{signal:n})}function tc(e){let t=e.includes("--update"),r=e.filter(n=>n!=="--update");if(r.some(n=>n.startsWith("-")))throw new Error("Usage: wf install [--update] [[@range] ...]");return{update:t,specs:r}}async function An(e,t,{manifest:r,lock:n},s){let o=new Map([[S,Ie(JSON.stringify(n,null,2)+` -`)]]);r&&o.set(R,Ie(rt(r))),await kn(e,o,t,s)}var jn=async(e,t)=>({format:e.format,manifestDigest:await ye(t),...e});async function lu(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}){let{update:c,specs:a}=tc(t),l=await re(e);if(!l.manifest)throw new Error(Oe);let u=lt({registry:r,registryExplicit:n},l.manifest),f={registry:u.url,signal:s,fetchImpl:i,progress:o};if(a.length&&c)throw new Error("Usage: wf install --update does not take packages");if(a.length&&l.status==="desynchronized")throw new Error(ve);if(!a.length&&!c&&l.status==="desynchronized")throw new Error(ve);o(ut(u));let m=l.status==="consistent"||l.status==="legacy";if(!a.length&&!c&&m){let{restored:U}=await ft(e,l.lock,f);if(l.status==="consistent")return{lock:l.lock,restored:U,registry:u};let oe=await jn(l.lock,l.manifest.dependencies);return await An(e,l,{manifest:null,lock:oe},{signal:s}),{lock:oe,restored:U,registry:u}}let d=Ya(l,a),A=m&&!c?l.lock:void 0,k=await Qa(d.dependencies,A,f),Le=Ka(d,k.lock,a);await ec(e,k.lock,k.downloads,{signal:s,progress:o});let se=await jn(k.lock,Le),y=a.length?Za(l,Le):null;return await An(e,l,{manifest:y,lock:se},{signal:s}),{lock:se,restored:0,registry:u}}var rc=[R,S,".webfront"],ne=(e,t)=>e===t||e.startsWith(t+"/");function ht(e){try{return T(e)}catch{throw new Error(`Not a project-relative path: ${e}`)}}var Se=(e,t,r)=>new Error(`Permission denied: ${e} ${t} is not granted by permissions.${r} in ${R}`);function qn(e,t){let r=ht(t);if(![...e?.files??[],...e?.publish??[]].some(s=>ne(r,s)))throw Se("reading",t,"files");return r}function Cn(e,t){let r=t===""||t==="."?"":ht(t),n=[...e?.files??[],...e?.publish??[]];if(r&&n.some(o=>ne(r,o)))return{path:r,keep:()=>!0};let s=o=>n.some(i=>ne(o,i)||i.startsWith(o+"/"));if(!n.some(o=>r===""||o.startsWith(r+"/")))throw Se("listing",r||"the project root","files");return{path:r,keep:o=>s(r?`${r}/${o.replace(/\/$/,"")}`:o.replace(/\/$/,""))}}function Dn(e,t){let r=ht(t);if(rc.some(n=>ne(r,n)))throw new Error(`Permission denied: ${t} is managed by wf and never written by a script`);if(!(e?.publish??[]).some(n=>ne(r,n)))throw Se("writing",t,"publish");return r}function hu(e,t,r){let n=new URL(t,r);if(!(e?.fetch??[]).includes(n.origin))throw Se("fetching",n.origin,"fetch");return n}var nc=2e3,Fn=600,Ne=[1,3600],Un=4,dt=class extends Error{constructor(t,r){super(t),this.exitCode=r}},$u=(e,t=1/0,r=Date.now())=>Math.min(r+e*1e3,t),yu=(e,t=Date.now())=>Math.max(0,(e-t)/1e3);function xu(e,t){let r=Fn,n=e;if(n[0]==="--timeout"){if(r=Number(n[1]),!Number.isInteger(r)||rNe[1])throw new Error(`--timeout expects whole seconds from ${Ne[0]} to ${Ne[1]}`);n=n.slice(2)}if(!n.length||n[0].startsWith("-"))throw new Error(`Usage: ${t}`);return{timeout:r,target:n[0],args:n.slice(1)}}function Ru(e,t,r,n,s=0){let o=e?.scripts??{};if(!Object.hasOwn(o,t)){let a=Object.keys(o).sort().join(", ")||"none";throw new Error(`No script "${t}" in ${R} (scripts: ${a})`)}let[i,...c]=n(o[t]);if(i==="wf"){if(s>=Un)throw new Error(`Scripts call wf more than ${Un} levels deep`);return{kind:"wf",argv:[...c,...r]}}return{kind:"module",entry:{namespace:"project",path:T(i)},args:[...c,...r]}}function zn(e,t){if(e?.roots&&Object.hasOwn(e.roots,t)){let{id:n}=e.roots[t];return[n,e.packages[n]]}let r=Object.entries(e?.packages??{}).filter(([,n])=>n.name===t);if(r.length>1)throw new Error(`${t} is locked at several versions; install it as a root to choose one`);return r[0]??null}function sc(e,t){let r=t.webfront?.bin;if(typeof r=="string")return{[t.name.split("/").pop()]:r};if(r&&typeof r=="object"&&!Array.isArray(r))return r;throw t.bin?new Error(`${e} only declares an npm "bin" (a Node.js program); wf exec runs only "webfront.bin" entries`):new Error(`${e} has no WebFront executable entry ("webfront.bin" in its package.json)`)}function bu(e,t){let r=t.indexOf(":",t.startsWith("@")?t.indexOf("/"):0),[n,s]=r<0?[t,void 0]:[t.slice(0,r),t.slice(r+1)],o=zn(e,n);if(!o)throw new Error(`${n} is not installed: run wf install ${n}`);let[i,c]=o,a=sc(i,c.manifest),l=Object.keys(a),u=s??(l.length===1?l[0]:void 0);if(!u||!Object.hasOwn(a,u))throw new Error(`${i} has the WebFront entries ${l.join(", ")||"none"}: run wf exec ${n}:`);let f=String(a[u]).replace(/^\.\//,"");if(!c.files.includes(T(f)))throw new Error(`${i}: webfront.bin entry ${u} names a missing file ${f}`);return{id:i,name:u,entry:{namespace:"npm",path:`${i}/${f}`}}}var oc=new TextDecoder;function Ou({bridge:e,permissions:t,lock:r}){let n=new AbortController,s=[],o=new Set;async function i(a,l){let u=Dn(t,a);if(!(l instanceof Uint8Array))throw new TypeError("context.project.write expects a string or a Uint8Array");let f={path:u,state:"staging"};s.push(f);let m=null;try{m=await x(e,"begin",u,!1),await K(e,{id:m,path:"output",bytes:l},n.signal),n.signal.throwIfAborted(),f.state="committing",await x(e,"commit",m),f.state="applied"}catch(d){let A=n.signal.aborted&&f.state!=="committing";throw f.state=A?"abandoned":"failed",m!==null&&await x(e,"abort",m).catch(()=>{}),d}}let c={read:a=>G(e,qn(t,a)),list:async(a="")=>{let{path:l,keep:u}=Cn(t,a);return JSON.parse(oc.decode(await x(e,"list",l))).filter(u)},write:i,resolve:a=>{let l=zn(r,a)?.[1];return l?{name:l.name,version:l.version,integrity:l.integrity}:null}};return{publications:s,async handle({operation:a,args:l}){if(n.signal.aborted)throw new Error("The script was stopped");if(!Object.hasOwn(c,a))throw new Error(`Unknown context operation: ${a}`);let u=c[a](...l);o.add(u);try{return await u}finally{o.delete(u)}},async finish(){for(let a of s)(a.state==="staging"||a.state==="committing")&&(a.unawaited=!0);for(;o.size;)await Promise.allSettled([...o]);await this.stop()},async stop(){n.abort(new Error("The script was stopped")),await Promise.allSettled([...o])}}}function vu({createWorker:e,host:t,message:r,signal:n,timeout:s=Fn,grace:o=nc,write:i}){return new Promise(c=>{let a=e(),l=[],u=null,f=!1,m=()=>u==="timeout"?124:130,d=y=>{f||(f=!0,a.terminate(),l.forEach(clearTimeout),n?.removeEventListener("abort",k),c({reason:u??"exit",...y}))},A=y=>{u||f||(u=y,a.postMessage({type:"abort"}),l.push(setTimeout(()=>d({code:m(),forced:o}),o)))},k=()=>A("interrupted"),se={console:y=>i(String(y.text).replace(/\r?\n/g,`\r +Run wf restore to download them.`);return f}function Hc(e){let t=e.includes("--offline");if(e.some(r=>r!=="--offline"))throw new Error("Usage: wf restore [--offline]");return{offline:t}}async function Ql(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}={}){let{offline:a}=Hc(t),c=await re(e);if(!c.manifest)throw new Error(be);if(!c.lock)throw new Error(`No ${S}: run wf install to resolve the dependencies`);let l=a?null:lt({registry:r,registryExplicit:n},c.manifest);o(a?"Offline: no registry is contacted":ut(l));let u=await ft(e,c.lock,{registry:l?.url,offline:a,signal:s,progress:o,fetchImpl:i}),f=Object.keys(c.lock.packages).length,m=a?`Cache verified offline: ${f} packages match ${S}.`:`Restored ${u.restored} of ${f} packages (${u.verified} already in the cache). Lock: ${S}`;return{...u,registry:l,text:vn(c)+m}}var jn=e=>{let{name:t,version:r}=ie(e);return[t,r||void 0]};function Yc(e,t){let{version:r}=e.packages[t.id];return!(pt.default.valid(t.requested)!==null)&&t.requested!=="latest"&&pt.default.validRange(t.requested)!==null?t.requested:`^${r}`}async function au(e,[t,...r],{signal:n}={}){if(r.length)throw new Error("Usage: wf init [name]");let{lock:s}=await re(e),o=wn(t??En(""));s&&(o.dependencies=Object.fromEntries(Object.entries(s.roots).map(([a,c])=>[a,Yc(s,c)]))),te(o),await Q(e,R,new Map([["output",ve(rt(o))]]),{directory:!1,replace:!1,signal:n});let i=s?` with the ${Object.keys(o.dependencies).length} dependencies of ${S}`:"";return`Created ${R}${i}. Add libraries with wf install .`}function Jc(e,t){let r={...e.manifest.dependencies},n=new Set;for(let s of t){let[o,i]=jn(s);r[o]=i??"latest",i&&i!=="latest"&&n.add(o)}return te({...e.source,dependencies:r}),{dependencies:r,explicit:n}}function Zc(e,t){let r={...e.source,dependencies:t};return te(r),r}function Kc({dependencies:e,explicit:t},r,n){let s={...e};for(let o of n){let i=jn(o)[0];t.has(i)||(s[i]=`^${r.packages[r.roots[i].id].version}`)}return s}async function Qc(e,t,r){let n=Object.entries(e).map(([i,a])=>`${i}@${a}`),{lock:s,downloads:o}=await On(n,{registry:r.registry,signal:r.signal,fetchImpl:r.fetchImpl,previous:t,download:async(...i)=>(r.progress(`Resolving ${i[0]}@${i[1]}`),D(...i))});return{lock:s,downloads:o}}async function ea(e,t,r,{signal:n,progress:s}){for(let[o,i]of r)s(`Storing ${o}`),await ke(e,t.packages[o],i,{signal:n})}function ta(e){let t=e.includes("--update"),r=e.filter(n=>n!=="--update");if(r.some(n=>n.startsWith("-")))throw new Error("Usage: wf install [--update] [[@range] ...]");return{update:t,specs:r}}async function Tn(e,t,{manifest:r,lock:n},s){let o=new Map([[S,ve(JSON.stringify(n,null,2)+` +`)]]);r&&o.set(R,ve(rt(r))),await kn(e,o,t,s)}var Pn=async(e,t)=>({format:e.format,manifestDigest:await ye(t),...e});async function lu(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}){let{update:a,specs:c}=ta(t),l=await re(e);if(!l.manifest)throw new Error(be);let u=lt({registry:r,registryExplicit:n},l.manifest),f={registry:u.url,signal:s,fetchImpl:i,progress:o};if(c.length&&a)throw new Error("Usage: wf install --update does not take packages");if(c.length&&l.status==="desynchronized")throw new Error(Ie);if(!c.length&&!a&&l.status==="desynchronized")throw new Error(Ie);o(ut(u));let m=l.status==="consistent"||l.status==="legacy";if(!c.length&&!a&&m){let{restored:U}=await ft(e,l.lock,f);if(l.status==="consistent")return{lock:l.lock,restored:U,registry:u};let oe=await Pn(l.lock,l.manifest.dependencies);return await Tn(e,l,{manifest:null,lock:oe},{signal:s}),{lock:oe,restored:U,registry:u}}let d=Jc(l,c),T=m&&!a?l.lock:void 0,k=await Qc(d.dependencies,T,f),Le=Kc(d,k.lock,c);await ea(e,k.lock,k.downloads,{signal:s,progress:o});let se=await Pn(k.lock,Le),y=c.length?Zc(l,Le):null;return await Tn(e,l,{manifest:y,lock:se},{signal:s}),{lock:se,restored:0,registry:u}}var ra=[R,S,".webfront"],ne=(e,t)=>e===t||e.startsWith(t+"/");function ht(e){try{return A(e)}catch{throw new Error(`Not a project-relative path: ${e}`)}}var Se=(e,t,r)=>new Error(`Permission denied: ${e} ${t} is not granted by permissions.${r} in ${R}`);function qn(e,t){let r=ht(t);if(![...e?.files??[],...e?.publish??[]].some(s=>ne(r,s)))throw Se("reading",t,"files");return r}function Cn(e,t){let r=t===""||t==="."?"":ht(t),n=[...e?.files??[],...e?.publish??[]];if(r&&n.some(o=>ne(r,o)))return{path:r,keep:()=>!0};let s=o=>n.some(i=>ne(o,i)||i.startsWith(o+"/"));if(!n.some(o=>r===""||o.startsWith(r+"/")))throw Se("listing",r||"the project root","files");return{path:r,keep:o=>s(r?`${r}/${o.replace(/\/$/,"")}`:o.replace(/\/$/,""))}}function Dn(e,t){let r=ht(t);if(ra.some(n=>ne(r,n)))throw new Error(`Permission denied: ${t} is managed by wf and never written by a script`);if(!(e?.publish??[]).some(n=>ne(r,n)))throw Se("writing",t,"publish");return r}function hu(e,t,r){let n=new URL(t,r);if(!(e?.fetch??[]).includes(n.origin))throw Se("fetching",n.origin,"fetch");return n}var na=2e3,zn=600,Ne=[1,3600],Un=4,dt=class extends Error{constructor(t,r){super(t),this.exitCode=r}},$u=(e,t=1/0,r=Date.now())=>Math.min(r+e*1e3,t),yu=(e,t=Date.now())=>Math.max(0,(e-t)/1e3);function xu(e,t){let r=zn,n=e;if(n[0]==="--timeout"){if(r=Number(n[1]),!Number.isInteger(r)||rNe[1])throw new Error(`--timeout expects whole seconds from ${Ne[0]} to ${Ne[1]}`);n=n.slice(2)}if(!n.length||n[0].startsWith("-"))throw new Error(`Usage: ${t}`);return{timeout:r,target:n[0],args:n.slice(1)}}function Ru(e,t,r,n,s=0){let o=e?.scripts??{};if(!Object.hasOwn(o,t)){let c=Object.keys(o).sort().join(", ")||"none";throw new Error(`No script "${t}" in ${R} (scripts: ${c})`)}let[i,...a]=n(o[t]);if(i==="wf"){if(s>=Un)throw new Error(`Scripts call wf more than ${Un} levels deep`);return{kind:"wf",argv:[...a,...r]}}return{kind:"module",entry:{namespace:"project",path:A(i)},args:[...a,...r]}}function Fn(e,t){if(e?.roots&&Object.hasOwn(e.roots,t)){let{id:n}=e.roots[t];return[n,e.packages[n]]}let r=Object.entries(e?.packages??{}).filter(([,n])=>n.name===t);if(r.length>1)throw new Error(`${t} is locked at several versions; install it as a root to choose one`);return r[0]??null}function sa(e,t){let r=t.webfront?.bin;if(typeof r=="string")return{[t.name.split("/").pop()]:r};if(r&&typeof r=="object"&&!Array.isArray(r))return r;throw t.bin?new Error(`${e} only declares an npm "bin" (a Node.js program); wf exec runs only "webfront.bin" entries`):new Error(`${e} has no WebFront executable entry ("webfront.bin" in its package.json)`)}function Ou(e,t){let r=t.indexOf(":",t.startsWith("@")?t.indexOf("/"):0),[n,s]=r<0?[t,void 0]:[t.slice(0,r),t.slice(r+1)],o=Fn(e,n);if(!o)throw new Error(`${n} is not installed: run wf install ${n}`);let[i,a]=o,c=sa(i,a.manifest),l=Object.keys(c),u=s??(l.length===1?l[0]:void 0);if(!u||!Object.hasOwn(c,u))throw new Error(`${i} has the WebFront entries ${l.join(", ")||"none"}: run wf exec ${n}:`);let f=String(c[u]).replace(/^\.\//,"");if(!a.files.includes(A(f)))throw new Error(`${i}: webfront.bin entry ${u} names a missing file ${f}`);return{id:i,name:u,entry:{namespace:"npm",path:`${i}/${f}`}}}var oa=new TextDecoder;function bu({bridge:e,permissions:t,lock:r}){let n=new AbortController,s=[],o=new Set;async function i(c,l){let u=Dn(t,c);if(!(l instanceof Uint8Array))throw new TypeError("context.project.write expects a string or a Uint8Array");let f={path:u,state:"staging"};s.push(f);let m=null;try{m=await x(e,"begin",u,!1),await K(e,{id:m,path:"output",bytes:l},n.signal),n.signal.throwIfAborted(),f.state="committing",await x(e,"commit",m),f.state="applied"}catch(d){let T=n.signal.aborted&&f.state!=="committing";throw f.state=T?"abandoned":"failed",m!==null&&await x(e,"abort",m).catch(()=>{}),d}}let a={read:c=>G(e,qn(t,c)),list:async(c="")=>{let{path:l,keep:u}=Cn(t,c);return JSON.parse(oa.decode(await x(e,"list",l))).filter(u)},write:i,resolve:c=>{let l=Fn(r,c)?.[1];return l?{name:l.name,version:l.version,integrity:l.integrity}:null}};return{publications:s,async handle({operation:c,args:l}){if(n.signal.aborted)throw new Error("The script was stopped");if(!Object.hasOwn(a,c))throw new Error(`Unknown context operation: ${c}`);let u=a[c](...l);o.add(u);try{return await u}finally{o.delete(u)}},async finish(){for(let c of s)(c.state==="staging"||c.state==="committing")&&(c.unawaited=!0);for(;o.size;)await Promise.allSettled([...o]);await this.stop()},async stop(){n.abort(new Error("The script was stopped")),await Promise.allSettled([...o])}}}function Iu({createWorker:e,host:t,message:r,signal:n,timeout:s=zn,grace:o=na,write:i}){return new Promise(a=>{let c=e(),l=[],u=null,f=!1,m=()=>u==="timeout"?124:130,d=y=>{f||(f=!0,c.terminate(),l.forEach(clearTimeout),n?.removeEventListener("abort",k),a({reason:u??"exit",...y}))},T=y=>{u||f||(u=y,c.postMessage({type:"abort"}),l.push(setTimeout(()=>d({code:m(),forced:o}),o)))},k=()=>T("interrupted"),se={console:y=>i(String(y.text).replace(/\r?\n/g,`\r `)+`\r -`,y.stream),exit:y=>d({code:u&&y.code===0?m():y.code}),error:y=>d({code:u?m():1,error:y.error}),call:async y=>{let U;try{U={value:await t.handle(y)}}catch(oe){U={error:oe.message}}f||a.postMessage({type:"reply",id:y.id,...U})}};a.onmessage=({data:y})=>se[y?.type]?.(y),a.onerror=y=>{y.preventDefault?.(),d({code:1,error:y.message||"The script Worker failed"})},n?.addEventListener("abort",k,{once:!0}),l.push(setTimeout(()=>A("timeout"),s*1e3)),a.postMessage({type:"run",...r}),n?.aborted&&k()})}function ic(e,t){let r=t?e:e.filter(o=>o.unawaited),n=o=>r.filter(i=>i.state===o).map(({path:i})=>i),s=[];return t&&n("applied").length&&s.push(`Applied before the stop: ${n("applied").join(", ")}`),n("abandoned").length&&s.push(`Abandoned, unchanged: ${n("abandoned").join(", ")}`),n("failed").length&&s.push(`Failed, unchanged: ${n("failed").join(", ")}`),s}function Iu(e,t,r){let n={interrupted:"stopped by Ctrl+C",timeout:"stopped at its time limit"}[t.reason],s=ic(r,n!==void 0);if(t.code===0&&!n&&!s.length)return`${e} completed.`;let o=t.forced?` (terminated after the ${t.forced/1e3} s grace period)`:"",i=t.code===0&&!n?1:t.code,c=n?`${n}${o}`:t.code===0?"ended without applying all its writes":`exited with code ${t.code}`;throw new dt([t.error,`${e} ${c}`,...s].filter(Boolean).join(`\r -`),i)}var Pu=new TextDecoder,lc=["",".tsx",".ts",".jsx",".js",".mjs",".cjs",".json",".css","/index.tsx","/index.ts","/index.js"],qu=new Map(Object.entries({mjs:"js",cjs:"js",js:"js",jsx:"jsx",ts:"ts",tsx:"tsx",css:"css",json:"json"}));async function uc(e,t,r){try{return await e(t,r)}catch(n){if(t!=="project")throw n;return}}function fc(e,t,r,n){let s=new Map,o=(a,l)=>{let u=n?.packages?.[a];if(u)return s.has(a)||s.set(a,new Set(u.files)),s.get(a).has(l)?t(`${M}/${u.key}/${l}`):void 0},i=async(a,l)=>{if(a==="project")return t(l);let u=l.indexOf("/"),[f,m]=[l.slice(0,u),l.slice(u+1)];return e?e[f]?.get(m):o(f,m)};return{read:i,find:async(a,l)=>{for(let u of lc){let f=await uc(i,a,l+u);if(f!==void 0)return r.set(`${a}:${l+u}`,f),{path:l+u,namespace:a}}throw new Error(`Cannot resolve ${l}`)}}}var pc=new Set(["assert","async_hooks","buffer","child_process","cluster","console","constants","crypto","dgram","diagnostics_channel","dns","domain","events","fs","http","http2","https","inspector","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","string_decoder","sys","timers","tls","trace_events","tty","url","util","v8","vm","wasi","worker_threads","zlib"]),hc=/^(?:node:|[a-z_][a-z0-9_]*(?:\/|$))/;function dc(e){if(e.startsWith("node:"))return e.slice(5).split("/")[0];let t=e.split("/")[0];return pc.has(t)?t:null}export{dt as ScriptExit,Vl as cacheState,hu as checkFetch,qn as checkRead,Dn as checkWrite,fc as createFinder,Ma as defaultRegistry,Fn as defaultTimeout,ye as dependenciesDigest,ut as describeRegistry,ve as desynchronized,D as downloadPackage,Wa as effectiveRegistry,Gl as embedTarget,sa as exactVersion,bu as execTarget,nc as gracePeriod,Ke as identifier,cu as initProject,ct as inspectCache,lu as install,Cn as listable,re as loadProject,S as lockPath,zn as lockedPackage,Pa as locksDependencies,ee as manifestFormat,En as manifestName,R as manifestPath,wn as newManifest,Oe as noManifest,dc as nodeBuiltin,hc as nodeImport,Ze as npmName,Sn as packageDirectory,M as packageRoot,gl as parseManifest,xu as parseRunOptions,kn as publishTogether,tt as readManifest,Nn as recordPath,vn as resolveEntry,bn as resolvePackages,Ql as restore,ft as restorePackages,$u as runDeadline,Iu as runResult,vu as runWorker,T as safePackagePath,et as sameOriginPath,Ru as scriptCommand,Ou as scriptHost,yu as secondsLeft,rt as serializeManifest,ke as storePackage,In as syncNotice,Ie as textBytes,Ne as timeoutBounds,_a as unpackedLimit,lt as usableRegistry,it as validateLock,te as validateManifest}; +`,y.stream),exit:y=>d({code:u&&y.code===0?m():y.code}),error:y=>d({code:u?m():1,error:y.error}),call:async y=>{let U;try{U={value:await t.handle(y)}}catch(oe){U={error:oe.message}}f||c.postMessage({type:"reply",id:y.id,...U})}};c.onmessage=({data:y})=>se[y?.type]?.(y),c.onerror=y=>{y.preventDefault?.(),d({code:1,error:y.message||"The script Worker failed"})},n?.addEventListener("abort",k,{once:!0}),l.push(setTimeout(()=>T("timeout"),s*1e3)),c.postMessage({type:"run",...r}),n?.aborted&&k()})}function ia(e,t){let r=t?e:e.filter(o=>o.unawaited),n=o=>r.filter(i=>i.state===o).map(({path:i})=>i),s=[];return t&&n("applied").length&&s.push(`Applied before the stop: ${n("applied").join(", ")}`),n("abandoned").length&&s.push(`Abandoned, unchanged: ${n("abandoned").join(", ")}`),n("failed").length&&s.push(`Failed, unchanged: ${n("failed").join(", ")}`),s}function vu(e,t,r){let n={interrupted:"stopped by Ctrl+C",timeout:"stopped at its time limit"}[t.reason],s=ia(r,n!==void 0);if(t.code===0&&!n&&!s.length)return`${e} completed.`;let o=t.forced?` (terminated after the ${t.forced/1e3} s grace period)`:"",i=t.code===0&&!n?1:t.code,a=n?`${n}${o}`:t.code===0?"ended without applying all its writes":`exited with code ${t.code}`;throw new dt([t.error,`${e} ${a}`,...s].filter(Boolean).join(`\r +`),i)}var ju=new TextDecoder,la=["",".tsx",".ts",".jsx",".js",".mjs",".cjs",".json",".css","/index.tsx","/index.ts","/index.js"],qu=new Map(Object.entries({mjs:"js",cjs:"js",js:"js",jsx:"jsx",ts:"ts",tsx:"tsx",css:"css",json:"json"}));async function ua(e,t,r){try{return await e(t,r)}catch(n){if(t!=="project")throw n;return}}function fa(e,t,r,n){let s=new Map,o=(c,l)=>{let u=n?.packages?.[c];if(u)return s.has(c)||s.set(c,new Set(u.files)),s.get(c).has(l)?t(`${M}/${u.key}/${l}`):void 0},i=async(c,l)=>{if(c==="project")return t(l);let u=l.indexOf("/"),[f,m]=[l.slice(0,u),l.slice(u+1)];return e?e[f]?.get(m):o(f,m)};return{read:i,find:async(c,l)=>{for(let u of la){let f=await ua(i,c,l+u);if(f!==void 0)return r.set(`${c}:${l+u}`,f),{path:l+u,namespace:c}}throw new Error(`Cannot resolve ${l}`)}}}var pa=new Set(["assert","async_hooks","buffer","child_process","cluster","console","constants","crypto","dgram","diagnostics_channel","dns","domain","events","fs","http","http2","https","inspector","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","string_decoder","sys","timers","tls","trace_events","tty","url","util","v8","vm","wasi","worker_threads","zlib"]),ha=/^(?:node:|[a-z_][a-z0-9_]*(?:\/|$))/;function da(e){if(e.startsWith("node:"))return e.slice(5).split("/")[0];let t=e.split("/")[0];return pa.has(t)?t:null}export{dt as ScriptExit,Vl as cacheState,hu as checkFetch,qn as checkRead,Dn as checkWrite,fa as createFinder,Mc as defaultRegistry,zn as defaultTimeout,ye as dependenciesDigest,ut as describeRegistry,Ie as desynchronized,D as downloadPackage,Wc as effectiveRegistry,Gl as embedTarget,sc as exactVersion,Ou as execTarget,na as gracePeriod,Ke as identifier,au as initProject,at as inspectCache,lu as install,Cn as listable,re as loadProject,S as lockPath,Fn as lockedPackage,jc as locksDependencies,ee as manifestFormat,En as manifestName,R as manifestPath,wn as newManifest,be as noManifest,da as nodeBuiltin,ha as nodeImport,Ze as npmName,Sn as packageDirectory,M as packageRoot,gl as parseManifest,xu as parseRunOptions,kn as publishTogether,tt as readManifest,Nn as recordPath,In as resolveEntry,On as resolvePackages,Ql as restore,ft as restorePackages,$u as runDeadline,vu as runResult,Iu as runWorker,A as safePackagePath,et as sameOriginPath,Ru as scriptCommand,bu as scriptHost,yu as secondsLeft,rt as serializeManifest,ke as storePackage,vn as syncNotice,ve as textBytes,Ne as timeoutBounds,_c as unpackedLimit,lt as usableRegistry,it as validateLock,te as validateManifest}; diff --git a/js/developer/environment/packages.mjs b/js/developer/environment/packages.mjs index 4fd6004d..57de2be4 100644 --- a/js/developer/environment/packages.mjs +++ b/js/developer/environment/packages.mjs @@ -1,5 +1,5 @@ // npm library resolution for the browser. Tools continue to use the existing wf installer. -import {parseSpec} from '../components/tools/wf.mjs'; +import {parseSpec} from './tarball.mjs'; import {downloadPackage} from './registry.mjs'; import {pinnedDownloader} from './pins.mjs'; import {connectPeers} from './peers.mjs'; diff --git a/js/developer/environment/registry.mjs b/js/developer/environment/registry.mjs index 66704627..0fceb1cd 100644 --- a/js/developer/environment/registry.mjs +++ b/js/developer/environment/registry.mjs @@ -1,7 +1,7 @@ // npm registry access: resolving a version, downloading and checking one package archive. import semver from 'semver'; import {responseBytes} from './io.mjs'; -import {verifyIntegrity} from '../components/tools/wf.mjs'; +import {verifyIntegrity} from './tarball.mjs'; import {readArchive, checkedManifest} from './archive.mjs'; import {sameOriginPath} from './manifest.mjs'; diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index 3271a0ec..8ea9aea9 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -1,5 +1,5 @@ -import {Terminal} from '../../../third_party/xterm/xterm.mjs'; -import {FitAddon} from '../../../third_party/xterm/addon-fit.mjs'; +import {Terminal} from '@xterm/xterm'; +import {FitAddon} from '@xterm/addon-fit'; import {LineEditor, tokenize, wordAtEnd, unicodeProvider, clearScreen, historyLimit} from './terminal.mjs'; import {manifestPath} from './manifest.mjs'; import {discoverCommands, runCommand} from './commands.mjs'; diff --git a/js/developer/environment/starter.mjs b/js/developer/environment/starter.mjs index 056b3da6..7db51385 100644 --- a/js/developer/environment/starter.mjs +++ b/js/developer/environment/starter.mjs @@ -1,4 +1,4 @@ -import {gunzip, readTar, verifyIntegrity} from '../components/tools/wf.mjs'; +import {gunzip, readTar, verifyIntegrity} from './tarball.mjs'; import {safePackagePath} from './paths.mjs'; import {publish, responseBytes} from './io.mjs'; import {recipeOf} from './recipe.mjs'; diff --git a/js/developer/environment/tarball.mjs b/js/developer/environment/tarball.mjs new file mode 100644 index 00000000..6cb9c06e --- /dev/null +++ b/js/developer/environment/tarball.mjs @@ -0,0 +1,146 @@ +// npm tarballs in the browser: package specs, SHA-512 integrity, gzip with a size bound, and tar entries (ustar, pax +// and GNU long names). + +const blockSize = 512; +// Largest unpacked tarball accepted, against decompression bombs. +export const maxUnpackedBytes = 256 * 1024 * 1024; +const utf8 = new TextDecoder(); + +// Splits "name[@version]", where the name may be scoped ("@scope/name@1.0.0"). The version is "" +// when absent. +export function parseSpec(spec) { + const at = spec.indexOf("@", spec.startsWith("@") ? 1 : 0); + return at < 0 ? {name: spec, version: ""} : {name: spec.slice(0, at), version: spec.slice(at + 1)}; +} + +// Checks bytes against an SRI integrity string ("sha512-", possibly several hashes +// separated by spaces) and returns the matching "sha512-…" hash. Only SHA-512 is accepted. +export async function verifyIntegrity(bytes, integrity) { + const expected = String(integrity ?? "") + .split(/\s+/) + .filter((hash) => hash.startsWith("sha512-")) + .map((hash) => hash.split("?")[0]); + if (expected.length === 0) + throw new Error("The package has no SHA-512 integrity"); + if (!globalThis.crypto?.subtle) + throw new Error("Integrity checks need a secure context (https or localhost)"); + const digest = new Uint8Array(await crypto.subtle.digest("SHA-512", bytes)); + const actual = "sha512-" + btoa(Array.from(digest, (byte) => String.fromCharCode(byte)).join("")); + if (!expected.includes(actual)) + throw new Error(`Integrity check failed: expected ${expected[0]}, got ${actual}`); + return actual; +} + +// Gunzips bytes, failing once more than `limit` bytes come out. +export async function gunzip(bytes, limit = maxUnpackedBytes) { + const reader = new Blob([bytes]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(); + const chunks = []; + let total = 0; + for (let read = await reader.read(); !read.done; read = await reader.read()) { + total += read.value.length; + if (total > limit) { + await reader.cancel(); + throw new Error(`The tarball unpacks to more than ${limit} bytes`); + } + chunks.push(read.value); + } + return new Uint8Array(await new Blob(chunks).arrayBuffer()); +} + +// A NUL-terminated header field. +function text(block, offset, length) { + const field = block.subarray(offset, offset + length); + const end = field.indexOf(0); + return utf8.decode(end < 0 ? field : field.subarray(0, end)); +} + +// An octal number, or a base-256 one when the first byte has its high bit set (GNU and star). +function number(block, offset, length) { + if (block[offset] & 0x80) + return block.subarray(offset + 1, offset + length).reduce((value, byte) => value * 256 + byte, block[offset] & 0x7f); + const digits = text(block, offset, length).trim(); + if (!/^[0-7]*$/.test(digits)) + throw new Error("Corrupt tar header"); + return digits === "" ? 0 : parseInt(digits, 8); +} + +function verifyChecksum(header) { + let sum = 0; + for (let index = 0; index < blockSize; ++index) + sum += index >= 148 && index < 156 ? 0x20 : header[index]; + if (number(header, 148, 8) !== sum) + throw new Error("Corrupt tar header checksum"); +} + +// " =\n" records of a pax extended header; lengths count bytes. +function paxRecords(data) { + const records = {}; + let offset = 0; + while (offset < data.length) { + const space = data.indexOf(0x20, offset); + const length = space < 0 ? NaN : Number(utf8.decode(data.subarray(offset, space))); + if (!(length > 0) || offset + length > data.length) + throw new Error("Corrupt pax header"); + const record = utf8.decode(data.subarray(space + 1, offset + length - 1)); + const equals = record.indexOf("="); + records[record.slice(0, equals)] = record.slice(equals + 1); + offset += length; + } + return records; +} + +// The entry whose header starts at `offset`: its header, type flag, data and the offset of the next +// entry. +function readEntry(archive, offset) { + const header = archive.subarray(offset, offset + blockSize); + verifyChecksum(header); + const size = number(header, 124, 12); + const start = offset + blockSize; + if (start + size > archive.length) + throw new Error("Truncated tar archive"); + return { + header, + type: header[156] === 0 ? "0" : String.fromCharCode(header[156]), + data: archive.subarray(start, start + size), + next: start + Math.ceil(size / blockSize) * blockSize, + }; +} + +// An archive ends at two zero blocks; one is enough to stop. +function isEnd(archive, offset) { + return offset + blockSize > archive.length || archive.subarray(offset, offset + blockSize).every((byte) => byte === 0); +} + +// The name field of a ustar header, after its prefix field. +function headerPath(header) { + const name = text(header, 0, 100); + const prefix = text(header, 257, 5) === "ustar" ? text(header, 345, 155) : ""; + return prefix ? `${prefix}/${name}` : name; +} + +// Entries naming the next one: a pax extended header and a GNU long name. A pax global header names +// nothing WebFront uses. +const nameEntries = { + x: (names, data) => ({...names, pax: paxRecords(data).path}), + L: (names, data) => ({...names, long: text(data, 0, data.length)}), + g: (names) => names, +}; + +// Reads a tar archive (ustar, with pax and GNU long names) and returns its regular files as +// {path, bytes}, in archive order. Directories, links and other entries are skipped. +export function readTar(archive) { + const files = []; + let names = {}; + for (let offset = 0; !isEnd(archive, offset);) { + const {header, type, data, next} = readEntry(archive, offset); + offset = next; + if (Object.hasOwn(nameEntries, type)) { + names = nameEntries[type](names, data); + continue; + } + if (type === "0" || type === "7") + files.push({path: names.pax ?? names.long ?? headerPath(header), bytes: data}); + names = {}; + } + return files; +} diff --git a/js/developer/tools/build.mjs b/js/developer/tools/build.mjs index 5924ad70..1d8c2af1 100644 --- a/js/developer/tools/build.mjs +++ b/js/developer/tools/build.mjs @@ -18,16 +18,13 @@ const options = { absWorkingDir: root, bundle: true, format: 'esm', platform: 'browser', target: 'es2020', minify: true, legalComments: 'inline', nodePaths: [resolve(root, 'js/developer/vendor/node_modules')], - plugins: [{name: 'terminal-assets', setup(build) { - build.onResolve({filter: /^\.\/(xterm|addon-fit)\.mjs$/}, args => ({path: resolve(root, 'third_party/xterm', args.path)})); - }}], }; await build({...options, entryPoints: ['js/developer/environment/runtime.mjs'], outfile: resolve(output, 'runtime.mjs')}); await build({...options, entryPoints: ['js/developer/environment/compiler.mjs'], outfile: resolve(output, 'compiler.mjs')}); await build({...options, entryPoints: ['js/developer/environment/script-worker.mjs'], outfile: resolve(output, 'script-worker.mjs')}); await build({...options, entryPoints: ['js/developer/environment/typecheck-worker.mjs'], outfile: resolve(output, 'typecheck-worker.mjs')}); await copyFile(resolve(root, 'js/developer/vendor/node_modules/esbuild-wasm/esbuild.wasm'), resolve(output, 'esbuild.wasm')); -await copyFile(resolve(root, 'third_party/xterm/xterm.css'), resolve(output, 'xterm.css')); +await copyFile(resolve(root, 'js/developer/vendor/node_modules/@xterm/xterm/css/xterm.css'), resolve(output, 'xterm.css')); const distribution = JSON.parse(await readFile(resolve(root, 'js/developer/tools/distribution.json'))); const version = distribution.version; const publicBase = baseUrl(distribution.baseUrl); @@ -36,8 +33,8 @@ const dependencies = JSON.parse(await readFile(resolve(root, 'js/developer/vendo const licenses = [ ['esbuild-wasm', 'js/developer/vendor/node_modules/esbuild-wasm/LICENSE.md'], ['semver', 'js/developer/vendor/node_modules/semver/LICENSE'], - ['xterm', 'third_party/xterm/LICENSE'], - ['xterm Fit addon', 'third_party/xterm/addon-fit-LICENSE'], + ['xterm', 'js/developer/vendor/node_modules/@xterm/xterm/LICENSE'], + ['xterm Fit addon', 'js/developer/vendor/node_modules/@xterm/addon-fit/LICENSE'], ['fflate', 'third_party/fflate/LICENSE'], ]; const notices = []; @@ -81,7 +78,7 @@ if (refresh) { await copyFile(resolve(root, 'js/developer/vendor/node_modules/semver/LICENSE'), resolve(root, 'js/developer/environment/PACKAGES-LICENSE.txt')); await writeFile(resolve(root, 'include/webfront/system/DeveloperReleaseData.hpp'), header); const inputs = {}; - for (const path of ['js/developer/environment/manifest.mjs', 'js/developer/environment/project.mjs', 'js/developer/environment/installer.mjs', 'js/developer/environment/restore.mjs', 'js/developer/environment/cache.mjs', 'js/developer/environment/scripts.mjs', 'js/developer/environment/script-worker.mjs', 'js/developer/environment/permissions.mjs', 'js/developer/environment/typecheck.mjs', 'js/developer/environment/typecheck-snapshot.mjs', 'js/developer/environment/typecheck-worker.mjs', 'js/developer/environment/packages-entry.mjs', 'js/developer/environment/bootstrap.mjs', 'js/developer/environment/bootstrap-entry.mjs', 'js/developer/environment/packages.mjs', 'js/developer/environment/starter.mjs', 'js/developer/environment/paths.mjs', 'js/developer/environment/runtime.mjs', 'js/developer/environment/terminal.mjs', 'js/developer/environment/commands.mjs', 'js/developer/environment/compiler.mjs', 'js/developer/environment/bundler.mjs', 'js/developer/environment/entry.mjs', 'js/developer/environment/conditions.mjs', 'js/developer/environment/io.mjs', 'js/developer/environment/recipe.mjs', 'js/developer/environment/registry.mjs', 'js/developer/environment/archive.mjs', 'js/developer/environment/lock.mjs', 'js/developer/environment/pins.mjs', 'js/developer/environment/peers.mjs', 'js/developer/environment/resolve.mjs', 'js/developer/environment/embed.mjs', 'js/developer/tools/starters/pi/main.tsx', 'js/developer/tools/starters/pi/style.css', 'examples/life/ui/main.tsx', 'examples/life/ui/style.css', 'js/developer/components/tools/wf.mjs', 'js/developer/tools/distribution.json', 'js/developer/tools/build.mjs', 'js/developer/tools/site.mjs', 'js/developer/tools/archive.mjs', 'js/developer/vendor/package-lock.json', 'js/core/bootstrap/bootstrap.bundle.mjs', 'js/developer/environment/packages.bundle.mjs', 'include/webfront/system/DeveloperReleaseData.hpp']) + for (const path of ['js/developer/environment/manifest.mjs', 'js/developer/environment/project.mjs', 'js/developer/environment/installer.mjs', 'js/developer/environment/restore.mjs', 'js/developer/environment/cache.mjs', 'js/developer/environment/scripts.mjs', 'js/developer/environment/script-worker.mjs', 'js/developer/environment/permissions.mjs', 'js/developer/environment/typecheck.mjs', 'js/developer/environment/typecheck-snapshot.mjs', 'js/developer/environment/typecheck-worker.mjs', 'js/developer/environment/packages-entry.mjs', 'js/developer/environment/bootstrap.mjs', 'js/developer/environment/bootstrap-entry.mjs', 'js/developer/environment/packages.mjs', 'js/developer/environment/starter.mjs', 'js/developer/environment/paths.mjs', 'js/developer/environment/runtime.mjs', 'js/developer/environment/terminal.mjs', 'js/developer/environment/tarball.mjs', 'js/developer/environment/commands.mjs', 'js/developer/environment/compiler.mjs', 'js/developer/environment/bundler.mjs', 'js/developer/environment/entry.mjs', 'js/developer/environment/conditions.mjs', 'js/developer/environment/io.mjs', 'js/developer/environment/recipe.mjs', 'js/developer/environment/registry.mjs', 'js/developer/environment/archive.mjs', 'js/developer/environment/lock.mjs', 'js/developer/environment/pins.mjs', 'js/developer/environment/peers.mjs', 'js/developer/environment/resolve.mjs', 'js/developer/environment/embed.mjs', 'js/developer/tools/starters/pi/main.tsx', 'js/developer/tools/starters/pi/style.css', 'examples/life/ui/main.tsx', 'examples/life/ui/style.css', 'js/developer/tools/distribution.json', 'js/developer/tools/build.mjs', 'js/developer/tools/site.mjs', 'js/developer/tools/archive.mjs', 'js/developer/vendor/package-lock.json', 'js/core/bootstrap/bootstrap.bundle.mjs', 'js/developer/environment/packages.bundle.mjs', 'include/webfront/system/DeveloperReleaseData.hpp']) inputs[path] = createHash('sha256').update(await readFile(resolve(root, path))).digest('hex'); await writeFile(resolve(root, 'js/developer/environment/bundles.json'), JSON.stringify(inputs, null, 2) + '\n'); for (const [source, name] of [['js/core/bootstrap/index.html', 'DeveloperIndexHtmlData'], ['js/core/bootstrap/bootstrap.bundle.mjs', 'DeveloperBootstrapData']]) diff --git a/js/developer/tools/check.mjs b/js/developer/tools/check.mjs index c12bd47f..422b9c0e 100644 --- a/js/developer/tools/check.mjs +++ b/js/developer/tools/check.mjs @@ -9,6 +9,7 @@ import {generateProvider, compress} from '../environment/embed.mjs'; import {environmentFiles, bootstrap} from '../environment/bootstrap.mjs'; import {publish, responseBytes} from '../environment/io.mjs'; import {tar} from './archive.mjs'; +import {parseSpec, verifyIntegrity, gunzip, readTar} from '../environment/tarball.mjs'; const encoder = new TextEncoder(); const encode = value => encoder.encode(typeof value === 'string' ? value : JSON.stringify(value)); @@ -199,3 +200,23 @@ test('a pinned cached environment bootstraps offline and failed refreshes preser test('compressed downloads stop at their byte limit', async () => { await assert.rejects(responseBytes(new Response(new Uint8Array(9)), 8), /byte limit/); }); + +test('npm tarballs: package specs, integrity, bounded gunzip and tar entries', async () => { + assert.deepEqual(parseSpec('plot'), {name: 'plot', version: ''}); + assert.deepEqual(parseSpec('plot@1.2.0'), {name: 'plot', version: '1.2.0'}); + assert.deepEqual(parseSpec('@acme/plot'), {name: '@acme/plot', version: ''}); + assert.deepEqual(parseSpec('@acme/plot@next'), {name: '@acme/plot', version: 'next'}); + const files = new Map([['package/package.json', encode({name: 'plot'})], ['package/dist/index.js', encode('x')]]); + const archive = compress(tar(files)); + assert.equal(await verifyIntegrity(archive, `sha1-ignored ${integrity(archive)}`), integrity(archive)); + await assert.rejects(verifyIntegrity(archive, integrity(encode('other'))), /Integrity check failed/); + await assert.rejects(verifyIntegrity(archive, 'sha1-only'), /no SHA-512 integrity/); + const unpacked = await gunzip(archive); + assert.deepEqual(readTar(unpacked).map(entry => entry.path).sort(), [...files.keys()].sort()); + await assert.rejects(gunzip(archive, unpacked.length - 1), /unpacks to more than/); + assert.deepEqual(readTar(new Uint8Array(1024)), []); + const corrupt = unpacked.slice(); + corrupt[148] ^= 1; + assert.throws(() => readTar(corrupt), /Corrupt tar header/); +}); + From f2149111700970dc252bc7e45dbb6f5ca0040d71 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 08:32:35 +0200 Subject: [PATCH 047/134] Remove the terminal component and the wf tool manager [#313] The developer environment's terminal and webfront::Commands replace them: - removed webfront::Terminal, terminal::Shell, webfront::ToolManager, fs::TerminalFS, fs::ToolManagerFS, fs::ToolStore, fs::PackageFS, their embedded modules and pages, the embedded xterm.js headers, third_party/xterm and cmake/UpdateXterm.cmake; - removed their Catch2 tests, the terminal and tools Jasmine specs and the fake tool registry; the safe path cases move to SafePathTests.cpp, the browser integration test keeps the bridge, content policy and React specs; - docs/UI_COMPONENTS.md now gives the replacement and the migration of terminal::Shell commands to webfront::Commands; ADR-010 is revised (1.7). --- .gitattributes | 11 - .github/workflows/DeveloperDistribution.yml | 2 - AGENTS.md | 6 +- cmake/UpdateXterm.cmake | 39 - docs/CHANGELOG.md | 9 + docs/DEVELOPER_ENVIRONMENT.md | 5 +- docs/EMBEDDED_ASSETS.md | 11 +- docs/PROJECT_STATUS.md | 14 +- docs/UI_COMPONENTS.md | 295 +-- ...DR-002-systemes-de-fichiers-composables.md | 6 +- ...ADR-010-composants-et-outils-optionnels.md | 16 +- docs/adr/ADR-016-bootstrap-comme-socle.md | 4 +- docs/adr/README.md | 2 +- include/webfront/components/Terminal.hpp | 360 --- include/webfront/components/ToolManager.hpp | 205 -- include/webfront/system/DefaultFS.hpp | 2 +- include/webfront/system/PackageFS.hpp | 91 - include/webfront/system/TerminalFS.hpp | 44 - .../webfront/system/TerminalIndexHtmlData.hpp | 33 - .../webfront/system/TerminalModuleData.hpp | 343 --- include/webfront/system/ToolManagerFS.hpp | 28 - .../webfront/system/ToolManagerModuleData.hpp | 393 --- include/webfront/system/ToolStore.hpp | 476 ---- include/webfront/system/XtermCssData.hpp | 81 - include/webfront/system/XtermFitAddonData.hpp | 38 - include/webfront/system/XtermModuleData.hpp | 2315 ----------------- js/core/WebFrontAssets.cmake | 21 - js/developer/components/terminal/index.html | 21 - js/developer/components/terminal/terminal.mjs | 360 --- js/developer/components/tools/wf.mjs | 341 --- js/developer/vendor/check.mjs | 3 - test/unit/CMakeLists.txt | 4 +- test/unit/ModuleHTTPServerTests.cpp | 10 +- test/unit/SafePathTests.cpp | 47 + test/unit/TerminalFSTests.cpp | 90 - test/unit/TerminalTests.cpp | 268 -- test/unit/ToolManagerTests.cpp | 306 --- test/unit/ToolStoreTests.cpp | 532 ---- test/web/JasmineTest.cpp | 63 +- test/web/SpecRunner.html | 1 - test/web/js/terminal-specs.mjs | 162 -- test/web/js/tools-specs.mjs | 271 -- test/web/js/webfront-specs.mjs | 2 - test/web/registry/make_fixture.py | 81 - test/web/registry/search.json | 12 - .../tarballs/webfront-test-tool-1.0.0.tgz | Bin 1090 -> 0 bytes test/web/registry/webfront-test-corrupt | 16 - test/web/registry/webfront-test-tool | 16 - third_party/xterm/LICENSE | 21 - third_party/xterm/VERSION | 2 - third_party/xterm/addon-fit-LICENSE | 19 - third_party/xterm/addon-fit.mjs | 18 - third_party/xterm/xterm.css | 285 -- third_party/xterm/xterm.mjs | 53 - 54 files changed, 121 insertions(+), 7733 deletions(-) delete mode 100644 cmake/UpdateXterm.cmake delete mode 100644 include/webfront/components/Terminal.hpp delete mode 100644 include/webfront/components/ToolManager.hpp delete mode 100644 include/webfront/system/PackageFS.hpp delete mode 100644 include/webfront/system/TerminalFS.hpp delete mode 100644 include/webfront/system/TerminalIndexHtmlData.hpp delete mode 100644 include/webfront/system/TerminalModuleData.hpp delete mode 100644 include/webfront/system/ToolManagerFS.hpp delete mode 100644 include/webfront/system/ToolManagerModuleData.hpp delete mode 100644 include/webfront/system/ToolStore.hpp delete mode 100644 include/webfront/system/XtermCssData.hpp delete mode 100644 include/webfront/system/XtermFitAddonData.hpp delete mode 100644 include/webfront/system/XtermModuleData.hpp delete mode 100644 js/developer/components/terminal/index.html delete mode 100644 js/developer/components/terminal/terminal.mjs delete mode 100644 js/developer/components/tools/wf.mjs create mode 100644 test/unit/SafePathTests.cpp delete mode 100644 test/unit/TerminalFSTests.cpp delete mode 100644 test/unit/TerminalTests.cpp delete mode 100644 test/unit/ToolManagerTests.cpp delete mode 100644 test/unit/ToolStoreTests.cpp delete mode 100644 test/web/js/terminal-specs.mjs delete mode 100644 test/web/js/tools-specs.mjs delete mode 100644 test/web/registry/make_fixture.py delete mode 100644 test/web/registry/search.json delete mode 100644 test/web/registry/tarballs/webfront-test-tool-1.0.0.tgz delete mode 100644 test/web/registry/webfront-test-corrupt delete mode 100644 test/web/registry/webfront-test-tool delete mode 100644 third_party/xterm/LICENSE delete mode 100644 third_party/xterm/VERSION delete mode 100644 third_party/xterm/addon-fit-LICENSE delete mode 100644 third_party/xterm/addon-fit.mjs delete mode 100644 third_party/xterm/xterm.css delete mode 100644 third_party/xterm/xterm.mjs diff --git a/.gitattributes b/.gitattributes index 82f4bab2..5c17cdc9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -58,19 +58,8 @@ js/core/fallback/index.html text eol=lf js/core/fallback/webfront-fallback.mjs text eol=lf include/webfront/system/FallbackIndexHtmlData.hpp text eol=lf include/webfront/system/FallbackModuleData.hpp text eol=lf -js/developer/components/terminal/* text eol=lf -js/developer/components/tools/* text eol=lf -include/webfront/system/ToolManagerModuleData.hpp text eol=lf -third_party/xterm/* text eol=lf -include/webfront/system/TerminalIndexHtmlData.hpp text eol=lf -include/webfront/system/TerminalModuleData.hpp text eol=lf -include/webfront/system/XtermModuleData.hpp text eol=lf -include/webfront/system/XtermCssData.hpp text eol=lf -include/webfront/system/XtermFitAddonData.hpp text eol=lf # The fake npm registry of the browser integration test: its packuments are served byte for byte. -test/web/registry/* text eol=lf -test/web/registry/tarballs/* binary # Serialisation *.json text diff --git a/.github/workflows/DeveloperDistribution.yml b/.github/workflows/DeveloperDistribution.yml index c7f9fec1..46c039e6 100644 --- a/.github/workflows/DeveloperDistribution.yml +++ b/.github/workflows/DeveloperDistribution.yml @@ -6,7 +6,6 @@ on: branches: [develop, master] paths: - 'js/developer/environment/**' - - 'js/developer/components/tools/**' - 'js/developer/tools/starters/pi/**' - 'examples/life/ui/**' - 'js/developer/tools/**' @@ -17,7 +16,6 @@ on: branches: [develop, master] paths: - 'js/developer/environment/**' - - 'js/developer/components/tools/**' - 'js/developer/tools/starters/pi/**' - 'examples/life/ui/**' - 'js/developer/tools/**' diff --git a/AGENTS.md b/AGENTS.md index 37cebe00..6782434e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -17,17 +17,15 @@ The README introduces WebFront through the Game of Life walkthrough, demonstrati - `include/webfront/weblink/`: bridge message encoding and routing. - `include/webfront/system/`: layered virtual filesystems and embedded web resources. - `include/webfront/frontend/`: system-browser, CEF, optional Windows WebView2 and macOS WKWebView frontend adapters. -- `include/webfront/components/`: opt-in UI components (`Terminal.hpp`, `ToolManager.hpp`); their assets are served by embedded providers such as `include/webfront/system/TerminalFS.hpp`, and installed tools by `include/webfront/system/PackageFS.hpp` from `ToolStore.hpp`'s project directory. - `examples/`: only Hello World (`hello-world/`) and Game of Life (`life/`, with console, developer and embedded stages). -- `js/core/`: readable browser bridge, fallback and bootstrap loader compiled into `include/webfront/`, plus the embedding CMake modules; `js/developer/`: developer environment, terminal/`wf` components, build and vendoring tools. Production C++ remains header-only in `include/webfront/`. +- `js/core/`: readable browser bridge, fallback and bootstrap loader compiled into `include/webfront/`, plus the embedding CMake modules; `js/developer/`: developer environment (its terminal and `wf`), build and vendoring tools. Production C++ remains header-only in `include/webfront/`. - `js/developer/tools/starters/pi/`, `test/fixtures/`, `test/web/fixtures/`: retained package and regression fixtures, not public example applications. - `test/unit/`: Catch2 unit tests; `test/web/`: Jasmine real-browser integration test; `test/fuzz/`, `test/fixtures/`; `test/cmake/`: CMake test scripts and sub-projects. The `RepositoryLayout` CTest case pins the tracked root. - `cmake/`: build modules (frontends, CEF, CPM, compiler options); `.github/`: workflows, `.github/CONTRIBUTING.md`. - `.devcontainer/`: devcontainer and its Dockerfile; `docs/`: documentation, `docs/CHANGELOG.md`, `docs/Doxyfile.in`. -- `third_party/xterm/`: vendored xterm.js distribution embedded by the terminal component; refresh it only with `cmake/UpdateXterm.cmake`. - `docs/PROJECT_STATUS.md`: evidence-based status snapshot and known limitations. - `docs/adr/README.md`: architecture decision index, Git history, tradeoffs and implementation rules; read the relevant ADRs before changing their contracts. -- `docs/UI_COMPONENTS.md`: UI component architecture, the terminal component and the planned `wf` tool manager. +- `docs/UI_COMPONENTS.md`: what replaced the removed terminal component and `wf` tool manager, with the migration to `webfront::Commands`. - `docs/ISSUE_AUDIT.md`: recommendations for the current GitHub backlog. The historical `webfront/` prototype and the former top-level `webtest/` are gone: use `test/unit/` for current C++ tests and `test/web/` for browser tests. Do not revive legacy code without a specific issue and regression coverage. diff --git a/cmake/UpdateXterm.cmake b/cmake/UpdateXterm.cmake deleted file mode 100644 index 5867c7dc..00000000 --- a/cmake/UpdateXterm.cmake +++ /dev/null @@ -1,39 +0,0 @@ -# Maintenance script, not part of the build: refreshes the vendored xterm.js files in -# third_party/xterm from the npm registry (network access required), then regenerate the embedded -# headers with the webfront-embedded-assets target and review the diff. -# -# cmake -DXTERM_VERSION=6.0.0 -DFIT_VERSION=0.11.0 -P cmake/UpdateXterm.cmake - -cmake_minimum_required(VERSION 3.31) - -if(NOT DEFINED XTERM_VERSION OR NOT DEFINED FIT_VERSION) - message(FATAL_ERROR "Set XTERM_VERSION and FIT_VERSION, e.g. -DXTERM_VERSION=6.0.0 -DFIT_VERSION=0.11.0") -endif() - -get_filename_component(root "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) -set(destination "${root}/third_party/xterm") -string(RANDOM LENGTH 8 suffix) -set(work "${CMAKE_CURRENT_BINARY_DIR}/webfront-xterm-update-${suffix}") - -function(_fetch_package url archive) - file(DOWNLOAD "${url}" "${archive}" STATUS status TLS_VERIFY ON) - list(GET status 0 code) - if(NOT code EQUAL 0) - message(FATAL_ERROR "Download of ${url} failed: ${status}") - endif() -endfunction() - -_fetch_package("https://registry.npmjs.org/@xterm/xterm/-/xterm-${XTERM_VERSION}.tgz" "${work}/xterm.tgz") -_fetch_package("https://registry.npmjs.org/@xterm/addon-fit/-/addon-fit-${FIT_VERSION}.tgz" "${work}/fit.tgz") -file(ARCHIVE_EXTRACT INPUT "${work}/xterm.tgz" DESTINATION "${work}/xterm") -file(ARCHIVE_EXTRACT INPUT "${work}/fit.tgz" DESTINATION "${work}/fit") - -file(COPY_FILE "${work}/xterm/package/lib/xterm.mjs" "${destination}/xterm.mjs") -file(COPY_FILE "${work}/xterm/package/css/xterm.css" "${destination}/xterm.css") -file(COPY_FILE "${work}/xterm/package/LICENSE" "${destination}/LICENSE") -file(COPY_FILE "${work}/fit/package/lib/addon-fit.mjs" "${destination}/addon-fit.mjs") -file(COPY_FILE "${work}/fit/package/LICENSE" "${destination}/addon-fit-LICENSE") -file(WRITE "${destination}/VERSION" "@xterm/xterm ${XTERM_VERSION}\n@xterm/addon-fit ${FIT_VERSION}\n") -file(REMOVE_RECURSE "${work}") - -message(STATUS "Updated ${destination}; now run: cmake --build --target webfront-embedded-assets") diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d88d0611..ab5b192d 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -49,6 +49,15 @@ `json::Reader::array`. `cppFunction` returns false when the name was already registered, and `hasCppFunction(name)` tells whether it is. +### Removed + +- **Breaking:** the terminal component and the `wf` tool manager (#313): `webfront::Terminal`, `terminal::Shell`, + `webfront::ToolManager`, `fs::TerminalFS`, `fs::ToolManagerFS`, `fs::ToolStore`, `fs::PackageFS`, their embedded + modules, the embedded xterm.js copy, `third_party/xterm` and `cmake/UpdateXterm.cmake`. The developer environment's + terminal and `webfront::Commands` replace them; `docs/UI_COMPONENTS.md` describes the migration. xterm.js is a + locked dependency of the environment archive. `fs::tools::safeRelativePath` becomes `fs::safeRelativePath` + (``). + ### Changed - **Breaking:** `BasicWF::getLink(id)`, whose reference could outlive a released connection, is replaced by diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 8da1c0b7..e952d8f3 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -359,7 +359,7 @@ open, Enter starts a new session. No system shell is exposed. sent in pieces below the 65,535-byte limit of bridge strings. An application adds its own commands with `webfront::Commands` (``), which replaces -`terminal::Shell` of the standalone terminal component. A command is a coroutine: +`terminal::Shell` of the removed terminal component ([migration](UI_COMPONENTS.md)). A command is a coroutine: ```cpp #include @@ -418,8 +418,7 @@ writing large output with it, faster than the browser reads, grows the connectio Preview/embed consume the locked local files without resolving versions again. - Unpacked packages are cached by name, version and integrity under `.webfront/developer/packages/`, each with a record of its files' digests. A failed install can leave unused cached packages, but the lock - file remains unchanged. A lock naming more than 512 packages is refused. The tools - installed by the existing `ToolManager` keep their separate store and `webfront-tools.lock.json`. + file remains unchanged. A lock naming more than 512 packages is refused. - Published environment/preview resources are served under `/webfront/developer/`. The protected `/WebFront.js` remains the library's version. Sources, staging and cached archives are not HTTP routes. Project reads and publications reject traversal and escaping symlinks. This does not diff --git a/docs/EMBEDDED_ASSETS.md b/docs/EMBEDDED_ASSETS.md index b11c10a3..de417a1f 100644 --- a/docs/EMBEDDED_ASSETS.md +++ b/docs/EMBEDDED_ASSETS.md @@ -25,7 +25,9 @@ Babel is served at `/babel-standalone@8.0.7/babel.min.js`. Jasmine 7 boots its globals from `jasmine.js`; its single `boot.js` installs the HTML reporter and starts the suite on window load. The runner serves `/jasmine/7.0.2/` and awaits the final C++ reporting Promise. The favicon is served as its original PNG, without an extra gzip layer. -The terminal keeps its existing `webfront/components/terminal/` URLs and MIME types. +xterm.js and its fit addon are no longer embedded: they are locked dependencies +(`js/developer/vendor/package.json`) bundled into the developer environment archive by +`js/developer/tools/build.mjs`. ## Maintenance @@ -37,8 +39,6 @@ Run from the repository root: # Online, maintenance only: exact versions and transitive integrity hashes are in package-lock.json. npm ci --prefix js/developer/vendor --ignore-scripts node js/developer/vendor/update.mjs -# Refresh xterm only through its dedicated script, retaining readable upstream files and licenses. -cmake -DXTERM_VERSION=6.0.0 -DFIT_VERSION=0.11.0 -P cmake/UpdateXterm.cmake # Offline after C++ dependencies are configured; npm/node_modules is not required here. cmake --build build --target webfront-embedded-assets @@ -49,9 +49,8 @@ ctest --test-dir build -R 'Asset.*Fresh|EmbeddedGzipContents|EmbeddedAssetGenera `package-lock.json` pins the npm tarball URLs, integrity hashes, scheduler 0.28.0 and esbuild 0.28.2. When upgrading, recheck the registry's stable tags, update exact versions and the lockfile, then review sources, routes, tests, version inventory and size measurements together. -`cmake/UpdateXterm.cmake` takes exact versions explicitly and records them in -`third_party/xterm/VERSION`. `js/developer/vendor/update.mjs` records the other versions alongside -their distribution files in `third_party/`. +`js/developer/vendor/update.mjs` records the versions alongside their distribution files in +`third_party/`. `js/core/EmbedTextAsset.cmake` delegates rendering and exact byte comparison to `js/developer/vendor/embed.mjs`. It assembles bounded lines of five 64-bit words and joins them diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index 1fcd1647..4f456561 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -318,15 +318,11 @@ See [WebKitGTK notes](WEBKITGTK.md). ## UI components: the terminal and the tool manager -- First opt-in UI component (#230), designed in [UI_COMPONENTS.md](UI_COMPONENTS.md): `webfront::Terminal` (`include/webfront/components/Terminal.hpp`) registers C++ commands behind an embedded xterm.js 6.0.0 terminal (`fs::TerminalFS`, served under `webfront/components/terminal/`; composed with `fs::DefaultFSWith<>`). The standalone terminal target was removed in 0.4; see the component API example in [UI_COMPONENTS.md](UI_COMPONENTS.md). The bridge protocol is unchanged. -- Line editing, history and Tab completion run in the browser; C++ receives whole lines and returns the output as the Promise result. A command exception rejects the Promise and is printed as an error. Output is capped at 60000 bytes because bridge strings carry a 16-bit length. -- Covered by Catch2 (`TerminalTests.cpp`, `TerminalFSTests.cpp`), five asset freshness CTest cases and Jasmine specs (`test/web/js/terminal-specs.mjs`) in the browser integration test. -- Verified 2026-10-14 on Linux (GCC 16.1, Unix Makefiles generator): CEF-off build with all 100 CTest cases passing; the example driven in headless Chromium (commands, errors, quoting, completion, history, `help`, `clear`); and the Jasmine suite, terminal specs included, run in headless Chromium through a scratch copy of the runner that replaces `CEFFrontend`. A deliberately broken terminal spec made that run fail. **Not verified:** the CEF/Xvfb CTest itself, Windows, macOS and Clang. -- Limitations: no output streaming, no cancellation, no per-browser sessions, and single-row line redraw (see the design note). -- The `wf` tool manager (#234, npm-hosted web tools installed during debugging): `webfront::ToolManager` (`include/webfront/components/ToolManager.hpp`) stores tools with `fs::ToolStore` under `.webfront/tools/`, records them in `webfront-tools.lock.json`, serves them with `fs::PackageFS` under `webfront/tools/` and runs `wf list`, `wf remove` and `wf help` in C++. `wf search`, `wf install` and `wf open` run in the page, in `wf.mjs` (`js/developer/components/tools/`, served by `fs::ToolManagerFS`), a terminal extension module loaded through the new `Terminal::extension()`: it fetches the packument and tarball, checks the SHA-512 `dist.integrity` with `crypto.subtle`, gunzips with `DecompressionStream`, reads the ustar archive (pax and prefixed paths included) and sends the files in 256 KiB chunks through `webfront.pkg.*`, after refusing archives unpacking to more than 256 MiB. Ctrl+C interrupts it through the `signal` the terminal passes to browser commands. The registry is set by `ToolManagerOptions::registry`. The standalone tools target was removed in 0.4; the component remains documented in [UI_COMPONENTS.md](UI_COMPONENTS.md). Covered by `ToolStoreTests.cpp`, `ToolManagerTests.cpp`, `TerminalTests.cpp` and the Jasmine specs `test/web/js/tools-specs.mjs`, which install a fixture package from a fake registry served by the test (`test/web/registry/`, regenerated by `make_fixture.py`) into a temporary directory. -- Verified 2026-10-15 on macOS (Apple clang, CEF off): all CTest cases pass except `AddSubdirectoryConsumer`, which fails locally because of the outdated libc++ headers of the Command Line Tools; the Jasmine suite, tools specs included, run in Chromium through a scratch copy of the runner that replaces `CEFFrontend` (one terminal spec, "reports an application without terminal functions", fails there as it does on develop, because that browser gave its unsized terminal a two-column width); `WebFrontTools` driven against registry.npmjs.org (`wf help`, `wf search`, `wf list`, `wf install left-pad` downloaded, verified and refused as not a tool). **Not verified locally:** the CEF/Xvfb CTest (Linux only; the macOS CEF build of `webtest` fails inside stdexec), Windows. -- Limitations of the tool manager: no semver ranges (an exact version or a dist-tag), no dependencies (a tool must bundle what it uses), no progress bar beyond step messages, sequential chunk uploads, and the trust model of `npm install`. -- Found while building it: the C++ encoder wrapped the 16-bit length of strings over 65535 bytes (#231, fixed: such strings now fail explicitly, see "Implemented baseline"); `MimeType::toString()` mapped `csv` to `text/css` (#232, fixed: a `static_assert` now ties the name table to the enum); with GCC 16.1 and the Ninja generator, CMake's module dependency scanning (`-fmodules-ts`) crashes the compiler inside stdexec, while Unix Makefiles builds work. +- Removed (#313, with #308): `webfront::Terminal`, `webfront::ToolManager`, `fs::TerminalFS`, `fs::ToolManagerFS`, + `fs::ToolStore`, `fs::PackageFS`, their embedded modules and xterm.js headers, `third_party/xterm` and + `cmake/UpdateXterm.cmake`, with their Catch2 and Jasmine tests and the fake tool registry. The environment's + terminal and `webfront::Commands` replace them ([UI_COMPONENTS.md](UI_COMPONENTS.md) has the migration); + `fs::safeRelativePath` moved to `SafePath.hpp`, the tarball helpers of `wf.mjs` to `js/developer/environment/tarball.mjs`. ## Intended product diff --git a/docs/UI_COMPONENTS.md b/docs/UI_COMPONENTS.md index 049d13f9..31361f11 100644 --- a/docs/UI_COMPONENTS.md +++ b/docs/UI_COMPONENTS.md @@ -1,280 +1,43 @@ # UI components -Status: design note, 2026-10-15. Stage 1 (the terminal component, #230) and stage 2 (the `wf` tool -manager, #234) are implemented. +Status: removed (#313, delivered with #308). The opt-in terminal component (`webfront::Terminal`, +`fs::TerminalFS`, #230) and the `wf` tool manager (`webfront::ToolManager`, `fs::ToolStore`, +`fs::PackageFS`, `fs::ToolManagerFS`, #234) are gone, with their embedded xterm.js copy. Their design +notes remain in the Git history of this file. -WebFront's core is a server and a bridge. A *UI component* is a reusable piece of browser UI with a -C++ façade, packaged so that an application gets it from a header include. The first component is an -interactive terminal: it is useful on its own (a command-line interface to a C++ application) and is -the host for the planned tool manager. +They are replaced by the developer environment, downloaded and verified by +`NativeApp::bootstrap("developer")` ([DEVELOPER_ENVIRONMENT](DEVELOPER_ENVIRONMENT.md)): -## Anatomy of a component - -A component has four parts. - -| Part | Rule | Terminal | -| --- | --- | --- | -| Assets | An embedded `fs::Provider` serving under the reserved prefix `webfront/components//`, so it never collides with a development document root or the application's own pages. Readable sources live in `js/developer/components//`, third-party code in `third_party/`, and generated headers are checked in and kept fresh by CTest, like `WebFront.js`. | `fs::TerminalFS` (`include/webfront/system/TerminalFS.hpp`) | -| Browser module | A native ES module exporting `mount(element, options)`. It depends only on the global `webFront` bridge and its own assets (relative imports), and waits for `webFront.ready`. | `js/developer/components/terminal/terminal.mjs` | -| C++ façade | A header under `include/webfront/components/` that registers its bridge functions under `webfront..`. `BasicWF::cppFunction` ignores a second registration of the same name, so the prefix is what keeps components and applications apart. | `webfront::Terminal` (`include/webfront/components/Terminal.hpp`) | -| Wire format | Only the existing bridge types: scalars, strings (at most 65535 bytes), tuples and numeric typed arrays. Lists of words cross as `"\n"`-separated strings. A component never changes `Messages.hpp` or `WebFront.js`. | `run(line) -> output`, `complete(line) -> candidates` | - -Assets are added to an application through its filesystem type. `fs::DefaultFSWith` is -`fs::DefaultFS` with extra providers placed after the protected `WebFront.js` and before the -document root, so a development root can neither replace the bridge nor shadow a component file: - -```cpp -using TerminalApp = webfront::BasicWF>; -``` - -Components are opt-in. `webfront::WebFront` does not include their assets, so its binary does not -grow, and `#include ` alone does not pull them in. - -## The terminal component - -```cpp -#include -#include - -int main() { - webfront::TerminalApp app; - webfront::Terminal terminal{app, {.prompt = "demo> "}}; - terminal.command("greet", "Greet someone", [](webfront::CommandArgs args) { - return "Hello, " + (args.empty() ? std::string{"world"} : args[0]) + "!"; - }); - app.show(terminal.page); -} -``` - -The snippet above shows the standalone component API. The [Life walkthrough](../README.md#game-of-life-from-console-to-native-application) demonstrates the downloaded developer terminal. - -- **Rendering:** [xterm.js](https://xtermjs.org/) 6.0.0 and its fit addon 0.11.0 (MIT; the terminal used by - VS Code, Tabby and Hyper), vendored verbatim in `third_party/xterm/` and embedded as reproducible gzip (95,272 bytes including word padding). - See [embedded asset maintenance](EMBEDDED_ASSETS.md) for pinned sources, licenses and regeneration commands. - ghostty-web, Ghostty's emulator compiled to WebAssembly with an xterm-compatible API, was - considered and set aside for now: it is under heavy development and supports Chrome only. -- **Line editing happens in the browser.** The editor in `terminal.mjs` handles insertion, left and - right, Home and End (also Ctrl+A and Ctrl+E), Backspace and Delete, Ctrl+U, history (up and down), - Tab completion of command names, Ctrl+C (cancel the line) and Ctrl+L (clear the screen). C++ - only receives validated lines, one at a time. The prompt stays locked until the Promise for the - line settles. -- **Commands** are registered by name with a help text and a handler of one of three shapes: - `(CommandArgs, std::ostream&)`, `(CommandArgs) -> R` or `() -> R`, where `R` is `void` or anything - that can be written to a `std::ostream`. `CommandArgs` is a `std::span` - without the command name. The line is split shell-style: single quotes are literal, double quotes - honor backslash escapes, and an unquoted backslash escapes the next character. `help` and `clear` - are built in. Duplicate, empty or whitespace-containing names throw `std::invalid_argument`. -- **Output and errors:** the command output is the Promise result, with `"\n"` converted to - `"\r\n"` and ANSI escape sequences passed through. An unknown command or a malformed line prints - a red message. An exception thrown by a command rejects the Promise, and the page prints - `Error: `. Output and error messages (which may quote the line) are capped at 60000 bytes, cut on a UTF-8 character boundary, with a - notice, because bridge strings carry a 16-bit length. -- **Lifetime and threads:** the registered bridge functions share ownership of the command - registry, so the `Terminal` object may go out of scope before the application. The registry is - guarded by a mutex: commands may be added while the server thread runs others, and commands run - on the server thread. - -### Limitations of the first version - -The developer environment's terminal (#308, [DEVELOPER_ENVIRONMENT](DEVELOPER_ENVIRONMENT.md#the-terminal-and-the-applications-commands)) -lifts all of them and replaces this component: streaming output, Ctrl+C for C++ commands (coroutines registered with -`webfront::Commands`), one session per browser, multi-row redraw with CJK and emoji widths, `exit`, persistent -history and multi-line paste. This component keeps them until its removal (#313): - -- Output appears when a command finishes. There is no streaming. A long command keeps the prompt - locked; Ctrl+C interrupts a browser command (below) but not a C++ one. -- Every connected browser shares the same commands. The terminal does not know which browser sent - a line. -- The line editor redraws within one terminal row, so a line wider than the terminal displays - incorrectly. Wide (CJK) characters count as one column. -- There is no `exit` command. With the system browser, `show()` waits for Enter on standard input, - and stopping the server from inside a command would drop the reply to that command. -- A multi-line paste runs its first line only. - -### Browser commands: terminal extensions - -Some commands must run in the page, such as a download over HTTPS. `Terminal::extension(url)` adds -a browser module that the page imports before it shows the prompt (the URLs are read from -`webfront.terminal.extensions()`). The module may export `commands`, an object mapping a command -name to `async (args, context) => output`. The page splits each line like C++ (`tokenize` in -`terminal.mjs`); when its first word names a browser command, the handler runs first. `context` -holds `line`, `bridge`, `write(text)` for progress output, `runInCpp()` and `signal`, an -`AbortSignal` that Ctrl+C aborts with the reason `Error("Interrupted")`. A handler returning -`undefined` lets C++ run the line, so one command can be split between the page and C++, as `wf` -is. A module that fails to load is reported in red and the terminal stays usable. - -## Core gaps found by the terminal - -These belong to the core, not to the component. Stage 1 did not change them; the first two are -now resolved: - -1. `onUIStarted` keeps a single handler, which a component would replace. Resolved by #233: - components call `subscribeUIStarted(handler)` and keep the returned `UISubscription`. -2. A `cppFunction` callback did not know which `UI` called it. Resolved by #233: a callback whose - first parameter is the application's `UI` receives the calling browser, so a component can answer - later or stream to it. -3. Outstanding calls cannot be cancelled (already listed in `PROJECT_STATUS.md`). -4. Bridge strings are limited to 65535 bytes. Until #231 the C++ encoder wrapped longer lengths and - corrupted the message; it now rejects them (the JavaScript encoder always did). The terminal caps - its output and error messages below that limit so they are shown rather than rejected. - -## Stage 2 design: the `wf` tool manager (#234) - -Goal: install web-based development tools (log viewers, memory or protocol inspectors, plotters…) -into a WebFront application while debugging it, the way `npm install` adds a package. - -### Packages - -A tool is an ordinary npm package whose `package.json` has a `webfront` field and the -`webfront-tool` keyword: - -```json -{ - "name": "@acme/webfront-plot", - "version": "1.2.0", - "keywords": ["webfront-tool"], - "webfront": { "kind": "tool", "title": "Live plot", "entry": "dist/index.html" } -} -``` - -Reusing npm provides hosting, versioning, `dist.integrity` hashes and search without running a -registry. - -### Commands - -`wf` is a terminal command, plus browser-side code for the network part (`wf.mjs`, a terminal -extension). `wf search`, `wf install` and `wf open` run in the page; `wf list`, `wf remove` and -`wf help` in C++: - -| Command | Effect | +| Removed | Replacement | | --- | --- | -| `wf search ` | npm search API restricted to `keywords:webfront-tool` | -| `wf install [@version]` | Download, verify, unpack, store, record in the lock file | -| `wf list` | Installed tools with version and title | -| `wf remove ` | Delete the tool's files and lock entry | -| `wf open ` | Open `webfront/tools//` in a new tab or window | - -### Installation flow - -The download runs in the browser, which already speaks HTTPS. This keeps TLS out of the -header-only C++ library. - -1. The browser fetches the packument from `registry.npmjs.org/` (CORS-enabled) and resolves - the version. -2. It downloads the tarball, then checks `dist.integrity` (SHA-512) with `crypto.subtle`. -3. It gunzips with `DecompressionStream("gzip")`, refusing more than 256 MiB of output, and reads the archive with a small ustar reader - (about 60 lines). -4. It calls `webfront.pkg.begin(pkg, version)`, then for each file - `webfront.pkg.writeFile(pkg, version, path, offset, Uint8Array)`. Files are sent in 256 KiB - chunks; typed arrays already cross the bridge. Progress is shown in - the browser, so no C++ push is needed. -5. C++ rejects absolute paths, empty, `.` and `..` components, backslashes, and the characters Windows forbids in file names, and a chunk - whose offset does not follow the bytes already written. Files are staged under - `/.webfront/tools/.staging/`, in a directory of their own for each installation in - progress, so versions differing only by case never share staged files. -6. `webfront.pkg.commit(pkg, version, integrity, entry, title)` checks that the entry page was - written, moves the staged files to `/.webfront/tools/@/`, replacing any - installed version, and records the tool in `/webfront-tools.lock.json`. A failed or - abandoned installation leaves the installed version untouched. -7. `fs::PackageFS` serves `webfront/tools//…` from the versions recorded in the lock file, - which it reads on each request. The prefix stays inside the reserved `webfront/` namespace, so a - tool never collides with the application's pages. +| `webfront::Terminal` page and its line editor | The environment's terminal: streaming, Ctrl+C for every command, per-browser sessions, multi-row redraw, CJK and emoji widths, history, completion | +| `terminal::Shell` and `Terminal::command` | `webfront::Commands` (``): coroutine commands, discovered by the environment | +| `Terminal::extension` browser commands | `wf run` scripts and `wf exec` package entries | +| `ToolManager`, `wf install/list/remove/open` of tools | `wf install` and `wf restore` of npm packages, locked by `webfront-packages.lock.json` | -### Browser side (implemented) +## Migrating `terminal::Shell` commands -`js/developer/components/tools/wf.mjs` is served by `fs::ToolManagerFS` at -`webfront/components/tools/wf.mjs` and added to the terminal by `ToolManager`. Besides the -`commands` it exports `search`, `install`, `installed`, `open`, `readTar`, `gunzip`, -`verifyIntegrity` and `parseSpec`, so other pages can use them. - -- The registry comes from `webfront.pkg.registry()`, which returns `ToolManagerOptions::registry` - (`https://registry.npmjs.org/` by default; a relative URL is resolved against the page). It must - allow CORS requests from the application's page. -- A version is an exact version or a dist-tag (`latest` by default); ranges are not resolved. -- Only SHA-512 integrities are accepted. `crypto.subtle` needs a secure context, which - `http://localhost` is. -- The reader accepts ustar headers (with the `prefix` field), pax extended headers (`path`) and GNU - long names, checks each header's checksum and keeps regular files only. The first path component - (`package/`) is removed, as npm does. -- The archive's `package.json` must name the requested package and version and have a `webfront` - field with `kind: "tool"` and an `entry` present in the archive; the title defaults to the name. -- Files are sent in 256 KiB chunks, one call at a time, so C++ sees every chunk in order. The - browser sends such a call in several WebSocket frames, which the server reassembles. -- Ctrl+C aborts the downloads and stops the upload before the next chunk; the installation is then - not committed. -- `wf open` finds the tool in `webfront.pkg.list()` and calls `window.open(url, "_blank")`; when the - browser blocks the window, it prints the URL instead. - -The browser integration test serves a fake registry: packuments and a fixture tarball in -`test/web/registry/` (regenerated by `make_fixture.py`, which also writes a packument with a wrong -integrity), and a search endpoint answered by the test. Tools are installed into a temporary -directory, never into the source tree. - -### C++ side (implemented) +A command of the removed component returned its output once it ended, on the server thread: ```cpp -#include - -webfront::ToolsApp app; // DefaultFSWith -webfront::Terminal terminal{app}; -webfront::ToolManager tools{app, terminal}; // adds 'wf' and the webfront.pkg.* functions +terminal.command("greet", "Greet someone", [](webfront::CommandArgs args) { + return "Hello, " + (args.empty() ? std::string{"world"} : args[0]) + "!"; +}); ``` -- `fs::ToolStore` (`include/webfront/system/ToolStore.hpp`, with the small JSON reader of `include/webfront/utils/Json.hpp`) validates npm names (`@scope/` allowed), - versions and paths, stages and commits installations, and reads and writes the lock file through - a temporary file renamed over it. The lock file is read strictly, and a record whose name, - version or entry could leave the tools directory is rejected. Names, versions and paths may not - contain `..` anywhere, because the HTTP server rejects such URLs, and titles and integrities may not - contain control characters, which would break the `webfront.pkg.list()` format, nor exceed 1024 - bytes, so that every line fits in a list page. Stores of the same project share one lock and one - set of pending installations within the process; versions differing only by case, which name the - same directory on a case-insensitive volume, replace each other without losing files. Once the lock file - is written, a directory that cannot be deleted is left behind instead of failing the operation. -- `fs::BasicPackageFS` (`include/webfront/system/PackageFS.hpp`) takes the project directory from - `Location::get()`; `fs::PackageFS` uses the working directory at startup (`fs::CurrentDirectory`). - `ToolManager` must use the same `Location`. -- `webfront.pkg.list(first)` returns the `name\tversion\tentry URL\ttitle` lines of the tools from - index `first`, as many as fit below the bridge's string limit, for `wf open`; the page calls it again - from the next index until it gets an empty string. The URL is absolute and percent-encoded, so every accepted file name reaches `PackageFS`. -- The registered functions share ownership of the store, so a `ToolManager` may be destroyed before - the application. - -The lock file is meant to be committed with the project, the `.webfront/` directory is not: +With `webfront::Commands`, it is a coroutine that streams its output and can be stopped: -```json -{ - "lockfileVersion": 1, - "tools": { - "@acme/webfront-plot": { - "version": "1.2.0", - "integrity": "sha512-…", - "entry": "dist/index.html", - "title": "Live plot" - } - } -} +```cpp +webfront::Commands commands{app}; +commands.add("greet", "Greet someone", [](webfront::Commands::Context context) -> webfront::Task { + context.write("Hello, " + (context.args().empty() ? std::string{"world"} : context.args()[0]) + "!\n"); + co_return; +}); ``` -### Security - -An installed tool runs in the application's origin and can call every registered C++ function. The -trust model is therefore that of `npm install`: only install tools you trust, and only during -development. A later step can serve tools from a separate origin (another port) with an allow-list of -callable functions. The tool manager is a development feature, like a document root, not a -production plugin system. - -### Prerequisites - -- Core gaps 1 and 2 above, for progress and output streaming initiated by C++ (done in #233). -- A filesystem provider writing outside the build tree, with tests using temporary directories. -- Browser tests that use a local fake registry: tests must not need the public network (done: - `test/web/js/tools-specs.mjs`). - -## Browser-powered developer environment - -The opt-in `NativeApp` bootstrap extends this architecture with a downloaded environment rather -than embedding xterm/compiler/framework assets. It installs ordinary npm libraries into a separate -store, builds TSX in a browser Worker and generates application-owned filesystem providers. -The existing terminal/ToolManager APIs and their prebundled tool format remain supported. -See [the developer environment](DEVELOPER_ENVIRONMENT.md) for the API, provisioning, Game of Life walkthrough, -trust boundary and offline tests. The browser installer is intentionally not the complete npm CLI. +- `CommandArgs` becomes `context.args()`; the `std::ostream&` output becomes `context.write(text)`, or + `co_await context.print(text)` for large output; `"\n"` ends a line. +- An exception is still shown as an error; `context.exit(code)` sets a non-zero exit code. +- A command must not block the server thread: long work awaits senders (`context.ui().resumeAfter`, + `jsFunctionSender`) or runs on another thread. Ctrl+C, the browser's disconnection and shutdown stop it. +- `help`, `clear`, `history` and `exit` are built into the terminal; their names are reserved. diff --git a/docs/adr/ADR-002-systemes-de-fichiers-composables.md b/docs/adr/ADR-002-systemes-de-fichiers-composables.md index 7a817ce2..0a46273d 100644 --- a/docs/adr/ADR-002-systemes-de-fichiers-composables.md +++ b/docs/adr/ADR-002-systemes-de-fichiers-composables.md @@ -63,9 +63,9 @@ la racine de développement optionnelle, puis la page de repli embarquée d’`I `fs::DefaultFSWith` place les providers supplémentaires entre le bridge protégé et la racine locale. Sans `documentRoot`, le provider local ne touche pas au disque. -Les espaces réservés `webfront/components//` et `webfront/tools//` séparent les -ressources réutilisables des pages applicatives. `PackageFS` ne sert que les installations -référencées par le store (ADR-010). Les fichiers natifs de développement et `NativeDebugFS` +Les espaces réservés `webfront/components//` et `webfront/tools//` séparaient les +ressources réutilisables des pages applicatives ; `PackageFS` et les composants qui les servaient +sont retirés (ADR-010 v1.7), l'environnement développeur sert les siennes sous `webfront/developer/`. Les fichiers natifs de développement et `NativeDebugFS` ne constituent pas un sandbox de production. ## Orientation embarquée, Yocto et mobile diff --git a/docs/adr/ADR-010-composants-et-outils-optionnels.md b/docs/adr/ADR-010-composants-et-outils-optionnels.md index 80941db4..50104a1d 100644 --- a/docs/adr/ADR-010-composants-et-outils-optionnels.md +++ b/docs/adr/ADR-010-composants-et-outils-optionnels.md @@ -11,11 +11,13 @@ | 1.4 | 2026-10-15 | Acceptée | Ambroise Leclerc | Validation des outils avec un registre local factice. | [d53ffcc](https://github.com/ambroise-leclerc/WebFront/commit/d53ffcc40102c7405eb7060d7021aad366d6d7e9) | | 1.5 | 2026-10-16 | Acceptée | Ambroise Leclerc | Interruption des commandes navigateur et transferts séquentiels par blocs de 256 KiB. | [c81f7f7](https://github.com/ambroise-leclerc/WebFront/commit/c81f7f74728ad24a53c16f907e016eb0fe1b8bce) | | 1.6 | 2026-10-22 | Acceptée | Ambroise Leclerc | Trajectoire de retrait de Terminal.hpp, ToolManager.hpp, ToolStore et PackageFS au profit de l'environnement bootstrap (ADR-016). | [404fed2](https://github.com/ambroise-leclerc/WebFront/commit/404fed2c2145d4faba8efee035e10522ff87a91f) | +| 1.7 | 2026-10-23 | Acceptée | Ambroise Leclerc | Retrait effectué (#313) : le terminal de l'environnement et `webfront::Commands` remplacent le composant terminal et le gestionnaire d'outils. | [PR #331](https://github.com/ambroise-leclerc/WebFront/pull/331) | ## État et chronologie **Acceptée.** Décision initiale : **2026-10-14** (version 1.0). -Dernière révision : **2026-10-22** (version 1.6). +Dernière révision : **2026-10-23** (version 1.7) : le terminal et les outils relèvent désormais +d'[ADR-016](ADR-016-bootstrap-comme-socle.md). Le présent texte expose la décision en vigueur ; le tableau retrace ses états antérieurs. ## Contexte @@ -68,9 +70,9 @@ l’autorité du bridge de l’application ; c’est une fonction de développem ### Révision de l'ADR-016 `Terminal.hpp`, `ToolManager.hpp`, `ToolStore`, `PackageFS`, `TerminalFS`, `ToolManagerFS` et xterm -embarqué sont voués au retrait (#313) : le terminal et le `wf` de l'environnement téléchargé -([ADR-016](ADR-016-bootstrap-comme-socle.md)) les remplacent. Ils restent fonctionnels et testés -tant que l'équivalent n'est pas couvert ; aucune nouvelle fonctionnalité ne leur est ajoutée. +embarqué sont retirés (#313, version 1.7) : le terminal et le `wf` de l'environnement téléchargé +([ADR-016](ADR-016-bootstrap-comme-socle.md)) les remplacent, et `webfront::Commands` remplace +`terminal::Shell` pour les commandes C++ de l'application. Les abonnements UI multiples et l'injection du navigateur appelant demeurent des contrats du cœur. ## Prescriptions d’implémentation et de génération de code @@ -87,8 +89,8 @@ Les abonnements UI multiples et l'injection du navigateur appelant demeurent des ## Sources et vérification -- [Architecture des composants et limites](../UI_COMPONENTS.md), - [Terminal](../../include/webfront/components/Terminal.hpp), [ToolManager](../../include/webfront/components/ToolManager.hpp). +- [Retrait et migration](../UI_COMPONENTS.md), [Commands](../../include/webfront/Commands.hpp) ; le composant + retiré reste lisible dans l'historique Git. - Tests : [UISubscribersTests](../../test/unit/UISubscribersTests.cpp), - [ToolStoreTests](../../test/unit/ToolStoreTests.cpp), [tools-specs](../../test/web/js/tools-specs.mjs). + [CommandsTests](../../test/unit/CommandsTests.cpp), [developer-specs](../../test/web/developer-specs.mjs). - Voir [ADR-002](ADR-002-systemes-de-fichiers-composables.md), [ADR-008](ADR-008-contenu-de-confiance-et-origines.md) et [ADR-016](ADR-016-bootstrap-comme-socle.md). diff --git a/docs/adr/ADR-016-bootstrap-comme-socle.md b/docs/adr/ADR-016-bootstrap-comme-socle.md index 03e75890..ea5862da 100644 --- a/docs/adr/ADR-016-bootstrap-comme-socle.md +++ b/docs/adr/ADR-016-bootstrap-comme-socle.md @@ -100,9 +100,9 @@ développeur ni outillage. L'outillage de construction n'est jamais embarqué da - **[ADR-009](ADR-009-modules-et-assets-reproductibles.md)** (v2.1) : les assets embarqués sont limités à la liste normative ; `BabelFS`, `ReactFS`, `JasmineFS` et leurs sources vendorisées sont retirés (#312, #319). Les tests migrent vers `wf test` (#311). -- **[ADR-010](ADR-010-composants-et-outils-optionnels.md)** (v1.6) : `Terminal.hpp`, +- **[ADR-010](ADR-010-composants-et-outils-optionnels.md)** (v1.7) : `Terminal.hpp`, `ToolManager.hpp`, `ToolStore`, `PackageFS`, `TerminalFS`, `ToolManagerFS` et xterm embarqué - sont retirés (#313). Le terminal et `wf` de l'environnement téléchargé les remplacent ; les + sont retirés (#313, effectué). Le terminal et `wf` de l'environnement téléchargé les remplacent ; les abonnements UI multiples et l'injection du navigateur appelant restent des contrats du cœur. - **[ADR-013](ADR-013-bootstrap-developpeur-a-la-demande.md), [ADR-014](ADR-014-construction-javascript-dans-le-browser.md), diff --git a/docs/adr/README.md b/docs/adr/README.md index b17eee03..48b8ed57 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -49,7 +49,7 @@ verification evidence remain in [PROJECT_STATUS](../PROJECT_STATUS.md). | [ADR-007](ADR-007-frontends-explicites.md) | Explicit frontend selection and a shared lifecycle contract | Accepted | 2026-05-31 | 1.10 — 2026-10-20 | | [ADR-008](ADR-008-contenu-de-confiance-et-origines.md) | Restricting bridge origins without promising a sandbox | Accepted | 2026-10-18 | 1.0 — 2026-10-18 | | [ADR-009](ADR-009-modules-et-assets-reproductibles.md) | Serving modules locally and regenerating assets reproducibly | Accepted | 2023-03-16 | 2.1 — 2026-10-22 | -| [ADR-010](ADR-010-composants-et-outils-optionnels.md) | Extending WebFront through optional components and development tools | Accepted | 2026-10-14 | 1.6 — 2026-10-22 | +| [ADR-010](ADR-010-composants-et-outils-optionnels.md) | Extending WebFront through optional components and development tools | Accepted | 2026-10-14 | 1.7 — 2026-10-23 | | [ADR-011](ADR-011-diagnostics-optionnels.md) | Confining mddlog behind an optional diagnostics façade | Accepted | 2026-10-01 | 1.2 — 2026-10-02 | | [ADR-012](ADR-012-preuves-et-tests.md) | Demonstrating contracts through deterministic tests and browser integration | Accepted | 2020-04-19 | 1.6 — 2026-10-19 | | [ADR-013](ADR-013-bootstrap-developpeur-a-la-demande.md) | Bootstrapping a downloaded developer environment | Proposée | 2026-10-20 | 0.2 — 2026-10-22 | diff --git a/include/webfront/components/Terminal.hpp b/include/webfront/components/Terminal.hpp deleted file mode 100644 index 91d414b3..00000000 --- a/include/webfront/components/Terminal.hpp +++ /dev/null @@ -1,360 +0,0 @@ -/// @brief Interactive terminal component: an xterm.js page served from embedded assets, whose line -/// editor sends each validated line to commands registered in C++. -#pragma once - -#include "../system/DefaultFS.hpp" -#include "../system/TerminalFS.hpp" -#include "../WebFront.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace webfront { - -/// Arguments of a terminal command, without the command name. -using CommandArgs = std::span; - -struct TerminalOptions { - std::string prompt = "> "; - std::string banner = "WebFront terminal. Type 'help' to list the commands."; -}; - -namespace terminal { - -namespace detail { - -/// Shell-style word splitting, one character at a time; see tokenize(). -class LineSplitter { -public: - explicit LineSplitter(std::string_view text) : line(text) {} - - std::vector split() { - while (index < line.size()) - take(line[index++]); - endWord(); - return std::move(words); - } - -private: - std::string_view line; - std::size_t index = 0; - std::vector words; - std::string word; - bool inWord = false; - - void take(char c) { - if (c == ' ' || c == '\t') - return endWord(); - inWord = true; - if (c == '\\') - readEscaped(); - else if (c == '\'' || c == '"') - readQuoted(c); - else - word += c; - } - - void readEscaped() { - if (index == line.size()) - throw std::invalid_argument("Trailing backslash"); - word += line[index++]; - } - - char nextQuoted() { - if (index == line.size()) - throw std::invalid_argument("Unterminated quote"); - return line[index++]; - } - - void readQuoted(char quote) { - for (char c = nextQuoted(); c != quote; c = nextQuoted()) - word += quote == '"' && c == '\\' ? escapedInDoubleQuotes() : c; - } - - // A backslash ending the line stays literal; the missing closing quote is reported next. - char escapedInDoubleQuotes() { - return index < line.size() ? line[index++] : '\\'; - } - - void endWord() { - if (inWord) - words.push_back(std::exchange(word, {})); - inWord = false; - } -}; - -} // namespace detail - -/// Splits a command line into words. Whitespace separates words; single quotes keep their content -/// verbatim, double quotes keep it but honor backslash escapes, and an unquoted backslash escapes -/// the next character. Throws std::invalid_argument on an unterminated quote or a trailing backslash. -inline std::vector tokenize(std::string_view line) { - return detail::LineSplitter{line}.split(); -} - -/// Bridge strings carry a 16-bit length, so a command output is capped below that limit, on a -/// UTF-8 character boundary, with a visible notice. -inline constexpr std::size_t maxOutputBytes = 60000; - -namespace detail { - -/// Prepares text for the terminal: "\n" becomes "\r\n", then the result is capped to -/// maxOutputBytes. -inline std::string toTerminalText(std::string_view text) { - std::string converted; - converted.reserve(text.size()); - char previous = '\0'; - for (const char c : text) { - if (c == '\n' && previous != '\r') - converted += '\r'; - converted += c; - previous = c; - } - if (converted.size() <= maxOutputBytes) - return converted; - std::size_t cut = maxOutputBytes; - while (cut > 0 && (static_cast(converted[cut]) & 0xC0) == 0x80) - --cut; - converted.resize(cut); - return converted + "\r\n\x1b[33m[output truncated]\x1b[0m"; -} - -} // namespace detail - -/// Command registry and dispatcher, independent of any connection. Thread-safe: commands may be -/// registered while the server thread runs others. -class Shell { -public: - using Handler = std::function; - - /// Registers a command. Throws std::invalid_argument if the name is empty, contains whitespace - /// or quotes, or is already registered. - void command(std::string name, std::string help, Handler handler) { - if (name.empty() || name.find_first_of(" \t'\"\\") != std::string::npos) - throw std::invalid_argument("Invalid terminal command name '" + name + "'"); - if (!handler) - throw std::invalid_argument("Terminal command '" + name + "' has no handler"); - std::scoped_lock lock{mutex}; - if (!commands.try_emplace(name, Command{std::move(help), std::make_shared(std::move(handler))}).second) - throw std::invalid_argument("Terminal command '" + name + "' is already registered"); - } - - /// Runs one line and returns its output, using "\n" line endings converted to "\r\n" for the - /// terminal. An empty line produces no output; an unknown command or a malformed line produces - /// an error message. Exceptions thrown by a command propagate to the caller. - std::string run(std::string_view line) const { - std::vector words; - try { - words = tokenize(line); - } catch (const std::invalid_argument& error) { - return errorMessage(error.what()); - } - if (words.empty()) - return {}; - - std::shared_ptr handler; - { - std::scoped_lock lock{mutex}; - if (auto found = commands.find(words.front()); found != commands.end()) - handler = found->second.handler; - } - if (!handler) - return errorMessage("Unknown command '" + words.front() + "'. Type 'help' to list the commands."); - - std::ostringstream output; - (*handler)(CommandArgs{words}.subspan(1), output); - return detail::toTerminalText(output.view()); - } - - /// Completes the command name of a line: returns the matching names separated by "\n", or an - /// empty string once the line already contains a space (arguments are not completed). - [[nodiscard]] std::string complete(std::string_view line) const { - if (line.find_first_of(" \t") != std::string_view::npos) - return {}; - std::string candidates; - std::scoped_lock lock{mutex}; - for (auto found = commands.lower_bound(std::string(line)); found != commands.end() && found->first.starts_with(line); ++found) { - if (!candidates.empty()) - candidates += '\n'; - candidates += found->first; - } - return candidates; - } - - /// Adds a browser module that the terminal page imports when it starts (see Terminal::extension). - /// Throws std::invalid_argument if the URL is empty or contains a line break; adding a URL twice - /// has no effect. - void extension(std::string moduleUrl) { - if (moduleUrl.empty() || moduleUrl.find_first_of("\r\n") != std::string::npos) - throw std::invalid_argument("Invalid terminal extension URL '" + moduleUrl + "'"); - std::scoped_lock lock{mutex}; - if (std::ranges::find(extensionUrls, moduleUrl) == extensionUrls.end()) - extensionUrls.push_back(std::move(moduleUrl)); - } - - /// The URLs of the browser modules, in the order they were added, separated by "\n". - [[nodiscard]] std::string extensions() const { - std::scoped_lock lock{mutex}; - std::string urls; - for (const auto& url : extensionUrls) { - if (!urls.empty()) - urls += '\n'; - urls += url; - } - return urls; - } - - /// Lists every command with its help text, aligned, one per line. - [[nodiscard]] std::string help() const { - std::scoped_lock lock{mutex}; - std::size_t width = 0; - for (const auto& [name, command] : commands) - width = std::max(width, name.size()); - std::string text; - for (const auto& [name, command] : commands) { - if (!text.empty()) - text += '\n'; - text += name + std::string(width - name.size() + 2, ' ') + command.help; - } - return text; - } - -private: - struct Command { - std::string help; - std::shared_ptr handler; - }; - - mutable std::mutex mutex; - std::map> commands; - std::vector extensionUrls; - - // Messages may quote the user's line, so they are capped like command output, before the - // color codes are added so the closing reset always survives. - static std::string errorMessage(std::string_view message) { - return "\x1b[31m" + detail::toTerminalText(message) + "\x1b[0m"; - } -}; - -/// Adapts the accepted handler shapes to Shell::Handler: -/// (CommandArgs, std::ostream&) -> void, (CommandArgs) -> R, () -> R -/// where R is void or anything that can be written to a std::ostream. -template -Shell::Handler adaptHandler(Function&& function) { - using Stored = std::decay_t; - auto callable = std::make_shared(std::forward(function)); - auto writeResult = [](std::ostream& output, auto&& invoke) { - using R = decltype(invoke()); - if constexpr (std::is_void_v) - invoke(); - else - output << invoke(); - }; - if constexpr (std::invocable) - return [callable](CommandArgs args, std::ostream& output) { - std::invoke(*callable, args, output); - }; - else if constexpr (std::invocable) - return [callable, writeResult](CommandArgs args, std::ostream& output) { - writeResult(output, [&]() -> decltype(auto) { - return std::invoke(*callable, args); - }); - }; - else { - static_assert(std::invocable, - "webfront::Terminal::command: the handler must accept (CommandArgs, std::ostream&), " - "(CommandArgs) or no argument."); - return [callable, writeResult](CommandArgs, std::ostream& output) { - writeResult(output, [&]() -> decltype(auto) { - return std::invoke(*callable); - }); - }; - } -} - -} // namespace terminal - -/// Application type serving the terminal page next to the default WebFront assets. -using TerminalApp = BasicWF>; - -/// Gives an application a command-line interface in the browser. -/// -/// The constructor registers the JavaScript-callable functions webfront.terminal.prompt, .banner, -/// .run, .complete and .extensions on the application, plus a built-in 'help' command. The registered functions -/// own the command registry, so a Terminal object may be destroyed before the application; commands -/// can only be added through a live Terminal. The application's filesystem must serve -/// fs::TerminalFS (TerminalApp does). -template -class Terminal { -public: - static constexpr std::string_view page = fs::TerminalFS::page; - /// Erases the screen and the scrollback and homes the cursor. The page writes no line break - /// after an output ending with the cursor-home sequence. - static constexpr std::string_view clearScreen = "\x1b[2J\x1b[3J\x1b[H"; - - explicit Terminal(App& app, TerminalOptions options = {}) : shell(std::make_shared()) { - shell->command("help", "List the available commands", [weakShell = std::weak_ptr(shell)](CommandArgs, std::ostream& output) { - if (auto registry = weakShell.lock()) - output << registry->help(); - }); - shell->command("clear", "Clear the screen and its scrollback", [](CommandArgs, std::ostream& output) { - output << clearScreen; - }); - app.template cppFunction("webfront.terminal.prompt", [prompt = options.prompt] { - return prompt; - }); - app.template cppFunction("webfront.terminal.banner", [banner = options.banner] { - return banner; - }); - app.template cppFunction("webfront.terminal.run", [registry = shell](const std::string& line) { - return registry->run(line); - }); - app.template cppFunction("webfront.terminal.complete", [registry = shell](const std::string& line) { - return registry->complete(line); - }); - app.template cppFunction("webfront.terminal.extensions", [registry = shell] { - return registry->extensions(); - }); - } - - /// Registers a command; see terminal::adaptHandler for the accepted handler shapes and - /// terminal::Shell::command for the errors. - template - Terminal& command(std::string name, std::string help, Function&& handler) { - shell->command(std::move(name), std::move(help), terminal::adaptHandler(std::forward(handler))); - return *this; - } - - /// Adds a browser module that the terminal page imports before showing the prompt, such as - /// "/webfront/components/tools/wf.mjs". The module may export `commands`, an object mapping a - /// command name to `async (args, context) => output`, run in the browser before the line reaches - /// C++. `args` are the words after the command name, split like in C++; `context` holds `line`, - /// `bridge`, `write(text)` (progress output) and `runInCpp()` (the C++ output of the line). A - /// handler returning undefined lets C++ run the line. See terminal.mjs. - Terminal& extension(std::string moduleUrl) { - shell->extension(std::move(moduleUrl)); - return *this; - } - -private: - std::shared_ptr shell; -}; - -template -Terminal(App&, TerminalOptions = {}) -> Terminal; - -} // namespace webfront diff --git a/include/webfront/components/ToolManager.hpp b/include/webfront/components/ToolManager.hpp deleted file mode 100644 index 6aaa2a0d..00000000 --- a/include/webfront/components/ToolManager.hpp +++ /dev/null @@ -1,205 +0,0 @@ -/// @brief The wf tool manager: web tools installed into a WebFront application while it is -/// developed, stored by fs::ToolStore and served by fs::PackageFS (see docs/UI_COMPONENTS.md). -#pragma once - -#include "../system/PackageFS.hpp" -#include "../system/ToolManagerFS.hpp" -#include "../system/ToolStore.hpp" -#include "Terminal.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace webfront { - -/// Application type serving the terminal page, the browser side of the tool manager and the installed -/// tools next to the default assets. -using ToolsApp = BasicWF>; - -struct ToolManagerOptions { - /// npm registry used by 'wf search' and 'wf install', from the browser. It must allow CORS - /// requests from the application's page (registry.npmjs.org does). A relative URL is resolved - /// against the page. - std::string registry = "https://registry.npmjs.org/"; -}; - -namespace tools::detail { - -// JavaScript numbers are exact integers up to 2^53. -inline std::uint64_t toIndex(double value) { - const bool integral = std::floor(value) == value; // false for NaN - const bool inRange = value >= 0 && value <= 9007199254740992.0; - if (!integral || !inRange) - throw std::invalid_argument("Invalid file offset or list index"); - return static_cast(value); -} - -/// Bridge strings carry a 16-bit length; a list page stays below it, like terminal output. -inline constexpr std::size_t maxListBytes = 60000; - -/// The lines of the installed tools from index 'first', as many whole lines as fit in -/// maxListBytes; empty past the last tool. A line always fits, since names, versions, paths and -/// texts are bounded by the store's validation. -inline std::string listPage(const fs::ToolStore& store, std::uint64_t first) { - const auto installed = store.installed(); - std::string page; - auto tool = installed.begin(); - std::advance(tool, static_cast(std::min(first, installed.size()))); - for (; tool != installed.end(); ++tool) { - const auto& [name, record] = *tool; - const auto line = name + "\t" + record.version + "\t" + fs::PackageFS::url(name, record.entry) + "\t" + record.title + "\n"; - if (page.size() + line.size() > maxListBytes) - break; - page += line; - } - return page; -} - -inline void requireArguments(CommandArgs args, std::size_t count) { - if (args.size() != count) - throw std::invalid_argument("Wrong number of arguments. Type 'wf help'."); -} - -inline void usage(fs::ToolStore&, CommandArgs, std::ostream& output) { - output << "wf search [term] Search the registry for web tools\n" - "wf install [@version] Download, verify and install a tool\n" - "wf list List the installed tools\n" - "wf open Open an installed tool in a new tab\n" - "wf remove Uninstall a tool"; -} - -// 'wf search', 'wf install' and 'wf open' are handled by the page (wf.mjs) and only reach C++ when -// the page did not load it. -inline void browserOnly(std::string_view command) { - throw std::invalid_argument("'wf " + std::string(command) + "' runs in the terminal page, which did not load " + std::string(fs::ToolManagerFS::module) - + ". Is fs::ToolManagerFS served?"); -} - -inline void removeTool(fs::ToolStore& store, CommandArgs args, std::ostream& output) { - requireArguments(args, 2); - if (!store.remove(args[1])) - throw std::invalid_argument(args[1] + " is not installed"); - output << "Removed " << args[1] << "."; -} - -inline void listTools(fs::ToolStore& store, CommandArgs args, std::ostream& output) { - requireArguments(args, 1); - const auto installed = store.installed(); - if (installed.empty()) { - output << "No tool installed."; - return; - } - std::size_t width = 0; - for (const auto& [name, record] : installed) - width = std::max(width, name.size() + 1 + record.version.size()); - const char* separator = ""; - for (const auto& [name, record] : installed) { - const auto label = name + "@" + record.version; - output << separator << label << std::string(width - label.size() + 2, ' ') << record.title; - separator = "\n"; - } -} - -struct WfCommand { - std::string_view name; - void (*run)(fs::ToolStore&, CommandArgs, std::ostream&); -}; - -// The subcommands running in C++; the page runs the others (browserCommands). -inline constexpr std::array wfCommands{ - WfCommand{ "help", &usage}, - WfCommand{ "list", &listTools}, - WfCommand{"remove", &removeTool}, -}; -inline constexpr std::array browserCommands{"search", "install", "open"}; - -inline void runWf(fs::ToolStore& store, CommandArgs args, std::ostream& output) { - const std::string_view command = args.empty() ? "help" : std::string_view(args[0]); - if (const auto found = std::ranges::find(wfCommands, command, &WfCommand::name); found != wfCommands.end()) - return found->run(store, args, output); - if (std::ranges::find(browserCommands, command) != browserCommands.end()) - return browserOnly(command); - throw std::invalid_argument("Unknown wf command '" + std::string(command) + "'. Type 'wf help'."); -} - -} // namespace tools::detail - -/// Adds the 'wf' command to a terminal, the browser module running its network part (wf.mjs, served -/// by fs::ToolManagerFS, loaded as a terminal extension) and the bridge functions the page uses: -/// webfront.pkg.registry() -> the npm registry URL of ToolManagerOptions -/// webfront.pkg.begin(name, version) -/// webfront.pkg.writeFile(name, version, path, offset, Uint8Array) -/// webfront.pkg.commit(name, version, integrity, entry, title) -/// webfront.pkg.list(first) -> "name\tversion\tentry URL\ttitle\n" lines of the installed tools -/// from index 'first', paged below the bridge's string limit: the -/// page calls it again from the next index until it gets "" -/// The tools live in Location::get(), which must match the application's fs::BasicPackageFS -/// (ToolsApp uses fs::CurrentDirectory). The registered functions share ownership of the store, so -/// a ToolManager may be destroyed before the application. -/// -/// Development only: an installed tool runs in the application's origin and can call every -/// registered C++ function, so the trust model is that of 'npm install'. -template -class ToolManager { -public: - using PackageFS = fs::BasicPackageFS; - - ToolManager(App& app, Terminal& terminal, ToolManagerOptions options = {}) : toolStore(std::make_shared(Location::get())) { - app.template cppFunction("webfront.pkg.registry", [registry = std::move(options.registry)] { - return registry; - }); - app.template cppFunction("webfront.pkg.begin", - [registry = toolStore](const std::string& name, const std::string& packageVersion) { - registry->begin(name, packageVersion); - }); - app.template cppFunction>( - "webfront.pkg.writeFile", - [registry = toolStore](const std::string& name, - const std::string& packageVersion, - const std::string& path, - double offset, - const std::vector& bytes) { - registry->write(name, packageVersion, {.path = path, .offset = tools::detail::toIndex(offset), .bytes = bytes}); - }); - app.template cppFunction( - "webfront.pkg.commit", - [registry = toolStore](const std::string& name, - const std::string& packageVersion, - const std::string& integrity, - const std::string& entry, - const std::string& title) { - registry->commit({.name = name, .version = packageVersion, .integrity = integrity, .entry = entry, .title = title}); - }); - app.template cppFunction("webfront.pkg.list", [registry = toolStore](double first) { - return tools::detail::listPage(*registry, tools::detail::toIndex(first)); - }); - terminal.command("wf", - "Manage web tools: wf search | install | list | open | remove. Type 'wf help'.", - [registry = toolStore](CommandArgs args, std::ostream& output) { - tools::detail::runWf(*registry, args, output); - }); - terminal.extension("/" + std::string(fs::ToolManagerFS::module)); - } - - [[nodiscard]] fs::ToolStore& store() { - return *toolStore; - } - -private: - std::shared_ptr toolStore; -}; - -template -ToolManager(App&, Terminal&, ToolManagerOptions = {}) -> ToolManager; - -} // namespace webfront diff --git a/include/webfront/system/DefaultFS.hpp b/include/webfront/system/DefaultFS.hpp index 8905b64f..8c288387 100644 --- a/include/webfront/system/DefaultFS.hpp +++ b/include/webfront/system/DefaultFS.hpp @@ -50,7 +50,7 @@ class OptionalDevRootFS { /// 3. IndexFS's embedded fallback page, favicon, and WebFront.js copy. using DefaultFS = Multi; -/// DefaultFS with additional embedded providers, such as a UI component's assets (e.g. TerminalFS). +/// DefaultFS with additional embedded providers, such as the assets an application generated with wf embed. /// They are consulted after the protected WebFront.js and before the document root, so a /// development root cannot shadow a component's files. template diff --git a/include/webfront/system/PackageFS.hpp b/include/webfront/system/PackageFS.hpp deleted file mode 100644 index 86de9cb1..00000000 --- a/include/webfront/system/PackageFS.hpp +++ /dev/null @@ -1,91 +0,0 @@ -/// @brief Virtual file system serving the web tools installed by the wf tool manager under -/// webfront/tools//, from the versions recorded in the project's lock file (see ToolStore). -#pragma once - -#include "FileSystem.hpp" -#include "ToolStore.hpp" - -#include -#include -#include -#include -#include -#include - -namespace webfront::fs { - -namespace detail { - -inline std::string encodePath(std::string_view path) { - constexpr std::string_view kept = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~/@"; - constexpr std::string_view hexDigits = "0123456789ABCDEF"; - std::string encoded; - for (const char c : path) { - const auto byte = static_cast(c); - if (kept.find(c) != std::string_view::npos) - encoded += c; - else - encoded += {'%', hexDigits[byte >> 4], hexDigits[byte & 0xF]}; - } - return encoded; -} - -} // namespace detail - -/// Default project location of the installed tools: the process's working directory when the -/// application starts. -struct CurrentDirectory { - static std::filesystem::path get() { - return std::filesystem::current_path(); - } -}; - -/// Serves webfront/tools// from the installed version of . The lock file is read -/// on each request, so tools installed or removed while the application runs are served at once. -/// Location::get() gives the project directory; the ToolManager component must use the same one. -/// Development only: an installed tool runs in the application's origin. -template -class BasicPackageFS { -public: - static constexpr std::string_view prefix = "webfront/tools/"; - - explicit BasicPackageFS(std::filesystem::path /*docRoot*/) : project(Location::get()) {} - - /// Absolute URL path of a file of an installed tool, such as the page of its entry. Characters - /// other than unreserved ones, '/' and '@' are percent-encoded, so the server decodes it back. - static std::string url(std::string_view name, std::string_view path) { - return "/" + std::string(prefix) + detail::encodePath(name) + "/" + detail::encodePath(path); - } - - std::optional open(std::filesystem::path file) const { - const auto filename = file.relative_path().generic_string(); - if (!filename.starts_with(prefix)) - return {}; - const auto rest = std::string_view(filename).substr(prefix.size()); - // A scoped name ("@scope/name") spans two components. - const auto nameEnd = rest.find('/', rest.starts_with('@') ? rest.find('/') + 1 : 0); - if (nameEnd == std::string_view::npos) - return {}; - try { - const ToolStore store{project}; - const auto record = store.find(rest.substr(0, nameEnd)); - if (!record) - return {}; - const auto path = store.installDir(record->name, record->version) / tools::safeRelativePath(rest.substr(nameEnd + 1)); - if (!std::filesystem::is_regular_file(path)) - return {}; - std::ifstream stream(path, std::ios::binary); - if (stream.is_open()) - return File{std::move(stream)}; - } catch (const std::exception&) { // malformed lock file or unsafe path: not served - } - return {}; - } - -private: - std::filesystem::path project; -}; - -using PackageFS = BasicPackageFS<>; - -} // namespace webfront::fs diff --git a/include/webfront/system/TerminalFS.hpp b/include/webfront/system/TerminalFS.hpp deleted file mode 100644 index 0daec7b0..00000000 --- a/include/webfront/system/TerminalFS.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/// @brief Virtual file system serving the terminal component's page, module and the vendored -/// xterm.js distribution (MIT, see third_party/xterm/LICENSE) under webfront/components/terminal/. -#pragma once - -#include "FileSystem.hpp" -#include "TerminalIndexHtmlData.hpp" -#include "TerminalModuleData.hpp" -#include "XtermCssData.hpp" -#include "XtermFitAddonData.hpp" -#include "XtermModuleData.hpp" - -#include -#include -#include - -namespace webfront::fs { - -class TerminalFS { -public: - static constexpr std::string_view prefix = "webfront/components/terminal/"; - static constexpr std::string_view page = "webfront/components/terminal/index.html"; - - explicit TerminalFS(std::filesystem::path /*docRoot*/) {} - - static std::optional open(std::filesystem::path file) { - const auto filename = file.relative_path().generic_string(); - if (!filename.starts_with(prefix)) - return {}; - const auto name = std::string_view(filename).substr(prefix.size()); - if (name == "index.html") - return File{generated::TerminalIndexHtmlData{}}; - if (name == "terminal.mjs") - return File{generated::TerminalModuleData{}}; - if (name == "xterm.mjs") - return File{generated::XtermModuleData{}}; - if (name == "xterm.css") - return File{generated::XtermCssData{}}; - if (name == "addon-fit.mjs") - return File{generated::XtermFitAddonData{}}; - return {}; - } -}; - -} // namespace webfront::fs diff --git a/include/webfront/system/TerminalIndexHtmlData.hpp b/include/webfront/system/TerminalIndexHtmlData.hpp deleted file mode 100644 index 7dbe56af..00000000 --- a/include/webfront/system/TerminalIndexHtmlData.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace webfront::fs::generated { - -struct TerminalIndexHtmlData { - static constexpr std::string_view encoding{}; - static constexpr std::size_t dataSize{617}; - static constexpr std::array data{ - 0x3c21444f43545950, 0x452068746d6c3e0a, 0x3c68746d6c206c61, 0x6e673d22656e223e, 0x0a3c686561643e0a, - 0x3c6d657461206368, 0x61727365743d2275, 0x74662d38223e0a3c, 0x6d657461206e616d, 0x653d227669657770, - 0x6f72742220636f6e, 0x74656e743d227769, 0x6474683d64657669, 0x63652d7769647468, 0x2c20696e69746961, - 0x6c2d7363616c653d, 0x31223e0a3c746974, 0x6c653e5765624672, 0x6f6e74205465726d, 0x696e616c3c2f7469, - 0x746c653e0a3c6c69, 0x6e6b2072656c3d22, 0x7374796c65736865, 0x6574222068726566, 0x3d22787465726d2e, - 0x637373223e0a3c73, 0x74796c653e0a2020, 0x68746d6c2c20626f, 0x6479207b20686569, 0x6768743a20313030, - 0x253b206d61726769, 0x6e3a20303b206261, 0x636b67726f756e64, 0x3a20233064313131, 0x373b207d0a202023, - 0x7465726d696e616c, 0x207b20706f736974, 0x696f6e3a20616273, 0x6f6c7574653b2069, 0x6e7365743a20302e, - 0x3572656d3b207d0a, 0x3c2f7374796c653e, 0x0a3c2f686561643e, 0x0a3c626f64793e0a, 0x3c6469762069643d, - 0x227465726d696e61, 0x6c2220617269612d, 0x6c6162656c3d2257, 0x656246726f6e7420, 0x7465726d696e616c, - 0x223e3c2f6469763e, 0x0a3c736372697074, 0x207372633d222f57, 0x656246726f6e742e, 0x6a73223e3c2f7363, - 0x726970743e0a3c73, 0x6372697074207479, 0x70653d226d6f6475, 0x6c65223e0a202069, 0x6d706f7274207b6d, - 0x6f756e747d206672, 0x6f6d20222e2f7465, 0x726d696e616c2e6d, 0x6a73223b0a202067, 0x6c6f62616c546869, - 0x732e77656266726f, 0x6e745465726d696e, 0x616c203d20617761, 0x6974206d6f756e74, 0x28646f63756d656e, - 0x742e676574456c65, 0x6d656e7442794964, 0x28227465726d696e, 0x616c2229293b0a3c, 0x2f7363726970743e, - 0x0a3c2f626f64793e, 0x0a3c2f68746d6c3e, 0x0a00000000000000 - }; -}; - -} // namespace webfront::fs::generated diff --git a/include/webfront/system/TerminalModuleData.hpp b/include/webfront/system/TerminalModuleData.hpp deleted file mode 100644 index 70bd555a..00000000 --- a/include/webfront/system/TerminalModuleData.hpp +++ /dev/null @@ -1,343 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace webfront::fs::generated { - -struct TerminalModuleData { - static constexpr std::string_view encoding{}; - static constexpr std::size_t dataSize{13037}; - static constexpr std::array data{ - 0x2f2f2f2040627269, 0x6566205765624672, 0x6f6e74207465726d, 0x696e616c20636f6d, 0x706f6e656e743a20, - 0x616e20787465726d, 0x2e6a73207465726d, 0x696e616c2077686f, 0x7365206c696e6520, 0x656469746f722073, - 0x656e647320656163, 0x682076616c696461, 0x7465640a2f2f2f20, 0x6c696e6520746f20, 0x74686520432b2b20, - 0x636f6d6d616e6473, 0x2072656769737465, 0x726564207468726f, 0x7567682077656266, 0x726f6e743a3a5465, - 0x726d696e616c2028, 0x696e636c7564652f, 0x77656266726f6e74, 0x2f636f6d706f6e65, 0x6e74732f5465726d, - 0x696e616c2e687070, 0x292c0a2f2f2f2075, 0x6e6c657373206120, 0x62726f7773657220, 0x636f6d6d616e6420, - 0x6f6620616e206578, 0x74656e73696f6e20, 0x6d6f64756c652028, 0x5465726d696e616c, 0x3a3a657874656e73, - 0x696f6e292068616e, 0x646c657320697420, 0x66697273742e0a0a, 0x696d706f7274207b, 0x5465726d696e616c, - 0x7d2066726f6d2022, 0x2e2f787465726d2e, 0x6d6a73223b0a696d, 0x706f7274207b4669, 0x744164646f6e7d20, - 0x66726f6d20222e2f, 0x6164646f6e2d6669, 0x742e6d6a73223b0a, 0x0a636f6e73742061, 0x6e7369203d207b0a, - 0x202020207265643a, 0x2028746578742920, 0x3d3e20605c783162, 0x5b33316d247b7465, 0x78747d5c7831625b, - 0x306d602c0a202020, 0x20636c656172546f, 0x456e643a20225c78, 0x31625b4b222c0a20, 0x202020636c656172, - 0x53637265656e3a20, 0x225c7831625b324a, 0x5c7831625b334a5c, 0x7831625b48222c0a, 0x202020206c656674, - 0x3a2028636f756e74, 0x29203d3e2028636f, 0x756e74203e203020, 0x3f20605c7831625b, 0x247b636f756e747d, - 0x4460203a20222229, 0x2c0a7d3b0a0a6675, 0x6e6374696f6e2063, 0x6f6d6d6f6e507265, 0x66697828776f7264, - 0x7329207b0a202020, 0x2072657475726e20, 0x776f7264732e7265, 0x6475636528287072, 0x656669782c20776f, - 0x726429203d3e207b, 0x0a20202020202020, 0x20636f6e7374206c, 0x696d6974203d204d, 0x6174682e6d696e28, - 0x7072656669782e6c, 0x656e6774682c2077, 0x6f72642e6c656e67, 0x7468293b0a202020, 0x20202020206c6574, - 0x206c656e67746820, 0x3d20303b0a202020, 0x2020202020776869, 0x6c6520286c656e67, 0x7468203c206c696d, - 0x6974202626207072, 0x656669785b6c656e, 0x6774685d203d3d3d, 0x20776f72645b6c65, 0x6e6774685d290a20, - 0x2020202020202020, 0x2020202b2b6c656e, 0x6774683b0a202020, 0x2020202020726574, 0x75726e2070726566, - 0x69782e736c696365, 0x28302c206c656e67, 0x7468293b0a202020, 0x207d293b0a7d0a0a, 0x2f2f205265616473, - 0x2061206c696e6520, 0x666f7220746f6b65, 0x6e697a6528292c20, 0x6f6e6520776f7264, 0x2070617274206174, - 0x20612074696d652e, 0x0a636c6173732053, 0x63616e6e6572207b, 0x0a20202020636f6e, 0x7374727563746f72, - 0x286c696e6529207b, 0x0a20202020202020, 0x20746869732e6c69, 0x6e65203d206c696e, 0x653b0a2020202020, - 0x202020746869732e, 0x696e646578203d20, 0x303b0a202020207d, 0x0a0a202020206765, 0x7420646f6e652829, - 0x207b0a2020202020, 0x2020207265747572, 0x6e20746869732e69, 0x6e646578203d3d3d, 0x20746869732e6c69, - 0x6e652e6c656e6774, 0x683b0a202020207d, 0x0a0a202020206e65, 0x78742870726f626c, 0x656d29207b0a2020, - 0x2020202020206966, 0x2028746869732e64, 0x6f6e65290a202020, 0x2020202020202020, 0x207468726f77206e, - 0x65772053796e7461, 0x784572726f722870, 0x726f626c656d293b, 0x0a20202020202020, 0x2072657475726e20, - 0x746869732e6c696e, 0x655b746869732e69, 0x6e6465782b2b5d3b, 0x0a202020207d0a0a, 0x202020202f2f2054, - 0x686520636f6e7465, 0x6e74206f66206120, 0x71756f7465642073, 0x7472696e67207768, 0x6f7365206f70656e, - 0x696e672071756f74, 0x6520776173207265, 0x61642e20496e7369, 0x646520646f75626c, 0x652071756f746573, - 0x2061206261636b73, 0x6c6173680a202020, 0x202f2f2065736361, 0x7065732074686520, 0x6e65787420636861, - 0x7261637465723b20, 0x6f6e6520656e6469, 0x6e6720746865206c, 0x696e652073746179, 0x73206c6974657261, - 0x6c2c20616e642074, 0x6865206d69737369, 0x6e6720636c6f7369, 0x6e672071756f7465, 0x0a202020202f2f20, - 0x6973207265706f72, 0x746564206e657874, 0x2e0a202020207175, 0x6f7465642871756f, 0x746529207b0a2020, - 0x2020202020206c65, 0x7420636f6e74656e, 0x74203d2022223b0a, 0x2020202020202020, 0x666f7220286c6574, - 0x2063686172203d20, 0x746869732e6e6578, 0x742822556e746572, 0x6d696e6174656420, 0x71756f746522293b, - 0x206368617220213d, 0x3d2071756f74653b, 0x2063686172203d20, 0x746869732e6e6578, 0x742822556e746572, - 0x6d696e6174656420, 0x71756f7465222929, 0x0a20202020202020, 0x2020202020636f6e, 0x74656e74202b3d20, - 0x71756f7465203d3d, 0x3d20272227202626, 0x2063686172203d3d, 0x3d20225c5c222026, 0x262021746869732e, - 0x646f6e65203f2074, 0x6869732e6e657874, 0x2829203a20636861, 0x723b0a2020202020, 0x2020207265747572, - 0x6e20636f6e74656e, 0x743b0a202020207d, 0x0a0a202020202f2f, 0x2057686174206063, 0x686172602c207265, - 0x6164206f75747369, 0x64652071756f7465, 0x732c206164647320, 0x746f207468652063, 0x757272656e742077, - 0x6f72642e0a202020, 0x2070617274286368, 0x617229207b0a2020, 0x2020202020206966, 0x202863686172203d, - 0x3d3d20225c5c2229, 0x0a20202020202020, 0x2020202020726574, 0x75726e2074686973, 0x2e6e657874282254, - 0x7261696c696e6720, 0x6261636b736c6173, 0x6822293b0a202020, 0x2020202020696620, 0x2863686172203d3d, - 0x3d20222722207c7c, 0x2063686172203d3d, 0x3d20272227290a20, 0x2020202020202020, 0x2020207265747572, - 0x6e20746869732e71, 0x756f746564286368, 0x6172293b0a202020, 0x2020202020726574, 0x75726e2063686172, - 0x3b0a202020207d0a, 0x7d0a0a2f2f2f2053, 0x706c697473206120, 0x6c696e6520696e74, 0x6f20776f72647320, - 0x6c696b6520746572, 0x6d696e616c3a3a74, 0x6f6b656e697a6520, 0x696e20432b2b3a20, 0x7768697465737061, - 0x6365207365706172, 0x6174657320776f72, 0x64732c2073696e67, 0x6c652071756f7465, 0x730a2f2f2f206b65, - 0x6570207468656972, 0x20636f6e74656e74, 0x2076657262617469, 0x6d2c20646f75626c, 0x652071756f746573, - 0x206b656570206974, 0x2062757420686f6e, 0x6f72206261636b73, 0x6c61736820657363, 0x617065732c20616e, - 0x6420616e20756e71, 0x756f7465640a2f2f, 0x2f206261636b736c, 0x6173682065736361, 0x7065732074686520, - 0x6e65787420636861, 0x7261637465722e20, 0x5468726f77732061, 0x2053796e74617845, 0x72726f72206f6e20, - 0x616e20756e746572, 0x6d696e6174656420, 0x71756f7465206f72, 0x206120747261696c, 0x696e670a2f2f2f20, - 0x6261636b736c6173, 0x682e0a6578706f72, 0x742066756e637469, 0x6f6e20746f6b656e, 0x697a65286c696e65, - 0x29207b0a20202020, 0x636f6e737420776f, 0x726473203d205b5d, 0x3b0a20202020636f, 0x6e7374207363616e, - 0x6e6572203d206e65, 0x77205363616e6e65, 0x72286c696e65293b, 0x0a202020206c6574, 0x20776f7264203d20, - 0x6e756c6c3b20202f, 0x2f206e756c6c2062, 0x65747765656e2077, 0x6f7264730a202020, 0x207768696c652028, - 0x217363616e6e6572, 0x2e646f6e6529207b, 0x0a20202020202020, 0x20636f6e73742063, 0x686172203d207363, - 0x616e6e65722e6e65, 0x787428293b0a2020, 0x202020202020636f, 0x6e73742073657061, 0x7261746f72203d20, - 0x63686172203d3d3d, 0x20222022207c7c20, 0x63686172203d3d3d, 0x20225c74223b0a20, 0x2020202020202069, - 0x6620287365706172, 0x61746f7220262620, 0x776f726420213d3d, 0x206e756c6c290a20, 0x2020202020202020, - 0x202020776f726473, 0x2e7075736828776f, 0x7264293b0a202020, 0x2020202020776f72, 0x64203d2073657061, - 0x7261746f72203f20, 0x6e756c6c203a2028, 0x776f7264203f3f20, 0x222229202b207363, 0x616e6e65722e7061, - 0x7274286368617229, 0x3b0a202020207d0a, 0x2020202069662028, 0x776f726420213d3d, 0x206e756c6c290a20, - 0x2020202020202077, 0x6f7264732e707573, 0x6828776f7264293b, 0x0a20202020726574, 0x75726e20776f7264, - 0x733b0a7d0a0a2f2f, 0x2042726f77736572, 0x20636f6d6d616e64, 0x206f757470757420, 0x7573657320225c6e, - 0x22206c696e652065, 0x6e64696e67732c20, 0x636f6e7665727465, 0x64206c696b652043, 0x2b2b206f75747075, - 0x742e0a636f6e7374, 0x20746f5465726d69, 0x6e616c5465787420, 0x3d20287465787429, 0x203d3e2074657874, - 0x2e7265706c616365, 0x282f283f3c215c72, 0x295c6e2f672c2022, 0x5c725c6e22293b0a, 0x0a2f2f2f2052756e, - 0x732061206c696e65, 0x3a20612062726f77, 0x73657220636f6d6d, 0x616e64206f662060, 0x636f6d6d616e6473, - 0x60202861204d6170, 0x2066726f6d20636f, 0x6d6d616e64206e61, 0x6d6520746f206861, 0x6e646c6572292077, - 0x68656e206f6e6520, 0x69730a2f2f2f2072, 0x6567697374657265, 0x6420666f72206974, 0x7320666972737420, - 0x776f726420616e64, 0x20646f6573206e6f, 0x742072657475726e, 0x20756e646566696e, 0x65642c20656c7365, - 0x206072756e496e43, 0x7070286c696e6529, 0x602e2041206c696e, 0x6520746861740a2f, 0x2f2f2063616e6e6f, - 0x742062652073706c, 0x697420676f657320, 0x746f20432b2b2c20, 0x7768696368207265, 0x706f727473207468, - 0x65206572726f722e, 0x2042726f77736572, 0x20636f6d6d616e64, 0x7320676574206073, 0x69676e616c602c20, - 0x7768696368204374, 0x726c2b430a2f2f2f, 0x2061626f72747320, 0x7769746820746865, 0x20726561736f6e20, - 0x4572726f72282249, 0x6e74657272757074, 0x656422293b206120, 0x432b2b20636f6d6d, 0x616e642063616e6e, - 0x6f7420626520696e, 0x7465727275707465, 0x642e0a6578706f72, 0x74206173796e6320, 0x66756e6374696f6e, - 0x2072756e4c696e65, 0x286c696e652c207b, 0x636f6d6d616e6473, 0x2c2072756e496e43, 0x70702c2077726974, - 0x652c206272696467, 0x652c207369676e61, 0x6c203d206e657720, 0x41626f7274436f6e, 0x74726f6c6c657228, - 0x292e7369676e616c, 0x7d29207b0a202020, 0x206c657420776f72, 0x64733b0a20202020, 0x747279207b0a2020, - 0x202020202020776f, 0x726473203d20746f, 0x6b656e697a65286c, 0x696e65293b0a2020, 0x20207d2063617463, - 0x6820286572726f72, 0x29207b0a20202020, 0x2020202072657475, 0x726e2072756e496e, 0x437070286c696e65, - 0x293b0a202020207d, 0x0a20202020636f6e, 0x73742068616e646c, 0x6572203d20776f72, 0x64732e6c656e6774, - 0x68203e2030203f20, 0x636f6d6d616e6473, 0x2e67657428776f72, 0x64735b305d29203a, 0x20756e646566696e, - 0x65643b0a20202020, 0x696620282168616e, 0x646c6572290a2020, 0x2020202020207265, 0x7475726e2072756e, - 0x496e437070286c69, 0x6e65293b0a202020, 0x20636f6e7374206f, 0x7574707574203d20, 0x6177616974206861, - 0x6e646c657228776f, 0x7264732e736c6963, 0x652831292c207b0a, 0x2020202020202020, 0x6c696e652c0a2020, - 0x2020202020206272, 0x696467652c0a2020, 0x2020202020207369, 0x676e616c2c0a2020, 0x2020202020207772, - 0x6974653a20287465, 0x787429203d3e2077, 0x7269746528746f54, 0x65726d696e616c54, 0x6578742853747269, - 0x6e67287465787429, 0x29292c0a20202020, 0x2020202072756e49, 0x6e4370703a202829, 0x203d3e2072756e49, - 0x6e437070286c696e, 0x65292c0a20202020, 0x7d293b0a20202020, 0x72657475726e206f, 0x7574707574203d3d, - 0x3d20756e64656669, 0x6e6564203f207275, 0x6e496e437070286c, 0x696e6529203a2074, 0x6f5465726d696e61, - 0x6c54657874285374, 0x72696e67286f7574, 0x70757429293b0a7d, 0x0a0a2f2f2f20496d, 0x706f727473207468, - 0x6520657874656e73, 0x696f6e206d6f6475, 0x6c6573206c697374, 0x656420627920432b, 0x2b2028225c6e222d, - 0x7365706172617465, 0x642055524c732920, 0x616e6420636f6c6c, 0x6563747320746865, 0x69722062726f7773, - 0x65720a2f2f2f2063, 0x6f6d6d616e64732e, 0x2041206d6f64756c, 0x6520746861742066, 0x61696c7320746f20, - 0x6c6f616420697320, 0x7265706f72746564, 0x20616e6420736b69, 0x707065642e0a6173, 0x796e632066756e63, - 0x74696f6e206c6f61, 0x64457874656e7369, 0x6f6e732875726c73, 0x2c20777269746529, 0x207b0a2020202063, - 0x6f6e737420636f6d, 0x6d616e6473203d20, 0x6e6577204d617028, 0x293b0a2020202066, 0x6f722028636f6e73, - 0x742075726c206f66, 0x2075726c732e7370, 0x6c697428225c6e22, 0x292e66696c746572, 0x2828656e74727929, - 0x203d3e20656e7472, 0x7920213d3d202222, 0x2929207b0a202020, 0x2020202020747279, 0x207b0a2020202020, - 0x2020202020202063, 0x6f6e7374206d6f64, 0x756c65203d206177, 0x61697420696d706f, 0x72742875726c293b, - 0x0a20202020202020, 0x2020202020666f72, 0x2028636f6e737420, 0x5b6e616d652c2068, 0x616e646c65725d20, - 0x6f66204f626a6563, 0x742e656e74726965, 0x73286d6f64756c65, 0x2e636f6d6d616e64, 0x73203f3f207b7d29, - 0x290a202020202020, 0x2020202020202020, 0x2020636f6d6d616e, 0x64732e736574286e, 0x616d652c2068616e, - 0x646c6572293b0a20, 0x202020202020207d, 0x2063617463682028, 0x6572726f7229207b, 0x0a20202020202020, - 0x2020202020777269, 0x746528616e73692e, 0x7265642860546572, 0x6d696e616c206578, 0x74656e73696f6e20, - 0x247b75726c7d2066, 0x61696c656420746f, 0x206c6f61643a2024, 0x7b6572726f723f2e, 0x6d65737361676520, - 0x3f3f206572726f72, 0x7d6029202b20225c, 0x725c6e22293b0a20, 0x202020202020207d, 0x0a202020207d0a20, - 0x2020207265747572, 0x6e20636f6d6d616e, 0x64733b0a7d0a0a2f, 0x2f2045646974696e, 0x67206b6579732c20, - 0x617320787465726d, 0x2e6a73207265706f, 0x727473207468656d, 0x20696e206f6e4461, 0x74612c206d617070, - 0x656420746f204c69, 0x6e65456469746f72, 0x20616374696f6e73, 0x2e0a636f6e737420, 0x6b6579416374696f, - 0x6e73203d206e6577, 0x204d6170285b0a20, 0x2020205b225c7222, 0x2c2028656469746f, 0x7229203d3e206564, - 0x69746f722e737562, 0x6d697428295d2c0a, 0x202020205b225c78, 0x3766222c20286564, 0x69746f7229203d3e, - 0x20656469746f722e, 0x6572617365282d31, 0x295d2c0a20202020, 0x5b225c62222c2028, 0x656469746f722920, - 0x3d3e20656469746f, 0x722e657261736528, 0x2d31295d2c0a2020, 0x20205b225c783162, 0x5b337e222c202865, - 0x6469746f7229203d, 0x3e20656469746f72, 0x2e65726173652830, 0x295d2c0a20202020, 0x5b225c7831625b44, - 0x222c202865646974, 0x6f7229203d3e2065, 0x6469746f722e6d6f, 0x7665546f28656469, 0x746f722e63757273, - 0x6f72202d2031295d, 0x2c0a202020205b22, 0x5c7831625b43222c, 0x2028656469746f72, 0x29203d3e20656469, - 0x746f722e6d6f7665, 0x546f28656469746f, 0x722e637572736f72, 0x202b2031295d2c0a, 0x202020205b225c78, - 0x31625b48222c2028, 0x656469746f722920, 0x3d3e20656469746f, 0x722e6d6f7665546f, 0x2830295d2c0a2020, - 0x20205b225c783162, 0x4f48222c20286564, 0x69746f7229203d3e, 0x20656469746f722e, 0x6d6f7665546f2830, - 0x295d2c0a20202020, 0x5b225c783031222c, 0x2028656469746f72, 0x29203d3e20656469, 0x746f722e6d6f7665, - 0x546f2830295d2c0a, 0x202020205b225c78, 0x31625b46222c2028, 0x656469746f722920, 0x3d3e20656469746f, - 0x722e6d6f7665546f, 0x28656469746f722e, 0x63686172732e6c65, 0x6e677468295d2c0a, 0x202020205b225c78, - 0x31624f46222c2028, 0x656469746f722920, 0x3d3e20656469746f, 0x722e6d6f7665546f, 0x28656469746f722e, - 0x63686172732e6c65, 0x6e677468295d2c0a, 0x202020205b225c78, 0x3035222c20286564, 0x69746f7229203d3e, - 0x20656469746f722e, 0x6d6f7665546f2865, 0x6469746f722e6368, 0x6172732e6c656e67, 0x7468295d2c0a2020, - 0x20205b225c783162, 0x5b41222c20286564, 0x69746f7229203d3e, 0x20656469746f722e, 0x726563616c6c282d, - 0x31295d2c0a202020, 0x205b225c7831625b, 0x42222c2028656469, 0x746f7229203d3e20, 0x656469746f722e72, - 0x6563616c6c283129, 0x5d2c0a202020205b, 0x225c74222c202865, 0x6469746f7229203d, 0x3e20656469746f72, - 0x2e747261636b2865, 0x6469746f722e636f, 0x6d706c6574654c69, 0x6e652829295d2c0a, 0x202020205b225c78, - 0x3033222c20286564, 0x69746f7229203d3e, 0x20656469746f722e, 0x63616e63656c4c69, 0x6e6528295d2c0a20, - 0x2020205b225c7830, 0x63222c2028656469, 0x746f7229203d3e20, 0x656469746f722e72, 0x656472617728616e, - 0x73692e636c656172, 0x53637265656e295d, 0x2c0a202020205b22, 0x5c783135222c2028, 0x656469746f722920, - 0x3d3e20656469746f, 0x722e6b696c6c4265, 0x666f726543757273, 0x6f7228295d2c0a5d, 0x293b0a0a2f2f2f20, - 0x4c696e6520656469, 0x746f722064726976, 0x656e206279207468, 0x65207465726d696e, 0x616c277320696e70, - 0x757420646174612e, 0x2060777269746528, 0x7465787429602064, 0x6973706c61797320, 0x746578743b206072, - 0x756e286c696e6529, 0x6020616e640a2f2f, 0x2f2060636f6d706c, 0x657465286c696e65, 0x2960207265747572, - 0x6e2050726f6d6973, 0x6573206f66207468, 0x6520432b2b206f75, 0x7470757420616e64, 0x206f6620225c6e22, - 0x2d73657061726174, 0x656420636f6d706c, 0x6574696f6e206361, 0x6e64696461746573, 0x2e0a6578706f7274, - 0x20636c617373204c, 0x696e65456469746f, 0x72207b0a20202020, 0x636f6e7374727563, 0x746f72287b777269, - 0x74652c2072756e2c, 0x20636f6d706c6574, 0x652c2070726f6d70, 0x747d29207b0a2020, 0x2020202020207468, - 0x69732e7772697465, 0x203d207772697465, 0x3b0a202020202020, 0x2020746869732e72, 0x756e203d2072756e, - 0x3b0a202020202020, 0x2020746869732e63, 0x6f6d706c65746520, 0x3d20636f6d706c65, 0x74653b0a20202020, - 0x2020202074686973, 0x2e61626f7274203d, 0x206e756c6c3b0a20, 0x2020202020202074, 0x6869732e70726f6d, - 0x7074203d2070726f, 0x6d70743b0a202020, 0x2020202020746869, 0x732e636861727320, 0x3d205b5d3b0a2020, - 0x2020202020207468, 0x69732e637572736f, 0x72203d20303b0a20, 0x2020202020202074, 0x6869732e68697374, - 0x6f7279203d205b5d, 0x3b0a202020202020, 0x2020746869732e68, 0x6973746f7279496e, 0x646578203d20303b, - 0x0a20202020202020, 0x20746869732e6275, 0x7379203d206e756c, 0x6c3b0a202020207d, 0x0a0a202020206765, - 0x74206c696e652829, 0x207b0a2020202020, 0x2020207265747572, 0x6e20746869732e63, 0x686172732e6a6f69, - 0x6e282222293b0a20, 0x2020207d0a0a2020, 0x20202f2f2f205265, 0x736f6c766573206f, 0x6e6365206e6f2063, - 0x6f6d6d616e64206f, 0x7220636f6d706c65, 0x74696f6e20697320, 0x70656e64696e672e, 0x0a20202020617379, - 0x6e63207768656e49, 0x646c652829207b0a, 0x2020202020202020, 0x7768696c65202874, 0x6869732e62757379, - 0x290a202020202020, 0x2020202020206177, 0x6169742074686973, 0x2e627573793b0a20, 0x2020207d0a0a2020, - 0x202073686f775072, 0x6f6d70742829207b, 0x0a20202020202020, 0x20746869732e7772, 0x6974652874686973, - 0x2e70726f6d707429, 0x3b0a202020207d0a, 0x0a2020202068616e, 0x646c652864617461, 0x29207b0a20202020, - 0x2020202069662028, 0x746869732e627573, 0x79290a2020202020, 0x2020202020202072, 0x657475726e207468, - 0x69732e696e746572, 0x7275707428646174, 0x61293b0a20202020, 0x20202020636f6e73, 0x7420616374696f6e, - 0x203d206b65794163, 0x74696f6e732e6765, 0x742864617461293b, 0x0a20202020202020, 0x2069662028616374, - 0x696f6e290a202020, 0x2020202020202020, 0x2072657475726e20, 0x616374696f6e2874, 0x686973293b0a2020, - 0x2020202020206966, 0x202821646174612e, 0x7374617274735769, 0x746828225c783162, 0x2229290a20202020, - 0x2020202020202020, 0x72657475726e2074, 0x6869732e696e7365, 0x7274546578742864, 0x617461293b0a2020, - 0x20207d0a0a202020, 0x202f2f205768696c, 0x65206120636f6d6d, 0x616e642072756e73, 0x2c204374726c2b43, - 0x2061626f72747320, 0x697473207369676e, 0x616c206f6e636520, 0x616e642074686520, 0x6f74686572206b65, - 0x7973206172652069, 0x676e6f7265642e0a, 0x20202020696e7465, 0x7272757074286461, 0x746129207b0a2020, - 0x202020202020636f, 0x6e73742072756e6e, 0x696e67203d207468, 0x69732e61626f7274, 0x3f2e7369676e616c, - 0x2e61626f72746564, 0x203d3d3d2066616c, 0x73653b0a20202020, 0x2020202069662028, 0x6461746120213d3d, - 0x20225c7830332220, 0x7c7c202172756e6e, 0x696e67290a202020, 0x2020202020202020, 0x2072657475726e3b, - 0x0a20202020202020, 0x20746869732e7772, 0x69746528225e435c, 0x725c6e22293b0a20, 0x2020202020202074, - 0x6869732e61626f72, 0x742e61626f727428, 0x6e6577204572726f, 0x722822496e746572, 0x7275707465642229, - 0x293b0a202020207d, 0x0a0a202020202f2f, 0x205479706564206f, 0x7220706173746564, 0x20746578743a2070, - 0x72696e7461626c65, 0x2063686172616374, 0x6572732061726520, 0x696e736572746564, 0x2c20612063617272, - 0x6961676520726574, 0x75726e207375626d, 0x6974732074686520, 0x6c696e650a202020, 0x202f2f20616e6420, - 0x7468652072657374, 0x206f662061206d75, 0x6c74692d6c696e65, 0x2070617374652069, 0x732064726f707065, - 0x642c2073696e6365, 0x20636f6d6d616e64, 0x732072756e206f6e, 0x6520617420612074, 0x696d652e0a202020, - 0x20696e7365727454, 0x6578742864617461, 0x29207b0a20202020, 0x20202020636f6e73, 0x74205b746578742c, - 0x202e2e2e72657374, 0x5d203d2064617461, 0x2e73706c69742822, 0x5c7222293b0a2020, 0x2020202020207468, - 0x69732e696e736572, 0x742841727261792e, 0x66726f6d28746578, 0x74292e66696c7465, 0x7228286368617229, - 0x203d3e2063686172, 0x203e3d2022202220, 0x2626206368617220, 0x213d3d20225c7837, 0x662229293b0a2020, - 0x2020202020206966, 0x2028726573742e6c, 0x656e677468203e20, 0x30290a2020202020, 0x2020202020202072, - 0x657475726e207468, 0x69732e7375626d69, 0x7428293b0a202020, 0x207d0a0a20202020, 0x696e736572742863, - 0x6861727329207b0a, 0x2020202020202020, 0x6966202863686172, 0x732e6c656e677468, 0x203d3d3d2030290a, - 0x2020202020202020, 0x2020202072657475, 0x726e3b0a20202020, 0x2020202074686973, 0x2e63686172732e73, - 0x706c696365287468, 0x69732e637572736f, 0x722c20302c202e2e, 0x2e6368617273293b, 0x0a20202020202020, - 0x20746869732e6375, 0x72736f72202b3d20, 0x63686172732e6c65, 0x6e6774683b0a2020, 0x2020202020207468, - 0x69732e7265647261, 0x7728293b0a202020, 0x207d0a0a20202020, 0x6572617365286f66, 0x6673657429207b0a, - 0x2020202020202020, 0x636f6e737420696e, 0x646578203d207468, 0x69732e637572736f, 0x72202b206f666673, - 0x65743b0a20202020, 0x2020202069662028, 0x696e646578203c20, 0x30207c7c20696e64, 0x6578203e3d207468, - 0x69732e6368617273, 0x2e6c656e67746829, 0x0a20202020202020, 0x2020202020726574, 0x75726e3b0a202020, - 0x2020202020746869, 0x732e63686172732e, 0x73706c6963652869, 0x6e6465782c203129, 0x3b0a202020202020, - 0x2020746869732e63, 0x7572736f72203d20, 0x696e6465783b0a20, 0x2020202020202074, 0x6869732e72656472, - 0x617728293b0a2020, 0x20207d0a0a202020, 0x206b696c6c426566, 0x6f7265437572736f, 0x722829207b0a2020, - 0x2020202020207468, 0x69732e6368617273, 0x2e73706c69636528, 0x302c20746869732e, 0x637572736f72293b, - 0x0a20202020202020, 0x20746869732e6375, 0x72736f72203d2030, 0x3b0a202020202020, 0x2020746869732e72, - 0x656472617728293b, 0x0a202020207d0a0a, 0x202020206d6f7665, 0x546f28706f736974, 0x696f6e29207b0a20, - 0x2020202020202063, 0x6f6e737420637572, 0x736f72203d204d61, 0x74682e6d61782830, 0x2c204d6174682e6d, - 0x696e28746869732e, 0x63686172732e6c65, 0x6e6774682c20706f, 0x736974696f6e2929, 0x3b0a202020202020, - 0x2020696620286375, 0x72736f72203d3d3d, 0x20746869732e6375, 0x72736f72290a2020, 0x2020202020202020, - 0x202072657475726e, 0x3b0a202020202020, 0x2020746869732e63, 0x7572736f72203d20, 0x637572736f723b0a, - 0x2020202020202020, 0x746869732e726564, 0x72617728293b0a20, 0x2020207d0a0a2020, 0x2020726563616c6c, - 0x2864697265637469, 0x6f6e29207b0a2020, 0x202020202020636f, 0x6e737420696e6465, 0x78203d2074686973, - 0x2e686973746f7279, 0x496e646578202b20, 0x646972656374696f, 0x6e3b0a2020202020, 0x2020206966202869, - 0x6e646578203c2030, 0x207c7c20696e6465, 0x78203e2074686973, 0x2e686973746f7279, 0x2e6c656e67746829, - 0x0a20202020202020, 0x2020202020726574, 0x75726e3b0a202020, 0x2020202020746869, 0x732e686973746f72, - 0x79496e646578203d, 0x20696e6465783b0a, 0x2020202020202020, 0x746869732e636861, 0x7273203d20417272, - 0x61792e66726f6d28, 0x696e646578203d3d, 0x3d20746869732e68, 0x6973746f72792e6c, 0x656e677468203f20, - 0x2222203a20746869, 0x732e686973746f72, 0x795b696e6465785d, 0x293b0a2020202020, 0x202020746869732e, - 0x637572736f72203d, 0x20746869732e6368, 0x6172732e6c656e67, 0x74683b0a20202020, 0x2020202074686973, - 0x2e72656472617728, 0x293b0a202020207d, 0x0a0a202020206361, 0x6e63656c4c696e65, 0x2829207b0a202020, - 0x2020202020746869, 0x732e777269746528, 0x225e435c725c6e22, 0x293b0a2020202020, 0x202020746869732e, - 0x6368617273203d20, 0x5b5d3b0a20202020, 0x2020202074686973, 0x2e637572736f7220, 0x3d20303b0a202020, - 0x2020202020746869, 0x732e686973746f72, 0x79496e646578203d, 0x20746869732e6869, 0x73746f72792e6c65, - 0x6e6774683b0a2020, 0x2020202020207468, 0x69732e73686f7750, 0x726f6d707428293b, 0x0a202020207d0a0a, - 0x202020202f2f2052, 0x6577726974657320, 0x7468652070726f6d, 0x707420616e642074, 0x6865206c696e6520, - 0x696e20706c616365, 0x2c207468656e206d, 0x6f76657320746865, 0x20637572736f7220, 0x6261636b20746f20, - 0x69747320706f7369, 0x74696f6e2e0a2020, 0x2020726564726177, 0x2870726566697820, 0x3d20225c72222920, - 0x7b0a202020202020, 0x2020746869732e77, 0x7269746528707265, 0x666978202b207468, 0x69732e70726f6d70, - 0x74202b2074686973, 0x2e6c696e65202b20, 0x616e73692e636c65, 0x6172546f456e6420, 0x2b20616e73692e6c, - 0x6566742874686973, 0x2e63686172732e6c, 0x656e677468202d20, 0x746869732e637572, 0x736f7229293b0a20, - 0x2020207d0a0a2020, 0x2020747261636b28, 0x70726f6d69736529, 0x207b0a2020202020, 0x202020746869732e, - 0x62757379203d2070, 0x726f6d6973652e66, 0x696e616c6c792828, 0x29203d3e207b0a20, 0x2020202020202020, - 0x202020746869732e, 0x62757379203d206e, 0x756c6c3b0a202020, 0x20202020207d293b, 0x0a20202020202020, - 0x2072657475726e20, 0x746869732e627573, 0x793b0a202020207d, 0x0a0a202020207375, 0x626d69742829207b, - 0x0a20202020202020, 0x20636f6e7374206c, 0x696e65203d207468, 0x69732e6c696e653b, 0x0a20202020202020, - 0x20746869732e7772, 0x69746528225c725c, 0x6e22293b0a202020, 0x2020202020746869, 0x732e636861727320, - 0x3d205b5d3b0a2020, 0x2020202020207468, 0x69732e637572736f, 0x72203d20303b0a20, 0x2020202020202069, - 0x6620286c696e652e, 0x7472696d28292021, 0x3d3d202222202626, 0x20746869732e6869, 0x73746f72792e6174, - 0x282d312920213d3d, 0x206c696e65290a20, 0x2020202020202020, 0x202020746869732e, 0x686973746f72792e, - 0x70757368286c696e, 0x65293b0a20202020, 0x2020202074686973, 0x2e686973746f7279, 0x496e646578203d20, - 0x746869732e686973, 0x746f72792e6c656e, 0x6774683b0a202020, 0x2020202020726574, 0x75726e2074686973, - 0x2e747261636b2874, 0x6869732e65786563, 0x757465286c696e65, 0x29293b0a20202020, 0x7d0a0a2020202061, - 0x73796e6320657865, 0x63757465286c696e, 0x6529207b0a202020, 0x2020202020746869, 0x732e61626f727420, - 0x3d206e6577204162, 0x6f7274436f6e7472, 0x6f6c6c657228293b, 0x0a20202020202020, 0x20747279207b0a20, - 0x2020202020202020, 0x202020636f6e7374, 0x206f757470757420, 0x3d20617761697420, 0x746869732e72756e, - 0x286c696e652c2074, 0x6869732e61626f72, 0x742e7369676e616c, 0x293b0a2020202020, 0x202020202020202f, - 0x2f20546865207072, 0x6f6d707420737461, 0x727473206f6e2061, 0x206e6577206c696e, 0x652c20756e6c6573, - 0x7320746865206f75, 0x7470757420616c72, 0x6561647920656e64, 0x73206f6e65206f72, 0x206c656176657320, - 0x7468650a20202020, 0x2020202020202020, 0x2f2f20637572736f, 0x7220617420686f6d, 0x6520287375636820, - 0x6173207468652027, 0x636c656172272063, 0x6f6d6d616e64292e, 0x0a20202020202020, 0x2020202020696620, - 0x286f757470757429, 0x0a20202020202020, 0x2020202020202020, 0x20746869732e7772, 0x697465286f757470, - 0x75742e656e647357, 0x69746828225c6e22, 0x29207c7c206f7574, 0x7075742e656e6473, 0x5769746828225c78, - 0x31625b482229203f, 0x206f757470757420, 0x3a206f7574707574, 0x202b20225c725c6e, 0x22293b0a20202020, - 0x202020207d206361, 0x7463682028657272, 0x6f7229207b0a2020, 0x2020202020202020, 0x2020746869732e77, - 0x7269746528616e73, 0x692e726564286045, 0x72726f723a20247b, 0x6572726f723f2e6d, 0x657373616765203f, - 0x3f206572726f727d, 0x6029202b20225c72, 0x5c6e22293b0a2020, 0x2020202020207d0a, 0x2020202020202020, - 0x746869732e73686f, 0x7750726f6d707428, 0x293b0a202020207d, 0x0a0a202020206173, 0x796e6320636f6d70, - 0x6c6574654c696e65, 0x2829207b0a202020, 0x20202020202f2f20, 0x4f6e6c7920746865, 0x20636f6d6d616e64, - 0x206e616d65206973, 0x20636f6d706c6574, 0x65642c20616e6420, 0x6f6e6c7920776974, 0x6820746865206375, - 0x72736f7220617420, 0x74686520656e6420, 0x6f6620746865206c, 0x696e652e0a202020, 0x2020202020696620, - 0x28746869732e6375, 0x72736f7220213d3d, 0x20746869732e6368, 0x6172732e6c656e67, 0x7468290a20202020, - 0x2020202020202020, 0x72657475726e3b0a, 0x2020202020202020, 0x636f6e7374206c69, 0x6e65203d20746869, - 0x732e6c696e653b0a, 0x2020202020202020, 0x6c65742063616e64, 0x6964617465733b0a, 0x2020202020202020, - 0x747279207b0a2020, 0x2020202020202020, 0x202063616e646964, 0x61746573203d2028, 0x6177616974207468, - 0x69732e636f6d706c, 0x657465286c696e65, 0x29292e73706c6974, 0x28225c6e22292e66, 0x696c746572282877, - 0x6f726429203d3e20, 0x776f726420213d3d, 0x202222293b0a2020, 0x2020202020207d20, 0x6361746368202865, - 0x72726f7229207b0a, 0x2020202020202020, 0x2020202072657475, 0x726e3b0a20202020, 0x202020207d0a2020, - 0x2020202020206966, 0x202863616e646964, 0x617465732e6c656e, 0x677468203d3d3d20, 0x30290a2020202020, - 0x2020202020202072, 0x657475726e3b0a20, 0x2020202020202063, 0x6f6e737420636f6d, 0x706c6574696f6e20, - 0x3d2063616e646964, 0x617465732e6c656e, 0x677468203d3d3d20, 0x31203f2063616e64, 0x6964617465735b30, - 0x5d202b2022202220, 0x3a20636f6d6d6f6e, 0x5072656669782863, 0x616e646964617465, 0x73293b0a20202020, - 0x2020202069662028, 0x636f6d706c657469, 0x6f6e2e6c656e6774, 0x68203e206c696e65, 0x2e6c656e67746829, - 0x0a20202020202020, 0x2020202020726574, 0x75726e2074686973, 0x2e696e7365727428, 0x41727261792e6672, - 0x6f6d28636f6d706c, 0x6574696f6e2e736c, 0x696365286c696e65, 0x2e6c656e67746829, 0x29293b0a20202020, - 0x2020202074686973, 0x2e77726974652822, 0x5c725c6e22202b20, 0x63616e6469646174, 0x65732e6a6f696e28, - 0x2220202229202b20, 0x225c725c6e22293b, 0x0a20202020202020, 0x20746869732e7265, 0x6472617728293b0a, - 0x202020207d0a7d0a, 0x0a2f2f2f204d6f75, 0x6e74732061207465, 0x726d696e616c2069, 0x6e2060656c656d65, - 0x6e7460206f6e6365, 0x2074686520576562, 0x46726f6e74206272, 0x6964676520697320, 0x72656164792e2052, - 0x657475726e732074, 0x686520787465726d, 0x205465726d696e61, 0x6c2c0a2f2f2f2069, 0x7473206c696e6520, - 0x656469746f722061, 0x6e6420612060666c, 0x7573682829602072, 0x65736f6c76696e67, 0x207768656e206576, - 0x6572792077726974, 0x6520686173206265, 0x656e2072656e6465, 0x7265642e0a657870, 0x6f7274206173796e, - 0x632066756e637469, 0x6f6e206d6f756e74, 0x28656c656d656e74, 0x2c207b6272696467, 0x65203d20676c6f62, - 0x616c546869732e77, 0x656246726f6e742c, 0x207465726d696e61, 0x6c4f7074696f6e73, 0x203d207b7d7d203d, - 0x207b7d29207b0a20, 0x202020636f6e7374, 0x207465726d696e61, 0x6c203d206e657720, 0x5465726d696e616c, - 0x287b0a2020202020, 0x202020637572736f, 0x72426c696e6b3a20, 0x747275652c0a2020, 0x202020202020636f, - 0x6e76657274456f6c, 0x3a2066616c73652c, 0x0a20202020202020, 0x20666f6e7446616d, 0x696c793a20277569, - 0x2d6d6f6e6f737061, 0x63652c2022436173, 0x636164696120436f, 0x6465222c2022536f, 0x7572636520436f64, - 0x652050726f222c20, 0x4d656e6c6f2c2043, 0x6f6e736f6c61732c, 0x206d6f6e6f737061, 0x6365272c0a202020, - 0x2020202020746865, 0x6d653a207b626163, 0x6b67726f756e643a, 0x2022233064313131, 0x37222c20666f7265, - 0x67726f756e643a20, 0x2223653665646633, 0x227d2c0a20202020, 0x202020202e2e2e74, 0x65726d696e616c4f, - 0x7074696f6e732c0a, 0x202020207d293b0a, 0x20202020636f6e73, 0x7420666974203d20, 0x6e65772046697441, - 0x64646f6e28293b0a, 0x202020207465726d, 0x696e616c2e6c6f61, 0x644164646f6e2866, 0x6974293b0a202020, - 0x207465726d696e61, 0x6c2e6f70656e2865, 0x6c656d656e74293b, 0x0a20202020666974, 0x2e66697428293b0a, - 0x202020206e657720, 0x526573697a654f62, 0x7365727665722828, 0x29203d3e20666974, 0x2e6669742829292e, - 0x6f62736572766528, 0x656c656d656e7429, 0x3b0a0a202020206c, 0x6574206c61737457, 0x72697465203d2050, - 0x726f6d6973652e72, 0x65736f6c76652829, 0x3b0a20202020636f, 0x6e73742077726974, 0x65203d2028746578, - 0x7429203d3e207b0a, 0x2020202020202020, 0x6c61737457726974, 0x65203d206e657720, 0x50726f6d69736528, - 0x287265736f6c7665, 0x29203d3e20746572, 0x6d696e616c2e7772, 0x6974652874657874, 0x2c207265736f6c76, - 0x6529293b0a202020, 0x207d3b0a20202020, 0x636f6e737420666c, 0x757368203d202829, 0x203d3e206c617374, - 0x57726974653b0a0a, 0x2020202074727920, 0x7b0a202020202020, 0x2020617761697420, 0x6272696467652e72, - 0x656164793b0a2020, 0x20207d2063617463, 0x6820286572726f72, 0x29207b0a20202020, 0x2020202077726974, - 0x6528616e73692e72, 0x65642860436f6e6e, 0x656374696f6e2074, 0x6f20746865206170, 0x706c69636174696f, - 0x6e206661696c6564, 0x3a20247b6572726f, 0x723f2e6d65737361, 0x6765203f3f206572, 0x726f727d6029202b, - 0x20225c725c6e2229, 0x3b0a202020202020, 0x202072657475726e, 0x207b7465726d696e, 0x616c2c2065646974, - 0x6f723a206e756c6c, 0x2c20666c7573687d, 0x3b0a202020207d0a, 0x0a20202020636f6e, 0x73742063616c6c20, - 0x3d20286e616d6529, 0x203d3e2062726964, 0x67652e6370704675, 0x6e6374696f6e2860, 0x77656266726f6e74, - 0x2e7465726d696e61, 0x6c2e247b6e616d65, 0x7d60293b0a202020, 0x206c65742070726f, 0x6d70742c2062616e, - 0x6e65722c20657874, 0x656e73696f6e733b, 0x0a20202020747279, 0x207b0a2020202020, 0x2020205b70726f6d, - 0x70742c2062616e6e, 0x65722c2065787465, 0x6e73696f6e735d20, 0x3d20617761697420, 0x50726f6d6973652e, - 0x616c6c285b63616c, 0x6c282270726f6d70, 0x74222928292c2063, 0x616c6c282262616e, 0x6e6572222928292c, - 0x2063616c6c282265, 0x7874656e73696f6e, 0x73222928295d293b, 0x0a202020207d2063, 0x6174636820286572, - 0x726f7229207b0a20, 0x202020202020202f, 0x2f20466f72206578, 0x616d706c65206120, 0x7061676520736572, - 0x7665642062792061, 0x6e206170706c6963, 0x6174696f6e207769, 0x74686f7574207765, 0x6266726f6e743a3a, - 0x5465726d696e616c, 0x2e0a202020202020, 0x2020777269746528, 0x616e73692e726564, 0x28605465726d696e, - 0x616c20756e617661, 0x696c61626c653a20, 0x247b6572726f723f, 0x2e6d657373616765, 0x203f3f206572726f, - 0x727d6029202b2022, 0x5c725c6e22293b0a, 0x2020202020202020, 0x72657475726e207b, 0x7465726d696e616c, - 0x2c20656469746f72, 0x3a206e756c6c2c20, 0x666c7573687d3b0a, 0x202020207d0a2020, 0x2020636f6e737420, - 0x636f6d6d616e6473, 0x203d206177616974, 0x206c6f6164457874, 0x656e73696f6e7328, 0x657874656e73696f, - 0x6e732c2077726974, 0x65293b0a20202020, 0x636f6e7374207275, 0x6e496e437070203d, 0x2063616c6c282272, - 0x756e22293b0a2020, 0x2020636f6e737420, 0x72756e203d20286c, 0x696e652c20736967, 0x6e616c29203d3e20, - 0x72756e4c696e6528, 0x6c696e652c207b63, 0x6f6d6d616e64732c, 0x2072756e496e4370, 0x702c207772697465, - 0x2c20627269646765, 0x2c207369676e616c, 0x7d293b0a20202020, 0x636f6e7374206564, 0x69746f72203d206e, - 0x6577204c696e6545, 0x6469746f72287b77, 0x726974652c207275, 0x6e2c20636f6d706c, 0x6574653a2063616c, - 0x6c2822636f6d706c, 0x65746522292c2070, 0x726f6d70747d293b, 0x0a20202020696620, 0x2862616e6e657229, - 0x0a20202020202020, 0x2077726974652862, 0x616e6e65722e7265, 0x706c616365416c6c, 0x28225c6e222c2022, - 0x5c725c6e2229202b, 0x20225c725c6e2229, 0x3b0a202020206564, 0x69746f722e73686f, 0x7750726f6d707428, - 0x293b0a2020202074, 0x65726d696e616c2e, 0x6f6e446174612828, 0x6461746129203d3e, 0x20656469746f722e, - 0x68616e646c652864, 0x61746129293b0a20, 0x2020207465726d69, 0x6e616c2e666f6375, 0x7328293b0a202020, - 0x2072657475726e20, 0x7b7465726d696e61, 0x6c2c20656469746f, 0x722c20666c757368, 0x7d3b0a7d0a000000 - }; -}; - -} // namespace webfront::fs::generated diff --git a/include/webfront/system/ToolManagerFS.hpp b/include/webfront/system/ToolManagerFS.hpp deleted file mode 100644 index 4f2da3c3..00000000 --- a/include/webfront/system/ToolManagerFS.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/// @brief Virtual file system serving the browser side of the wf tool manager (the terminal extension -/// wf.mjs) under webfront/components/tools/. -#pragma once - -#include "FileSystem.hpp" -#include "ToolManagerModuleData.hpp" - -#include -#include -#include - -namespace webfront::fs { - -class ToolManagerFS { -public: - static constexpr std::string_view prefix = "webfront/components/tools/"; - static constexpr std::string_view module = "webfront/components/tools/wf.mjs"; - - explicit ToolManagerFS(std::filesystem::path /*docRoot*/) {} - - static std::optional open(std::filesystem::path file) { - if (file.relative_path().generic_string() == module) - return File{generated::ToolManagerModuleData{}}; - return {}; - } -}; - -} // namespace webfront::fs diff --git a/include/webfront/system/ToolManagerModuleData.hpp b/include/webfront/system/ToolManagerModuleData.hpp deleted file mode 100644 index a055a52f..00000000 --- a/include/webfront/system/ToolManagerModuleData.hpp +++ /dev/null @@ -1,393 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace webfront::fs::generated { - -struct ToolManagerModuleData { - static constexpr std::string_view encoding{}; - static constexpr std::size_t dataSize{15006}; - static constexpr std::array data{ - 0x2f2f2f2040627269, 0x65662042726f7773, 0x6572207369646520, 0x6f66207468652077, 0x6620746f6f6c206d, - 0x616e616765722028, 0x23323334292c2061, 0x207465726d696e61, 0x6c20657874656e73, 0x696f6e2061646465, - 0x642062790a2f2f2f, 0x2077656266726f6e, 0x743a3a546f6f6c4d, 0x616e616765722028, 0x696e636c7564652f, - 0x77656266726f6e74, 0x2f636f6d706f6e65, 0x6e74732f546f6f6c, 0x4d616e616765722e, 0x687070292e202777, - 0x6620736561726368, 0x272c202777662069, 0x6e7374616c6c2720, 0x616e640a2f2f2f20, 0x277766206f70656e, - 0x272072756e206865, 0x72652c2062656361, 0x7573652074686520, 0x646f776e6c6f6164, 0x20737065616b7320, - 0x48545450533b2027, 0x7766206c69737427, 0x2c20277766207265, 0x6d6f76652720616e, 0x6420277766206865, - 0x6c70272072756e0a, 0x2f2f2f20696e2043, 0x2b2b2e20416e2069, 0x6e7374616c6c6174, 0x696f6e2066657463, - 0x6865732074686520, 0x7061636b756d656e, 0x7420616e64207468, 0x652074617262616c, 0x6c2066726f6d2074, - 0x6865206e706d2072, 0x656769737472792c, 0x20636865636b7320, 0x7468650a2f2f2f20, 0x74617262616c6c27, - 0x73205348412d3531, 0x3220696e74656772, 0x6974792c20756e70, 0x61636b7320697420, 0x616e642073656e64, - 0x7320697473206669, 0x6c6573207468726f, 0x7567682077656266, 0x726f6e742e706b67, 0x2e626567696e2c0a, - 0x2f2f2f202e777269, 0x746546696c652061, 0x6e64202e636f6d6d, 0x69742e0a0a636f6e, 0x737420626c6f636b, - 0x53697a65203d2035, 0x31323b0a2f2f2f20, 0x46696c6573206372, 0x6f73732074686520, 0x6272696467652069, - 0x6e206368756e6b73, 0x206f662074686973, 0x206d616e79206279, 0x7465733b20746865, 0x2062726f77736572, - 0x2073656e64732061, 0x206c61726765206f, 0x6e6520696e207365, 0x766572616c0a2f2f, 0x2f20576562536f63, - 0x6b6574206672616d, 0x65732c2077686963, 0x6820746865207365, 0x7276657220726561, 0x7373656d626c6573, - 0x2e0a6578706f7274, 0x20636f6e73742063, 0x68756e6b53697a65, 0x203d20323536202a, 0x20313032343b0a2f, - 0x2f2f204c61726765, 0x737420756e706163, 0x6b65642074617262, 0x616c6c2061636365, 0x707465642c206167, - 0x61696e7374206465, 0x636f6d7072657373, 0x696f6e20626f6d62, 0x732e0a6578706f72, 0x7420636f6e737420, - 0x6d6178556e706163, 0x6b65644279746573, 0x203d20323536202a, 0x2031303234202a20, 0x313032343b0a636f, - 0x6e73742075746638, 0x203d206e65772054, 0x6578744465636f64, 0x657228293b0a0a2f, 0x2f2f2053706c6974, - 0x7320226e616d655b, 0x4076657273696f6e, 0x5d222c2077686572, 0x6520746865206e61, 0x6d65206d61792062, - 0x652073636f706564, 0x2028224073636f70, 0x652f6e616d654031, 0x2e302e3022292e20, 0x5468652076657273, - 0x696f6e2069732022, 0x220a2f2f2f207768, 0x656e20616273656e, 0x742e0a6578706f72, 0x742066756e637469, - 0x6f6e207061727365, 0x5370656328737065, 0x6329207b0a202020, 0x20636f6e73742061, 0x74203d2073706563, - 0x2e696e6465784f66, 0x282240222c207370, 0x65632e7374617274, 0x7357697468282240, 0x2229203f2031203a, - 0x2030293b0a202020, 0x2072657475726e20, 0x6174203c2030203f, 0x207b6e616d653a20, 0x737065632c207665, - 0x7273696f6e3a2022, 0x227d203a207b6e61, 0x6d653a2073706563, 0x2e736c6963652830, 0x2c206174292c2076, - 0x657273696f6e3a20, 0x737065632e736c69, 0x6365286174202b20, 0x31297d3b0a7d0a0a, 0x66756e6374696f6e, - 0x2072656769737472, 0x7942617365287265, 0x6769737472792920, 0x7b0a20202020636f, 0x6e73742062617365, - 0x203d206e65772055, 0x524c287265676973, 0x7472792c20676c6f, 0x62616c546869732e, 0x6c6f636174696f6e, - 0x3f2e68726566293b, 0x0a20202020696620, 0x2821626173652e70, 0x6174686e616d652e, 0x656e647357697468, - 0x28222f2229290a20, 0x2020202020202062, 0x6173652e70617468, 0x6e616d65202b3d20, 0x222f223b0a202020, - 0x2072657475726e20, 0x626173653b0a7d0a, 0x0a2f2f2054686520, 0x7265676973747279, 0x20656e636f646573, - 0x2074686520736c61, 0x7368206f66206120, 0x73636f706564206e, 0x616d652e0a636f6e, 0x7374207061636b75, - 0x6d656e7455726c20, 0x3d2028626173652c, 0x206e616d6529203d, 0x3e206e6577205552, 0x4c286e616d652e72, - 0x65706c6163652822, 0x2f222c2022253266, 0x22292c2062617365, 0x293b0a0a6173796e, 0x632066756e637469, - 0x6f6e206665746368, 0x4f6b2875726c2c20, 0x6665746368496d70, 0x6c2c207369676e61, 0x6c29207b0a202020, - 0x20636f6e73742072, 0x6573706f6e736520, 0x3d20617761697420, 0x6665746368496d70, 0x6c2875726c2c207b, - 0x7369676e616c7d29, 0x3b0a202020206966, 0x202821726573706f, 0x6e73652e6f6b290a, 0x2020202020202020, - 0x7468726f77206e65, 0x77204572726f7228, 0x60247b75726c7d3a, 0x204854545020247b, 0x726573706f6e7365, - 0x2e7374617475737d, 0x60293b0a20202020, 0x72657475726e2072, 0x6573706f6e73653b, 0x0a7d0a0a6173796e, - 0x632066756e637469, 0x6f6e206665746368, 0x4a736f6e2875726c, 0x2c20666574636849, 0x6d706c2c20736967, - 0x6e616c29207b0a20, 0x2020207265747572, 0x6e20286177616974, 0x2066657463684f6b, 0x2875726c2c206665, - 0x746368496d706c2c, 0x207369676e616c29, 0x292e6a736f6e2829, 0x3b0a7d0a0a66756e, 0x6374696f6e207265, - 0x736f6c76654d616e, 0x6966657374287061, 0x636b756d656e742c, 0x206e616d652c2072, 0x6571756573746564, - 0x29207b0a20202020, 0x636f6e7374207461, 0x67203d2072657175, 0x6573746564207c7c, 0x20226c6174657374, - 0x223b0a2020202063, 0x6f6e737420766572, 0x73696f6e203d2070, 0x61636b756d656e74, 0x5b22646973742d74, - 0x616773225d3f2e5b, 0x7461675d203f3f20, 0x7265717565737465, 0x643b0a2020202063, 0x6f6e7374206d616e, - 0x6966657374203d20, 0x7061636b756d656e, 0x742e76657273696f, 0x6e733f2e5b766572, 0x73696f6e5d3b0a20, - 0x2020206966202821, 0x6d616e6966657374, 0x290a202020202020, 0x20207468726f7720, 0x6e6577204572726f, - 0x722860247b6e616d, 0x657d20686173206e, 0x6f2076657273696f, 0x6e2027247b746167, 0x7d2760293b0a2020, - 0x202072657475726e, 0x206d616e69666573, 0x743b0a7d0a0a2f2f, 0x2f20436865636b73, 0x2062797465732061, - 0x6761696e73742061, 0x6e2053524920696e, 0x7465677269747920, 0x737472696e672028, 0x227368613531322d, - 0x3c6261736536343e, 0x222c20706f737369, 0x626c792073657665, 0x72616c2068617368, 0x65730a2f2f2f2073, - 0x6570617261746564, 0x2062792073706163, 0x65732920616e6420, 0x72657475726e7320, 0x746865206d617463, - 0x68696e6720227368, 0x613531322de280a6, 0x2220686173682e20, 0x4f6e6c7920534841, 0x2d35313220697320, - 0x6163636570746564, 0x2e0a6578706f7274, 0x206173796e632066, 0x756e6374696f6e20, 0x766572696679496e, - 0x7465677269747928, 0x62797465732c2069, 0x6e74656772697479, 0x29207b0a20202020, 0x636f6e7374206578, - 0x706563746564203d, 0x20537472696e6728, 0x696e746567726974, 0x79203f3f20222229, 0x0a20202020202020, - 0x202e73706c697428, 0x2f5c732b2f290a20, 0x202020202020202e, 0x66696c7465722828, 0x6861736829203d3e, - 0x20686173682e7374, 0x6172747357697468, 0x2822736861353132, 0x2d2229290a202020, 0x20202020202e6d61, - 0x7028286861736829, 0x203d3e2068617368, 0x2e73706c69742822, 0x3f22295b305d293b, 0x0a20202020696620, - 0x2865787065637465, 0x642e6c656e677468, 0x203d3d3d2030290a, 0x2020202020202020, 0x7468726f77206e65, - 0x77204572726f7228, 0x2254686520706163, 0x6b61676520686173, 0x206e6f205348412d, 0x35313220696e7465, - 0x677269747922293b, 0x0a20202020696620, 0x2821676c6f62616c, 0x546869732e637279, 0x70746f3f2e737562, - 0x746c65290a202020, 0x2020202020746872, 0x6f77206e65772045, 0x72726f722822496e, 0x7465677269747920, - 0x636865636b73206e, 0x6565642061207365, 0x6375726520636f6e, 0x7465787420286874, 0x747073206f72206c, - 0x6f63616c686f7374, 0x2922293b0a202020, 0x20636f6e73742064, 0x6967657374203d20, 0x6e65772055696e74, - 0x3841727261792861, 0x7761697420637279, 0x70746f2e73756274, 0x6c652e6469676573, 0x7428225348412d35, - 0x3132222c20627974, 0x657329293b0a2020, 0x2020636f6e737420, 0x61637475616c203d, 0x2022736861353132, - 0x2d22202b2062746f, 0x612841727261792e, 0x66726f6d28646967, 0x6573742c20286279, 0x746529203d3e2053, - 0x7472696e672e6672, 0x6f6d43686172436f, 0x6465286279746529, 0x292e6a6f696e2822, 0x2229293b0a202020, - 0x2069662028216578, 0x7065637465642e69, 0x6e636c7564657328, 0x61637475616c2929, 0x0a20202020202020, - 0x207468726f77206e, 0x6577204572726f72, 0x2860496e74656772, 0x6974792063686563, 0x6b206661696c6564, - 0x3a20657870656374, 0x656420247b657870, 0x65637465645b305d, 0x7d2c20676f742024, 0x7b61637475616c7d, - 0x60293b0a20202020, 0x72657475726e2061, 0x637475616c3b0a7d, 0x0a0a2f2f2f204775, 0x6e7a697073206279, - 0x7465732c20666169, 0x6c696e67206f6e63, 0x65206d6f72652074, 0x68616e20606c696d, 0x6974602062797465, - 0x7320636f6d65206f, 0x75742e0a6578706f, 0x7274206173796e63, 0x2066756e6374696f, 0x6e2067756e7a6970, - 0x2862797465732c20, 0x6c696d6974203d20, 0x6d6178556e706163, 0x6b65644279746573, 0x29207b0a20202020, - 0x636f6e7374207265, 0x61646572203d206e, 0x657720426c6f6228, 0x5b62797465735d29, 0x2e73747265616d28, - 0x292e706970655468, 0x726f756768286e65, 0x77204465636f6d70, 0x72657373696f6e53, 0x747265616d282267, - 0x7a69702229292e67, 0x6574526561646572, 0x28293b0a20202020, 0x636f6e7374206368, 0x756e6b73203d205b, - 0x5d3b0a202020206c, 0x657420746f74616c, 0x203d20303b0a2020, 0x2020666f7220286c, 0x6574207265616420, - 0x3d20617761697420, 0x7265616465722e72, 0x65616428293b2021, 0x726561642e646f6e, 0x653b207265616420, - 0x3d20617761697420, 0x7265616465722e72, 0x656164282929207b, 0x0a20202020202020, 0x20746f74616c202b, - 0x3d20726561642e76, 0x616c75652e6c656e, 0x6774683b0a202020, 0x2020202020696620, 0x28746f74616c203e, - 0x206c696d69742920, 0x7b0a202020202020, 0x2020202020206177, 0x6169742072656164, 0x65722e63616e6365, - 0x6c28293b0a202020, 0x2020202020202020, 0x207468726f77206e, 0x6577204572726f72, 0x2860546865207461, - 0x7262616c6c20756e, 0x7061636b7320746f, 0x206d6f7265207468, 0x616e20247b6c696d, 0x69747d2062797465, - 0x7360293b0a202020, 0x20202020207d0a20, 0x2020202020202063, 0x68756e6b732e7075, 0x736828726561642e, - 0x76616c7565293b0a, 0x202020207d0a2020, 0x202072657475726e, 0x206e65772055696e, 0x7438417272617928, - 0x6177616974206e65, 0x7720426c6f622863, 0x68756e6b73292e61, 0x7272617942756666, 0x65722829293b0a7d, - 0x0a0a2f2f2041204e, 0x554c2d7465726d69, 0x6e61746564206865, 0x6164657220666965, 0x6c642e0a66756e63, - 0x74696f6e20746578, 0x7428626c6f636b2c, 0x206f66667365742c, 0x206c656e67746829, 0x207b0a2020202063, - 0x6f6e737420666965, 0x6c64203d20626c6f, 0x636b2e7375626172, 0x726179286f666673, 0x65742c206f666673, - 0x6574202b206c656e, 0x677468293b0a2020, 0x2020636f6e737420, 0x656e64203d206669, 0x656c642e696e6465, - 0x784f662830293b0a, 0x2020202072657475, 0x726e20757466382e, 0x6465636f64652865, 0x6e64203c2030203f, - 0x206669656c64203a, 0x206669656c642e73, 0x7562617272617928, 0x302c20656e642929, 0x3b0a7d0a0a2f2f20, - 0x416e206f6374616c, 0x206e756d6265722c, 0x206f722061206261, 0x73652d323536206f, 0x6e65207768656e20, - 0x7468652066697273, 0x7420627974652068, 0x6173206974732068, 0x6967682062697420, 0x7365742028474e55, - 0x20616e6420737461, 0x72292e0a66756e63, 0x74696f6e206e756d, 0x62657228626c6f63, 0x6b2c206f66667365, - 0x742c206c656e6774, 0x6829207b0a202020, 0x2069662028626c6f, 0x636b5b6f66667365, 0x745d202620307838, - 0x30290a2020202020, 0x2020207265747572, 0x6e20626c6f636b2e, 0x7375626172726179, 0x286f666673657420, - 0x2b20312c206f6666, 0x736574202b206c65, 0x6e677468292e7265, 0x6475636528287661, 0x6c75652c20627974, - 0x6529203d3e207661, 0x6c7565202a203235, 0x36202b2062797465, 0x2c20626c6f636b5b, 0x6f66667365745d20, - 0x262030783766293b, 0x0a20202020636f6e, 0x7374206469676974, 0x73203d2074657874, 0x28626c6f636b2c20, - 0x6f66667365742c20, 0x6c656e677468292e, 0x7472696d28293b0a, 0x2020202069662028, 0x212f5e5b302d375d, - 0x2a242f2e74657374, 0x2864696769747329, 0x290a202020202020, 0x20207468726f7720, 0x6e6577204572726f, - 0x722822436f727275, 0x7074207461722068, 0x656164657222293b, 0x0a20202020726574, 0x75726e2064696769, - 0x7473203d3d3d2022, 0x22203f2030203a20, 0x7061727365496e74, 0x286469676974732c, 0x2038293b0a7d0a0a, - 0x66756e6374696f6e, 0x2076657269667943, 0x6865636b73756d28, 0x6865616465722920, 0x7b0a202020206c65, - 0x742073756d203d20, 0x303b0a2020202066, 0x6f7220286c657420, 0x696e646578203d20, 0x303b20696e646578, - 0x203c20626c6f636b, 0x53697a653b202b2b, 0x696e646578290a20, 0x2020202020202073, 0x756d202b3d20696e, - 0x646578203e3d2031, 0x343820262620696e, 0x646578203c203135, 0x36203f2030783230, 0x203a206865616465, - 0x725b696e6465785d, 0x3b0a202020206966, 0x20286e756d626572, 0x286865616465722c, 0x203134382c203829, - 0x20213d3d2073756d, 0x290a202020202020, 0x20207468726f7720, 0x6e6577204572726f, 0x722822436f727275, - 0x7074207461722068, 0x6561646572206368, 0x65636b73756d2229, 0x3b0a7d0a0a2f2f20, 0x223c6c656e677468, - 0x3e203c6b65793e3d, 0x3c76616c75653e5c, 0x6e22207265636f72, 0x6473206f66206120, 0x7061782065787465, - 0x6e64656420686561, 0x6465723b206c656e, 0x6774687320636f75, 0x6e74206279746573, 0x2e0a66756e637469, - 0x6f6e207061785265, 0x636f726473286461, 0x746129207b0a2020, 0x2020636f6e737420, 0x7265636f72647320, - 0x3d207b7d3b0a2020, 0x20206c6574206f66, 0x66736574203d2030, 0x3b0a202020207768, 0x696c6520286f6666, - 0x736574203c206461, 0x74612e6c656e6774, 0x6829207b0a202020, 0x2020202020636f6e, 0x7374207370616365, - 0x203d20646174612e, 0x696e6465784f6628, 0x307832302c206f66, 0x66736574293b0a20, 0x2020202020202063, - 0x6f6e7374206c656e, 0x677468203d207370, 0x616365203c203020, 0x3f204e614e203a20, 0x4e756d6265722875, - 0x7466382e6465636f, 0x646528646174612e, 0x7375626172726179, 0x286f66667365742c, 0x2073706163652929, - 0x293b0a2020202020, 0x2020206966202821, 0x286c656e67746820, 0x3e203029207c7c20, 0x6f6666736574202b, - 0x206c656e67746820, 0x3e20646174612e6c, 0x656e677468290a20, 0x2020202020202020, 0x2020207468726f77, - 0x206e657720457272, 0x6f722822436f7272, 0x7570742070617820, 0x6865616465722229, 0x3b0a202020202020, - 0x2020636f6e737420, 0x7265636f7264203d, 0x20757466382e6465, 0x636f646528646174, 0x612e737562617272, - 0x6179287370616365, 0x202b20312c206f66, 0x66736574202b206c, 0x656e677468202d20, 0x3129293b0a202020, - 0x2020202020636f6e, 0x737420657175616c, 0x73203d207265636f, 0x72642e696e646578, 0x4f6628223d22293b, - 0x0a20202020202020, 0x207265636f726473, 0x5b7265636f72642e, 0x736c69636528302c, 0x20657175616c7329, - 0x5d203d207265636f, 0x72642e736c696365, 0x28657175616c7320, 0x2b2031293b0a2020, 0x2020202020206f66, - 0x66736574202b3d20, 0x6c656e6774683b0a, 0x202020207d0a2020, 0x202072657475726e, 0x207265636f726473, - 0x3b0a7d0a0a2f2f20, 0x54686520656e7472, 0x792077686f736520, 0x6865616465722073, 0x7461727473206174, - 0x20606f6666736574, 0x603a206974732068, 0x65616465722c2074, 0x79706520666c6167, 0x2c20646174612061, - 0x6e6420746865206f, 0x6666736574206f66, 0x20746865206e6578, 0x740a2f2f20656e74, 0x72792e0a66756e63, - 0x74696f6e20726561, 0x64456e7472792861, 0x7263686976652c20, 0x6f66667365742920, 0x7b0a20202020636f, - 0x6e73742068656164, 0x6572203d20617263, 0x686976652e737562, 0x6172726179286f66, 0x667365742c206f66, - 0x66736574202b2062, 0x6c6f636b53697a65, 0x293b0a2020202076, 0x6572696679436865, 0x636b73756d286865, - 0x61646572293b0a20, 0x202020636f6e7374, 0x2073697a65203d20, 0x6e756d6265722868, 0x65616465722c2031, - 0x32342c203132293b, 0x0a20202020636f6e, 0x7374207374617274, 0x203d206f66667365, 0x74202b20626c6f63, - 0x6b53697a653b0a20, 0x2020206966202873, 0x74617274202b2073, 0x697a65203e206172, 0x63686976652e6c65, - 0x6e677468290a2020, 0x2020202020207468, 0x726f77206e657720, 0x4572726f72282254, 0x72756e6361746564, - 0x2074617220617263, 0x6869766522293b0a, 0x2020202072657475, 0x726e207b0a202020, 0x2020202020686561, - 0x6465722c0a202020, 0x2020202020747970, 0x653a206865616465, 0x725b3135365d203d, 0x3d3d2030203f2022, - 0x3022203a20537472, 0x696e672e66726f6d, 0x43686172436f6465, 0x286865616465725b, 0x3135365d292c0a20, - 0x2020202020202064, 0x6174613a20617263, 0x686976652e737562, 0x6172726179287374, 0x6172742c20737461, - 0x7274202b2073697a, 0x65292c0a20202020, 0x202020206e657874, 0x3a20737461727420, 0x2b204d6174682e63, - 0x65696c2873697a65, 0x202f20626c6f636b, 0x53697a6529202a20, 0x626c6f636b53697a, 0x652c0a202020207d, - 0x3b0a7d0a0a2f2f20, 0x416e206172636869, 0x766520656e647320, 0x61742074776f207a, 0x65726f20626c6f63, - 0x6b733b206f6e6520, 0x697320656e6f7567, 0x6820746f2073746f, 0x702e0a66756e6374, 0x696f6e206973456e, - 0x6428617263686976, 0x652c206f66667365, 0x7429207b0a202020, 0x2072657475726e20, 0x6f6666736574202b, - 0x20626c6f636b5369, 0x7a65203e20617263, 0x686976652e6c656e, 0x677468207c7c2061, 0x7263686976652e73, - 0x7562617272617928, 0x6f66667365742c20, 0x6f6666736574202b, 0x20626c6f636b5369, 0x7a65292e65766572, - 0x7928286279746529, 0x203d3e2062797465, 0x203d3d3d2030293b, 0x0a7d0a0a2f2f2054, 0x6865206e616d6520, - 0x6669656c64206f66, 0x2061207573746172, 0x206865616465722c, 0x2061667465722069, 0x7473207072656669, - 0x78206669656c642e, 0x0a66756e6374696f, 0x6e20686561646572, 0x5061746828686561, 0x64657229207b0a20, - 0x202020636f6e7374, 0x206e616d65203d20, 0x7465787428686561, 0x6465722c20302c20, 0x313030293b0a2020, - 0x2020636f6e737420, 0x707265666978203d, 0x2074657874286865, 0x616465722c203235, 0x372c203529203d3d, - 0x3d20227573746172, 0x22203f2074657874, 0x286865616465722c, 0x203334352c203135, 0x3529203a2022223b, - 0x0a20202020726574, 0x75726e2070726566, 0x6978203f2060247b, 0x7072656669787d2f, 0x247b6e616d657d60, - 0x203a206e616d653b, 0x0a7d0a0a2f2f2045, 0x6e7472696573206e, 0x616d696e67207468, 0x65206e657874206f, - 0x6e653a2061207061, 0x7820657874656e64, 0x6564206865616465, 0x7220616e64206120, 0x474e55206c6f6e67, - 0x206e616d652e2041, 0x2070617820676c6f, 0x62616c2068656164, 0x6572206e616d6573, 0x0a2f2f206e6f7468, - 0x696e672057656246, 0x726f6e7420757365, 0x732e0a636f6e7374, 0x206e616d65456e74, 0x72696573203d207b, - 0x0a20202020783a20, 0x286e616d65732c20, 0x6461746129203d3e, 0x20287b2e2e2e6e61, 0x6d65732c20706178, - 0x3a20706178526563, 0x6f72647328646174, 0x61292e706174687d, 0x292c0a202020204c, 0x3a20286e616d6573, - 0x2c20646174612920, 0x3d3e20287b2e2e2e, 0x6e616d65732c206c, 0x6f6e673a20746578, 0x7428646174612c20, - 0x302c20646174612e, 0x6c656e677468297d, 0x292c0a2020202067, 0x3a20286e616d6573, 0x29203d3e206e616d, - 0x65732c0a7d3b0a0a, 0x2f2f2f2052656164, 0x7320612074617220, 0x6172636869766520, 0x2875737461722c20, - 0x7769746820706178, 0x20616e6420474e55, 0x206c6f6e67206e61, 0x6d65732920616e64, 0x2072657475726e73, - 0x2069747320726567, 0x756c61722066696c, 0x65732061730a2f2f, 0x2f207b706174682c, 0x2062797465737d2c, - 0x20696e2061726368, 0x697665206f726465, 0x722e204469726563, 0x746f726965732c20, 0x6c696e6b7320616e, - 0x64206f7468657220, 0x656e747269657320, 0x61726520736b6970, 0x7065642e0a657870, 0x6f72742066756e63, - 0x74696f6e20726561, 0x6454617228617263, 0x6869766529207b0a, 0x20202020636f6e73, 0x742066696c657320, - 0x3d205b5d3b0a2020, 0x20206c6574206e61, 0x6d6573203d207b7d, 0x3b0a20202020666f, 0x7220286c6574206f, - 0x6666736574203d20, 0x303b20216973456e, 0x6428617263686976, 0x652c206f66667365, 0x74293b29207b0a20, - 0x2020202020202063, 0x6f6e7374207b6865, 0x616465722c207479, 0x70652c2064617461, 0x2c206e6578747d20, - 0x3d2072656164456e, 0x7472792861726368, 0x6976652c206f6666, 0x736574293b0a2020, 0x2020202020206f66, - 0x66736574203d206e, 0x6578743b0a202020, 0x2020202020696620, 0x284f626a6563742e, 0x6861734f776e286e, - 0x616d65456e747269, 0x65732c2074797065, 0x2929207b0a202020, 0x2020202020202020, 0x206e616d6573203d, - 0x206e616d65456e74, 0x726965735b747970, 0x655d286e616d6573, 0x2c2064617461293b, 0x0a20202020202020, - 0x2020202020636f6e, 0x74696e75653b0a20, 0x202020202020207d, 0x0a20202020202020, 0x2069662028747970, - 0x65203d3d3d202230, 0x22207c7c20747970, 0x65203d3d3d202237, 0x22290a2020202020, 0x2020202020202066, - 0x696c65732e707573, 0x68287b706174683a, 0x206e616d65732e70, 0x6178203f3f206e61, 0x6d65732e6c6f6e67, - 0x203f3f2068656164, 0x6572506174682868, 0x6561646572292c20, 0x62797465733a2064, 0x6174617d293b0a20, - 0x202020202020206e, 0x616d6573203d207b, 0x7d3b0a202020207d, 0x0a20202020726574, 0x75726e2066696c65, - 0x733b0a7d0a0a2f2f, 0x2f20546865206669, 0x6c6573206f662061, 0x6e206e706d207461, 0x7262616c6c206279, - 0x2070617468207265, 0x6c61746976652074, 0x6f20746865207061, 0x636b61676520726f, 0x6f743a2074686520, - 0x6669727374207061, 0x746820636f6d706f, 0x6e656e740a2f2f2f, 0x20286e6f726d616c, 0x6c7920227061636b, - 0x6167652f22292069, 0x732072656d6f7665, 0x642c206173206e70, 0x6d20646f65732e20, 0x41206c6174657220, - 0x656e747279207265, 0x706c616365732061, 0x6e206561726c6965, 0x72206f6e652e0a66, 0x756e6374696f6e20, - 0x7061636b61676546, 0x696c657328656e74, 0x7269657329207b0a, 0x20202020636f6e73, 0x742066696c657320, - 0x3d206e6577204d61, 0x7028293b0a202020, 0x20666f722028636f, 0x6e7374207b706174, 0x682c206279746573, - 0x7d206f6620656e74, 0x7269657329207b0a, 0x2020202020202020, 0x636f6e7374207265, 0x6c6174697665203d, - 0x20706174682e7265, 0x706c616365282f5e, 0x285c2e3f5c2f292b, 0x2f2c202222292e73, 0x706c697428222f22, - 0x292e736c69636528, 0x31292e6a6f696e28, 0x222f22293b0a2020, 0x2020202020206966, 0x202872656c617469, - 0x766520213d3d2022, 0x22290a2020202020, 0x2020202020202066, 0x696c65732e736574, 0x2872656c61746976, - 0x652c206279746573, 0x293b0a202020207d, 0x0a20202020726574, 0x75726e2066696c65, 0x733b0a7d0a0a6675, - 0x6e6374696f6e2070, 0x61636b6167654a73, 0x6f6e2866696c6573, 0x2c206e616d652c20, 0x76657273696f6e29, - 0x207b0a2020202063, 0x6f6e7374206d616e, 0x6966657374203d20, 0x66696c65732e6765, 0x7428227061636b61, - 0x67652e6a736f6e22, 0x293b0a2020202069, 0x662028216d616e69, 0x66657374290a2020, 0x2020202020207468, - 0x726f77206e657720, 0x4572726f72286024, 0x7b6e616d657d4024, 0x7b76657273696f6e, 0x7d20686173206e6f, - 0x207061636b616765, 0x2e6a736f6e60293b, 0x0a20202020636f6e, 0x737420706b67203d, 0x204a534f4e2e7061, - 0x7273652875746638, 0x2e6465636f646528, 0x6d616e6966657374, 0x29293b0a20202020, 0x69662028706b672e, - 0x6e616d6520213d3d, 0x206e616d65207c7c, 0x20706b672e766572, 0x73696f6e20213d3d, 0x2076657273696f6e, - 0x290a202020202020, 0x20207468726f7720, 0x6e6577204572726f, 0x7228605468652061, 0x7263686976652063, - 0x6f6e7461696e7320, 0x247b706b672e6e61, 0x6d657d40247b706b, 0x672e76657273696f, 0x6e7d2c206e6f7420, - 0x247b6e616d657d40, 0x247b76657273696f, 0x6e7d60293b0a2020, 0x202072657475726e, 0x20706b673b0a7d0a, - 0x0a636f6e73742069, 0x73546f6f6c203d20, 0x286669656c642920, 0x3d3e206669656c64, 0x3f2e6b696e64203d, - 0x3d3d2022746f6f6c, 0x2220262620747970, 0x656f66206669656c, 0x642e656e74727920, 0x3d3d3d2022737472, - 0x696e67223b0a0a66, 0x756e6374696f6e20, 0x746f6f6c4f662866, 0x696c65732c206e61, 0x6d652c2076657273, - 0x696f6e29207b0a20, 0x202020636f6e7374, 0x20746f6f6c203d20, 0x7061636b6167654a, 0x736f6e2866696c65, - 0x732c206e616d652c, 0x2076657273696f6e, 0x292e77656266726f, 0x6e743b0a20202020, 0x6966202821697354, - 0x6f6f6c28746f6f6c, 0x29290a2020202020, 0x2020207468726f77, 0x206e657720457272, 0x6f722860247b6e61, - 0x6d657d206973206e, 0x6f74206120576562, 0x46726f6e7420746f, 0x6f6c3a2069747320, 0x7061636b6167652e, - 0x6a736f6e20686173, 0x206e6f2077656266, 0x726f6e7420666965, 0x6c64207769746820, 0x6b696e642022746f, - 0x6f6c2220616e6420, 0x616e20656e747279, 0x60293b0a20202020, 0x72657475726e207b, 0x656e7472793a2074, - 0x6f6f6c2e656e7472, 0x792e7265706c6163, 0x65282f5e285c2e5c, 0x2f292b2f2c202222, 0x292c207469746c65, - 0x3a20747970656f66, 0x20746f6f6c2e7469, 0x746c65203d3d3d20, 0x22737472696e6722, 0x203f20746f6f6c2e, - 0x7469746c65203a20, 0x6e616d657d3b0a7d, 0x0a0a636f6e737420, 0x706b6746756e6374, 0x696f6e203d202862, - 0x72696467652c206e, 0x616d6529203d3e20, 0x6272696467652e63, 0x707046756e637469, 0x6f6e286077656266, - 0x726f6e742e706b67, 0x2e247b6e616d657d, 0x60293b0a0a2f2f2f, 0x204f7074696f6e73, 0x2073686172656420, - 0x6279207365617263, 0x68282920616e6420, 0x696e7374616c6c28, 0x293a0a2f2f2f2020, 0x2062726964676520, - 0x2020207468652057, 0x656246726f6e7420, 0x6272696467652028, 0x676c6f62616c5468, 0x69732e7765624672, - 0x6f6e74290a2f2f2f, 0x2020207265676973, 0x7472792020746865, 0x206e706d20726567, 0x6973747279205552, - 0x4c20286465666175, 0x6c743a2077656266, 0x726f6e742e706b67, 0x2e72656769737472, 0x7928292c20736574, - 0x20696e20546f6f6c, 0x4d616e616765724f, 0x7074696f6e73290a, 0x2f2f2f2020206665, 0x7463682020202020, - 0x7468652066657463, 0x682066756e637469, 0x6f6e0a2f2f2f2020, 0x207369676e616c20, 0x202020616e204162, - 0x6f72745369676e61, 0x6c2073746f707069, 0x6e67207468652064, 0x6f776e6c6f616473, 0x20616e6420746865, - 0x2075706c6f61640a, 0x6173796e63206675, 0x6e6374696f6e2073, 0x657474696e677328, 0x7b62726964676520, - 0x3d20676c6f62616c, 0x546869732e776562, 0x46726f6e742c2072, 0x656769737472792c, 0x2066657463683a20, - 0x6665746368496d70, 0x6c203d20282e2e2e, 0x6172677329203d3e, 0x20676c6f62616c54, 0x6869732e66657463, - 0x68282e2e2e617267, 0x73292c207369676e, 0x616c7d203d207b7d, 0x29207b0a20202020, 0x72657475726e207b, - 0x6272696467652c20, 0x6665746368496d70, 0x6c2c207369676e61, 0x6c2c20626173653a, 0x2072656769737472, - 0x7942617365287265, 0x676973747279203f, 0x3f20286177616974, 0x20706b6746756e63, 0x74696f6e28627269, - 0x6467652c20227265, 0x6769737472792229, 0x282929297d3b0a7d, 0x0a0a2f2f2f205365, 0x6172636865732074, - 0x6865207265676973, 0x74727920666f7220, 0x7061636b61676573, 0x2077697468207468, 0x652077656266726f, - 0x6e742d746f6f6c20, 0x6b6579776f72642e, 0x2052657475726e73, 0x207b6e616d652c20, 0x76657273696f6e2c, - 0x0a2f2f2f20646573, 0x6372697074696f6e, 0x7d206f626a656374, 0x732e0a6578706f72, 0x74206173796e6320, - 0x66756e6374696f6e, 0x2073656172636828, 0x7465726d2c206f70, 0x74696f6e7329207b, 0x0a20202020636f6e, - 0x7374207b66657463, 0x68496d706c2c2073, 0x69676e616c2c2062, 0x6173657d203d2061, 0x7761697420736574, - 0x74696e6773286f70, 0x74696f6e73293b0a, 0x20202020636f6e73, 0x742075726c203d20, 0x6e65772055524c28, - 0x222d2f76312f7365, 0x61726368222c2062, 0x617365293b0a2020, 0x202075726c2e7365, 0x6172636850617261, - 0x6d732e7365742822, 0x74657874222c2060, 0x6b6579776f726473, 0x3a77656266726f6e, 0x742d746f6f6c2024, - 0x7b7465726d7d602e, 0x7472696d2829293b, 0x0a2020202075726c, 0x2e73656172636850, 0x6172616d732e7365, - 0x74282273697a6522, 0x2c2022323022293b, 0x0a20202020636f6e, 0x737420726573756c, 0x74203d2061776169, - 0x742066657463684a, 0x736f6e2875726c2c, 0x206665746368496d, 0x706c2c207369676e, 0x616c293b0a202020, - 0x2072657475726e20, 0x28726573756c742e, 0x6f626a6563747320, 0x3f3f205b5d292e6d, 0x617028287b706163, - 0x6b6167653a20666f, 0x756e647d29203d3e, 0x20287b0a20202020, 0x202020206e616d65, 0x3a20666f756e642e, - 0x6e616d652c0a2020, 0x2020202020207665, 0x7273696f6e3a2066, 0x6f756e642e766572, 0x73696f6e2c0a2020, - 0x2020202020206465, 0x736372697074696f, 0x6e3a20666f756e64, 0x2e64657363726970, 0x74696f6e203f3f20, - 0x22222c0a20202020, 0x7d29293b0a7d0a0a, 0x2f2f20446f776e6c, 0x6f61647320746865, 0x2074617262616c6c, - 0x206f662061206d61, 0x6e69666573742061, 0x6e64207265747572, 0x6e73206974732066, 0x696c657320776974, - 0x6820746865207665, 0x7269666965642069, 0x6e74656772697479, 0x2e0a6173796e6320, 0x66756e6374696f6e, - 0x20646f776e6c6f61, 0x64286d616e696665, 0x73742c207061636b, 0x756d656e744c6f63, 0x6174696f6e2c2066, - 0x65746368496d706c, 0x2c207369676e616c, 0x29207b0a20202020, 0x636f6e7374207461, 0x7262616c6c55726c, - 0x203d206e65772055, 0x524c286d616e6966, 0x6573742e64697374, 0x3f2e74617262616c, 0x6c203f3f2022222c, - 0x207061636b756d65, 0x6e744c6f63617469, 0x6f6e293b0a202020, 0x20636f6e73742074, 0x617262616c6c203d, - 0x206e65772055696e, 0x7438417272617928, 0x6177616974202861, 0x7761697420666574, 0x63684f6b28746172, - 0x62616c6c55726c2c, 0x206665746368496d, 0x706c2c207369676e, 0x616c29292e617272, 0x6179427566666572, - 0x2829293b0a202020, 0x20636f6e73742069, 0x6e74656772697479, 0x203d206177616974, 0x2076657269667949, - 0x6e74656772697479, 0x2874617262616c6c, 0x2c206d616e696665, 0x73742e646973743f, 0x2e696e7465677269, - 0x7479293b0a202020, 0x2072657475726e20, 0x7b696e7465677269, 0x74792c2066696c65, 0x733a207061636b61, - 0x676546696c657328, 0x7265616454617228, 0x6177616974206775, 0x6e7a697028746172, 0x62616c6c2929297d, - 0x3b0a7d0a0a2f2f20, 0x53656e6473207468, 0x652066696c657320, 0x746f207765626672, 0x6f6e742e706b672e, - 0x777269746546696c, 0x6520696e20636875, 0x6e6b733b20616e20, 0x656d707479206669, 0x6c65206973207365, - 0x6e74206173206f6e, 0x6520656d70747920, 0x6368756e6b2e0a61, 0x73796e632066756e, 0x6374696f6e207570, - 0x6c6f61642866696c, 0x65732c207b627269, 0x6467652c206e616d, 0x652c207665727369, 0x6f6e2c207369676e, - 0x616c7d29207b0a20, 0x202020636f6e7374, 0x2077726974654669, 0x6c65203d20706b67, 0x46756e6374696f6e, - 0x286272696467652c, 0x2022777269746546, 0x696c6522293b0a20, 0x202020666f722028, 0x636f6e7374205b70, - 0x6174682c20627974, 0x65735d206f662066, 0x696c657329207b0a, 0x2020202020202020, 0x6c6574206f666673, - 0x6574203d20303b0a, 0x2020202020202020, 0x646f207b0a202020, 0x2020202020202020, 0x207369676e616c3f, - 0x2e7468726f774966, 0x41626f7274656428, 0x293b0a2020202020, 0x2020202020202063, 0x6f6e737420636875, - 0x6e6b203d20627974, 0x65732e7375626172, 0x726179286f666673, 0x65742c206f666673, 0x6574202b20636875, - 0x6e6b53697a65293b, 0x0a20202020202020, 0x2020202020617761, 0x6974207772697465, 0x46696c65286e616d, - 0x652c207665727369, 0x6f6e2c2070617468, 0x2c206f6666736574, 0x2c206368756e6b29, 0x3b0a202020202020, - 0x2020202020206f66, 0x66736574202b3d20, 0x6368756e6b2e6c65, 0x6e6774683b0a2020, 0x2020202020207d20, - 0x7768696c6520286f, 0x6666736574203c20, 0x62797465732e6c65, 0x6e677468293b0a20, 0x2020207d0a7d0a0a, - 0x2f2f2f20446f776e, 0x6c6f6164732c2076, 0x6572696669657320, 0x616e642073746f72, 0x657320226e616d65, - 0x5b4076657273696f, 0x6e206f7220646973, 0x742d7461675d2220, 0x286c617465737420, 0x6279206465666175, - 0x6c74292e20607072, 0x6f67726573732874, 0x65787429600a2f2f, 0x2f207265706f7274, 0x7320746865207374, - 0x6570732e20526573, 0x6f6c76657320746f, 0x207b6e616d652c20, 0x76657273696f6e2c, 0x207469746c652c20, - 0x656e7472792c2066, 0x696c65737d3b2072, 0x656a656374732077, 0x6974686f75742063, 0x68616e67696e6720, - 0x7468650a2f2f2f20, 0x696e7374616c6c65, 0x642076657273696f, 0x6e207768656e2061, 0x6e797468696e6720, - 0x6661696c73206f72, 0x20607369676e616c, 0x602069732061626f, 0x727465642e0a6578, 0x706f727420617379, - 0x6e632066756e6374, 0x696f6e20696e7374, 0x616c6c2873706563, 0x2c207b70726f6772, 0x657373203d202829, - 0x203d3e207b7d2c20, 0x2e2e2e6f7074696f, 0x6e737d203d207b7d, 0x29207b0a20202020, 0x636f6e7374207b6e, - 0x616d652c20766572, 0x73696f6e3a207265, 0x717565737465647d, 0x203d207061727365, 0x5370656328737065, - 0x63293b0a20202020, 0x636f6e7374207b62, 0x72696467652c2066, 0x65746368496d706c, 0x2c207369676e616c, - 0x2c20626173657d20, 0x3d20617761697420, 0x73657474696e6773, 0x286f7074696f6e73, 0x293b0a2020202063, - 0x6f6e737420706163, 0x6b756d656e744c6f, 0x636174696f6e203d, 0x207061636b756d65, 0x6e7455726c286261, - 0x73652c206e616d65, 0x293b0a2020202063, 0x6f6e7374206d616e, 0x6966657374203d20, 0x7265736f6c76654d, - 0x616e696665737428, 0x6177616974206665, 0x7463684a736f6e28, 0x7061636b756d656e, 0x744c6f636174696f, - 0x6e2c206665746368, 0x496d706c2c207369, 0x676e616c292c206e, 0x616d652c20726571, 0x756573746564293b, - 0x0a20202020636f6e, 0x7374207b76657273, 0x696f6e7d203d206d, 0x616e69666573743b, 0x0a2020202070726f, - 0x6772657373286044, 0x6f776e6c6f616469, 0x6e6720247b6e616d, 0x657d40247b766572, 0x73696f6e7de280a6, - 0x60293b0a20202020, 0x636f6e7374207b69, 0x6e74656772697479, 0x2c2066696c65737d, 0x203d206177616974, - 0x20646f776e6c6f61, 0x64286d616e696665, 0x73742c207061636b, 0x756d656e744c6f63, 0x6174696f6e2c2066, - 0x65746368496d706c, 0x2c207369676e616c, 0x293b0a2020202063, 0x6f6e7374207b656e, 0x7472792c20746974, - 0x6c657d203d20746f, 0x6f6c4f662866696c, 0x65732c206e616d65, 0x2c2076657273696f, 0x6e293b0a20202020, - 0x696620282166696c, 0x65732e6861732865, 0x6e74727929290a20, 0x2020202020202074, 0x68726f77206e6577, - 0x204572726f722860, 0x54686520656e7472, 0x7920706167652024, 0x7b656e7472797d20, 0x6f6620247b6e616d, - 0x657d206973206e6f, 0x7420696e20746865, 0x207061636b616765, 0x60293b0a0a202020, 0x2070726f67726573, - 0x732860496e737461, 0x6c6c696e6720247b, 0x66696c65732e7369, 0x7a657d2066696c65, 0x73e280a660293b0a, - 0x2020202061776169, 0x7420706b6746756e, 0x6374696f6e286272, 0x696467652c202262, 0x6567696e2229286e, - 0x616d652c20766572, 0x73696f6e293b0a20, 0x2020206177616974, 0x2075706c6f616428, 0x66696c65732c207b, - 0x6272696467652c20, 0x6e616d652c207665, 0x7273696f6e2c2073, 0x69676e616c7d293b, 0x0a20202020736967, - 0x6e616c3f2e746872, 0x6f77496641626f72, 0x74656428293b0a20, 0x2020206177616974, 0x20706b6746756e63, - 0x74696f6e28627269, 0x6467652c2022636f, 0x6d6d69742229286e, 0x616d652c20766572, 0x73696f6e2c20696e, - 0x746567726974792c, 0x20656e7472792c20, 0x7469746c65293b0a, 0x2020202072657475, 0x726e207b6e616d65, - 0x2c2076657273696f, 0x6e2c207469746c65, 0x2c20656e7472792c, 0x2066696c65733a20, 0x66696c65732e7369, - 0x7a657d3b0a7d0a0a, 0x2f2f2f2054686520, 0x696e7374616c6c65, 0x6420746f6f6c732c, 0x2066726f6d207468, - 0x6520706167657320, 0x6f66207765626672, 0x6f6e742e706b672e, 0x6c69737428293a20, 0x7b6e616d652c2076, - 0x657273696f6e2c20, 0x75726c2c20746974, 0x6c657d206f626a65, 0x6374732e0a657870, 0x6f7274206173796e, - 0x632066756e637469, 0x6f6e20696e737461, 0x6c6c656428627269, 0x646765203d20676c, 0x6f62616c54686973, - 0x2e77656246726f6e, 0x7429207b0a202020, 0x20636f6e7374206c, 0x697374203d20706b, 0x6746756e6374696f, - 0x6e28627269646765, 0x2c20226c69737422, 0x293b0a2020202063, 0x6f6e737420746f6f, 0x6c73203d205b5d3b, - 0x0a20202020666f72, 0x20283b3b29207b0a, 0x2020202020202020, 0x636f6e7374206c69, 0x6e6573203d202861, - 0x77616974206c6973, 0x7428746f6f6c732e, 0x6c656e6774682929, 0x2e73706c69742822, 0x5c6e22292e66696c, - 0x74657228286c696e, 0x6529203d3e206c69, 0x6e6520213d3d2022, 0x22293b0a20202020, 0x2020202069662028, - 0x6c696e65732e6c65, 0x6e677468203d3d3d, 0x2030290a20202020, 0x2020202020202020, 0x72657475726e2074, - 0x6f6f6c733b0a2020, 0x202020202020666f, 0x722028636f6e7374, 0x206c696e65206f66, 0x206c696e65732920, - 0x7b0a202020202020, 0x202020202020636f, 0x6e7374205b6e616d, 0x652c207665727369, 0x6f6e2c2075726c2c, - 0x207469746c655d20, 0x3d206c696e652e73, 0x706c697428225c74, 0x22293b0a20202020, 0x2020202020202020, - 0x746f6f6c732e7075, 0x7368287b6e616d65, 0x2c2076657273696f, 0x6e2c2075726c2c20, 0x7469746c657d293b, - 0x0a20202020202020, 0x207d0a202020207d, 0x0a7d0a0a2f2f2f20, 0x4f70656e73207468, 0x6520656e74727920, - 0x70616765206f6620, 0x616e20696e737461, 0x6c6c656420746f6f, 0x6c20696e2061206e, 0x657720746162206f, - 0x722077696e646f77, 0x2c20616e64207265, 0x736f6c7665732074, 0x6f20697473205552, 0x4c2e0a6578706f72, - 0x74206173796e6320, 0x66756e6374696f6e, 0x206f70656e286e61, 0x6d652c2062726964, 0x6765203d20676c6f, - 0x62616c546869732e, 0x77656246726f6e74, 0x29207b0a20202020, 0x636f6e737420746f, 0x6f6c203d20286177, - 0x61697420696e7374, 0x616c6c6564286272, 0x6964676529292e66, 0x696e64282863616e, 0x6469646174652920, - 0x3d3e2063616e6469, 0x646174652e6e616d, 0x65203d3d3d206e61, 0x6d65293b0a202020, 0x206966202821746f, - 0x6f6c290a20202020, 0x202020207468726f, 0x77206e6577204572, 0x726f722860247b6e, 0x616d657d20697320, - 0x6e6f7420696e7374, 0x616c6c656460293b, 0x0a20202020726574, 0x75726e207b2e2e2e, 0x746f6f6c2c206f70, - 0x656e65643a20676c, 0x6f62616c54686973, 0x2e6f70656e28746f, 0x6f6c2e75726c2c20, 0x225f626c616e6b22, - 0x2920213d3d206e75, 0x6c6c7d3b0a7d0a0a, 0x66756e6374696f6e, 0x2072657175697265, 0x4f6e652861726773, - 0x29207b0a20202020, 0x6966202861726773, 0x2e6c656e67746820, 0x213d3d2031290a20, 0x2020202020202074, - 0x68726f77206e6577, 0x204572726f722822, 0x57726f6e67206e75, 0x6d626572206f6620, 0x617267756d656e74, - 0x732e205479706520, 0x2777662068656c70, 0x272e22293b0a2020, 0x202072657475726e, 0x20617267735b305d, - 0x3b0a7d0a0a66756e, 0x6374696f6e20666f, 0x726d6174466f756e, 0x6428666f756e6429, 0x207b0a2020202069, - 0x662028666f756e64, 0x2e6c656e67746820, 0x3d3d3d2030290a20, 0x2020202020202072, 0x657475726e20224e, - 0x6f20746f6f6c2066, 0x6f756e642e223b0a, 0x20202020636f6e73, 0x7420776964746820, 0x3d204d6174682e6d, - 0x6178282e2e2e666f, 0x756e642e6d617028, 0x287b6e616d652c20, 0x76657273696f6e7d, 0x29203d3e206e616d, - 0x652e6c656e677468, 0x202b207665727369, 0x6f6e2e6c656e6774, 0x68202b203129293b, 0x0a20202020726574, - 0x75726e20666f756e, 0x642e6d617028287b, 0x6e616d652c207665, 0x7273696f6e2c2064, 0x6573637269707469, - 0x6f6e7d29203d3e20, 0x60247b6e616d657d, 0x40247b7665727369, 0x6f6e7d602e706164, 0x456e642877696474, - 0x68202b203229202b, 0x2064657363726970, 0x74696f6e292e6a6f, 0x696e28225c6e2229, 0x3b0a7d0a0a2f2f20, - 0x5468652077662073, 0x7562636f6d6d616e, 0x64732072756e6e69, 0x6e6720696e207468, 0x652062726f777365, - 0x723b20277766206c, 0x697374272c202777, 0x662072656d6f7665, 0x2720616e64202777, 0x662068656c702720, - 0x72756e20696e2043, 0x2b2b2e0a636f6e73, 0x7420737562636f6d, 0x6d616e6473203d20, 0x7b0a202020207365, - 0x617263683a206173, 0x796e632028617267, 0x732c207b62726964, 0x67652c207369676e, 0x616c7d29203d3e20, - 0x666f726d6174466f, 0x756e642861776169, 0x7420736561726368, 0x28617267732e6a6f, 0x696e28222022292c, - 0x207b627269646765, 0x2c207369676e616c, 0x7d29292c0a202020, 0x20696e7374616c6c, 0x3a206173796e6320, - 0x28617267732c207b, 0x6272696467652c20, 0x7369676e616c2c20, 0x77726974657d2920, 0x3d3e207b0a202020, - 0x2020202020636f6e, 0x737420746f6f6c20, 0x3d20617761697420, 0x696e7374616c6c28, 0x726571756972654f, - 0x6e65286172677329, 0x2c207b6272696467, 0x652c207369676e61, 0x6c2c2070726f6772, 0x6573733a20287374, - 0x657029203d3e2077, 0x7269746528737465, 0x70202b20225c6e22, 0x297d293b0a202020, 0x2020202020726574, - 0x75726e2060496e73, 0x74616c6c65642024, 0x7b746f6f6c2e6e61, 0x6d657d40247b746f, 0x6f6c2e7665727369, - 0x6f6e7d3a20247b74, 0x6f6f6c2e7469746c, 0x657d2e2054797065, 0x20277766206f7065, 0x6e20247b746f6f6c, - 0x2e6e616d657d272e, 0x603b0a202020207d, 0x2c0a202020206f70, 0x656e3a206173796e, 0x632028617267732c, - 0x207b627269646765, 0x7d29203d3e207b0a, 0x2020202020202020, 0x636f6e737420746f, 0x6f6c203d20617761, - 0x6974206f70656e28, 0x726571756972654f, 0x6e65286172677329, 0x2c20627269646765, 0x293b0a2020202020, - 0x2020207265747572, 0x6e20746f6f6c2e6f, 0x70656e6564203f20, 0x604f70656e656420, 0x247b746f6f6c2e74, - 0x69746c657d3a2024, 0x7b746f6f6c2e7572, 0x6c7d60203a206054, 0x68652062726f7773, 0x657220626c6f636b, - 0x656420746865206e, 0x65772077696e646f, 0x772e204f70656e20, 0x247b746f6f6c2e75, 0x726c7d603b0a2020, - 0x20207d2c0a7d3b0a, 0x0a6173796e632066, 0x756e6374696f6e20, 0x7766285b636f6d6d, 0x616e642c202e2e2e, - 0x617267735d2c2063, 0x6f6e746578742920, 0x7b0a202020207265, 0x7475726e204f626a, 0x6563742e6861734f, - 0x776e28737562636f, 0x6d6d616e64732c20, 0x636f6d6d616e6429, 0x203f20737562636f, 0x6d6d616e64735b63, - 0x6f6d6d616e645d28, 0x617267732c20636f, 0x6e7465787429203a, 0x20756e646566696e, 0x65643b0a7d0a0a2f, - 0x2f2f205465726d69, 0x6e616c2062726f77, 0x73657220636f6d6d, 0x616e647320287365, 0x65205465726d696e, - 0x616c3a3a65787465, 0x6e73696f6e292e0a, 0x6578706f72742063, 0x6f6e737420636f6d, 0x6d616e6473203d20, - 0x7b77667d3b0a0000 - }; -}; - -} // namespace webfront::fs::generated diff --git a/include/webfront/system/ToolStore.hpp b/include/webfront/system/ToolStore.hpp deleted file mode 100644 index e55e6338..00000000 --- a/include/webfront/system/ToolStore.hpp +++ /dev/null @@ -1,476 +0,0 @@ -/// @brief Installed web tools (the wf tool manager, #234): validation of the names and paths a -/// browser sends, the files of each tool under /.webfront/tools/, and the lock file -/// /webfront-tools.lock.json that records them. -#pragma once - -#include "../utils/Json.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace webfront::fs { - -/// One installed tool, as recorded in the lock file. -struct ToolRecord { - std::string name{}; - std::string version{}; - std::string integrity{}; - std::string entry{}; ///< Page opened by 'wf open', relative to the package root - std::string title{}; - - bool operator==(const ToolRecord&) const = default; -}; - -/// Part of a file sent by the browser: bytes to write at an offset of a '/'-separated path. -struct FileChunk { - std::string_view path{}; - std::uint64_t offset = 0; - std::span bytes{}; -}; - -namespace tools { - -namespace detail { - -inline constexpr std::string_view nameCharacters = "abcdefghijklmnopqrstuvwxyz0123456789-._~"; -inline constexpr std::string_view versionCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.+-"; - -inline std::filesystem::path fromUtf8(std::string_view text) { - return std::filesystem::path(std::u8string(reinterpret_cast(text.data()), text.size())); -} - -inline bool consistsOf(std::string_view text, std::string_view allowed) { - return text.find_first_not_of(allowed) == std::string_view::npos; -} - -// Neither "." nor ".." can be a name part, since no part starts with '.'. -// The HTTP server rejects every URL containing "..", so a name or path containing it could be -// installed but never served. -inline bool hasDoubleDot(std::string_view text) { - return text.find("..") != std::string_view::npos; -} - -inline bool isNamePart(std::string_view part) { - if (part.empty() || hasDoubleDot(part)) - return false; - return std::string_view("._").find(part.front()) == std::string_view::npos && consistsOf(part, nameCharacters); -} - -inline bool isPackageName(std::string_view name) { - if (name.size() > 214) - return false; - if (!name.starts_with('@')) - return isNamePart(name); - const auto slash = name.find('/'); - if (slash == std::string_view::npos) - return false; - return isNamePart(name.substr(1, slash - 1)) && isNamePart(name.substr(slash + 1)); -} - -inline bool isVersion(std::string_view toolVersion) { - if (toolVersion.empty() || toolVersion.size() > 256) - return false; - if (hasDoubleDot(toolVersion)) - return false; - return std::isdigit(static_cast(toolVersion.front())) != 0 && consistsOf(toolVersion, versionCharacters); -} - -inline bool hasSafeCharacters(std::string_view path) { - using namespace std::string_view_literals; - if (path.size() > 4096 || hasDoubleDot(path)) - return false; - return path.find_first_of("\\:*?\"<>|\0"sv) == std::string_view::npos; -} - -// Titles and integrities are listed one tool per line, fields separated by tabs. -inline bool hasControlCharacters(std::string_view text) { - return std::ranges::any_of(text, [](char c) { - return static_cast(c) < 0x20 || c == 0x7F; - }); -} - -// Appends a component unless it is empty, "." or ".." (or "...", which no package needs). -inline bool appendComponent(std::filesystem::path& path, std::string_view component) { - if (component.find_first_not_of('.') == std::string_view::npos) - return false; - path /= fromUtf8(component); - return true; -} - -} // namespace detail - -/// Accepts an npm package name: lowercase URL-safe characters, an optional "@scope/" prefix, and no -/// part starting with '.' or '_'. Throws std::invalid_argument. -inline void validatePackageName(std::string_view name) { - if (!detail::isPackageName(name)) - throw std::invalid_argument("Invalid package name '" + std::string(name) + "'"); -} - -/// Accepts a semantic version: a digit followed by letters, digits, '.', '+' or '-'. Throws -/// std::invalid_argument. -inline void validateVersion(std::string_view toolVersion) { - if (!detail::isVersion(toolVersion)) - throw std::invalid_argument("Invalid package version '" + std::string(toolVersion) + "'"); -} - -/// Converts a '/'-separated path received from the browser into a relative path that stays inside -/// its directory. Rejects empty and absolute paths, empty, "." and ".." components, backslashes, -/// colons (drive letters and alternate streams), the other characters Windows forbids in file names -/// (*?"<>|) and NUL, on every platform, with std::invalid_argument. -inline std::filesystem::path safeRelativePath(std::string_view path) { - std::filesystem::path result; - bool safe = detail::hasSafeCharacters(path); - for (const auto part : std::views::split(path, '/')) - safe = safe && detail::appendComponent(result, std::string_view(part.begin(), part.end())); - if (!safe || result.empty()) - throw std::invalid_argument("Unsafe path '" + std::string(path) + "'"); - return result; -} - -namespace detail { - -// The string members of a lock file record, by JSON name. -inline constexpr std::array, 4> recordFields{ - { - {"version", &ToolRecord::version}, - {"integrity", &ToolRecord::integrity}, - {"entry", &ToolRecord::entry}, - {"title", &ToolRecord::title}, - } -}; - -// Bounds every webfront.pkg.list() line well below one bridge string. -inline constexpr std::size_t maxTextBytes = 1024; - -inline void validateRecord(const ToolRecord& record) { - validatePackageName(record.name); - validateVersion(record.version); - safeRelativePath(record.entry); - if (std::max(record.title.size(), record.integrity.size()) > maxTextBytes) - throw std::invalid_argument("Title or integrity of " + record.name + " longer than " + std::to_string(maxTextBytes) + " bytes"); - if (hasControlCharacters(record.title + record.integrity)) - throw std::invalid_argument("Control characters in the title or integrity of " + record.name); -} - -/// What the stores of one project directory share within the process. -struct ProjectState { - std::mutex mutex; - /// Staging subdirectory of each installation in progress, by exact "@". Numbered - /// rather than named after the key, so versions differing only by case never share a directory - /// on a case-insensitive volume. - std::map> pending; - std::uint64_t nextStaging = 0; -}; - -/// Returns the state of a project directory, the same for every store of that directory in the -/// process however its path is spelled, so their transactions are serialized. -inline std::shared_ptr projectState(const std::filesystem::path& project) { - static std::mutex registryMutex; - static std::map> registry; - std::error_code error; - auto key = std::filesystem::weakly_canonical(project, error); - if (error) - key = std::filesystem::absolute(project).lexically_normal(); - std::scoped_lock lock{registryMutex}; - std::erase_if(registry, [](const auto& entry) { - return entry.second.expired(); - }); - auto& entry = registry[key]; - auto state = entry.lock(); - if (!state) - entry = state = std::make_shared(); - return state; -} - -inline ToolRecord readRecord(json::Reader& reader, const std::string& name) { - ToolRecord record{.name = name}; - reader.object([&](const std::string& key) { - const auto field = std::ranges::find(recordFields, key, &std::pair::first); - if (field == recordFields.end()) - return reader.skipValue(); - record.*(field->second) = reader.string(); - }); - validateRecord(record); - return record; -} - -} // namespace detail - -using LockedTools = std::map>; - -/// Parses a lock file. Unknown members are ignored; every recorded name, version and entry is -/// validated, so a hand-edited lock file cannot point outside the tools directory. Throws -/// std::runtime_error on malformed JSON and std::invalid_argument on an invalid record. -inline LockedTools parseLock(std::string_view text) { - LockedTools tools; - json::Reader reader{text}; - reader.object([&](const std::string& key) { - if (key != "tools") - return reader.skipValue(); - reader.object([&](const std::string& name) { - tools.insert_or_assign(name, detail::readRecord(reader, name)); - }); - }); - reader.end(); - return tools; -} - -/// Writes a lock file's JSON, tools sorted by name. -inline std::string formatLock(const LockedTools& tools) { - std::string text = "{\n \"lockfileVersion\": 1,\n \"tools\": {"; - const char* separator = "\n"; - for (const auto& [name, record] : tools) { - text += separator; - text += " " + json::quote(name) + ": {"; - const char* fieldSeparator = "\n"; - for (const auto& [field, member] : detail::recordFields) { - text += fieldSeparator; - text += " " + json::quote(field) + ": " + json::quote(record.*member); - fieldSeparator = ",\n"; - } - text += "\n }"; - separator = ",\n"; - } - return text += tools.empty() ? "}\n}\n" : "\n }\n}\n"; -} - -} // namespace tools - -/// The tools installed in a project directory: -/// /.webfront/tools/@/ the files of each installed tool -/// /webfront-tools.lock.json name, version, integrity, entry and title of each -/// An installation is staged under .webfront/tools/.staging/ and replaces the installed version -/// only when committed; a reinstalled version is kept as @~backup (or ~backup if -/// an earlier backup could not be deleted) until the lock file is written. A failed or abandoned installation leaves the installed tool intact. -/// Thread-safe within a process, also between stores of the same project; several processes must -/// not install into the same project at the same time. Errors throw std::invalid_argument (invalid input) or -/// std::runtime_error / std::filesystem::filesystem_error (I/O). -class ToolStore { -public: - explicit ToolStore(std::filesystem::path projectDirectory) : project(std::move(projectDirectory)), state(tools::detail::projectState(project)) {} - - [[nodiscard]] const std::filesystem::path& projectDir() const { - return project; - } - [[nodiscard]] std::filesystem::path toolsDir() const { - return project / ".webfront" / "tools"; - } - [[nodiscard]] std::filesystem::path lockFile() const { - return project / "webfront-tools.lock.json"; - } - [[nodiscard]] std::filesystem::path installDir(std::string_view name, std::string_view toolVersion) const { - return toolsDir() / tools::detail::fromUtf8(std::string(name) + "@" + std::string(toolVersion)); - } - - /// The installed tools; an absent lock file means none. Throws std::runtime_error if the lock - /// file cannot be read or is malformed, so its tools are never dropped by mistake. - [[nodiscard]] tools::LockedTools installed() const { - return readLock(lockFile()); - } - - [[nodiscard]] std::optional find(std::string_view name) const { - auto tools = installed(); - if (auto found = tools.find(name); found != tools.end()) - return std::move(found->second); - return std::nullopt; - } - - /// Starts (or restarts) the installation of a version, discarding the files already staged for it. - void begin(std::string_view name, std::string_view toolVersion) { - tools::validatePackageName(name); - tools::validateVersion(toolVersion); - std::scoped_lock lock{state->mutex}; - // With no installation in progress, whatever is staged was abandoned by an earlier process. - if (state->pending.empty()) - std::filesystem::remove_all(stagingRoot()); - auto& staging = state->pending[key(name, toolVersion)]; - if (!staging.empty()) - std::filesystem::remove_all(stagingRoot() / staging); - staging = std::to_string(state->nextStaging++); - std::filesystem::remove_all(stagingRoot() / staging); - } - - /// Writes a chunk of a staged file. Offset 0 creates or truncates the file; any other offset must - /// equal the number of bytes already written, so a missing or repeated chunk is detected. - void write(std::string_view name, std::string_view toolVersion, const FileChunk& chunk) { - const auto relative = tools::safeRelativePath(chunk.path); - std::scoped_lock lock{state->mutex}; - const auto target = stagingDir(name, toolVersion) / relative; - if (chunk.offset != 0) - requireWritten(target, chunk); - std::filesystem::create_directories(target.parent_path()); - std::ofstream file(target, std::ios::binary | (chunk.offset == 0 ? std::ios::trunc : std::ios::app)); - file.write(reinterpret_cast(chunk.bytes.data()), static_cast(chunk.bytes.size())); - if (!file.flush()) - throw std::runtime_error("Cannot write '" + std::string(chunk.path) + "'"); - } - - /// Installs the staged files as record.version, replacing any installed version of the tool, and - /// records it in the lock file. The entry page must have been written. - void commit(const ToolRecord& record) { - tools::detail::validateRecord(record); - std::scoped_lock lock{state->mutex}; - const auto staged = stagingDir(record.name, record.version); - if (!std::filesystem::is_regular_file(staged / tools::safeRelativePath(record.entry))) - throw std::invalid_argument("Entry page '" + record.entry + "' of " + record.name + " was not written"); - - auto locked = readLock(lockFile()); - std::optional replaced; - if (const auto previous = locked.find(record.name); previous != locked.end() && previous->second.version != record.version) - replaced = installDir(record.name, previous->second.version); - locked.insert_or_assign(record.name, record); - installStaged(record, locked); - state->pending.erase(key(record.name, record.version)); - if (replaced) - removeReplaced(*replaced, installDir(record.name, record.version)); - } - - /// Uninstalls a tool. Returns false if it is not installed. - bool remove(std::string_view name) { - tools::validatePackageName(name); - std::scoped_lock lock{state->mutex}; - auto tools = readLock(lockFile()); - const auto found = tools.find(name); - if (found == tools.end()) - return false; - const auto directory = installDir(name, found->second.version); - tools.erase(found); - writeLock(tools); - removeLeftover(directory); - return true; - } - - static tools::LockedTools readLock(const std::filesystem::path& file) { - if (!std::filesystem::exists(file)) - return {}; - std::ifstream stream(file, std::ios::binary); - if (!stream.is_open()) - throw std::runtime_error("Cannot read " + file.filename().string()); - std::ostringstream content; - content << stream.rdbuf(); - try { - return tools::parseLock(content.view()); - } catch (const std::exception& error) { - throw std::runtime_error("Malformed " + file.filename().string() + ": " + error.what()); - } - } - -private: - std::filesystem::path project; - std::shared_ptr state; - - static std::string key(std::string_view name, std::string_view toolVersion) { - return std::string(name) + "@" + std::string(toolVersion); - } - - [[nodiscard]] std::filesystem::path stagingRoot() const { - return toolsDir() / ".staging"; - } - - // Requires the installation to be in progress; called with the mutex held. - [[nodiscard]] std::filesystem::path stagingDir(std::string_view name, std::string_view toolVersion) const { - const auto found = state->pending.find(key(name, toolVersion)); - if (found == state->pending.end()) - throw std::invalid_argument("No installation of " + key(name, toolVersion) + " in progress"); - return stagingRoot() / found->second; - } - - static void requireWritten(const std::filesystem::path& target, const FileChunk& chunk) { - std::error_code error; - const auto written = std::filesystem::file_size(target, error); - if (error || written != chunk.offset) - throw std::invalid_argument("Chunk of '" + std::string(chunk.path) + "' at offset " + std::to_string(chunk.offset) - + " does not follow the bytes already written"); - } - - // Moves the staged files into place and writes the lock file. A directory already installed for - // this version is kept aside until the lock file is written, and restored if anything fails. - void installStaged(const ToolRecord& record, const tools::LockedTools& locked) const { - const auto target = installDir(record.name, record.version); - const auto backup = unusedBackup(target); - const bool replacing = std::filesystem::exists(target); - if (replacing) { - std::filesystem::rename(target, backup); - } - try { - std::filesystem::create_directories(target.parent_path()); - std::filesystem::rename(stagingDir(record.name, record.version), target); - writeLock(locked); - } catch (...) { - restore(target, backup, replacing); - throw; - } - removeLeftover(backup); - } - - // Next to the target, so renaming does not need write access to the directory itself; '~' cannot - // appear in a version, so no installed version has this name. A backup an earlier operation left - // behind (see removeLeftover) is deleted if possible, otherwise skipped, so it never blocks a - // later reinstallation. - static std::filesystem::path unusedBackup(const std::filesystem::path& target) { - for (std::size_t index = 1;; ++index) { - auto backup = target; - backup += index == 1 ? std::string("~backup") : "~backup" + std::to_string(index); - removeLeftover(backup); - if (!std::filesystem::exists(std::filesystem::symlink_status(backup))) - return backup; - } - } - - // Once the lock file is written the operation has succeeded: a directory that cannot be deleted - // is left behind rather than reported as a failure of an operation that took effect. - static void removeLeftover(const std::filesystem::path& directory) { - std::error_code ignored; - std::filesystem::remove_all(directory, ignored); - } - - // On a case-insensitive volume, versions differing only by case ("1.0.0-alpha" and - // "1.0.0-Alpha") name the same directory, which now holds the new version. - static void removeReplaced(const std::filesystem::path& replaced, const std::filesystem::path& installed) { - std::error_code error; - if (!std::filesystem::equivalent(replaced, installed, error)) - removeLeftover(replaced); - } - - static void restore(const std::filesystem::path& target, const std::filesystem::path& backup, bool replacing) { - std::error_code ignored; - std::filesystem::remove_all(target, ignored); - if (replacing) - std::filesystem::rename(backup, target, ignored); - } - - // Written next to the lock file, then renamed over it, so a reader never sees a partial file. - void writeLock(const tools::LockedTools& tools) const { - const auto file = lockFile(); - auto temporary = file; - temporary += ".tmp"; - { - std::ofstream stream(temporary, std::ios::binary | std::ios::trunc); - stream << tools::formatLock(tools); - if (!stream.flush()) - throw std::runtime_error("Cannot write " + temporary.string()); - } - std::filesystem::rename(temporary, file); - } -}; - -} // namespace webfront::fs diff --git a/include/webfront/system/XtermCssData.hpp b/include/webfront/system/XtermCssData.hpp deleted file mode 100644 index a8a06525..00000000 --- a/include/webfront/system/XtermCssData.hpp +++ /dev/null @@ -1,81 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace webfront::fs::generated { - -struct XtermCssData { - static constexpr std::string_view encoding{"gzip"}; - static constexpr std::size_t dataSize{2547}; - static constexpr std::array data{ - 0x1f8b080000000000, 0x0203ad58e9522347, 0x12fe0d4f913b8e8d, 0x8509b50433b6d7d6, 0x4438560362e85d90, - 0x0849783c3f4bdd25, 0xa9a00fb9ba5bc038, 0xfceefb651dad9b81, 0x5d33671d79677e99, 0xd5adb76f0fe92d9d, - 0xe5f327ada6b3928e, 0xa2637a7772fa3d8d, 0x66921e4ba9d3e65d, 0x41a22a67b92e9ad4, 0x491232170bd2b290, - 0x7a21e3e64e06ef02, 0xfcf5be416733ad8a, 0x329fcfa4a67fcbc9, 0x44cb273aba0e4774, 0xa5229915f298a967, - 0x65392fdaadd65495, 0xb36adc8cf2b415cd, 0xeeee5a4e3c5ff957, 0x62ef1368b1e6ad1b, 0x9caaa2507946aa20, - 0x0890e3279a6a9195, 0x326e102449ca2714, 0xcd849eca06953989, 0xec89e6521720c8c7, 0xa55099caa6242882, - 0xeecc0f97cb193815, 0xf9a47c105ae27e4c, 0xa228f24809b0a438, 0x8faa5466a52859e4, 0x4425b2a0a3126e7a, - 0x3374146f8e8d9c58, 0x8a8419aa0c0c25f9, 0x537a80797955b2e7, 0x4aad2266d3c0a528, 0xa962d6c41f272a55, - 0x4e08935b77333fb0, 0xae0a98c20a3728cd, 0x6335e17fa5b16f5e, 0x8d1355cc1a14c3df, 0x5a8dab129b056f1a, - 0xbf35d89a56aea990, 0x89510e4c140c3046, 0x2f7534d75810fc04, 0x2d9cbb0ade7998e5, 0xe9ba3dca6835a974, - 0x06c170109b9ec37d, 0x46ee9d8c4ade618a, 0x499e24f903db18e5, 0x59acd8b4a2eda2c8, 0x7926c6f9421ab36c, - 0x0e657909adad2a1c, 0x11a38c8db43b2a66, 0x029938860ec67d10, 0xae32e6c6bbde32d8, 0x5a8d8b12f9a04442, - 0xf35c1bb99b1673fa, 0x1a3d2ebb34ec5f8c, 0x3e77065d0a877433, 0xe8ff1a9e77cfe94d, 0x6788f59b067d0e47, - 0x97fddb11e1c6a0d3, 0x1b7da1fe05757a5f, 0xe83f61efbc41dddf, 0x6e06dde190fa03e6, 0x165edf5c855d6c87, - 0xbdb3abdbf3b0f789, 0x3e82b4d747e28748, 0x61f01df58d4cc72d, 0xec82f482aebb83b3, 0x4b2c3b1fc3ab70f4, - 0xa5c1bc2ec2518f39, 0x5ff407d4a19bce60, 0x149edd5e75067473, 0x3bb8e90fbb50e21c, 0x9c7b61ef620041dd, - 0xeb6e6fd48460ec51, 0xf7572c6878d9b9ba, 0x6269ccae730b3306, 0xac289df56fbe0cc2, 0x4f9723baec5f9d77, - 0xb1f9b10bfd3a1faf, 0xba561aac3bbbea84, 0xd70d3aef5c773eb1, 0x8e03ea839131926f, 0x5a35e9f365977759, - 0x6a07bfcf4661bfc7, 0xf69cf57ba301960d, 0x983b18d5d49fc361, 0xb7419d413864cf5c, 0x0cfad7c652f62e88, - 0x700b7c40daeb5a46, 0xecf9f500e10aaf6f, 0x61bde749e7ddce15, 0xd8215abdcd80fa20, 0xf7915f2a43923c21, - 0x27f53dd266a291d5, 0x475c7a262b2cd0fd, 0x6335e58e395389e8, 0x428c51b4923ea280, 0x848e71e74e2c4411, - 0x69352f69519e9e9c, 0x304fba2b1295558f, 0x8e88910dc036b634, 0xcd5c4f5bee42cb5e, 0xd802ced34d41f61e, - 0x9749eeb407c0146a, 0x9a01475280185099, 0x0f192bcda12a51e2, 0x13275e1428129991, 0x0494675c26a84857, - 0x3216dde96c18a262, 0xc011a59fe6d9d412, 0xe67086a689146505, 0xb462f7b50e0f5db3, 0xa073391155525251, - 0x3e3106b2d5be53d8, 0x8b4dcbfa8f4370a2, 0xa80284e836147c2c, 0x3f989d795e180c68, 0xc3820440b790761f, - 0xe0a603280fe468a3, 0xd033b71da445b0ef, 0xe8418eef55b9ebf8, 0x4faf467302dc2e1a, 0x6ed5362ba71ad016, - 0xb1905b2464ff0966, 0x32610074b7976a8b, 0x7191270058ab04ba, 0x5b9b4eecff8d8bf8, 0xc702dbd740c1eb8f, - 0x1e733cbfb42a4a06, 0xaf19020f37973361, 0xa13e1219320a2e45, 0xe7c875cc11c8b5e7, 0x175e770d0e8bf95c, - 0x0a4ddc1df2392263, 0x4e914df871e2daf4, 0xc35e63020e03604f, 0x78a344cccda73660, 0x6ce4d6cb14cd53c1, - 0xe2da3cba66a8ae99, 0x70bf72c6a11238d3, 0x3ce443c5444e4af4, 0x02de10e8056ca0c9, 0x056ed7c0715aa842, - 0x8d13e9b5dfe7df7c, 0x2e22553ed54a30db, 0x36053fe347a6db21, 0x78507139ab5733c9, 0xc5552f6b0f057091, - 0x0b18dd68b9405fa7, 0x070ddf7297322a4b, 0xf6b8f33626a02997, 0x9ab5a2b6de5b956b, 0xcdddce1be00d7a98, - 0xa9520605d43729c6, 0xec9d450ba927e888, 0x6d64401ccbcceea2, 0xd0d4d75dc98879c8, 0xb30e164a3eb8d021, - 0x18a3fe79bf0d0ca9, 0xcf973a4ce1e05416, 0x056abe9ac3a2543e, 0xf088e4751b8be87e, 0xaaf32a8bdbf4ddc9, - 0x89734f94275caadf, 0x5d5c5cd80d0c13f3, 0x44c0f7cb9adb17a6, 0xbdd6d63e3f7dd6aa, 0xa6c04484dcb2c6d5, - 0x82c7491eddef4867, 0x26e19ebe74463fa3, 0xfe907eb323037e6b, 0xf97ba5b4190d96d5, 0xe4531513097c8065, - 0x5d50938adb0292ed, 0xf76a879702ef9ada, 0x573e880194b40c9d, 0x0f1ddec516259f77, 0x9a81fe8dcc768bd5, - 0x9c1ee76599a766b9, 0xe50857779b18b584, 0xd67d14166dbe016e, 0x3b55aa39063c5d07, 0xa91405da4400fce5, - 0xf97833822a63900d, 0x5c20f9c814be4a4c, 0x51af56c04b107647, 0xf51bf6bed0b35ca7, 0x02a158e2bfcc0450, - 0x2648737489c054ba, 0x371a49f379064f98, 0x2372473cd95a9298, 0x8ee4b449655a3d62, 0xb0679040ba397ce3, - 0xb932467786ce0a0f, 0x0eeda1cd25ce5612, 0x2cd5718e33170247, 0xedbb938fd0fae946, 0x2375bbab3c919c55, - 0x9ab90e681bded2c4, 0x3373c8833f0e191a, 0xf072a833dc334502, 0x1718aad52a5baf8d, 0x882200898f1890fb, - 0xa819cb71353dde54, 0x9bf1464c7d09bf2a, 0xa536b27cbb369628, 0xb28e55251e7c001d, 0x8dd8f92432ee7191, - 0xdedbdbd78c0a4a54, 0xc4aa65f4b6dd5e3a, 0x8cedd925ee054c0d, 0xed24cfca60225295, 0x20e13164e5062559, - 0xddb5c1c54f486b48, 0x3ad72fd39e7e41c5, 0x2d8c38a323b02e0d, 0xecc4d8362e379c6d, 0x6f9c6064c24b0c23, - 0xe1ba1109f022d072, 0xea6dfe560c4d15ce, 0x1fd7faeea95ffb82, 0xac37b6bbde124762, 0xe5c74524ec391605, - 0x9ec2496cc604e033, 0x801975b744633755, 0x6024b6b3819f4160, 0xb4b4376cbcb80d30, 0xb99218a3ed18251f, - 0xb1040d58baf7f954, 0x66529b177e94e0b9, 0x6f9e9dfc71c3d4fa, 0xa9f9b0e0aba51e45, 0x4ee96f0aed4bf3eb, - 0x72d50e4896dae0d1, 0x29fd61021ac412f3, 0x8179ceb7a93efe40, 0x7f6e93bcdb4512e7, 0x78c3cb6f50bedf45, - 0xf920164fdfa0fb7e, 0xb7c4929df13ce50f, 0x3b2985f90eb046e9, 0x4939fabce7c2bc45, 0xebcf57bde9f75ee6, - 0xdc5ac22ecdf7b2da, 0xe9f49ad533dedfcb, 0x7167306a8e7ba3b2, 0x97dfce20ad68b837, 0x5a7b39ee0cde92e3, - 0x3351e44f4bf7b29c, 0xa1c6a6b37da13432, 0xdc9dd570bab9c397, 0x7c4d61b008e3353a, 0xddd619641cd4d0ff, - 0xe387c3835d88f4ff, 0x89d8be8ca6146074, 0x319d7729fd9f6b80, 0xb5bccd8ee36934d0, 0x555237eb9aeaa797, - 0x8f36eb0def1b7d6c, 0x43df4db1eff63fb5, 0xc182dff278c66bac, 0xdd279045d11ae3e9, 0xd91aebfc013da955, - 0xa9961d6a3124b752, 0x192bb15c3723a0a4, 0xfd20b0fc448c9103, 0xcd5b7d7539d08753, 0xb4f25f19f0b1c4cd, - 0x47e69b01136f8da4, 0xe06de6343f45fe42, 0xcd5ae2c604b43a55, 0x41878e66a55fcfd4, 0x2ef8257cb0355b1d, - 0x989e6d1f64a76861, 0xbbf1fe7949fe7d0b, 0xfecbc6f1e1f0f000, 0x3a7fac7b1971da10, 0x9ee11c0a7828ecfe, - 0x4c817997f04753f4, 0x2415dde3ab65864a, 0x4f910476743b5879, 0xbfe9e9581c9d34cc, 0xaf63666ffabf0bbb, - 0x6f90f83c9516a632, 0x055b070d427cc3d6, 0x30927be75cca7b4c, 0xe5785a32efe5a865, 0x5e6c2f315565bb8c, - 0x4526a35e77a7f1ab, 0xb83627027683f52e, 0xd37e5a33cda6c4b0, 0xe687f1d70c3ab097, 0x5bfa70266278f5a5, - 0xb9626f43f0aefa3d, 0xd8781dbfcc28cbb3, 0x696b76c9c23d8f0e, 0x3c201cd811eb3d4f, 0x4f077e96b22b3f69, - 0x9d9cfc1dab71fe18, 0x589e6d5a087d1404, 0x8b823fe839f14874, 0x77dc308fd7633aa1, 0x1f91cffc27e0bff0, - 0x59439a9c7e85f2ac, 0xdb7eedad96f5985f, 0x6bef1476eadb5baf, 0xd69e55b616fccfda, 0x1b788776680a9a3b, - 0xc20bc2b06ac65a10, 0xcce2b5d26bfffd65, 0xd6ff176f2b2d08c8, 0x1b00000000000000 - }; -}; - -} // namespace webfront::fs::generated diff --git a/include/webfront/system/XtermFitAddonData.hpp b/include/webfront/system/XtermFitAddonData.hpp deleted file mode 100644 index 697e50d8..00000000 --- a/include/webfront/system/XtermFitAddonData.hpp +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace webfront::fs::generated { - -struct XtermFitAddonData { - static constexpr std::string_view encoding{"gzip"}; - static constexpr std::size_t dataSize{807}; - static constexpr std::array data{ - 0x1f8b080000000000, 0x0203b5545d73d33a, 0x107defafd87267b8, 0x76af2327b97d4a46, 0xc3e5169881a1c050, - 0xe035a3daeb5a41b6, 0x3cd2e68b24ff9d95, 0x4dd3625a280fe425, 0xd6ea9cb3677725a5, 0x272747700267b6d9, - 0x387d551244590ce3, 0xe1e874301e8e4fe1, 0x4389b0267495987b, 0x500b2aadf3029e1a, 0x032dda83438f6e89, - 0xb9082aff199d61ed, 0x11ce5f7ee0f59dc2, 0x63161efd9bc059e9, 0xb427db94e8e01516, 0x85c30d44cc83d79d, - 0x467c8fe05b56d3b5, 0x32660385759f3187, 0xc2d90aa295a61288, 0xed762efff6d0b06d, 0xedbdb6753c094c80, - 0x17ead2b120fc8fc6, 0x28973366ae96ca67, 0x4e37044b1a0d8741, 0x13e6dee87ab1fe46, 0x2a899a499a5e761c, - 0x61dd55fa0d907680, 0x1f4a1cf513312e3d, 0x4a4f067ff2d77af9, 0xdecab9ce9cf5b620, 0x8ebbc63a45dc8bfb, - 0xa777ddf91c1675ce, 0x5309cdbc35100117, 0x888705ad0974dd62, 0x1a67e79811386ba9, 0xeddff5d074cdabaa, - 0xcbca09fe64f5dcdf, 0xa57250ca713293a3, 0xc4cacc28efb72a23, 0xbd548411c65b2ab5, 0x17b37096c3f191b8, - 0xcfb56facc728deee, 0x0b4dfc679000658b, 0xe39ac2de335d7125, 0xecdf47f15417d131, 0xee76c7df0bed76da, - 0xbf516f221499353e, 0xbe593abbf271ec90, 0x16ae9e0669eaa40f, 0x4c31cbacc369d48b, 0x06deb1949dc06ed7, - 0xdb0d49dadd36dbe3, 0xc7118999c330af0b, 0x9e24375e6406958b, 0xe2a42f8b5e7fe146, 0xb4c4e4dadefe8e42, - 0xb7a1d07e91bd8040, 0x83cca07b3744a3d8, 0x163def56bf6e43bf, 0x8afc6028f49d44e6, 0xbdc8f8368995cea9, - 0x94520eb93537d112, 0xc3810ee1dba97c3f, 0x956dc261f482afbc, 0x35e652659f03e5c9, 0x70720fce2e831d5c, - 0xbd5f18744fbadcbb, 0xdde8347172a5ebdc, 0xaec415d299ad9a05, 0x617e411b83fd69de, 0xdd8ec4480e787c59, - 0x53e482c63b1e033a, 0xda7c526681d1a3ae, 0x9c47719c2879aea8, 0x14955a47c3e4a79c, 0xd61c53e244ffa6b9, - 0x38a9e5969fe2c941, 0x5fdfa1dfa83cd7f5, 0xd58081c1d8a525b2, 0xd5c3281d36b0da77, 0xe761a4161a38068b, - 0x0752029219fba492, 0xb5609fffd4a24b9d, 0xe41c680539145049, 0x26cda04a1aa906f9, 0xc04fbb33b30d5763, - 0x72e87799b49f85b1, 0xd6454dda3f83a11a, 0xbe4337f8d96d7c76, 0x1bdf8d938dedf753, 0x5cf34b4c5b0bcac3, - 0x0b4d4ff3dcd6fbe9, 0x519afe05de2e5c86, 0xe7aa69b8988fef5f, 0x4b2ecbd6037e9c44, 0x35f79ca339fa0ab7, - 0x9f71d2af07000000 - }; -}; - -} // namespace webfront::fs::generated diff --git a/include/webfront/system/XtermModuleData.hpp b/include/webfront/system/XtermModuleData.hpp deleted file mode 100644 index d8fccbab..00000000 --- a/include/webfront/system/XtermModuleData.hpp +++ /dev/null @@ -1,2315 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace webfront::fs::generated { - -struct XtermModuleData { - static constexpr std::string_view encoding{"gzip"}; - static constexpr std::size_t dataSize{91908}; - static constexpr std::array data{ - 0x1f8b080000000000, 0x0203d4bd6b5fdb48, 0xf22ffe7c5e85e37f, 0x0e3f3b08e30b1030, 0x283edc92b0c36dc1, - 0x49266158226c8135, 0x18c923c95c06bcaf, 0xfdffadeaab649964, 0xf69c7d70763f13ac, 0xbe56575757575755, - 0x572fbe79f34be94d, 0x693b1a3dc6c1f520, 0x2d557ad552b3de58, 0x5a68d69b4ba5eec0, 0x2f3da47e7c5bfb23, - 0x2979e37410c549ad, 0xb4391c96b874528a, 0xfdc48feffc7e8d5a, 0xf9dfc3a0e787895f, 0x3ad8ebe2bbb0e126, - 0x1a6eb49cd2f6200e, 0x92341a0dfcb8f40f, 0xffea2af61f4b15d4, 0x2bed8b36aa331a3c, 0x426b41e80d878fa5, - 0xab28bef1fba5ab38, 0xba2d55ee8374504a, 0x01ae80f27f92d208, 0x600749124461b54d, 0x354ba5f7de658c06, - 0x4b5bfe70e8c57d94, 0xf9c3bbf3925e1c8c, 0xd2d25ddaa8d7a9cd, 0xd21fc93008c70fb2, 0xd2204d47edc5c54b, - 0x51a716c5d78bb2c0, 0xa2283035c446be23, 0x945bfc65f1cdc27f, 0xf37f0c4b169483a0, 0x1747497495223d1e, - 0x45b1970217b3674f, 0x61be5f1a877dcc0a, 0x21d39a905ae9d4f7, 0xf547fa90968290cb, 0x8ce2e80fbf9796e2, - 0x284a197f6ad28210, 0x5fb7a25774f0df1c, 0x3df07be7c5a5bf12, 0xf7e89280a9f5fdab, 0x20f48fe30854903e, - 0xae53e6c950655efb, 0xe9d17da832777c41, 0x0151ccc5f6876e25, 0x71d2aafbee09e057, 0x288986524aab7f25, - 0xc8f09d27546fa767, 0xfeb9e387e35b3ff6, 0x2e877efb557d529d, 0x70fd03ae8e7281dd, 0x44ec06ef1a9dbb28, - 0xe897eaeda07332ac, 0xa048b59d3aa19bd4, 0x867e789d0e161a4e, 0xb41ebe73ebebe1c2, 0x42b512b9c959785e, - 0x9d9babc46e25e844, 0x54c189abeda81257, 0xabcfcf71753df6d3, 0x711c9682b9b9786e, 0x0ec089024e3c714e, - 0xd5102a028c94fe3a, 0x499501fc90b8e52e, 0xad0dac220c6c344e, 0xcbce6de0f2b02a28, 0xfc217112fc4ce897, - 0x9b4c9cd7543e8a4a, 0xb7e3dea0148d5354, 0x28a551c90bc3681c, 0xf67ca7147a77c1b5, 0x97fa941a47f749e9, - 0xd60bc7bc4229c1f7, 0xfa65e7c26affb56e, 0x1f2d2793f52bb442, 0x3402c2ac24d52739, 0xaaa416fba3a1d7f3, - 0x2b8bbfc79ddfc3c5, 0x6ba7fc7b5cae4e74, 0xf11b14c7205585b4, 0x53fefda1b175d6ac, 0xd7ff5d9e4fe6d557, - 0xe3dfe576626a7da6, 0x4944ada4d61b06a3, 0xcb08cb73c74bbdb9, 0xb95c420d30d2df4a, 0x39f51fd245801284, - 0x652745f210248496, 0xba48ae3a496d14fb, 0x777e98eef857de78, 0x98562c00ffe4ae98, 0x129e82ab4a52237e, - 0x4754e7015b2850a1, 0xea994eab4f431f0b, 0x0924918505a89b82, 0xa5babe1d5662d9fe, 0xc4f48a54dd6be232, - 0x4e9dc46564f95816, 0xbde338b8c3641d44, 0x7d3fa95dc65eefc6, 0x4ffdfeb19788b4b9, 0xb9a0167bf747236a, - 0x2ca905d76114fb5b, 0x53c55eb9eeab7a15, 0x2da66025d77e4ce0, 0xed121ed00d65a4b5, 0x3b6f38f6dd72d940, - 0x76202113a30c5c9f, 0xc6b50522ea07e1f5, 0xf63040ed13e01668, 0x911840c26f0b0196, 0xc755bad0a8f35211, - 0xa95f910a5c22711d, 0x33923e0efdda7dd0, 0x4f076eb9591f3df0, 0x3471e2c0273e974f, 0xa5f6dcefaf9fe2c9, - 0xe8e1bb4e457b9418, 0x6612ffda032b7c70, 0xcbd81aead4c055d4, 0x1b27f61c1f6b6c63, 0xe93de9113a5891c0, - 0x23f58e81f56e4e99, 0x6a682a1462822c25, 0x69cab21bdff6ed05, 0xf16e6579b9b5dca9, 0x240b2efd5a714e81, - 0xfbf0ba46fbdff6c0, 0x8bb7312d954af2ee, 0x5da35e9d5f5e6eae, 0xad54e78b8a24ffab, 0x81ad7d7e79a5d5ac, - 0x57abedc22216107b, 0x34a5a95b777ccda9, 0xd40496cbebc4df04, 0xcda6ebf186bf3e3f, 0x0f34500226eb2c3e, - 0x073f9350870aea60, 0xde2d043cfc21e061, 0x16f0190d85d58962, 0x8c1366deb1db1b7a, 0x49f2d4033da7f1b8, - 0x07465fa93ea58320, 0xa95d0421849be0d6, 0xad4f7a43df2b4ac7, 0x8aa1562db24d2516, 0xd6b1a65f0555d959, - 0x7d5da081c8b44e59, 0x998644dd08757b12, 0xcecdb412cecf57d7, 0x79341b6e3437176d, 0xb8cb6f5b4bad8e7f, - 0x16cfcf9fbbd91616, 0x0462de300aa205ae, 0x36cf186d5764854c, 0x7947264620b9dc90, 0xd49c456eb81e6d04, - 0x98b348c037ccc217, 0x55691cdcef863b9c, 0x9b1b02c09556638d, 0xb9192abd73f5e8b3, 0x5d0c9d98b1e14db5, - 0x27470b76ebe5473b, 0xcc8cd02b1ce1508d, 0xcaabae633a534861, 0xfe64085eb4b2dc7c, 0xbb86ad5295d33410, - 0x4f264efa02052890, 0x43ffbef4091fab9b, 0x71ec3d565ad52c41, 0xc862b5ab6038acd4, 0xabff095538913374, - 0x3c678cdf038b4264, 0xcb67f573d1d285fb, 0xaae18cc45c9abcf5, 0xd19c5b19cd359b4b, 0x55d7751b6bcd4eab, - 0xd1a684a53a2520bd, 0xd3586ebfe5de30c5, 0xce152fccf5ca55b6, 0xa1f9f9dbf3b99516, 0x848adb8da5f5ea68, - 0x63c35d7146cfee15, 0x57dc942467bab53b, 0x6cb6a7734defadf6, 0x9273e26e2edc8a8e, 0x071b27eb4c26038b, - 0x4878d080e86c8039, 0x722a577368b68ac9, 0x6b3457ab4f838505, 0x0763afaf5f4262b8, 0x99f843089099fe6e, - 0x6962af1c03330632, 0xb9787eae6c12089d, 0xd1069ae9a095b6a4, 0x81519b325ac868d6, 0x97569f9f47ef5c26, - 0xb0b9b991243da4a1, 0x04930e9a51d5aaed, 0xd106531d5569341a, 0x4bf8cfce96eb294f, 0x1184c09e1b2c2c39, - 0x7d772090d0c7daaa, 0xb204889fbdb9b957, 0x6072187d1f421d0d, 0x9913c012cefaf30d, 0x3b09ab10494d3b09, - 0x0b09492d99b45e95, 0xc0847a91ab1f6681, 0x38fd79778910ce5d, 0x12c243c290aebace, 0x18467e25b46699e7, - 0xac9f5fd866cad165, 0x4c8d0ab06916a3cc, 0x2cf61716ccc244b9, 0xb18be65b8deac6c6, 0xca73840973c60c44, - 0xb69c04692c265d82, 0xa449ebff36482f37, 0x9549691066b97131, 0x27d4f8f0c7e36d2c, 0x63bc8de63300c15a, - 0xa3a10fc5d005218e, 0x35218e35218e1521, 0x56556bebc5585965, 0xac0039ff2f61e5ef, 0x369e496912557377, - 0x62155077de8f27e1, 0x2dcdc1aa9e039a0e, 0x9a059e0e4f4c875c, 0xe563b5ca0b706f6d, 0x237c760a62127ae8, - 0xd73d64db92f8b9e3, 0x8bfda554b8c35c5d, 0x83dbf3af4bfd0b02, 0x9f0fc1b2cfdb4e9c, 0x4e921407821e8e4b, - 0xdbd1308a4f3e6c55, 0xf4b9e62c7d07c168, 0x65aeb9bcecd0cf55, 0xf18bfe3d57f558fe, 0x99aa594999472f33, - 0x35ae3ce3b3a13e57, 0x9f53e0953eb0cd45, 0xa10f58897fa50c4f, 0xa20e961077afc5fe, 0x71750df914e0cb61, - 0xe0438f20331e88e7, 0xdc9a934e82642fbc, 0xf3e384dab6a7feea, 0x7a6ee56da3bebaba, 0xb284325bd1b03f5d, - 0xa0d15a6a36debe6d, 0xaea2c427d24540dd, 0x926f67e025bbb2d7, 0xcd348d2194cfcd65, 0x61612d06d53c2551, - 0x1ec452ef34daaa8b, 0xe6caea526b796979, 0x858040a19b692840, 0x1cab6feb6b8da618, 0x4b900438e817005b, - 0x7fdb7abbd4586dd2, 0x78f6520fe27eaed0, 0x6566c83bc1ed74be, 0x3d62126a71d81ac4, 0xd1f87a30dd5fb3b1, - 0xf47669b5b5b24465, 0x719a4c7168f0f348, 0x449336f847988902, 0x1c52c7067a1cc6de, 0x5f3319d101af001f, - 0xf556ab41ddd2a96d, 0x6641ea59150c92f7, 0xd744928622734d11, 0x33b34a6f1594b6da, 0xcb957e7f7dec816a, - 0x53034161fb8d95b7, 0x402c160056404176, 0xabb5bcbcb4d4222c, 0x6dcd68300742bec1, 0x5cb6d5e0fb6bad15, - 0x7809c23af75d5c34, 0xd7381525720f2ec7, 0xa99fafa1668acac9, 0xc580354b95ccd4a2, 0x700255696f300dc9, - 0x53cfc346a346d7e6, 0x2f3598769e089797, 0xd7b980aa9d2f209b, 0x595e87228e8094f9, 0x0b8d89453e3960ec, - 0xb1fe3430a8f43230, 0x44e4b38199662379, 0x6a369c623cea4371, 0xa28a2bfeaef94d90, 0xecde8ed2c74ab5a3, - 0xaaba0baaf25bc178, 0x2eaf9f5dd31e10a1, 0xb99bc2873a16d81d, 0xcfcdfd7b0667e35a, 0x551b8733cafc0788, - 0x9dd5d2cbd89e556b, 0xc614884a3679aa1d, 0x773a630a5dc5dce7, 0x67d12666e947f812, 0xf396678df6bea437, - 0xdeff1c929f9c3a8b, 0xfd09b0347f9d8227, 0xcfc8fe9b30e5f9e1, 0xcfd4d114a7c7a121, 0x9e1a4b319bfbef8c, - 0xa56e00320a5d9bf0, 0x589628d89415287a, 0xede752664825ed46, 0x9bb9b36effb31707, 0x5e981e5d5d41ff9c, - 0xeb67ba8d4c69683a, 0xe2b4501215da3b9c, 0x19849a06ed2841f4, 0x621c0ff7fafa8b72, 0xa08ab4727c82ae84, - 0xf41c2c225b8c8daa, 0xcd2d2cadacbd5dc1, 0x0967ed9913b3e3dc, 0xd868ae08d452e109, 0xa0e53621ab5a1d73, - 0x57d97ac5bd2e4b55, 0x0477acfa5dadbe7b, 0xd75ce1a6736dd8bd, 0x80276b40e54091fa, 0xeca604a1692b0b8a, - 0x62ce1950a83129d6, 0xb5b2bd8ae2b95e95, 0x0498e9d434c0fdd1, 0xe00a472cdae76cdd, 0xac989f1cd2f2e423, - 0xa47a0b5badb7cbab, 0xf5b595d6ea12a16b, 0x4d8bfa1bf54efaaf, 0xa5e6dad2da0aa450, 0xf097ec90b2ed6687, - 0xa604cd461e9f6b56, 0x6ffa9c213be48386, 0x81cba639e2007227, 0xcda0223bab969023, 0x5141828e38a5fda9, - 0x56011119964c8223, 0x5aee68968c61fbab, 0xd46a352fbe86112f, 0x4c611ce3c6e80c88, 0x4fb5247ee2f4a6ea, - 0xdd5e0236b6d790d5, 0xc33e9a4105cae61b, 0xad2ccc1cb3c81290, 0xbecf96730220615b, 0x3699c3838470ae59, - 0x5f7bdb586e12017c, 0x21e3477131cc3217, 0xa1c6f3d24dae25b1, 0x9aed8188259b2dd6, 0xe8c02c51945e6d63, - 0xd8d4d3f4b66c8f65, 0xba175b473c9da98c, 0xa3309616744a649a, 0xc39d3e76fb38ff0a, 0xc2e2b913a87fd520, - 0x55828fb3b06cf95d, 0xb38ad4bad6875959, 0xa46a5126394eb600, 0xaddbca71587b62ad, 0x1c17d68f7cf98656, - 0x7e877373a1527e67, 0x48ae126754e0a1ad, 0x027ff67160c79a6a, 0xb60958a913d2bf32, 0xcd4c43aa2bafc356, - 0x3c8d62ae2110a5da, 0x9014a12bf226b899, 0x682c1bed84520f48, 0x31499299fe969469, 0xf29938cee542fd03, - 0xa6e57ef03ac522f4, 0x6185fe18f267df1f, 0xd1fa0a7b819f949d, 0xf7212f97036f642c, 0xc5bfc1b26a0c6367, - 0x1fc3f3e7e7b37363, 0xb30ad87086f9791f, 0x92a2001f4afd8404, 0x7485042687d45555, 0xd8400ed315a99914, - 0x47905400cd41ab4a, 0xc7f17be65abb710c, 0x0e52fedf7ba7709d, 0x80a7c3a177eb2f90, 0x3d00fe15707ee879, - 0x61290a61fbbef44b, 0x6372a6800d5ce6c2, 0x37a534f262948766, 0x0bf6db63760240af, 0x13a371b908fa6e82, - 0x31134f6043355429, 0xc6d8c8166fb239a4, 0x677f24e720cfb493, 0xd2e86ba37132a83c, 0x05fd76e20464b16c, - 0xfb932a3649ca73cf, 0xb2e99869ae9c56d9, 0x3cf6de05b2ca5be3, 0xab2b3f96232ac37c, 0x097f0524c36f04d6, - 0x5e0cc3e45cc37429, 0x734ce2b74424d2e4, 0xfba949c7ae4ee97b, 0xe0bcd83d02b67aeb, 0x5ca6805074b41f5d, - 0x9b5a1f39495aa04d, 0x72228a1e25bd7de8, 0x6b4cfa3f44e79fc2, 0x806c32267d4b40ba, 0x23903fd5f3bd9495, - 0xb29292b09b8b6de5, 0xd2460aec9b2235ca, 0xc0e5fa2a3903961b, 0x4ce0167317f47d4a, 0x64d70c6d289a6ebb, - 0x26be6ab4b9f12aa9, 0xc0decdfc0596a427, 0xbf22dc4694c3079b, 0x1a62f70c1a7dd958, 0x1624db7c4f9aad8f, - 0x5ed81ffab103731f, 0xc8f74f6708db33fa, 0xe842b97aebf7f799, 0xc6b1423d170e2863, 0xfa67404c5219097b, - 0xe09cbd8de17a0fc6, 0x4a0208da55178560, 0x960868696d0b8601, 0x77a32a2f1e58eb23, 0xafbf0dbfa74acf81, - 0xed312a54d445962c, 0xcb5b3e6b6da9ddea, 0xd3d8ed01967c09cb, 0x5a400c6f305500ab, 0xd4133c7c8c9f0460, - 0x05e3105c7a0025af, 0x4ceca19721754363, 0x93dacbdcdc1172e8, 0x93199d57eda0fd80, 0x5ae92b03dd13a839, - 0x4edb4f0fedf17cc3, 0x7984ac044fa03e7d, 0xf7e62baf06ba13a8, 0x1be10941f91358f4, 0xc4c6f32aecd4e01a, - 0x13dd1f46e1477896, 0x91022fea45c3a49a, 0xc68fdcbeb4459eec, 0xa3c3f5b332bb9f95, 0x1dfe9bb4cbe7d08b, - 0xf78663f86e546ee1, 0x7a222ac31da8820e, 0x6085ea79d0043cd1, 0xefc9083e42922f90, 0xd748bbefc45e78ed, - 0xb72f1c0fdc845c40, 0xda955be70a0e3961, 0x27aca9344a722eaa, 0xeda321673a8308aa, 0x4353b0c6df9d9a2c, - 0xe6c0467a67b5038e, 0x896f9d0d9728a2a5, 0x9f24820e48a068ea, 0xc1c8982c8940e1e8, 0xe2c3ff09db0796ef, - 0x41e5ecb45277de57, 0x9dd34ac3f9487f9a, 0xe012d573e73ead9a, 0xcd0243618f1f601f, 0x447415c4b795ef3b, - 0x51e9311a97eec195, 0x8841db1e4caf9fd2, 0x49e7975fbe6c9e1c, 0xee1d7e68c3053248, 0xe0d216de947ad178, - 0xd82f8da071255e46, 0xfe4de0f17d422a54, 0xb5c9772c00b1c2ef, 0xc16aa3fb1abccbe0, 0xe243934e1c05b31b, - 0x7012fc11c2f17028, 0xa76a420b063fc947, 0x6e10fbb08e0a0227, 0xa614915b8b074d20, 0x78a11fc2d1418071, - 0x890ae4f7e82525d1, 0x9e042c84fb1d0062, 0xbbb5df87a714f377, 0x6ce68a359f067f59, 0xecd1338c7c8bbcb6, - 0x6cf6bf232ae5583f, 0xb135a49ed0dc5885, 0xff29f8af7071b1d9, 0xac13c95d047d83be, 0xfcf81f11189c55f3, - 0x44340827d35bab9b, 0xa1dc123056ac0ee2, 0xa1a60a73ee2fe16c, 0x7bfe104ea5849384, 0xf8a33c36f80f23d6, - 0x91f3ce2db9a1d9f8, 0xc9170cdc30b8f5e1, 0xdb56210735b4449b, 0x3df900c1eda9e3c5, 0xa4daa3ba87511783, - 0xc4f61d3fa25a87d6, 0x295c04d2daad9f24, 0xdeb53ffffd975fbe, 0xcfcb6ad5b6111666, 0x9500e3c09a9d78fd, - 0xfebe04db586f844c, 0xa787235632c40109, 0x20b1add8bfc56ab4, 0xaa6271dc06e67866, 0x2a8399ef7a5011fa, - 0xa84be7612ccce9da, 0xf94ac9881c3985b8, 0x6852598c388296b2, 0xea603502739f0af1, 0xabdb9b817e3eb7ce, - 0xa89a3ff615159a44, 0x61aef60f7a2480c5, 0xe94da028db00f938, 0xc31df2271b023fdf, 0x1a329bfe121a3eb3, - 0x4f62e5d32139dc3d, 0x3f6f0d6bd310c2ad, 0x8ae8f713c4dc6d0f, 0xae93432c53539f6b, 0x6aa1169e992434f5, - 0xfce8aa7419745ed5, 0xdb99246e909c1643, 0x8893d86e3ee15491, 0x2832e36feeea3290, 0x47617510e67a8567, - 0xe14fa14410b7c8bf, 0x6473e0b61a483fb2, 0x81e42520c6f67d6f, 0x38f4afe151aac4e7, 0x36386932f96eaf83, - 0x72be0c981441e949, 0x071debc03e0d27ad, 0x5306544d24c309fe, 0xd5874adec272e6e8, 0xad2794f4ea36fe12, - 0x6d8fe683809f3d92, 0xfb1a937ae9c2d591, 0x572d52f8afe3ab7e, 0x0a99832661354145, 0x804e9c13adb0fba9, - 0x913f3f9737436865, 0x1459952ec7d7a5a8, 0xd71bc7e0f835f04e, 0xe9e08c65c98245fa, 0x38f269ad025deca9, - 0x2a9368ffd433fa5e, 0x1e2aa0230c721e7e, 0x38f542c60c84374b, 0xbc11c29b45f88d1d, 0x78e9a076358c905e, - 0x89e7c3ea6213da93, 0x4a72169d573bb11b, 0xcd37daa11b69db39, 0xec2c34cb3d35cbbd, 0xa9e1097ee691eb95, - 0x96b3e1bfdddf87bb, 0xe941848d0dff8d13, 0xfadaeb3f9007db54, 0x9e9ce35e5c430ff0, 0xea86c156a8acc439, - 0x503449aebaef65d5, 0x63602cc0c60bb95c, 0x89ba410984618142, 0x52e90b15b1ad430a, 0x4ef167fa74680063, - 0x7fb27689a708c206, 0x5a12b5e14e9df07e, 0x7d0f7727f6b6c7c1, 0xb18203a4ff277ca7, 0x218854a573bd7f17, - 0xa0195311d33c7901, 0x2a705641d098576b, 0x2c98e11fa055fb93, 0xff08fd3e845ea268, 0x08b8d29fddea076e, - 0xf120ae826920f997, 0xa8208ddc5e6ca8ef, 0x142775f22eb54ef3, 0xda1fbed2984fa12a, 0x60f7f9681dde2670, - 0xa757f51248e6aa8a, 0xb7519f0cb147ef63, 0xa57681463731eda7, 0x9972201dbbe051bc, 0x4bc806c919fe6697, - 0x7f278a7f80471af6, 0x076eda374503bb28, 0x6b1fa9f0a18f8b28, 0x7e4c5d1cc576cdc0, 0x19d6aeadef06be87, - 0x0a6288b7c35a38ab, 0x2aee1654e2e8f9d9, 0x7d9a58726d08566c, 0xfcdfb5a77f42eac3, 0x84a892319744ea2e, - 0x40b290f20c6c2a9e, 0xb39916aec300dd0a, 0x425262432e87c488, 0x0aae1454c9d31bc4, 0x18099f49a56d3e3b, - 0xcf5052a692106364, 0x4d526d0443645bfc, 0x92d6107456289ca9, 0x1cd0c8826a87161d, 0xee5aa0d75b6ff453, - 0xd520c0102e502389, 0x6ed916209607c8b1, 0x084ad4402b54c579, 0xe503449f79cdfb20, 0x4e58aee2bab32a32, - 0x84a81d38afa0ad64, 0xf778cda97e5899c1, 0x240f56b84a09ec98, 0xca07dec3166f2adc, 0x02d834d49545cdc4, - 0x68a612e0dc1765a9, 0x166dc7504054a97d, 0xd28062f9e29e88ec, 0x64b2be09771ed2b7, 0xf31e483a582c3410, - 0x1afb3b45eea6b53a, 0x7a92e4040ae566d3, 0xe38e2a74a80175da, 0xbc14bc57fa86133e, 0x49274a1ee138ac8a, - 0x9fa014a40a92c015, 0x06b5f732d90e23c7, 0x8b9c08cca2484723, 0xe9318d7ef51fb506, 0x0614a13585947236, - 0x8cce5d1c4ba0834c, 0x0728689cd505a307, 0xd7463508dfd43959, 0x51129c8ff2e61734, 0x5aa37412d20df198, - 0xde9196e59b5c011a, 0x1c9f75774882af30, 0x2a31e54d15545976, 0x733833436359549a, 0xd3b345df604f89a1, - 0x2605d86a70d89fd5, 0x2e4695f8b601f2ab, 0x8f813fec9f611b38, 0x9fdcf88f7953802a, 0x3679a37efd5c83a5, - 0x34e7394f45648ae1, 0x1f7ac6385b25d392, 0xa9f5709066e56bc0, 0xd8c298ce2a5ee49e, 0x3ede5e46e0a74cd9, - 0x51ec0c75521a09af, 0xffae770d12a99ecf, 0x1a88d0308f5ff0fd, 0xb608464c6f4e4947, 0xb0b2320e877810ad, - 0x30db809ec44eaa26, 0x3a05df85bd860909, 0x92959ad217daa255, 0xa8a69e4c3d4c6096, 0x3dcba60ce02383c5, - 0x994d06e690c7d49c, 0x2356abb05a67cfcf, 0x723cb634f82bdf60, 0xb1ab12bb69c00153, 0x56d3e766a1ee5362, - 0x343b6812634265d2, 0x75d00d1e6f341a3e, 0x626e8d898d381a29, 0x4e9ec8acce7a8ee2, 0x72aa33b85df2b5be, - 0x70bd7294ddfdf7f4, 0xacef016b906941a3, 0x7b90b223e6496593, 0x7696a32468cdcbaa, 0x9df2e4088c12e282, - 0xd8b8243fc355541f, 0x8c00ccc9160b0c95, 0xa192609746167813, 0x10406241ec213f01, 0x7dc24409c9593510, - 0x5b1013f49dbd36d5, 0x41d9fb1864684944, 0xa13db6e767ea8e4e, 0x32f0d8d6bd455444, 0x2dcf1b774fdbc8d6, - 0x6fe8fae00dae0f4a, 0x58ce6ece519f6ea8, 0x4131ef46a697a1e9, 0xe5157a994653a50a, 0x7984ccfeb53e0cb7, - 0xa04ea814095b6c99, 0x7587a625cf86f785, 0x667861d260682f85, 0xae563730aeec3937, 0x82e28e01bdbe9de2, - 0x13dfd92321fca612, 0xf9ce3114d092daf4, 0xf6f7aa41c8c6beee, 0x8e4d7b03d19e6ae7, 0xd86ae658db818e19, - 0x92907df5155a7b85, 0x15a91656ac40e831, 0xcd98105adc9ea9d9, 0x7f7908a2ae1e059a, 0x20d6d337f52f7ea2, - 0xfe1bbbfed5d08354, 0x30722f4c1b23b266, 0xdb7491a98b3ae080, 0x3820b89619ed96ba, 0x758ee5a9ce778f75, - 0xcf07b2672472b707, 0xbe5e93114d224e1b, 0x63a80371db43757f, 0x25dad2c42800b9d9, 0x0053abdccc9b64e7, - 0x18ae06c726a17dfc, 0x4efd4449abfefacd, 0xc6f1fa0d869b2165, 0xdcbc46bfb8dea22f, 0x8d52bfeee1f8f612, - 0x0694e3a3d3bdeede, 0xe7dd8bbdc3f77b87, 0x7bddaf0aa7904989, 0x0088c94a0a383b76, 0xf6ce79e1638c4574, - 0x6be1025372e06fdc, 0xe01f80235ac462f2, 0x256553cbc7b85a89, 0x6562da963c02a6ce, 0xf56321e1a0082f01, - 0x25e8a0d05341b76a, 0x2901cd131a30ed5b, 0xe08aeee6ba973c86, 0xd06aa8819fd0ba13, 0x0c00a3a37bd7debd, - 0x07d5964dbab2673d, 0x77500ae04a3c2c44, 0x3e94cb777ee58668, 0x89dbed0a21de3dc1, 0x51e32f88687cd460, - 0x65eb90d87f1faee1, 0x90ef9c813ac30ff2, 0x4a24a926bc03e7db, 0x09925194d0b5e844, 0xefaf74835527b365, - 0x25bb3f4dd59cdead, 0x201a3fc17c4aaa25, 0x862589c671cf17bf, 0xe135cd2c1727d536, 0xc06544e37275d07f, - 0x680fa0beed3fcccf, 0xe31e587147621317, 0xc27e4a175d4d660e, 0xc8a241ac432fc480, 0x1080f2278f5a6802, - 0xaa52d74b9ad26306, 0x7e6a1f2f6c35a889, 0xa1c201ebd68b6f36, 0xe1364e45e0406114, 0xb5f98168994156d1, - 0x28d1758aba024fd7, 0x0589c9a3cc096ef2, 0x4f03cb863186cdda, 0xf70379c10d273bae, 0x203c1a726dcce85a, - 0x5601dea10a37aa37, 0x311f7c919dcd9474, 0xf5b86f8d33735981, 0x847db99ec0fe6620, 0x460bc9e79277572a, - 0x674e708e3331642f, 0x9e315807898e489f, 0x330d3f24d30c96aa, 0x8afda219d10a0c6f, 0xd12deec5fbfb50e6, - 0x643bc7690a579715, 0x12d9f704fe26b862, 0x02e987d33c350e18, 0x5f5f1883926bf510, 0x7aeebbdecf400f93, - 0x5a167a82616c3c5c, 0x1443e4891c281917, 0x25e884cd9d08b625, 0xe6dd1d5bfdbfaaf4, 0xe41ccecd0df878a2, - 0xbe71d6845c6bf531, 0xa52183d127864304, 0xfeeb3de25277afd4, 0x0fe4584bf05d81a6, 0xf615f45cf65d4a5b, - 0x9682e2c5121f7a0e, 0x4cb3aca3ec299f1e, 0xec3a7d160c2a1738, 0x640851f002921f18, 0x16f050eee0b7db83, - 0x7b509bfec148c97f, 0xfa0243ac02a583e0, 0x8ac453810ec40160, 0x14b33524ad7cffe5, 0x7bd520068de12e87, - 0x0e5450f6d2122cb5, 0xe52a08c4cc112607, 0x498abcc795817356, 0x16fa5f67f15f397e, 0x53fabd527bf37bf5, - 0xf522b24caa580231, 0xba2b2e8c53f440c9, 0x781270e133338658, 0x2937318f7604d821, 0xe9f7d8250cea2cba, - 0x8d3ad8c0c4ca0bac, 0xb89d59854118c799, 0xb1d86e61631d546b, 0x7fc078c7e3073dc1, 0x6a9944316e3047b8, - 0x94f5ce23060b760c, 0xfc09f570b90c2703, 0x23c688be755b208e, 0xa7e1fc3c9715a0c0, 0xe3406c6196c78106, - 0x871c0fa4b57e7cd6, 0x3b5fefbbdf2b092c, 0x8ad07e73cc175cd9, 0x67c66480edcd372c, 0x70c181e9fcbef81a, - 0xf657d1e4a484f3e9, 0x4d522d61be5e3ff5, 0x27df19149c05f3ed, 0xd8ad38b72eb41fb4, 0x40474430235c647d, - 0x1757aeaa00a9eae0, 0xf75515aeedc47f4b, 0xb76704a71ecfd995, 0xb3790e04c8d385e2, 0x45b7d5ea00162641, - 0x6ddf1146a6b450e2, 0xad8266d98769f70a, 0xb06d6a8823d20c0a, 0xb8c936ccae106afc, 0x57b0b2ac9bc6e040, - 0x19cdbbb034fe0222, 0x9ffa5f49b228ac37, 0x4d48af9f8619fc90, 0xe9c613cb9ee50fb9, 0xcbb32963522a6af5, - 0x97d74f0383ac4961, 0xcf3ffb3f9848f50d, 0x7eb59ec1602a7250, 0x9801c41ee9034495, 0xbb904e4ab7306333, - 0x7ab2434bd058d501, 0xf9006fedc0e9fba9, 0x170c937634c19957, 0x08062036d61344ee, 0xc03a847d625b1ca4, - 0x9e8478d097a1a040, 0x78ab5d5c04c98569, 0xff82d7a4dfbfb828, 0xafa30e2d3aa16e98, 0x2948582cf0d8f224, - 0x200841d1a6e5b294, 0x1cd6a78cd36709bc, 0xdd947fc030baa603, 0xbfd3f271653d2763, 0x90f902076130a09d, - 0x1adc4d7c3e985375, 0xdae6a5fb418174f1, 0x37aa65248c09acca, 0x1a815764ed54b26c, 0x3fede49917472531, - 0xc5475c9ccae5e0b1, 0x2351dc05423741c5, 0xcc5029c994f9d538, 0x7bf4d3aa62297c9a, 0x49aa7d611913f548, - 0x4167ea7d80de2303, 0x6f7e8059780f9583, 0xe15f21f656f22f34, 0xcaef5ca7bce3130a, 0x714410a3028f6634, - 0xb25f88567f12dacd, 0x8ed9903b26dde1e4, 0x58016a25a80cd6d5, 0x5ec3a0407e2bd2cc, 0xe9947743f882d0c5, - 0x59d0924f8949e97e, 0x1060898bae697110, 0x5058cce44c2187cb, 0x923f8621d4f849b5, 0x73768e8839ca1f56, - 0x5b4a21602af86d54, 0x0c223a784a556fea, 0x6e3395327e740772, 0x526c57c66dc29f74, 0xc18c2b4fb2e536d4, - 0x4f4ce4a0070aae03, 0x4ce1ff5ac1cacaa0, 0xbe3a82f40b8f2017, 0x692489478932523d, 0x4c372f0551b17b1b, - 0x3a2075e3448f4945, 0xfed0c5c8a94a9652, 0x2134ac26b08fb1c3, 0xac50750a05b2c9cf, 0xab914d8e56976ae3, - 0xa20698372abaa7ca, 0xe40214e6f22df559, 0xaea252b82a2d35c9, 0x4da9b1705357e42c, 0x4a439912c4e08940, - 0x9e432024f2f1c029, 0xd2de19c8cc952230, 0xcd15a431350d5886, 0x42053a8d964e3fae, 0xedec9d6e6eedef5e, - 0xe02f8ee3bb3b17d2, 0x93caf02cf669b245, 0xc1f8910893624af5, 0xe1d664f74f6925c3, 0x354e8970c9540aa9, - 0x05ee4fde90a24b91, 0x1b968f452b610081, 0xd7386e1d1aa32fde, 0x76b15522ea19acad, 0x82cf6234da072787, - 0x4a814190aa51db13, 0xfac4bf3f42a284e1, 0x051ce6bbd3bde04e, 0xb5610fb2f34d987f, 0x002f1fdfd45d0753, - 0x559809944377619b, 0x3c556c98217df80b, 0x93a3acb3bbbedb8f, 0x9d9d1722e630ef10, 0xbb18f49f6a7d5047, - 0x265b5087b5b472eb, 0x880b59c3852f9220, 0xbe9fc5f3cf13abdd, 0xa1985a2042ec6b39, 0x7dafe24100173b19, - 0x63e3515eec2f0e1d, 0x54cc4f880fb0e434, 0x9b0564cde6422f4a, 0xb76d4435ed0e6173, 0x228511595c5db513, - 0x5f1d8b31834ea6d6, 0xa708388591672c35, 0x225580f20217244e, 0x979bbee94ead6e64, 0x83dc95a25fc5e9ad, - 0x72d9f9b1abea2130, 0xdd62210a43ce1546, 0x20ce71c2bdd2e8fa, 0x3b22a17d3d8c2ebd, 0x21b96b72851b65e6, - 0xbe293673b3b30e14, 0x2cd29c43ba3cf726, 0xadd14d3c0a1dd817, 0xc9e46391490638f6, 0x27af849b54bb6873, - 0x803d5470b68bdccb, 0x157a850efc836946, 0xf20554284a66fb10, 0x6b660a6d947cbe29, 0xbe33257b72ed4635, - 0x19d893c2e584a30f, 0x497e360c5a05c638, 0x42c035c6895502ac, 0x8bb1974982e26ac6, 0x5825b9e4c7aa7883, - 0x18ab3acce4eda050, 0x0cc0ad04d40113fb, 0x44fa44ce2a01df4a, 0xf395b97bf541aab1, 0x66e248d886658eb0, - 0x4c4a88037351485d, 0xf531b9f634c2a229, 0x3015c2c6cdf80958, 0xa6ca541268cf7616, 0x88d2548deb071291, - 0x849979b721156eda, 0x7f81e5a5181c0169, 0x522891be9dec0332, 0x91fa0c236f703fd9, 0x392ea005b53eb20b, - 0x55366c95e3153a8a, 0x46760f34fe973aa0, 0xfc9f689f8a71f33a, 0x59f4c168c9b68fdd, 0x91b156d42b512ed5, - 0x80a696112b4a4aa2, 0x152896b70ae45761, 0xcbd95479a5f8a789, 0x1b72c60bad70690b, 0x350485d5d0d4eaa2, - 0xd68a20cd0065cfa5, 0x18b095905fc24a30, 0x211a5b701b933745, 0x96899fe517d23140, 0xcd307881804072f2, - 0xbf86ae61d535f835, 0x729458b8656aa36d, 0x71762d64aeaf8db7, 0xcead761ba51b19e4, 0x8a295d51b27e4124, - 0x25413f5be070480d, 0xfe05b5294dcbab46, 0x075a69eec4da49f2, 0xfdd77069ae5f29ce, 0x37d20d6e87d0915d, - 0xa20ad5f41e491140, 0x390b3e91f4db16ab, 0x448655075a10718b, 0xf7efb5eb0fbd51c1, 0x114415e18b30f2e2, - 0xb64a5bc8f5204513, 0xee219f2767f103db, 0x85ae22faf735ff7e, 0xbd5ef9273998ffd3, 0x17e21531262169d9, - 0xee788fbc865f0b8d, 0xca5314ee04fd4de3, 0xffdeee4edc47e7da, 0xbd0e945b51d5b987, 0x8ae611ded4d992dc, - 0xfcd3fc3c48c26d82, 0xf4b3172692103818, 0x4408288073301cbe, 0x4956dcdffb7577ff, 0xabb894371a5f92ce, - 0x99f448a71f8f3eed, 0xef943e6e7ede2d6d, 0xedee1e4a2292dac5, 0xdcd9a356b25b2615, 0x365d89c37242b42a, - 0x9c029d2eeebe80e7, 0x9a73ae5f7974ba46, 0xb1802f861b8eff8e, 0x1477c0b4e5af6e75, 0x02dc61196174193f, - 0x43e04cf2fa2e70c3, 0x06af7b6a8516e42e, 0xa1fe4171d107f7b1, 0x72881c3a00eeaa03, 0xe043e7c1086b6d54, - 0x4057c2efe6da3984, 0xee4836e8eccecd59, 0x059d87098103a371, 0xce91010372aef590, 0x0695cabdb32b807a, - 0x0050dcffbd687ed7, 0xe9560e811599895a, 0xd422d9be33fe0e3f, 0xd1e01335e4e86635, 0xd4ba51e9fc627949, - 0x94a29f6998da9d9b, 0xb31aceb72b6cfd19, 0xcf093d1da5472a92, 0x20462e9c48332e11, 0xd088bc3c69426bf2, - 0xc89ae407f7dd03c3, 0x622605ff5353da03, 0x58f7a029f4e4858f, 0x59c7091e207265a3, 0xd7da6f063968b5b2, - 0xeb76511b83d905f2, 0x783cd2709f719760, 0x0aa516d0948b25f9, 0x056765ac34767ad4, 0xf743aa4fd7a0ad5d, - 0x72dff0d1dcc4e105, 0x79222e916093b20b, 0x5a6703708b2e8e2f, 0x957b611b00fac191, 0xefe853828a1543e7, - 0x3200b85be340ca66, 0xedf4326ba76bbbef, 0xb3aaaad315cab3c7, 0x6abb3b37d7e5761e, 0x71e1ceb440eb8db0, - 0x8ff0bd181a168a58, 0x2d40308ff79b93fa, 0xce91ef90c489ab6c, 0x8e9fbaac2afe021e, 0x421e66b89085a53e, - 0xecb71f30da1958f9, 0x06ac20c4f0bb2708, 0x67f3680f1847a303, 0x082ef7b0c71d6153, 0xabdc1219c5d89668, - 0x8b50c71cba3b2778, 0x184172055b30fc18, 0xf519e848ffaabcba, 0x7f7efecb87de0f41, 0x3b654357f0a66429, - 0xd9511b26f645c422, 0x870b44b95361f15e, 0xa98c8fd0271ab394, 0xc818e735a2e722d1, 0x957d00447cd59d3f, - 0xc7fed8e7a0f1a997, 0xdca020c4479e681a, 0xba9c693370700b80, 0x85ca43baf0f72241, 0x60a47234df329471, - 0x4894e14314e77b8f, 0x42ab70c70972ce0f, 0x0571dc621018bb20, 0x0f6691971c7adc72, 0xa1295dd054631066, - 0xbd5b0589ed62ed03, 0xdbf79dcabda01a5e, 0x12edb3dd7350c814, 0x2b168bdfc3cd8adb, 0x316cbdbee568531a, - 0x714faa3d6071973a, 0xa52180c4eaceae76, 0x94118b90730e5dcc, 0xe2ab6ee5019554be, 0x244850e344f6879e, - 0xc0c2320e3a191676, 0xa619924c77ec847b, 0x1864bb5859483f67, 0xbe44164bcb45a774, 0xc580a3d36bba1c67, - 0xb886347881e38396, 0x31d6774fbb9d5d79, 0xe10ca6f96f9a7aa1, 0x160151dff39ce0be, 0x801818d3f06e47bb, - 0x1f5203a60a96b5b8, 0xeee87c93d33b9bc1, 0x3ce010a340b05bb0, 0xfa546456501bf458, 0xe9762c423facb60f, - 0x4933fb02613ee476, 0x3c01aad138eb9ebf, 0xe18ebba13f715d3b, 0xeb8564b12a220dde, 0x61e4d47759d979a4, - 0x5b7dac6827ca6f52, 0xaaf6dd43340f2d08, 0x893cdf208d939876, 0x626d4c847d459c0f, 0x6237603339fc82a8, - 0x8113e91d5b297ff4, 0x861484018a623622, 0xad0b09f9a8480d01, 0x348ce89e24fbd21b, 0x466bf2040d74a51f, - 0xb39ae0d925afb1e5, 0x742b204b30185947, 0x10e78b55a846e7ba, 0x7d22ab881d8a364d, 0xb5a8f4b696afbc8b, - 0xfeee815e5a8aa067, 0xd900afa20a5628ed, 0x8cee3b8a802769fd, 0x9ad6e7fd0bad71a9, 0x07f79ad72a6dbbaa, - 0x2c6a36b0c030ad9d, 0xdd367ca4444f7ac6, 0x303e65f561038b69, 0x9acc3f5df79a90d8, 0x052027550e6fac37, - 0x3f4b52dc937b1596, 0xb104f7de2519e11b, 0x9953c46ab816dfb4, 0xa668d591500c3c61, 0xc53fc8efdc9d4ece, - 0x3b7c79ddb57767ad, 0x8ff6835908449d92, 0xf8c919f590eeb251, 0xc2ae90addd3db314, 0x6efe837160897173, - 0x59c8b3a32a28f0df, 0x18daced141666437, 0x6664c796e4471d4b, 0x6f3accef3b92d131, 0xc7ccc5d34866903f, - 0xa51646b107096c74, 0x05d09a19c0e107f7, 0xc4b10e9eba123b58, 0xe9cc54e5b7941726, 0xe455c2e61f6122eb, - 0x5a5b29882b3b0a05, 0x41649d230eb26791, 0x475e7baa4b2544e3, 0xf8d4770fac5ac75c, 0xcbda5679813f62dd, - 0x61e162cdb150390e, 0xa1ea3d1d5fd2432a, 0x9718b72fd9ceafd9, 0xb04bdc8c0cb97049, 0x2fcf108f72bb52f7, - 0x202d973a18194597, 0xc0e5956ba1601784, 0x346ba62546404747, 0xdc309912581d3f93, 0x02640d415bb94a93, - 0x7570009259cd8d61, 0x024c89aecef5dcdc, 0xb5b02658d9d5c925, 0xac12e1270e12491c, 0x21332af81f622cb8, - 0x3f7c1ce149220c5b, 0x0c8dcac90c956070, 0x642300817ec2fe8c, 0xb611393d8b41be4a, 0x20954106d1e4a704, - 0xa71dd1a48ed163f5, 0xa2eb64309fc181dc, 0x95f32d93df0cdfb1, 0xb2446f2c098bda08, 0x77bf0a02d46d6528, - 0x564c011344df3a6e, 0x7ece1e7eed231436, 0x4202efd07db2110f, 0x41807c3d0db69000, 0x04ed4aa41037c962, - 0x013200a40e34a48e, 0x5f340ea770b23057, 0x324327a026451d63, 0x16a6a908a7c8a97e, 0x9880bfb996954931, - 0x36ab1a5a529247e6, 0xb2b7df5162483b6b, 0xacbfe7c32b6f5f24, 0xa2b05c90c5e63ebf, 0x80f2196ebdaf2daf, - 0xde03651c3928368e, 0xa8fbfedb44516a45, 0x06e19d0c55914996, 0xfa268a310cfca9d4, 0xfe5804dd210143a4, - 0xf04568bcb0924e2e, 0x5e3f1d70a8a3e328, 0x8227d8e4bb834fd4, 0xd56b0aae2ca46e32, 0x9a3a52547d61e998, - 0x08e916cfde4c4349, 0x61b4b37a685d2bab, 0xbbd4c90a74cc4e16, 0x661d6da16080f3ca, 0x6294430754f39632, - 0x4e002b8d61985631, 0x407d83c80c5ffa1f, 0xbd0edd83d41945d0, 0xcdf1f7a5d26d5ee6, 0x2e4b538022b77219, - 0x1bf455f595a84a63, 0xa50a07ccfe2923af, 0xe594ebf04554a1fa, 0x32d117c478615e15, 0x075c75878ea72890, - 0xfc9734693c3218d7, 0xe80e6ade46c806f4, 0xa4a39d0f7a03bf07, 0x5b75cebb59f7c1ee, 0xa3b881fbfcec6f68, - 0x9f4ebb256dd4149f, 0xca2d56ac1cc06ce5, 0x094f64e998fafc6c, 0xbdb722f3d98758e4, 0x3b31dc01e5cc6486, - 0x043d775132405423, 0xcc622078535b2658, 0xcef094877c6c0560, 0x1c440902d0e1d236, 0x7819f00e0ce064ef, - 0x7e3f039d2b8c4ece, 0x4dd018847011345b, 0xdadfddfc1591c144, 0xf86e07fe0ce4f10b, 0xaf3678d8e9681bca, - 0xc3a1563a383aedc2, 0xa94af4631aa9bc7e, 0x8a10e9eb3b854732, 0xea4f984db3be1602, 0x87c2d3f84fe43b48, - 0x99260b78624ac73b, 0xad975076aa19689f, 0x8973c45606332b46, 0x8ff04eb16ada0ec8, 0x1c8840bb4e22241b, - 0xb94e660aa32e9150, 0xcc9e0f2e17e1fbac, 0xc64b68823744f4f2, 0x12cbe973e85ec6ce, 0xb58a8691bb509ab1, - 0x88eb68fc4a016d79, 0x9bb31782ea48da16, 0x6494980e9c7c11f3, 0x8bf5c0dcbac6be69, 0xdb76221667eea6ed, - 0x628a78107fcad036, 0x2f4583a005561409, 0x4389366472970ec6, 0xf21c42612ba0b777, 0xbefe5f68fdc4bf1a, - 0x273252ca54079fc1, 0xce9ce3c2c06a591c, 0xcb0da5ef7e26fe8f, 0x710fdda6f3d5bcbc, 0x477e67f60e788c5b, - 0x8514b48fcd74dac1, 0x0e94e26fa87001eb, 0xfa720ec258200c01, 0x5d8aa47bc768fd82, 0x6f277ed05e9cd891, - 0x40ac7b242b011e21, 0x4e5bd1fe484ec89a, 0x13ce68b1c24d0636, 0x84d3eeeee1eec9e9, 0x79e9c3f6ff5074bf, - 0x016c34d68265dfa4, 0x7b726d3f3ceac281, 0x44fb04f5db1441c9, 0x6e35b1bd8b55f760, 0x3ec299134033c921, - 0xc0039e14f88bf799, 0x13767ba1f822e407, 0x2a547fb05d29af76, 0x8a0023372ee8ed88, 0xecef5e98096969cf, - 0x46b5d3d17f490d8a, 0xa82788fee08ea277, 0x60da99621ce86b4a, 0x4dcad1603e83e03b, 0x38982a7a6142e974, - 0xf655c32fb7d01945, 0xd5b6f20311412e60, 0x60232872b511fc22, 0xbaa2d08bdce96bb9, 0xca54bec9ceb506d7, - 0xa800dbf8e33f49d5, 0x996f3393696d7786, 0x5fa9b9b4640c9564, 0x8cef9966b03d8ac8, 0x1fd28147b971650a, - 0xd17d2c92a015ee15, 0x35713757f2712e6d, 0x2156b9eb397d2d93, 0xf1578e2989b00792, 0x2d69d3142822575f, - 0xfbdbd87e173994cc, 0x383d91c2778a5032, 0x5a7f8e1acdef01e6, 0xc3265362a78398c4, 0xea894ce336a09b52, - 0x5822a04444072bd3, 0x88146fdec8f0ac9e, 0xd970ed8272f33dd9, 0x7dffe974f7949d09, 0x7b3d1f6fbd12cd98, - 0x357be9f73c5805e1, 0x3c06c6d8f37d721b, 0x8423190096fd942e, 0xf1d82c9613765bcb, 0xe3a6749750b0b899, - 0xd04daab96d19772e, 0xc49d87a93ac51b65, 0xa77356fe74f8ebe1, 0xd197437135a0ec2c, 0x2050ab9081bf8273, - 0xc04b7f522b7ddc3b, 0xecb64b5ca7848ee9, 0xfd4db4552c2c8c11, 0xe975b29042439a54, 0xbf3b637a754cb991, - 0x4ccd7c66053f3fef, 0xa7d50aae6f0a8b2e, 0x7b2b6797849c6569, 0xf125bb07d9fdd95e, 0x4e97878410c76a13, - 0x92ebe93d34e52d53, 0x3ced22c850cf0f54, 0x1c9b420aa835f985, 0x54b907d96663ed97, 0x63aa09095516b6e8, - 0x1e0222ee70e0093e, 0xdd50d4e9586d4d2d, 0x4c693e372494d9aa, 0x945b4796117478f0, 0x7fc8f78eac652862, - 0xe89a040834ca2d35, 0x17fe0dafbf4e4f53, 0x913e04ebd376d833, 0x7dc983536e81cfaa, 0xaebd0b0847e2c2ce, - 0x503a783f5da0d438, 0xd48e9b1039c10034, 0x57c82922a11c11d7, 0xc772a75a11356198, 0x3fd5522014384fd1, - 0x90d1ee857c515288, 0xaf996b95050295d3, 0xb2442a79430b37eb, 0x16613443b8fde7bb, 0x8482c42ef0c7ef8b, - 0xbf2fca6f842040e8, 0x96df17cffed53e7f, 0xd3febd3f4fff5517, 0x1189d2efd1babd88, 0xc1a3d5509d71a786, - 0xb8c89d8ee7988706, 0x61e1b0185c51783d, 0xbd64729397b5ace9, 0xa9935b8ed90ca494, 0x6c8e3a226a046299, - 0xbec8d87f8297677c, 0x73855460859a55fb, 0xa42150ba0b6ae200, 0x8a7b811cbc55f8eb, 0xda775310cf593abd, - 0x4a61d1300c2d0d71, 0x39ea5797a18f5c3e, 0xa24b21fb1fa74787, 0x987a1277822bc841, 0x391481088daf3002, - 0x8dd21d6c1982597a, 0x668fc31b78b560ba, 0x641ded92cd9e4f0b, 0x783e2f3897f8cb9c, 0x3bb3fb75764fcf4e, - 0xc99b3ff14e263d32, 0x6be2a8d18ba0e6d1, 0xcd3a1edd54f9eb11, 0x84561f71d3f00c26, 0x9e033d475c9ce8bc, - 0x8dc07e452c0477c7, 0xf0d419def12bca23, 0x69b72819b120e0f8, 0x2685cb10be74325f, 0x5f11d217056480f4, - 0x1fef032a30b13cec, 0x81bd2b72e19b423a, 0x55de72a1a8da1cb3, 0x5575cd905957ab15, 0x3a6dd9467896d582, - 0x0dba31079fb2ccd8, 0x10a31d59f4129c3a, 0x8ca2a894a1607222, 0x0da52da115ca6379, 0x144ba0a66ba88521, - 0x05515c3d622d5341, 0x326bac2cfacd53a7, 0x11748af78ddc20f3, 0xab8eee9a2bff51b5, 0x263390629efd9085, - 0x4211f14fcbf27a17, 0x5131180a468ee92a, 0x1c2745235214900f, 0x1a24366af5eac21f, 0x2f84650d48af2594, - 0x6988b941ca6c09a7, 0x156f3bc0d9511791, 0x3eb76aa1c9a188d3, 0xa39f758c93248b5a, 0xd93a3617ccf8a60b, - 0x70af9586edbaf01e, 0x116ca25fd8af7caf, 0xdf8dbe45d1ed3e18, 0xbb50e0a900535825, 0xc452858a375be44e, - 0x1428cc9f5d5568c4, 0x45d5a9fedf23842e, 0x02eace04e03d4cd7, 0xb0bfe02acc0c08ac, 0x022f549e09031539, - 0x35edcba00e1af6bc, 0x1f7631fe840649bf, 0x0d20f229ca51a753, 0xa73b105673ea06a3, 0x2c6c727c7aa8a788, - 0x69d94d124b78010c, 0x221fbad6aff6c8a2, 0xc9604622428319fc, 0xff7098a2d80be3e4, 0x272bec067570ac59, - 0x6db1626d7a80747f, 0x915ebfd05397c519, 0xde303239ff39cecc, 0xb4bf80348b7c14d6, 0x32dd6ba4bd1252cd, - 0xac1e66614dbc71a2, 0xbf4d705521bea92c, 0x32dcc5b5bdc3d3ee, 0xe6e1b67035bb8e79, 0xb19f062e7e99f723, - 0xcc430a055a141c5c, 0x0844ec5d0708aa49, 0x3132e876d6948dba, 0x0c070c8cbd8c6658, 0xd9b23b764f03dd7b, - 0xe1dab73c7bec38ba, 0x76b52cb5c988c1dd, 0x994d1b243b476093, 0x6234329c39b885b9, 0x24a3d36a38eac69b, - 0xd7144605f7f47703, 0xf7087ba914e6ca38, 0x06f857d143b98a38, 0x52ce16426259799b, 0x08d3e57ff12f7f0d, - 0x10b797f2bbd9badb, 0x10fe6ee1724259a7, 0xb88cd0854862e79f, 0x7a3843079ccf73b2, 0x37ce54dfa5f0e171, - 0x142e8a161eb3b9b0, 0x2fc7e0de22ef8eaf, 0x3f10a18bf15e9153, 0xa99a2edb455c29fc, 0x32052ae50a498343, - 0xef71e116c4d3a6b3, 0x75d8f7e87da26a09, 0x617472b9e276d102, 0x5dba8f11a77f8102, 0xe023b70a751eeeae, - 0xbed8f0959e1c945e, 0x07d492acfcc40105, 0x5ef94ee2549e640a, 0xbdd88163d51d643f, 0xc41c1669b088a012, - 0xf95d19bbea456436, 0xe1bb98a9e33075cb, 0x3efce11f092dce03, 0xffbbc751dbbeb163, 0xf61d3b695ff3bfff, - 0xe0947ff2bfbec7e6, 0x5dfeb71b3b7bb17b, 0x983a9711fd1b78ce, 0x6bdff9ec5b9eface, 0x038c4402df9f11ca, - 0x8817de46796c42ad, 0xe9540a348c100609, 0xe5761e7c772aa32d, 0x6b58e5742b32ad53, 0xa3701642040d5135, - 0xb33ed1a62c26ac99, 0xa778e558d47e8080, 0x672a72447a9094a9, 0x8c3710dc531cf4a9, 0x1c55a1c0cc101610, - 0x621e47018ba2d083, 0x5e3ab0d4c6ee0380, 0x876311f9fa531d10, 0x45ab59265ce732fa, 0x5e8cbc32e13f9783, - 0xd8fde387324dc91e, 0x16c6ab57c8f6c3bb, 0xdae9e1e671eef3e2, 0x64f7f3dee9ded121, 0xcdd629def6c60ca9, - 0xfc6d046bd31f5b9f, 0xf6f6772e364fba7b, 0xef37b7bb600e1fa0, 0xa3ded93bd9ddee1e, 0x9d7cc59cd254f2b4, - 0x32cb4f0824aaf7f9, 0x74fb6867f7e270ff, 0xf462fb0891b23ed0, 0xc8cd0b14a9cbc72c, 0x4472812e0f28463b, - 0x29738d7dd83be13e, 0x0a12496b5122bfd0, 0x3e0bdf14500ad14a, 0xc3eb31b42dcfcf4c, 0x44f42abe4c39666d, - 0x24a20084099042f3, 0x83a743ae82ebf738, 0x89aba80244a8ea45, 0xa3999c0cc88abd4e, 0xe535dc45a7591aad, - 0x81d7e6705a163b43, 0x22d80666cbce3bf0, 0x7a508d46c940e462, 0x4da0d159d9cfcf76, 0x5e70ec0956944f1e, - 0x8089700685867e65, 0x00bcf51ebad1b837, 0x3886662285127856, 0xcebb3a518edd269e, 0x4100d9308458a9af, - 0x41b706c2e852b053, 0x5edba819db176b2e, 0xac59dedf3cfcf069, 0xf3c32e4f0ba6d374, 0xafa60736e4fd0876, - 0x8b6dbcec098509a6, 0xb80b6d933a81b395, 0x909ed85197b2e57c, 0x971481232835afc4, 0xdfe8a8fb1077f0b7, - 0xd17ee4bfad36d17b, 0x05bf10249c1fde89, 0xddc7d8e9faee43ec, 0x7c0bb11ac423da31, 0xc473f12490e75e63, - 0x891aae12dc922705, 0x4484608438d2f60d, 0xa0873186d2419128, 0x0ee0022275fddcca, 0x7b1fc872700f6a2f, - 0x76126f9d828ddaf1, 0x234d30463c552d8f, 0x0799b0d15601eb35, 0xb00e5f14246edbd6, 0xe9efdc1692e92d73, - 0xca212b0cbdb44d1f, 0xa1f8c00be6f85828, 0x233219fac2d55af1, 0xb2a47c532f1b7dda, 0xea56766457c1d1a7, - 0x5a493ccb9123c21a, 0xd3888286233d504f, 0x0018348114f35874, 0x7611169af578f446, 0x3cc22969c3184a4e, - 0x4b3a32063e441d51, 0x039ed588e0353727, 0xfe4aee7e8a2dab3f, 0x1efa9b144fee4b14, 0xdfe8f01b74b2a3cd, - 0x4fea3c820dd8e394, 0xb10ed1baa1722106, 0x84481af488df0fda, 0x84a14e3e4c11e001, 0x0adc9124a79d4bd6, - 0x972b2d0439f00a3e, 0xa6c32413dc0292f9, 0xf9745daa53e95dac, 0xc051f56903c68e67, 0x23b1f234038a7630, - 0x71ca6fe88915355b, 0x08af6d3c8f21b555, 0x010ec73126de5d79, 0x0f75f87b6b515ba2, 0x121c57c745456c49, - 0x0c5a772ef36a089c, 0xe70b5a62155e5429, 0x6c6bb77f2da4aaaa, 0xb35f58c096ae245d, 0xfd9c30d9864794e7, - 0xb94f88e035ba8ce0, 0x3bd87eba8f7167b0, 0x4b2f0eed405bd48f, 0xe0424fba1d9cf7e3, 0x47bc0288ab72f014, - 0x1c112d92c7d9cbf9, 0x90b1a3d16319be06, 0x003a82ce2682b248, 0x7595fd421c55d92f, 0x02c7c1674243f0e3, - 0x9aaa382caf888c2c, 0x86413549d4ead4db, 0x28ab929f9f4f63bc, 0xead4745262d9ed32, 0x6442fac1aa9f7200, - 0x0f7b6c7c283ec5d3, 0x47f4031a345a5549, 0x1b4223e7c80430c7, 0xc28666ef1178308e, 0xc313487786c22be6, - 0x00995e9ce8926b90, 0x7e0b073e14719782, 0x47535651fc6e049e, 0xa04b9c76c466bba1, 0xb3141aca82a6ce72, - 0xfb07dc6328c8b4ae, 0x3775493bd7285c2e, 0x4c635385333da5b9, 0x9ee086020bff3f84, 0x52e23170bae29933, - 0xfcdad3bf1ec52f61, 0x5c68b62489ff1351, 0x85a3ecae000f01d9, 0xf33f429a743300a0, 0x26d27e56d99d2253, - 0x293310ae44ee78b2, 0x5a86d39b6adda8b0, 0xaf4ffc24538a505f, 0xd7c9a7d3ec8d4053, 0x79efc7953f1013c7, - 0x0db5cc2dbe4cf739, 0xa8110f782a4d8ec4, 0x6e377b8b0f0d8289, 0x0fdfb96babb813b4, 0xe1361a2d651324d2, - 0x5a97af94a3987c81, 0x5c3e015efe342a8b, 0x07c51bea29f1f20e, 0x54f42a715925eefb, 0x57a94a7cab124fc8, - 0xbdb1acd8f08c5953, 0x47cb4d587fe1e7c4, 0xcc2c048bfea71de8, 0xf4c4dc269e72b873, 0x62784c89f5808686, - 0x14755eaac8f876bd, 0x15851eb72fe84bfa, 0xd0e135188f3e63f1, 0x296143dffcc84726, 0xca7be6711aa9cb57, - 0x7d4175a37ecb1cdd, 0x2d65a90f992741a0, 0x1cf153851597c050, 0x86fc2d73145c9423, 0x7f93c6e5a3970ce4, - 0x63ae96038204a453, 0x6e94db7030844890, 0x8148a74b05930041, 0xa74a7b8aec5f25cb, 0x6dfafbafe41d4a2e, - 0x7008ee86ff62fc67, 0x0338f90eb5125e60, 0x0fae023fa610f859, 0x466186a1fc554cca, 0xf274cadba9243c61, - 0x9e4b59c2eb16e888, 0xacd8e45f99716786, 0x572f9b6ecf49d9b5, 0x3326a1047c548127, 0xd853f6b9ddcc144e, - 0xc3969b470b0a5920, 0x339dd360cf9ad4e5, 0xb752e58d78bc85fe, 0x40d9d0632a58279e, 0x7a828a2b8afb383e, - 0xc9378ef94bbcdd35, 0x451c65f3be82784b, 0xc8aaa25db436103e, 0x832c5ed2cb0a4eb3, 0xe57552a4c0a9d694, - 0x86f316a9c14c0fc6, 0xb5cfac1b19268858, 0x8b1c7ea62b748035, 0x63a7a8d8e1e6694b, 0xe13f5604a67ceb32, - 0x0793eadc24e980e4, 0x2a18073b839b0bac, 0x9e8c1247ad88f778, 0x95d14bec08cc52e9, 0x793c1ea7558a38f8, - 0x08961841456afcff, 0x847a55ef2664b111, 0x98d773ad027d69c6, 0xfb96527683aae4bd, 0x401bb3cfe535c93e, - 0x4babcb82a1aed4db, 0x28f92d5415d7dec2, 0x87922e2a89dc862e, 0xbf2219705d7160fc, 0x5c5369bad946a3a1, - 0x18754b575d1549cd, 0xe612f5d555c1b24b, 0xcbb22f1d716e4b4c, 0x6f97024260346b7a, 0x382849d3a2339a26, - 0x43ed008f11c40992, 0x0938a8a3e776fd4e, 0x7379a54d6fbac375, 0xdf5d6e349dbe87fb, 0xc0cd25e74ae422a7, - 0x8d2222c8d04bae8b, 0xe4800a3d61dc2786, 0x40d2204b6f5bd068, 0x90f3977c464c6e0b, 0x97e245452ea12426, - 0xf1ca31ce37e28734, 0x5649160f9bb2f825, 0x5d2af5b6a27f8a0c, 0xc9dc7148e31ff229, 0x0ac9d9e9d932fea5, - 0xcb7ec0e302f4f689, 0x08deac78137c8552, 0xbab45bde94256809, 0xda3c0384abec9774, 0xfe21e8f0270bb1fd, - 0x31cd5c33d05abfa7, 0x796e6ec099af697e, 0x9c1db0fd51c0e0a5, 0xa4ea2586854bd397, 0x0cd76cb376bb30b5, - 0xb04d8b7caab8ce81, 0x659482a8607ee5d9, 0x5c49def6d44b566c, 0x2771e81553ebc725, 0xd011596271a36be4, - 0xe138209edef8a99e, 0x72d57ea208fae2fd, 0xce1a655614cf62a7, 0x408c99463818f1a4, 0x08df72db900ea872, - 0xdac0b697b3fb1752, 0x96a65256a65296df, 0x0a87332b5528018c, 0x334b6e13aef8cfee, 0x18b187333b2b250e, - 0x54a2d98f29b9af92, 0xf5364ba95748c51f, 0x4889f6206dfce534, 0x11ffb5d1b2ebcb89, 0x741b286426f65033, - 0x43214ba29010eec5, 0x49e90bd871e6c1f5, 0x91dac95e4177c2f1, 0x539f9fd52fccb08e, 0x11ca92bed1236347, - 0x9557642026aaf23a, 0x4dc43515aa3b8a92, 0x4d95a1ac52da3c2b, 0xc92aa572ed1ea5fe, 0xd84ed1314b459fbc, - 0x1decabb780a4833f, 0x38e2293c448fb83d, 0xa129e69bd3c635e5, 0x3eb262dee33db027, 0x9f6fcee37024df0c, - 0x50a654bc8fd38756, 0xd4059e109b21ee40, 0x8dc41a26199a4ee1, 0x14cef3941f5cd123, 0xf03895f03b9978b9, - 0xc7fac4b99fe0afb6, 0xff4e13a20a64ae78, 0x9dc3bddacf69a970, 0xd67ca74a0e1bf7da, 0x029a81a3ab6d14ef, - 0x8bb19fe09e131e81, 0xc6d16913c7100a99, 0x28d28da710941234, 0xdb6ae77e02f36853, 0xe08cabb45d9f4854, - 0x90a6afae9c2f5fc0, 0xb07188a20bd3385d, 0x09efc2a8265f4f26, 0x93cc957c3e79de1d, 0xc21d057ecec3e157, - 0x380ae0468f49f88d, 0x12860415543d78f7, 0xccc68bbc6c2d9c07, 0x737904db16eef610, 0x33da1e064839c121, - 0x913a9c47d0778c8c, 0x7af120115ea51295, 0x3c5cbce247c3c5c3, 0x4462c1fc591422d2, 0x7aa18c3c6d53ef76, - 0xe4aae0526aa32992, 0x10a8e9ad714a0f31, 0x509001fe014159ae, 0xd5a08f4b3ad3d9f2, 0x1213503c28a80c55, - 0x15f7c6df89ce81f5, 0x7ba648228264931e, 0x967f3c3fc352a88d, 0x65fdcb2145ebbf61, 0x33b955baa9c485ff, - 0x923c237491581350, 0xcbfe66473b11511a, 0xa304ef528a4c19b7, 0x314aa83ea57c555e, 0xb3b214e007ce7f9b, - 0xb7305083bec18f77, 0x942ef232c2952b41, 0x5ea47478a1a4525f, 0x2aa232953260882e, 0xbffe5c97dd68f4b7, - 0x7b441dc58bf6d9f9, 0xe46faff0da5de023, 0xde8146d4824be1d5, 0xed71500a96c04f88, 0x3dff910453208b88, - 0x25f650a4e6540fd6, 0xaabb7a99e5249968, 0x86c6f13289fc0926, 0x267f511803fa4ae2, 0x9ecd49d53218a6de, - 0x57e588c65fbf41cb, 0xa3a32fd209453ea8, 0x00e5e3b42952be2a, 0xb12874fdbf2f56d8, 0xa3186739b71276d8, - 0xb68a0b489510a6a2, 0x6abbd16c55a1316b, 0x36d9af5ec7957460, 0x68056f839b0be686, 0xeea7d023e8c7c183, - 0x3f3c211461655a26, 0xebb0763ff0fde10e, 0x834d26f56a2cdcd4, 0xe54032f98b9546b3, 0xfe068ed7b34ba080, - 0x0e7529bb886a9f77, 0x616cdededcbfd8fc, 0x6def54d8eda39af7, 0x8047d45c30d84cae, 0xf066944d2f449251, - 0x2cb64ca39aa970b7, 0xd25903f6ac754f54, 0xc37185b2bd1a6232, 0x5cececee77372ff6, 0xf70e119b86ece738, - 0xba653ac0ca1070b7, 0x3263d2e9c5a98b4b, 0x7546f9340a7f6314, 0x9ec21de3dec6e36f, 0xee020c555631c253, - 0xb59d2d922d308dea, 0x7c8942547f3c3ad9, 0xfb7674d89d85ec5c, 0xbe856ec048e3fbef, 0xa15b76c0b0dbe8b6, - 0xd28b5309ddf63c98, 0x370f654991602187, 0xee646426dace2ca4, 0xe24c019a1c8427fd, 0x21c7a27b527f9f65, - 0x091fd9229eb513e5, 0xa24beb883fd6eb8a, 0xb6c5505c9481ed0a, 0xc609296e980b6899, 0x885ef47a3764bddb, - 0x699b361cad55fc37, 0x2032e08b38780c96, 0x7f8bf7e6f1e03c12, 0x6c55739ad0d3f2af, 0x60ed928417bf3266, - 0xbe570de5a983a732, 0x12d984bc89087b1d, 0xacc330d8962f71cd, 0xd6f7c8ccac0be34a, 0xfc8cc2e6e945326b, - 0xdba5bad10d5c4b71, 0xb9a03038f78ceee9, 0xb1af199db55f8b9b, 0x4af410911efd4f37, 0x5b9fd9ec0e2e5cc3, - 0x76706b5be1e196f0, 0x52a070d33df60d79, 0x4b44c51411c717ca, 0x2faaa0efc4671a51, 0x573b6423da953d13, - 0xa4438599136b43d1, 0x927ea9a07070d331, 0xcb75af5c6d064e5e, 0xa8d6d989d49d2509, 0x9d1e5226ac8a52bf, - 0x6462834cbfce306b, 0xc4f958e4367ad59a, 0xbc80eb970c92a52f, 0x4d824b78b02f73fe, 0xd79745f95cc07715, - 0x749f8816af775b7e, 0xa496df85125b8dc0, 0xaaec37b87e7c7518, 0xa5f4d21675911fa8, 0xa288a28727f2e4c2, - 0x30705457bab76cb3, 0x0a2b5fb5a400a6cb, 0x19d40ac5ed913098, 0x1b13a63b2b02ff49, 0x4ae1f7877063bb2e, - 0xfd8f5df97f28f0be, 0x0ac48fdb36b277fa, 0xa3afd7e4c623a098, 0x7ad92687520a2a08, 0xd4e471f577e0b4ea, - 0xfe0c98b27389cbbf, 0x0f2b5d36bf79e1c5, 0x61f35881ba63245d, 0xb52dcaca4dafa932, 0x15717faab5a93985, - 0x806c3cc26cd7f0ff, 0x93f955f7e60b2758, 0xcac778ed2b7fc15e, 0xa248465a31a0cbfb, 0x84b86d49a4abebe0, - 0xfdbf1983fcc162c9, 0xae15b1f42f3d6733, 0x5e379bb0f6fbb6fc, 0xe5f8ba6c92ee5174, 0x1fe91284ad502f66, - 0xbd415a5544c7b36a, 0x743621eacb7806bb, 0x91f6b652da13795c, 0x337a81f9c6f23a02, 0x76e61fa5e84bbaa3, - 0x3d89d409b8c1070d, 0x4ac61ac93765e124, 0x8237cb8205d320a8, 0x91ee7d4b35a8b651, 0x59828578559302e5, - 0x4f26b883c9e0628e, 0xb4b3542156e87589, 0x29bed67922d8084c, 0x7f22ddf0a0072bec, 0x54c7aa2f42a08859, - 0x3f712e3d173e559b, 0xb1156bdbb1dcaaee, 0x20fd904f57ee4dd4, 0x849e54620a84068a, 0x9f43d54f9e5268a7, - 0x80c3edc2e7034e01, 0x14746de8be1be27c, 0xa5c2e763a7a0b8bb, 0x46088ff90c209688, 0x09fb31e1272a53da, - 0x89337e20e8ba2038, 0x1c4388e7f7435e03, 0xd08c0ab070230e49, 0xf2861c6ef887f887, 0x1ed0c25571849d66, - 0x47b32da804a03baf, 0x56ee6c51e342ee52, 0xf8a1f498641314be, 0x2dd9c0e717b8d585, 0x4ee1be89ddf000c1, - 0x83456008ab960272, 0xaa9ec06baeb6807c, 0x461bb61560aa91e9, 0xa9a0e3f148968018, 0x2b7a3982e791440f, - 0x092aba1bf01938e3, 0xfd9fb44fe119adf7, 0x71e1df46af219a5e, 0xe98232753863eb27, 0x3848dfa02e372738, - 0x2290b7a49236c83d, 0x5684785657634e18, 0x52ed2c15856c7353, 0x51d558e4c9c7db15, 0x946216df9304ae1d, - 0xe3094b15834d00eb, 0xa839c9e4f124d1bb, 0xa93eb1109d253e69, 0x88ac99cfe24abd04, 0x4ce42b19a84ab2ee, - 0x6fe6da51cf50050a, 0x2475d74e24101c26, 0x4554d377eff0bebf, 0x7c5a80c7bb37f5be, 0x80b2943cd193016d, - 0x83947e6407f6a2f9, 0x807653bd9266a681, 0x97afbc212b272aeb, 0x0080868053f348b0, 0x5df22cc5a5d24926, - 0x9a14f7d3c8d6c50d, 0x14ae2bc7b42e50fa, 0xda447e5417bd33b3, 0xae645aa1a127a68b, 0x99a256cd20753d41, - 0x3e7ca1beb84f7ad8, 0x432e0ed039936ad1, 0xe29841fa69554f5d, 0x85e889489fdbd1ad, 0x5c709c76798fd4ac, - 0x7711cef5ef77479d, 0xd09d7e7bbda9e0b0, 0x994e555ab6df5e84, 0x9b0609ac188565c9, 0x2bf915ac3358bdb2, - 0x985dcad45581e5a8, 0x4501af3561ea503e, 0xf596762047a01eea, 0xd32ec53095aada76, 0x7f592200479743b6, - 0xdd0898a84c8c4645, 0xa799a87379eae143, 0x1d66ca62e63f6a50, 0x5aaf55f3e201f81f, 0x76a0d7ffcce6458a, - 0x8a9e36b31966172f, 0x402952a485423251, 0x1d26a8b8d1c93a30, 0xbc7b70dcfdea1201, 0xe88def0c714cd889, - 0x2f42bad994f7ed5b, 0x76cbcbcdb5950d17, 0xce75c986bbbcd26a, 0xac995b55fc86a32e, 0xb8d26ad675c1b7ad, - 0xa59629b889164983, 0x2383a6240ba2d58d, 0x46bd3a5f4917b86a, 0x757e6579b9b5622a, 0x1dd86084e80a5a1e, - 0x93cb09685239e908, 0xd90315c85d46e962, 0x94170de9fe68a3e9, 0xfce1575a4b6ba897, 0x8b9d81e71b7761ac, - 0xa58caef8cb6e37ea, 0x02946ae7588c43e4, 0x290d8eca3cb52b4a, 0x014fe5a15f9307f3, 0x9978f4c5ce5e6bc1, - 0xf1825ec3654d9a95, 0xb1d2a00c2b46a86c, 0x4b2133ddd858c673, 0x23f309dc77741909, 0x8bc21e55e92cb55a, - 0xedd59556e6014f39, 0xa0a7d44591c6d2da, 0x12779673499b7244, 0xe3d2c6ef6a93d46b, 0x544d3b9ce9f62552, - 0xb5a283bba92f2dbf, 0xa53980282bc356e3, 0x59510a6a84390dc0, 0x243310cae9c8b6b0, 0xda68ad12a08e94fb, - 0x61cd275214cf2bd3, 0xd3d276ab10e7304c, 0x6e988806f726f8d9, 0x7abb13dcd16719de, 0x6dc9d04888d5b100, - 0xf3b4fbef4aa5b181, 0xc08b38faab883fc9, 0xc6460ab9772ea9be, 0x7b8737ccf18f85f7, 0x1bc627b04686fbcb, - 0x477ada9c30274c2e, 0x0aab14ac37dec063, 0x6e40256d9ef1395e, 0xab3211ad79c06880, 0xe2508a07bad5046c, - 0xa4eb555823e71385, 0x69eb41d17b7ee695, 0x07a032a79e7ed8e2, 0x08ec386111e9131b, 0xe010eb9fe01ebfaa, - 0x968178a79b436115, 0xc7c76c8af898225a, 0x0ca2f7b5016f2521, 0x2c64236a3ae9e292, 0xb886bbad5c84b78b, - 0x9f1e1dd45d38bc35, 0x9757971a6b2d15c5, 0xb8e12ed59bad66ab, 0x058a54694d171e67, 0xcdd66a0b8e682aad, - 0xe536dfa236c86155, 0x252d0109abcbadb7, 0x6f9761201069147a, 0x9ec5476bac2b6f15, 0x47a7dc9dcf9c4f4f, - 0xec7f86d948f25aca, 0x9171ebedc298542d, 0xd6a6104361ba3409, 0x64fea3dbae1f615a, 0x3e455085889e9ad5, - 0xb958f741827b31a4, 0xb2188b50bb56480f, 0x75d507e7ddfc1bf3, 0x2ac408f5affc8115, 0x3056d4a682be9dc8, - 0xc1156a209cd45df5, 0x0e4e72218e6f50bf, 0x00661879e95aa2b5, 0x92e9890dbace221f, 0xb083070081832d01, - 0x0f9593a7fa7c6343, 0xba632222975d1139, 0x3805269531420221, 0x3ca1e3b9e0fa9133, 0xc6ab199e4bacbd25, - 0x1e720bd1a2edb998, 0xa0656c6eb20c1f24, 0xd5f084ec003772b8, 0x0b519343749d0377, 0x28a31b8a16b353a4, - 0xc23615cf483811ed, 0xcb601aeaedec8d46, 0x73b5939e81cd6155, 0xb6830df27484bd5c, 0x2434d69acf9560ae, - 0xb1b6ba440b1f5e78, 0x32bdb94ae92b2d66, 0x075554e3bd4cd783, 0xf726e7379696ea54, 0x04fe94d99a4b752c, - 0xdc975ad42d2dd519, 0x82d5d672bdbeca6d, 0xade6ea602501e6ff, 0xa81b0701c456e04a, 0xa5450d1fb14c1cbc, - 0x6db6225d0835b9cf, 0x73125ddf4bcf5696, 0x70a4a3cb7bf8b94c, 0x3f71750f3f57f0c4, 0x3b05044420e7a978, - 0x766a1968b5b65917, 0x2fae230ddacbab4c, 0x51804546d6eac9ae, 0x1d417646c7aac697, 0x2d2543dbc2edf313, - 0x87b101bb55dcab3a, 0x6f3e1af647d3fe68, 0xd91fe08cba2dc905, 0xa92319d34cf629e7, 0xc7c19e320bf81c53, - 0x7ab70ca7b7ecdc65, 0x2acb8072a9bbfa26, 0x3b5a8b4dee7c263d, 0x0df1c956b3b2bce2, 0xb096ec6a18d1d17e, - 0x71a9b9b6b4b6f216, 0xb21b226de9f8c053, 0xd556300fffcb94b5, 0x8a0aa826f2af7afc, 0x1a71672f83eb2d78, - 0xb8ddb49aea6a846c, 0x56cb223dec9abd8d, 0x95a5f5debcbb54e5, 0x37c965773df861c0, 0xcea2bfa83bfc67d5, - 0xa45a1b90318bea62, 0xef67b72695b08055, 0x83daffca2602aee9, 0x44a0673a11eb8200, 0x9030d8ac7b405e5e, - 0x8a5034cf1e34c961, 0x411209f92d481271, 0x3c67ec0c72c35fa5, 0x21cc577b604b1db0, 0xcc782e7cfe773c07, - 0x2eeb36961bab6009, 0xcda5355c40de5812, 0xd9ff0affc579abcb, 0x6bd80e5bf00947de, 0x8aae8a9acf21d706, - 0x5ba9afa110584adb, 0xaad86aad2d2fadac, 0xbd5d85a3d2c005a6, 0x0267b93aefcd0fe7, 0xc7f39951bfe141cf, - 0xe9395fc640228c8b, 0xb626548b1d5c1fc3, 0xe0f14ca73b50fb74, 0x5da3651e9cc9d4d4, 0x1280fa311f176437, - 0x35fae6c382ec9646, 0xe97c5490bda4d13c, 0x3fb4b27152ca1263, 0x5628d0d7e1842055, 0xa1538b38416d47a0, - 0x62fa05362702de09, 0x1fa1f6d6c0d15158, 0xda977844ca4f9553, 0x52fbd0ca4bdaefed, 0x2f8e9fddfe6825ed, - 0xf5db4791f9dc7a44, 0xc29701bcf313d9f8, 0xa7817ab52103c021, 0xa68103e67dd26107, 0x65ceafb2c254c65f, - 0x83896b29fdc52567, 0x1541e94a38f3e0cd, 0x2fe96289801cc6da, 0x90b0c7e5ae3f81cc, 0x4ade9eb8b4990d36, - 0x43c70421ed086d9e, 0x7859f60eb421c22f, 0x5957e320b698438e, 0xf4efb054e722aeb6, 0x0e7c8b1841956127, - 0x555fcafbb00825f2, 0x4dac59789166d419, 0xc881368673b3c9a4, 0x8ce61b2bf4bc7894, 0x1bb3baefa2a27c0a, - 0x9f4d812888490a91, 0x51068f22acbf2804, 0x1da4f6cc25ace63b, 0x60f988cb4bb310bb, 0x75d06be653a040b5, - 0xc85a01e8cdb18b89, 0x4afb40f5d7dad6ee, 0xfba393dd8b4f87fb, 0x479b3be229156913, 0x1765e52b6ad4155e, - 0xded2946addbd1701, 0x019062e73325db85, 0x380aac4dd7843bf5, 0xf8573e3491a16fab, 0x94c4b2dd0d2f87d0, - 0x7c5369e91a4b0225, 0xfc5e33fe80e41526, 0xa20990fb9e8a4599, 0xf7193445a47badf2, 0x8955b3e1216c0af9, - 0x98e1debd298405c1, 0x80a9762cc02f0997, 0xda1711061b699749, 0x0a6f98892b94e6d5, 0x55f819293d0ffb24, - 0x292db9785b83986b, 0x362835dde256da26, 0xaa3d1da1c034966d, 0x2adbd0b43f812ca6, 0x650d6ebde8bda19f, - 0xecc002d2b607a881, 0x297704a3a0122764, 0x4b6ce7a8f2f2108f, 0x64732c7eccaa0f34, 0x5b33aa587813527c, - 0x7f52aab0295a577d, 0x60effd7c45d356c2, 0x15f9b56d54e3ebff, 0x8899a4cba9e9135e, 0x898189a9001e269c, - 0x8111909f3e6e237a, 0x5c95eeeeca040a9a, 0x042d3e6804918042, 0x174300e140d91160, 0x6fe6025077d8e5f1, - 0x093fac24b1bec7a3, 0x321daa4217832013, 0xc53ec313021e7963, 0xc1736e53f1a6893a, 0x9dabe8f637b9d0f6, - 0x2ab0bdb22c8b55d1, 0x95fea173730c5b81, 0x0ddde089aa4ba3a5, 0x5da0a33cd4ac06c9, 0x156067a6e7aaa23f, - 0xbc9c446fd92a2fdb, 0x38c0e586141ec3ea, 0x411fee4a9cb1f3a4, 0x6bf2103207616a71, 0xf32413ab5ce57358, - 0x1fbb376dd80142f6, 0x69ceb52981954eb6, 0x729f22360990e0c2, 0xa77e827e6d4b7a66, 0x5385de46fd12fb22, - 0xfd123b23fdc20a60, 0x9322b1fe504b9511, 0x344cb4038614f19a, 0xd5eff4aa02178948, 0xb5267e42c50b962f, - 0x6be2581fa9f02bf5, 0xf52a2e6410e83bc8, 0xc7dfaa836ff1ea39, 0x07f065ccacebbaf0, 0x7d59bf4de1854bea, - 0x044c8534b879ee51, 0x0410202bb2a414f0, 0xae0d5951c08618c0, 0xea19599cf40664fb, 0x138079ce00543910, - 0xbafb316d2ea23859, 0xd66501408b3825d2, 0x92be1906700c06ea, 0xded36504dee4e8e1, 0x0db4319e38f79e04, - 0x2b0714df82900d2b, 0x9545164a96618ba0, 0x1498cc4339162a0b, 0x59f896514dc18cb5, 0x817da41e081ae51e, - 0x08d246d1fba08feb, 0xc2f2bee3c0e76786, 0xfc0959afd5cd242e, 0xa10e41a284e15574, 0x415717c27257dfa2, - 0x1c47f51f09626413, 0x9d22512859ac468c, 0xd3950e0ea5d21448, 0xb6e795ca12a0eb1c, 0xd5f6904866c695fc, - 0x11fcc7592224a0e4, 0xc8541fdaa8a4aec3, 0x592b88efcbb08b25, 0xfcce5fe1175c2a55, 0xffb818c0bfc8e355, - 0x418b34f113ab6c94, 0x0a5748d96d9d7c43, 0x696eb62277648592, 0x78cfd60575e16ac6, 0xb5164c03d81b8279, - 0x4969926fb1909a0e, 0xd71b40a7e22a0dc2, 0x9a8c90887f75da57, 0xe80700a202da11c0, 0xe15341c96f818b90, - 0xf433dd9e6ec7841f, 0x5c46902f5d697631, 0x116f88b11920f76e, 0xd0541d26700c2000, 0x651b8e32a32cd13c, - 0x5c4975dc79586048, 0x690ebf246a058fc5, 0x50bca16ac8defa09, 0x5e6e329175c505b8, 0x3b7006ee22d77265, - 0x4cce232c3e421db8, 0x0e414b0f405e0643, 0x9472f7899b6dc335, 0x55566b0f850ccecd, 0xf9ed483e7d86a8c5, - 0x96a8eb0968e85922, 0xf9535acbe03baf1d, 0xbf86f41b280ec5ac, 0x06fc6a05c9c750eb, 0xe243c604575ed5d3, - 0x8891a5a11e274958, 0xf044f64451e28708, 0x2e290095de535fdd, 0xa7edfdbded5fdb72, 0xb777363ffd2613bc, - 0xf1834cdbd9da9769, 0xfa8a907370847717, 0x2e3e1db7856480ad, 0x5c26ede0490399c8, 0xdbbf4c3ec2050299, - 0x4c1a31957c807499, 0x4c82992efda9ab0a, 0x8f5395b87bd8d56d, 0x00c5a611bce0a25b, 0x81b1cb34f3e5e3ee, - 0xee7e5b3ac53bc747, 0x784d61f784819651, 0x7b086c952c009719, 0x02749525a0945902, 0x4e9525fb9679b277, - 0x44deebeefed6bd38, 0xd83dfc04cc5a9292, 0x9305e9d7ddafb25f, 0x252d71d2f1c9eee9, 0x29a709918913096c, - 0x21343974f8699787, 0x1122d539991351bb, 0x7c89c852b13f0e45, 0xa64a55dfc7081477, 0x8157f1bf00625c9f, - 0xa2272564e2c7bd1d, 0x1a061207419fc6b7, 0x89d77028014232a8, 0x62ebe80433e25d62, 0x0b4660d19393234c, - 0x045b75cb0e60ddfb, 0x86a28014145a764e, 0xb74f8ef63144c164, 0xcacefb4ffbfb48c3, 0xf3fb17db1f11ac0e, - 0x454df04c1567f5cb, 0xaf1705e5eefdcb9b, 0x209d2e7dbabb8f38, 0x88e882a34002dfb2, 0xbcceffb475b047f9, - 0xe34b58d419c45d7c, 0x7268690074b4fd09, 0xd8bdc20907a8e5af, 0x8b3d4c0127508047, 0x91c434c8694c835b, - 0xfb9f30e6cbe11843, 0xde3b3ca6cc20c49d, 0x60f486888c4021ba, 0x035fe4506a3bf8be, 0x40cc46c2591f4922, - 0xf613278b04594452, 0x34a54882e6644953, 0x942c098a93c512a2, 0x54b182764e8e4012, 0x88ee058a90cd61aa, - 0x456398ebcdc3bd83, 0xcd2e424d4a48b6d2, 0x8e44a89653d85886, 0x282d9e4a90809aaa, 0xd46441c55d746055, - 0xcbf5b78751f1afa2, 0xaac22b889c28ad06, 0x10de4b26ca3b161e, 0x5e7538fbfdfef785, 0xf379586afe3ffd1b, - 0x1f95df6be6f34d75, 0xd1ec961fd9ae09a9, 0x1d4fd02a67413861, 0x8a971ee445dfd872, 0x8b958f096c79fd12, - 0xbd11435e8fb7b895, 0x08bf57711c8a612e, 0x787ec633077765bc, 0x68a20e0a74777990, 0xa6a3f6e2e2fd3dce, - 0xd32ddc5abe5e6cac, 0xadad2d3e0cd2db61, 0xb913b93af49908c0, 0x256fa01d9e02beb0, 0xda9e954f226a7cd6, - 0x3ae77d0101f3e837, 0xa52c8914de83e9e1, 0x23642c9dd3239443, 0x0f06e4c5df6b8bd7, 0x4eb954564f624020, - 0x40745e617346ab71, 0x006d07c28ea8379e, 0x2b6743c73b679745, 0x213479efe00a899d, 0x77f15f51f8fbfdfc, - 0xebc55a4ac69061b5, 0x139d0dcf5daf4d57, 0x70e55a833b400717, 0x77f896341e61c093, 0xb024810f9d32c402, - 0x04bdc3f697cb8050, 0x8b6b1ab8db849027, 0xb805c333e344e6fc, 0x7a220cc948378215, 0xe6f1650c23b8aeac, - 0x3239f16aa79f3f98, 0x13ed4f36d6acd7eb, 0x8bc91d16a2694a04, 0xf59b1147479c02c5, 0xf3c84a32be805fee, - 0x1796f7102047da5e, 0xb29f52f4d3df10bf, 0xcc070968e6eb32c2, 0xe5dd5bf3cd977ecd, 0x274cdb24f7e132e8, - 0x541a5d499d4adcca, 0x35279339a69649bd, 0xc2d6f4debb0d868f, 0xd9b42f39b829ed94, 0xe48f6c4afa08d7ed, - 0x6c6320e771eceb30, 0x62994c8e8ac97c67, 0x2a9b36c81dbf07fe, 0x49f9168ee081f231, 0x070c1627d8c5e988, - 0x82b85e9b64b33c74, 0x920cd96c61415e9d, 0x352977015e810df0, 0xd28c55aa170de1ae, 0x646606becbd73109, - 0xdedbd90c344db63d, 0xdc4ad5974668afa7, 0xa7dbcb21458bd553, 0xfb703af0b0bda32a, 0x5d79389064638cea, - 0x7ba49ef8ffb9fbf2, 0xe626af2ecf9ab56a, 0xe68fd9f79a05d434, 0x65e1c7c63610826d, 0xd9650c2424ec4b08, - 0xedb8405832d68b2c, 0xb96539acfeeef33b, 0xdbdd1f4986a4e7ed, 0x79bb83f5dcf5dced, 0xdc73cf9a6c2a7288, - 0xe098576ea729fb40, 0x77228cd4b004a41f, 0x2eb97161b6af98d0, 0x136fd6a81bd9bec5, 0x3ef44de88b71ebb2, - 0x36e5e665f347eddb, 0x5bb2d481e68505b9, 0x0b6cf972fb384c51, 0xe374b88a2d53862b, 0xc26dd29129374a87, - 0x326a954f69b159ce, 0xf185b8613976e5a6, 0xe584478deba12f36, 0xaf796141ee828f70, 0xb907c61951078245, - 0x8aed4b56508c5b87, 0xf763c533e52e3c1e, 0x8afa09d053b1b320, 0x3fad10765bbf2e01, 0xae2b75cc387052cf, - 0x5c20ab12f63d69e9, 0x22a45aea5fd1ed24, 0x08b448a15a08c584, 0xd50d51780906c1ed, 0x9340901279250936, - 0xe1ee02afd8e9ef07, 0xe2e1b80e836bc31c, 0x4b44dd85f94905d7, 0x955c317157929675, 0xa5b7516d57969f54, - 0x705dd1cd559e52bb, 0xd7a2e974975d712a, 0x5d6e5cd87746a5e2, 0x617152362ab93d6b, 0x07a5d97171bf50f1, - 0x3d9bac589c992f5d, 0x7249d7af615ab0ae, 0x09075776c5c79065, 0xd9196c398d500b5d, 0xa1687d3372954454, - 0x86072da63e229812, 0xc2a4084c5aa65051, 0x6e1d47ccd4dc3d2e, 0x3fbe813c0d54be87, 0x7c7e5a412fbb805e, - 0xaabbf58222c9f517, 0x125b35f76058a450, 0x8da1d836f2cc4fbb, 0xa3d8a219f7745c32, 0xd941465c903c9bbd, - 0xc55339e8c2b1b2a3, 0xca24f203354065b9, 0x888962e286b3fe08, 0x7c323c04bde78157, 0xda3202dde8cde22e, - 0x7199615141fd4a95, 0xfac68d4e8d5a77c4, 0x6bb1799f1b15e60e, 0x7e7144aeefc213be, 0x5127013d5cec26cc, - 0x4f2ac83213891c2c, 0x317dc6cbcb3474b1, 0x6dcdf2c584a48ac9, 0x6fdf76429747bda4, 0x347bb1bfac50a9aa, - 0x1c21a3f4f50425f4, 0x7fd4b57f15949105, 0x85c9e0c02149f14d, 0xbca1258246f74a67, 0x6ee9e84375cefe69, - 0x8257028ff44c5fea, 0x532298064b8a27c0, 0xbd39ca43f7d9ba6c, 0xfc6e09178e1392a5, 0x93c74dcde2696658, - 0x94dbf6ec80fc5866, 0xd96056138335484c, 0x6ae4f9a7c25b6067, 0x4859f128cf52ad97, 0x729528cf570944fb, - 0x409d5ee86e461d81, 0xd60fa2f71e9f1e7d, 0x78bd1aa8bebf2209, 0x47a8090069928680, 0x7a51724dead41886, - 0xc3772254b9ad7ea8, 0x71b699d97c9fa054, 0xdb5a563f7081e39e, 0xe29d13e5a41266f2, 0x6d8240803d74443b, - 0xdaab3e726f41b0e7, 0xa4a00f2c29e6d841, 0x96e90fd9e38f1b62, 0xbb6fe71aa016ee28, 0x3a65047dfd902aec, - 0x4b78afe991d39418, 0x90381e59a95712ea, 0x8de032351c57e409, 0x3c6ed01c3bd44d5a, 0x695c4e7b24815ca5, - 0xe2e020713c4dc6fe, 0x5c7bbb7d44149573, 0xceaa33180891a4c6, 0x88441cc7ddac9605, 0xda216357f93924b1, - 0x208e47da9c685285, 0xb20d3694260d2473, 0x2187636fa11bd351, 0x3b2736a7fdccb14e, 0xfd7c90bb76a7be5c, - 0x07caf34704484daf, 0x6c21e64ed30b65f5, 0x9a5c91778428e104, 0x46deb8ae38fa4b68, 0xb90f01638353c961, - 0xb916a8102cc75c4b, 0x43be1645f66edc07, 0x3a00814ff1b74f10, 0x2f7c38e87f848e14, 0x718c114adcebdc1c, - 0xc3b8657c70ee5377, 0x34844b4d5200c014, 0xc0bd3664dc060ce9, 0xa2443e440816240a, 0x24a4585295f8d383, - 0x21b4302c6c86634e, 0xbfbe7028805d20c7, 0xeaafd738baad6383, 0x82a3e935ba44f8de, 0x3e7ef87e400e8dba, - 0x23d001036831288f, 0x58ecbc5c0edb670e, 0x2a424688e1743222, 0x4d3fb2a985f80ac6, 0xdaf6452139ecb758, - 0xaf8e08d7d2e391ea, 0x93361eaff6ce6057, 0x04c93f76d7a0e9b3, 0x010f5bcfdae0612e, 0x40916774b8406af7, - 0xd8bfe33664188345, 0x31094c334daa3358, 0x6479459aad328bc1, 0x228412591e4b26d0, 0xb017c165ad07d2b9, - 0x6673ee47f84d7006, 0xf98f5551e2b1d33b, 0xba95e068d53af29e, 0x2f38ba9bf72223ce, 0xe8047f6f2bdbb8f7, - 0x7600119da812c539, 0x080cc82efc100f04, 0xfedc117f45578e34, 0xcc429d3300456e4f, 0x3091acb8485e2402, - 0x0b768d657d61113a, 0x41a4ca74f206d2b3, 0x1e7001b46c9dcfd1, 0x581fb6c701ea2464, 0xf73d0a01a4f209f0, - 0xf57dec12ec52399c, 0xe4d009a9626a05e1, 0xf46748098f013805, 0x4162c9734d33bc18, 0x4923583458c0c14c, - 0x79423d91b8261509, 0xbbe49d9f56351abf, 0xa6d98f99a762662a, 0xdce9c83a90aa1ddd, 0x6b8f81fab9f95bec, - 0x90cfdd6aa615fbd8, 0x456a84c0c47fb47e, 0x18b09edd63d54ae8, 0xb57c9eed0151d071, 0x0195cf6d93275753, - 0x7d09b6c49f094ab4, 0xf526021477ad98e4, 0x8cb16c52aa4336b2, 0x9193f2953abe0936, 0x3bf4c35829cf5323, - 0xd1c673b8df7b4551, 0x85a53376e3ac17c4, 0xbbad794cd56368e6, 0x6ea3f501db42aa26, 0x495a0a12cc43523e, - 0xc9cff10ec9f2b099, 0xd93dfb6e8b225385, 0x29156c8ac63db841, 0xe1e690a5fe5a2d19, 0x671be33d24f7b49a, - 0xf4885ca1a2a0b844, 0x0d125f6ae2cb8a24, 0xefc45d3517b5c7ab, 0x6450aaa9521f6071, 0x0351f24b4b7e0957, - 0x09a29acc03c286fa, 0x41d025abce024b0a, 0x2e86604fc0257d19, 0xf1df6a70c9f74bfd, 0x7ee93dfe10869456, - 0x40132478931c6fe7, 0x54053d31125f7c71, 0x738c70ddf6109412, 0x08809d77de81f988, 0x6353dc7ca99ab6d8, - 0x4144779024f05f24, 0xb6eac99618aef739, 0xc8bbaaf365c5784f, 0x0c45ee9c7796dec8, 0x6a95da0ef606b022, - 0xdf379e1821544882, 0xeaf6e0dcf3073f3f, 0x80ea081c1da0b906, 0x04ad6b749521a460, 0x976347c0f031df8a, - 0x61e3bb502df473b3, 0x70829061f18e23b8, 0x0fd61fc31b252251, 0xc269e4d6cb8b17d9, 0xd0aafd060694569c, - 0x77d3c253284d2d86, 0xfbabd95cbf0252aa, 0x5cfe6556fe259797, 0x99dcabdd73b8f02a, 0x0fa76ebc3ddd7839, - 0x089564bdccb25e26, 0xfb473ad883030675, 0xa889c07f7f4de30e, 0xc8977f98f1b3f369, 0x83aad070a7d4e4ab, - 0x28d1e31eda5b5922, 0x8c32aba3d69ecfe2, 0x9629f5b0d589535f, 0x52ea7e6b07346d48, 0x53ed9a9390add646, - 0x3229a176273dde2f, 0x5edc32fe44b0223a, 0x818ab341028f900a, 0xcc01cb653128a4f5, 0x3b6a5e7e551d6d2c, - 0x21341c8c91f77cc6, 0x21651c5a46274165, 0x32a375eb090c95ad, 0x232695f5f7845a9f, 0x706c0b38b397e34c, - 0xa8ffcd843353e802, 0xc4992aa9707e63fb, 0x040d1ff207de22e6, 0x949407632de04940, 0x7ad192e84608d38f, - 0x11d64e4856f225cf, 0xe4819f2c217b9c3b, 0x7239eeee7d27166e, 0xb8bfe99d44db08e3, 0x211705bd855a9278, - 0xe3f1e23654a99ebc, 0x7a86b8bbdb0f9f3f, 0x78f6ead9ddfbb737, 0x47885f3a72be494a, 0xb434dc307848477c, - 0x2a22c0e49d02cde6, 0x30cd9f51326a9840, 0xa8f38540111a27ec, 0xd8c00f03fba8c9de, 0x0d64e60e7b05dbd4, - 0x49738e1923b3a79a, 0xf771737a8ca635a4, 0xa621709a0a9a27ca, 0xe336d710ce758867, 0xf368ad095b6014a2, - 0xfb9ec232a84e1374, 0xf399ccdc81590745, 0xd3126d7e759a36c2, 0xc95e18e01f4783ed, 0x2063971d780d92b3, - 0x647c9170ffc2e794, 0x3fb6ccbf215577b1, 0x498d68ce16d4e0bb, 0x622e26382d200a3a, 0xc04223202f8472c4, - 0x7f8714ef0786d58f, 0x17458ff1d59d2777, 0xb74997ed120cd8ca, 0xc9830dd2e445c565, 0xb432bc34b80403b6, - 0xb64f3b6a9d5c6a23, 0x8dd762bf1ec7f39e, 0xc2448481947f6dbd, 0xaaa284972dd85c38, 0x552e60bead649a60, - 0x3e5d1d6abc9c706e, 0xf6646ee65fc9eccc, 0x43ecee08267e4a95, 0xc8e994302e934119, 0x655c2283442f7b76, - 0x322824917332082f, 0xc93215046a2ba282, 0x947e9d4090c3b671, 0xf29280924d6e5cc4, 0x90089748295ebadb, - 0xfbc93d199574b470, 0x561297673b219fe5, 0x7b22f9ccf694617f, 0x663573055b2fc951, 0x9b99b8c2cb3cd95f, - 0xd0969775c2c759c1, 0xcc1a0c3231a852b3, 0xea6aeb8fa5fc4ff1, 0x1a4e0e666b617169, 0xe95a159271adeb4b, - 0x88055ebc14e0c865, 0xa9ba3fb7f362b85b, 0x3dae1ad1f3b70133, 0x7966073d1ab51e8b, 0x92a059d078b610fc, - 0x6f91627ce859d071, 0x62c8aeed25ba850a, 0x3d0ca636108f556c, 0xf9cc608e789bc381, 0x53999fd08657b19f, - 0xd610a9084f6d8834, 0x8aa735c41ac8535b, 0x6295e5094da97afb, 0x84764c15de3782dd, 0x17543f515778b595, - 0xc13d2e556525ed09, 0x5559979b8d2a8703, 0xd2ee9e509454c0b5, 0x24eb854f28ca2ae4, 0x5a56d0e1a49dc1ea, - 0xeb5c5aee78454481, 0xc1d2231053218fc8, 0x45757a3e4434d6ea, 0x616a1fd94f4cbb12, 0xfb488825b6082592, - 0x3b124421711f1a51, 0xe6ed2d5574add153, 0x6695680b76638503, 0xf97ca30dcef5fb05, 0x2f496da465139935, - 0x2c0b80dd21ceab29, 0xa8ca87486775c6f9, 0xc6d1879a92a64588, 0x0c5181d0b2661f06, 0x7422e11684424bab, - 0xb3822e24ae343aab, 0x42ca7d93ea881e6f, 0x524914f626553385, 0xdfa422abe24daaa7, 0x8ac15a2d544b9e61, - 0xb50aba14fef744b5, 0x8274894adaa1cf87, 0xc1ca14b53b5d899a, 0xf528286eb2cd1a55, 0x9ab02425c54c3180, - 0x4b2ae6cb5256bad4, 0x1f69f56c718a2a95, 0xf2d7eaa62231156b, 0x39078e8a0a380898, 0xf3dfe89287caa772, - 0xbb20909731ba8417, 0x348dcc47674ec582, 0x146419149d93b865, 0xcd29dc5fd5586022, 0xf5a47b849dc6dec2, - 0x4be3b9ef1c920575, 0x2ce2fe94ba2f21d2, 0xccc190f0a1e77dbc, 0x9ff314fc247b4259, 0x90b0f019d46d05de, - 0xddcb6388edbfa978, 0x8a2d814097bb572e, 0x23c428df6fe47737, 0x2f314317a5528589, 0x8901ea56305ba8df, - 0x51d8848954dbc5fe, 0xc231e6d2e4dac485, 0x09238faea7f228fa, 0xc32106b31ee5f3c8, 0x2b7269eda991455d, - 0x3c6e3658766a83a3, 0x3d0aa7d47ddb1dfd, 0xc2ae3b9cf9855898, 0xb1335109d51a3ade, 0x2f54241a13b1e4c8, - 0x5b640fff8ee07c82, 0xde3503fc8b772bfe, 0xedb7fa5f6c8247ed, 0xf74f5dc42f13e7bb, 0x445264ee57dd757a, - 0xe5d1931e11e5ba1b, 0x50478057b8de029e, 0xaa23cec1bb094c67, 0xfe496eecf0fc1a6c, 0xe0bd0ce7e4c305d8, - 0xfaf43987ecd4a5f5, 0x48fb5e06276afdea, 0x34c34720337814ab, 0xaae72fc95755c061, 0x98c6e0d684f48c07, - 0x4ab195a314557e88, 0x461e1542829631db, 0x67352836b5896020, 0x1cd2dc7f47255cf7, 0xfe53f39d01b59926, - 0x47f574bcbea62444, 0x650c68f7c5c6ec02, 0xff2d6cdbc13149f0, 0x33e7c78a2c0b5bc9, 0x5f093c54ba121084, - 0x4ceda9bd81bc2b15, 0x0c5acb0629522348, 0xa8342253b4106129, 0x8942179bc36bbb66, 0xc5ed272e8542e627, - 0x024392c21e242503, 0x0453179662f57d3f, 0x95a122e38cd318cc, 0x553a0909d834e608, 0x683f29d13c852723, - 0x3f1769ab1841d4a8, 0x1b60386468d43045, 0x2509cadb4d8cdacd, 0x98c6ace9f5520b06, 0xc499e1005559ce8f, - 0x2628c12351976bce, 0x90c656d71cb08503, 0x0beaea4895b1e1c6, 0x1594c097790be80d, 0x9e1e0e87b682b836, - 0xa01a30a4a882a16b, 0x002448be2587c370, 0x99b220e100b20331, 0x71d7a7cb1ace44bf, 0x637bd4e6c075eb32, - 0xa2d1bb6c5e513f6e, 0xe7e620d825530e41, 0xb2337c533c26f563, 0x0df96c30164b1c05, 0x83b2b4818260dfc3, - 0xa87f4bedfb6e2da9, 0x4dd1339ea8e3991a, 0x95146cca4827452f, 0x49528228dc91d04e, 0xe3ec1201f6bbb690, - 0x94b14ff173609d04, 0x5be8165486f8c500, 0xaab8906c3e169574, 0xd81a3fc04062cf29, 0x547342b6f3d2c80e, - 0x52c93905b1ad0bc8, 0x055e35ecff9c6bc7, 0x78af179523d342de, 0x5b659c9e45a62a35, 0x9e2b3140e52f3c71, - 0x362fb4729326134a, 0x54fd1eb9e24d506d, 0xe08fc44f0b471ac9, 0x0a529cafecce2b55, 0x6718d3828164a8dc, - 0x5352d6b6069aa282, 0x60f99b4666324f35, 0xd3b709aeed5ef728, 0x0724e89d8774e784, 0x4d51e2d1a6c34ada, - 0x2e2fe878e8f48468, 0x16d0f636bcb6629b, 0x4f693c9e332bf600, 0x3cf4f88e98b43885, 0x93f4ed7b2f59821e, - 0x7b48ca0095ed280b, 0xece3639476a177f7, 0x2c43af1973106523, 0x596a44d9fe1ca279, 0x538df469648c5ebb, - 0x3ce1cd1f560a5174, 0xdc24926669916a06, 0x5544f9a56ea387ab, 0x5637d218584c1c9e, 0x67295d3b119ca00a, - 0x5120c14316c1d5e1, 0x708d10df03735e97, 0x36446ed3f1902a67, 0xf233911e6b35f91d, 0x5dede6aa69f3a725, - 0x100d1f312d2d140a, 0x4f4fb137db37359b, 0x74fa261667dcb3ae, 0x45b99107fa309e1d, 0x5ad5984ea175de2a, - 0xf8169248641cbc6c, 0xfa8d1606969bf584, 0xd776172882e26621, 0x53928482a3681acd, 0x53c8d51e8140c0b7, - 0x643888320df9a467, 0xb81caf6936704197, 0x1eec88d152b3bb49, 0x3e4291eccf72aa02, 0xd4854bbcee0611cd, - 0x018487836264cd2d, 0x3e13c634d5f6ff2f, 0x36001c58dbec95ef, 0xee35389115964097, 0x7cda85645510dc4a, - 0xa83df68b152e5cfe, 0x22822a236be95737, 0x4b6112d5dd62fae0, 0x8f9e6881f9b8ac25, 0x424e044afff0a71a, - 0x84d81d2fb808134e, 0xed3df0e738dfbdf4, 0x8edc4a06be32ef69, 0xd08adc5f66e85abf, 0xbb090fd297c937dd, - 0xdc1cf172108918ff, 0xaaf3cc07266899e4, 0x0695b0af0d6c0c81, 0xb8f2c3ed1255dce3, 0xd0b0b17766596f92, - 0x44bb9d454e6cb394, 0x7c86f38ab2900466, 0x16d53ebab65c9238, 0x7c48976a9696e999, 0x14371ca6989b87b4, - 0x11d92b38d44edd6a, 0x8c35d85859bc76c9, 0xe2b27b8f3c632c19, 0xf86be3f9c5ebc826, 0x3d9505fe0547a448, - 0x95df942af97033da, 0x46482bf4816b893c, 0xf4921de8229ceb9b, 0x9b34cecbc3b6d6ad, 0x0e5ed5b43e768aeb, - 0x8aa5e867e262c3a4, 0xad86f45560b0abe8, 0x699ef35d24d3c596, 0x4d778ba0e0987ae5, 0xb430b2a4a4b87386, - 0xa98ff76bf372b49f, 0x599b695db50515b9, 0xfb2d447a3b112b84, 0x3c4b789d73a2626e, 0x8e387c0691a671ea, - 0x840de9b712055b73, 0xf448ecd2d5ee7df1, 0xb66b8e5083b4cf60, 0x04cf2f2f29b11728, 0xc3222de65fa138a1, - 0xb7101b6d859e7779, 0x9f1ea1ee71859de4, 0x23ed846596175065, 0x79418dfeeea422db, 0xf81daf00c652dbdc, - 0x38579202d36787b9, 0x7b832ccb7c2f9bbc, 0x30c42bc76c238cfd, 0xe7bc31f78e1f74bb, 0x1d56b03029125862, - 0x6c0475b39b9516eb, 0xa84206490034a06c, 0x9d98e75b2d945f49, 0x8c9a0436daca7401, 0x26a9aef9c268a6b4, - 0x07791459387958d5, 0xb9407aa2020811c7, 0x90fd82e6e957c873, 0x681d24a77520a82f, 0x5015d2d540638470, - 0x5c399ac474b974e4, 0xc033784a078b2173, 0x7857b7829f3cdb1c, 0x51a36ec74c6e4d05, 0x998129bdb9d58af7, - 0x27bd2e0393fe9a5d, 0x6db752bed2845072, 0x10021ad6e075a6b6, 0x500ba35a09151837, 0xab2f49d9d673e2c1, - 0xd6aa0215b90c3751, 0x5a2f08f7eece88b7, 0xd97267240a1f1e10, 0x8d3a2770039a4f4a, 0x3625a76078011406, - 0xcaeff7a0932c06b9, 0x82142c6576902741, 0x902f0b22e66d36ce, 0xedb7e14b926cd7d9, 0x7a936350b45bcb57, - 0x97aae7a906d53485, 0x957efbd3c7272849, 0x5864d17f388bd263, 0x92bbd31fc75f34b6, 0xa7637ad347947bf3, - 0x2329adb97cf98c4a, 0xbc698f988076652c, 0x2143c8a4fe4b05ca, 0x58ee0eb9bdf685ab, 0x864ed739d7eab906, - 0x62956032466db9d2, 0x91e4e612fa6836bf, 0xb35570a2fa127cbc, 0xc3dc812e0c16b4b7, 0xe6a622ff99d517e4, - 0xcce87ad936b7630e, 0x4bf8899a2a89aa4a, 0xe422a00140a181d2, 0x20bfa8a8213e2327, 0x562047300b3809d0, - 0xf8443d7153386576, 0x1c820a5acdfb7044, 0x97d78cc9d42da0df, 0x15d69aa675a1f9a9, 0xdec5e92b99264475, - 0x11c70fe12b3b5a81, 0x877472cc1a35ee34, 0xf284004517d32749, 0x06562eed9c202824, 0x4fc18a16fdc2e0d9, - 0x73cc89b32eaf948e, 0x914943126d1e7d91, 0xfab9f665c465599a, 0x6a34a8b2057b91d3, 0xf0b8a878cac303c1, - 0x42844f28ab6e7c4c, 0xbf25e82ff414422c, 0x8b74b0ea68838376, 0xc277ed0cd31fb610, 0xefc66ca3c5a5d27d, - 0x460efa07aafea1fe, 0xa7077536fcd252b8, 0x1307e2575a6542aa, 0xed5ae8547a21e5ab, 0x9bdcd3c58b835c8b, - 0x17ec09f016746398, 0x7fae98a91ee324a3, 0x11fb5d2d5da007bf, 0x0dc715715670efa8, 0x523dc401b4f58bd5, - 0xc231896eca6c238b, 0x0affa3185841d23f, 0x79704185bfca01be, 0xc14982d65344bbd5, 0xc197119aa0fbb8fe, - 0x8f44709db936bf7b, 0x0534e31006902524, 0xbb8dd23fafe83bba, 0xb1d20983188b0205, 0x4086dcefde238530, - 0xde686e16ea0b3f3d, 0x84f70e296ca5f559, 0xa2e8bfa601c99ed2, 0x0b5f6652667e7243, 0x5eec465761e18e24, - 0x125755dd48cba780, 0x4f4de0321cc4f54e, 0xc9e68e823226cd05, 0x176c8a994928e882, 0x2f80a702eb25d250, - 0x055bbb3bf338c8df, 0xc7cc85a714d46976, 0xa29a106f07876ead, 0xb7de2254bcde1a41, 0xd725ba037235bdda, - 0x3b00c4853e78b299, 0xcc526412ab1e33f3, 0xa72e8f69e50cf7f7, 0x71467e2dc6f690bc, 0x973eafc9daeb5283, - 0xe40a56c2877c18b4, 0x1042a3d42522b2a2, 0xbc18eec86dc50d88, 0x7dce805694ed875c, 0x90573fb4275d32e7, - 0xf91d5bc6e41591b0, 0xfb16dce023b4732e, 0x16cd5f1e2694cc56, 0xb6d8c61d30551ff2, 0xf8a86e07b48709ab, - 0xcf5a1f554939f31b, 0x3601440b85e46f50, 0xcd9dbc79bdcc880b, 0x3c1c8d0f866f8703, 0x1855e7459d84239e, - 0x95bd3ec409c61a51, 0x8a25f51ad81033b1, 0x068b9afe282d5b22, 0x87d4e7d34c4320bd, 0xd096637b0f17b0b7, - 0x30adef710ff437b6, 0xdbee8698b0d1468c, 0x1c128d05efb5c9fb, 0x06a899ef4173c13c, 0x8d4deda676a7ddea, - 0xf6c76d0aa4126a18, 0x4f9df7c00f193c35, 0x225c098219903b07, 0xf3261465881b10da, 0x8b934e9d21f3cfaa, - 0xaa4d8e8b321d1a8a, 0xd29ef20dea941b34, 0x22b67b751b8d175d, 0x904966f916741de4, 0x05cf46d1c0019ad1, - 0x4413a9315f4cb931, 0x3f1b1ba65611db6d, 0xb81050d99f6cd9e3, 0xfd950de1a10af314, 0x8f3d2c492f2b6f5c, - 0x90e6bab12ba783f3, 0x9d98de11c8a6ebac, 0x49b634a6ee0cc783, 0x87b0f7ea76b67e6f, 0xf77819b992cda0e5, - 0x1a85e9e928cbf197, 0x6a5649b29ed00ba6, 0x26cf41e3197bfb60, 0x541c6c6b29d14ba3, 0x206d828d4a4ab26e, - 0x72b23de3d38a539d, 0x4f5f3679c5a9f3fc, 0x77f7b6d22313ad8e, 0x93b6a5bd90bb58c4, 0x10cfd6ce7aab9903, - 0x42b2e4b3297dfe4c, 0xefdb8f27ec3ad822, 0x67ed397cccccd8bb, 0x55c921707be0ac50, 0x64a8a4f6c889cbce, - 0x87a54de06b4f3d8e, 0x3eb699ed62052d70, 0x8628171757827327, 0x842983bb05773f49, 0xca7061e5127000c2, - 0x3193c9fb6883e9bd, 0xf36dbdde81560ae7, 0x71350003c2caf454, 0xaeb65d923f8e611d, 0x68b6150ee5ea5292, - 0x6a4bb1ba24fa5c27, 0xe1f0dd105660f8eb, 0xc387f72ef52fb337, 0xb283d65c7fe104d2, 0xff11aee06aaf35b8, - 0x044bf73f714c88dc, 0x571ad341dd9882aa, 0x70dc427287e23673, 0xc1e3d2459e8a4852, 0x447476c4e2626294, - 0x50329883a5f43a44, 0xed8b5b523de2f665, 0x7de2045c9e16e7d4, 0xc9f83dad6219a432, 0x1a3c6ce3cbd84da8, - 0xd7c3add5288d72a9, 0x7ce9051fd7294e67, 0x543578cfd7910954, 0xa58e984817808711, 0xbc41cba57d095fbe, - 0x6ed8f5933aed4563, 0x8f8f22a0a6b22a82, 0x7ed21c4a1644bf73, 0x902faf18f20f291e, 0xd17f28ed25d6479e, - 0xe9f5f66d00fb0751, 0xd4890bdfbb3e693e, 0x377b0ba1ef6e455f, 0xbdf93cb1ea4d1c8f, 0xd0f8671bc904b8e6, - 0xc7679d6c21625fa4, 0x9a14cfb3b8a681fa, 0x9b7f1c854af0c43f, 0x61d64e59df9bee34, 0x91477ef644381486, - 0x0341243d4c9c0d88, 0x51dc1c56f4670820, 0x209a1cf53e11efbf, 0xff63fb9851c4f126, 0xd8fcb6a0b8bbc232, - 0xac37b0840e7c528c, 0xa2e1b8967cbbec05, 0x452d212e383273a4, 0xd8f228d0a969569e, 0x5319f558d5481757, - 0x1bbe0ce267b907d3, 0xaaa9610b77c3e953, 0xcb275e70c559c8fd, 0xdd160ac11fe5b9c8, 0x0d2e79de6537ae8b, - 0x7f818f5dbb6842d9, 0x5470a747d31f4dcf, 0x4294e38e7df3f24a, 0x135623622a13811d, 0x94713a1a4e1616c9, - 0xc1bc44a956284597, 0x76c4bd2db9478fdb, 0x0832540455904c72, 0xf3c6c208d235c20d, 0xb8d51c08546622e7, - 0xe0876f4f63f615a4, 0x1ae18682fa685eb9, 0xf4962db6e7e9ef70, 0x5b7e6d93029c682c, 0xced806349e27f0f7, - 0xa298bf09e7ab2407, 0x11aea2159cc4ac8a, 0xabbc743baa48d167, 0xc24710f0256686ec, 0xa25003b4ab2c8b87, - 0x12c9deb558ec2dc7, 0x42615254b89ead51, 0xf3364991964f28b6, 0x5b27410995c502d8, 0x62708aca1de634e5, - 0x1fc38d6153537f5f, 0xcc7805c0d2dd0c1d, 0xed1650c346bb06c8, 0xc024be05aca5fa3b, 0xc04a9cf106c846f5, - 0x67e1ffe855174c67, 0x8aff5d7a8cfd4b19, 0x7a21cc82f9dd112d, 0x69299c09f317f07b, 0xd2789023d1c30aa8, - 0x9fbafd63f1be0618, 0xfa63113f6dc46fc3, 0xfbaa51fe87237ea8, 0x64ce86f881c5cf8a, 0xf87157cc86f88d16, - 0x988ef7d992e24c68, 0xff6ca8795694ef04, 0x2933e172eb72764c, 0x7ebfddba06cf6d3f, 0x0ff1a7fa34245ef9, - 0x4931826b607d3236, 0x67742e900dbd637e, 0x75761af4f5d2fbdc, 0x80d3ad161c4d569f, 0xecd2f8342a066ad9, - 0x6b53b42be8f65e53, 0xe8293ec3e8239c6f, 0xea37ac22e04e14ce, 0x628d2fd81ee10bcf, 0xed47071f8f69d8f7, - 0xc9dfda0b8a0c2e6a, 0xaa61b5168a9a149b, 0x6b5282beae106c40, 0xb83c08d200d6730f, 0x7fbd7e5e7bb4d619, - 0xaa2c946a058d6e8e, 0x858b447aeb2b954a, 0x9ac60b60b177ed31, 0x2863d819edca445c, 0x8217cfb88de61b74, - 0xf16e6d0433816816, 0xe64700ef6fe3b4aa, 0x373f7ffa1e3a4dac, 0x32e11fabadc56b66, 0xf0004645a73deaf0, - 0x24a89f059e8a677a, 0x1d7739a6c9e21bba, 0x14ba232e41d2c1c3, 0xa1b3ff9386028306, 0xc8e264816105a23f, - 0x5fc20c447c1d4fa9, 0xe22a9845464c1ab0, 0x02bd98628a37382f, 0x099eb06ac62fd6b9, 0x5dda75320da9e485, - 0x07a8002631dcc844, 0x157caeed2c2e6911, 0x3ff17b3e9ffa0886, 0xa0371f7c8ffb0e3f, 0xf256ec5ce680b420, - 0xb6246a820e4bf460, 0x7f4a4973d836a43b, 0x18265928216fe1a3, 0x73de243e729afa12, 0xa9c64b90dddec3ae, - 0xa1fdea95b9b7fa87, 0xa0a8e002c0370521, 0x746d2e5c6f93ebe4, 0xf9d6e2ca35dcf7b6, 0xa6393c58e11c1c18, - 0x14b944281568c940, 0x72ab89e4dad3b3cb, 0xe507d4ff4690acc1, 0xad64a52ce9286f00, 0xe7479477e0f3b8f8, - 0x9effa6226b077fdb, 0x16e1fddedf9ea814, 0x1f9c9dc56bce8cc6, 0xb5e8eaf5c81302f4, 0x8de2f988ad5808f8, - 0x484c0096fffae2d2, 0x3230eea7910f3341, 0x9bfed38891f0c171, 0xebd3a8ea9853a71a, 0x956e55158dbd53fc, - 0x510e288683173d10, 0x2833b495950b93e2, 0x36e5de6c3d2233c2, 0x5caddce809d74f26, 0x403648e7864e8d3f, - 0xea8c6d2a9db15648, 0x9b0589715968606a, 0xfc1f781cf5f70542, 0xca3b5765c12d8266, 0x0251f96ae8d02c10, - 0xa06b19c8d9b31222, 0x7bb750d92941509a, 0xe8e7f93c38a1254f, 0x27c44a5e969f3d2b, 0x8b6ae56768f20cae, - 0x109d9949e0b75222, 0x03f97e16a01e4615, 0x49d93eec31f59918, 0x9aaccca6acee6b24, 0x6e1611df8ba950f5, - 0xa2e8ca450ad96923, 0x99ba70696e3315a8, 0xa98d642b5ed7844d, 0x0b769e84153cb64b, 0x8e34ab24c97c8ace, - 0xa81f9ed74c75c539, 0x2f9bcf7c14794309, 0xf450f6fa3a10d38a, 0x5f0b61d64e0e2031, 0x72be1ac8acf23700, - 0x9ab765c08252a95b, 0xf3c0d2309bec382f, 0x1f67e8c9a44f5861, 0xf0706079f1ee4b72, 0xed0d688ae94abb38, - 0xf4f86c2866b75d4f, 0xa273905e6a844393, 0x079834ee489ccafb, 0x6ca7151fb85e2ec1, 0x0ba22146d30fa9e8, - 0xd06bd5871e97676a, 0xe01e97752db0c917, 0x99780d4f5c68f7c4, 0xdad2997c117e87ce, 0xf25baf03c3bddf3d, - 0x26a052c3ce541549, 0x8cc91edacd0c4ffc, 0xa4e6a7f3938af534, 0x39f3b3545a8a0736, 0xf24266ee4b89a453, - 0xca4249fad445a712, 0x349edf7bddf74fe0, 0x9b6104fb0ccccd5d, 0x3870763510418c38, 0x78aa4d69bb052a8b, - 0xc07e37bb70af00be, 0xd66ce8f0d4e913ff, 0x92168d6d7a4c453c, 0x6fb0a08f3ca3e326, 0x4f77144b977d3ac5, - 0xba26b1da5be4cf89, 0xb4d48571e0f186ab, 0x9ddd8a784b3ff3c6, 0x8459f67cab71eeb0, 0xbdf7c7dec409b783, - 0x80335740e9790d3d, 0xf8d61e6a78214b93, 0xbe114b38cba2eea2, 0xdfddca5aa399c6b5, 0x8f475611b809e501, - 0xe784dca0cf7d0a46, 0x32536fc592e8a798, 0x1ef4a0d268088b87, 0x7876b407e3ad0fbd, 0xe3620fc592ecf7ad, - 0x901ef4e0c99af21a, 0x7ad945583668c08e, 0x5cb1bae381f972c5, 0xbe231ed7144062fd, 0xabda560a204eefa5, - 0x583200beae879091, 0x36617994f116979f, 0x40bc2b67d1f11bc3, 0x261d1f3043793354, 0x72177caa00ab6c74, - 0xc16e62bd637792c7, 0x4ec95dd575485a12, 0x4893c11f52178ba8, 0xf09ca21bf403051c, 0x169de3320e10ae46, - 0xed1d66313a96a228, 0xfb67bf09018431a1, 0x82c7650e2c59ede9, 0xfbad040d47e350e3, 0xc18cd8b0e00e2f7e, - 0xbc7dfb1e14029350, 0x9b64f2910d1c96a5, 0x016f6e9382cb9239, 0x014e347d3b851065, 0xe11c1c3b86c2da27, - 0x78464608d03a3e20, 0xf87b325e703bb91f, 0x61af501026e5beb8, 0xf833cae39b198382, 0x6d638dcc5e296612, - 0x941157cdb97af96c, 0xf82bd4f9e787c4b5, 0xd98433e8d6923062, 0x59e3bfb9e19948fd, 0x26b297f0ba777c74, - 0x87a2fbbda3ad0fec, 0xd37a07deb2775b3b, 0xfd6a88384a128af0, 0x3cddbef152a4df12, 0xdfe5e7eec7b55a18, - 0xbf7c698345769e7c, 0xdb0048d09e80624a, 0xa3ed3e35c915fac9, 0x5c162f0f72bc3d4b, 0x391998b35b88689d, - 0xb2ff47b0cfa0f28f, 0x9d02157689f9f4f3, 0xf0d210d19e4ebc88, 0x64616e6f7d693390, 0x13ee356521f6babd, - 0x3e3e8c4b9523ad92, 0x00e680a2c05114ed, 0xa0c37ed0213d6d66, 0xedb1845d6bfb4464, 0x8c745a6a9c85c287, - 0x13e2df450e870f82, 0xcf2f5f82c909f248, 0x2c8735a5135a7b3e, 0x020f64748ecb528d, 0xc8e2a96c64a1ce28, - 0x0f62eba67a830c0c, 0x89de254d366c8188, 0x63ed3cccdc6228db, 0xfdf7ed8fc7903b1d, 0xe3b5ecc161afecec, - 0x552eab417ccba8ec, 0xdd7db70ea6dae6cd, 0x58b3dde13528ed9e, 0x2aad6760c8ea4001, 0x2433c641628b3bcf, - 0x31f4947c2e232d75, 0x1ed73d9bcc351ff0, 0xccade58ca21afb56, 0x87f0e2dbdb0b53c4, 0x52777602417ed08e, - 0x09f515f38ab93ec2, 0x230eb84f01dfcfbd, 0xf6e55e23e41890cf, 0x41772481df5fbb0e, 0x5e9f771a09ae77f7, - 0x2b70b03abb916f69, 0x01adc15aba2a2990, 0xcfbc5210de7d6188, 0x546bd45ac8cc35f0, 0xac4a411422e7ad14, - 0x4f6104c72fc40222, 0xc72fc0ef3d7c62f3, 0xf2571f2117be68c2, 0x029559802c0851ea, 0x2853a76c0adbefb5, - 0xf0aa2e7c1e9cbe9e, 0x8d0de76a0ca31a53, 0x7862ae56ff946a4a, 0x7f4cf2049c73e7e3, 0xc7f352620609ad7c, - 0xc0492f94774bcca6, 0xe38ea412be8e3bd4, 0x45ce4c52857949e5, 0x1a39508997a27cf7, 0x44f6f013b661a99c, - 0x39c2147378f543d4, 0xfcac472e800cc445, 0x3a2313b06a60623f, 0x0d202945647a04ca, 0xac2064bcb4bac030, - 0x3232681a3983ba54, 0xb3ac53d443102198, 0x39a62bd92121c046, 0x17403aef7db3df9c, 0x64881ad79df52a85, - 0x62c98c960953b044, 0xe8260fd233b8c013, 0xfd8450154e1fa321, 0xeae5400c61021e1a, 0x95e3eff81a2e492b, - 0xf82240311ebff90a, 0x3e4d6b0485703852, 0x468daf58621ca17a, 0x56018d1841ee2b5b, 0x8a567205685033d0, - 0x17c17867286d5331, 0x4bc300a08624f27d, 0xd614d06eeaaaa365, 0xff7cf08df934ad1f, 0x14429509af2cdfc6, - 0x148e191a9dd4cc72, 0x557c56048b55c71c, 0xa3952b56bda6434d, 0xde7ce9a80bdc3037, 0x0169556ca332455d, - 0x9c86203f9f81b032, 0x9af58aa37e852dc9, 0xd6d4154140c18415, 0x109cd638c38e6c52, 0x9c653a1e3b07072a, - 0xe2dfd151f2859683, 0x1a11e7aa543d638e, 0x456dc5d59771c40b, 0x1afcc5665d6edea6, 0xaf18b6e774544bcd, - 0xb9ccac355f0d07c0, 0xee3adf44c8a6443d, 0x57c097ad99a15ae6, 0x61d04a363b99526e, 0xde5e3a92bc4a308e, - 0xd21ce7792954e1fc, 0x466ac4c989f27c4b, 0x7790b420f852ce58, 0xb7b872adaf5ef25a, 0x2578dcb6f9087c3f, - 0x6719768dcea58a52, 0x8ae2137625fb290f, 0x479b29def8d0d8a9, 0x0ace9b93fd7d0040, 0x32b23d68b5c47c2d, - 0x4b6e470f1a4b3d71, 0xda374fe0481c4a95, 0x1a0708be7811a56d, 0x92164e6df95256a4, 0x95d33b7efa71b027, - 0xb4b34bfa912e64e7, 0xe9dee790be38942f, 0x8eedf9c8e5988666, 0x7e92314e22209ff4, 0xe628f87a124c86af, - 0xb642b0007387134d, 0x17058f5286763906, 0xce2457f1ab7bad0d, 0x842b1fc08465000a, 0xa58275af630b25ba, - 0x4649af20018fba7b, 0x086bbd279d4bdc20, 0x88f70b2034c42d07, 0x383c35e168be665c, 0xde415c4027aa5642, - 0x69aa7f26cfcf9f03, 0xe416dc062b212517, 0x1309c9ddb6b8b828, 0x6d1341ca43366102, 0x9c8f1ce431306be6, - 0xee3e582dbda3be56, 0xd6b9db69a891b3bf, 0xf8a1d0532408904e, 0x927f27696eecf214, 0xd74c4751ec910fa0, - 0x14c213b08213341e, 0xee0dfb0a25764c26, 0xc72df7f339275de7, 0xf62e2e7f470ef9ea, 0xd7ae2813feac81b4, - 0x0c596bf8ac25e7aa, 0xc5417c61717432a0, 0xb7d3c91b14ed4183, 0xb78f3108ecdbc3fe, 0x70741c46a1cc7b0f, - 0xa5fc16a7d58516e6, 0x065a7d50bed45090, 0xb1b8777c4c632ae9, 0xb14cee231bc076f0, 0xe49b02de08aab178, - 0xb9fb756378ed0c0c, 0xa085d903955456db, 0xe1a2c0ea9082e410, 0x07cd4c862f289843, 0xf3b56b12363a06ca, - 0x22257e1ad04e6391, 0x25f5e7e44f4960bf, 0x71cefbcee50fbef0, 0xce7d6e54afcf9df3, 0xcbb57a0ebc165b45, - 0x6f5ec0856fc68bba, 0xf6ba6a9ce2b87d65, 0xd7ab07744ecf04c0, 0x8f54e38f8502922e, 0x52f33b13181c63b6, - 0x5b846377f12f5019, 0x997bfdafc1a5aa43, 0x79d14dcf97f031d9, 0x68b8bd837bf7a44b, 0xb76b69c3949a902f, - 0xbacf6ff22f170337, 0xd83ad066c46dfe92, 0x048e1a7b4e5a0e3a, 0x9b1960e530079b7d, 0x22b0f951754d0063, - 0x2a0787f1a1a59287, 0x41e56612e19185ef, 0x2a9dfdccf26f2a12, 0x7565c15a09f93474, 0x99f970543dcf6745, - 0x2c9302f9053d2843, 0xc6b4112042829eb0, 0x20656073ab4c03d1, 0xd05e8eb716ae4962, 0xd2734680cd7c91e3, - 0x679d1dc8c28d674a, 0x59139902d368934c, 0xcc58f3fa9fd24e59, 0x6459f3029bd25644, 0x1b6c8a7df2972fcb, - 0x574f4ffd49c07623, 0x9f46724c26af1657, 0xea247113b3aac552, 0xa5556a7720741007, 0x32f01142d8283cc3, - 0xc566c2c32c073103, 0x974e3678b03c34ed, 0xb68440163f92469f, 0xe3ce4690991cc791, 0xfd811f7df7107050, - 0xd491fbaec099289b, 0x59b6737bf07b7b42, 0x1cd1990f839e9de2, 0xf4e065834790288e, 0x38eaaafe695371a8, - 0x87742d5cccb9598e, 0xf9b71c6aa760eadf, 0x69240308f1aca88a, 0x4c5eeef849e7448a, 0xe5519b5649dd7b50, - 0xdc8ff422bf751ebd, 0xaa8b915987480267, 0xf8c19ab29dd74658, 0x85f221b6382cc5b7, 0x2e1b7ab083cebab7, - 0x2d19e28c5bf7e776, 0x9ec26aef4eb37a3a, 0x77a56a03313c9dbb, 0x5a8de091fce9dcb5, 0xea097f7f57fd487f, - 0xae577bdde66ef509, 0xaecc885df0c38cec, 0x824224d96ed7cc6d, 0x5be62232661ff49c, 0xcfa711e2cdb26248, - 0xca59e87491c978c4, 0x726cdd62e6c2302b, 0xaf5d1fb3edd1fdf6, 0x911680ce89901f77, 0x8f8540f2ef7fbf88, - 0x1a43d76761c8e488, 0x1d2766165b11575a, 0xb830a4fa4538734e, 0xf5543d8c10686a49, 0x57379ab70269ef6a, - 0xd49031f1bea44d43, 0xdf70f185db84ace1, 0xf511e8a9a2ce5071, 0xf92d07163f25676b, 0xde23c2a0618b4292, - 0xcfa7a156be23b4df, 0x09245dbe31a8cba3, 0x513688b8bd3f8e1e, 0xcd774b7d4bce54b2, 0xdc0d9aaa1d67b6cb, - 0x69982eed891686f2, 0xc759473cad617af0, 0xc1439e352a2f405f, 0x00da4975ef5bb363, 0x765bdd5e8fa6a59d, - 0x1d441c06187ff26a, 0x9f26e0db6c4f2150, 0x92fcb39326e5bd6e, 0x2eec4a140b035bae, 0x467cbf39d6893847, - 0x0ea76be6dba790f3, 0x8ac009bb9f64178c, 0xb484809cf387b0bc, 0xd35565a89ed27b3b, 0x30f34a5bf16a305c, - 0xfcd730c8b3bac130, 0x34963c610ae76f12, 0x4b8271e05a6f1ad6, 0x63a6852f230e7e0b, 0xc891d53e284246a3, - 0x42202125963721f1, 0x4512364783f444a8, 0x2961f2308ddc7a7d, 0xe173706de3de364d, 0x1623a19b339328e2, - 0x14e8f4e8c36bd787, 0x5ce9d449d0b2249e, 0xa969a57ec2a63118, 0x6df7b03d7aa774dc, 0x04ba810cd1092129, - 0x39fc2d5d534f4286, 0x1204676f48556dfd, 0x8c7cd8dc7421f1a0, 0x333152ec120f034c, 0x0b52e73220681458, - 0x59786b87b3db2036, 0x4eba65f13685a3b9, 0x74ebebaefdbac923, 0xbdcfdefa12748d36, 0x8a189c1dcf741795, - 0x43c33a77fabb083b, 0x788876edde3eec8d, 0xb1ab854c73b5c0a0, 0xcf221517d0255ebb, 0x1cfb106f182b951e, - 0x5674a56d3a03e342, 0x43e4f210bedd72ea, 0x24a42e902df7b958, 0x4b8548336f9174e2, 0x29502c885b87f7e9, - 0x72237fe7e184d45c, 0xa29b3251ab8d37fd, 0xe1de3bb35dcd8ad1, 0xc0ff010eb7f5f127, 0x1c6e6b5a0f77ef5b, - 0xdaf8d6532aeb5bd8, 0x9770b6e0ce5374d0, 0x709c6cc7f20bac17, 0xaae367e73d9834a8, 0x3f4136f3e54b8315, - 0xfb9a84ab47044663, 0xd34e3b7f42f70f23, 0x199d6dcd6828d0dc, 0x2186974c0bf92cfb, 0x868668e809d1e3ee, - 0xd7da43b93903b5e3, 0xcf4810ce15af313c, 0xa8f835b62cafb115, 0x7d8d5da96eeaab8c, 0x9f5f3fd8f3ab141d, - 0xd9e083f00ba2d09d, 0x5d251fe8f3d170d8, 0xcf53ee62463eb496, 0x4c69123be9116e66, 0x7a6e7fde87f205a4, - 0x32348de41299cc2e, 0x46f8c10b04f10c5b, 0x6a723fa96e97b5ad, 0xac06753701ae7231, 0x5be7895bd2249b3b, - 0x4e839373260ec391, 0x59cbf6684846738a, 0x2104ab269b145cdb, 0x120b4df96a459a8d, 0xfb6ab2950833d289, - 0x8e9fd88a14236b06, 0x67883fb58a950c54, 0x7a6919486a3c3aa6, 0xd8307f473ede493f, 0x20b8c15cd88ba8ce, - 0x56e72f6d5aa767c3, 0x521d7ccd068823ba, 0x3b1de225945b7381, 0x20c854a1b00aea3a, 0x3659ec701529597d, - 0xbf44357775b26799, 0xea64fdcbcdb9b598, 0x7102666a94c377c8, 0xad449384b6a3a99e, 0xa10520a319ea032c, - 0xb2ad9adee0fc3ccc, 0x76a288a341752009, 0xcc1634436698529b, 0x8669a5dd74255381, 0x7ae150a261c6798e, - 0xc9e7764932d6e360, 0xa076e8179677d36a, 0x3afe53528155f4e5, 0x1dd887380d6e370b, 0x672bf2cf06422f5d, - 0x5b9ce775a4460391, 0x86920317c78d2e35, 0xa5946700d34e0fb7, 0x21a1dac66ea91fb5, 0x522e574020e1e888, - 0x9aebb6646b7afc9b, 0x6651ccf2a443ef1c, 0x28c9a058e6ea2819, 0x5150a65c0e551b5a, 0xbad3cadceb4d2ff3, - 0xe69b749268cf126b, 0x2b6536c62c486336, 0x963598ceca674c34, 0x9efa9a0c0b8fc36e, 0xaa0655606f9a2e14, - 0x9f455ad5a71827fa, 0x04abf2070349ac3b, 0x9eb3468667b3117b, 0x3acfdf628acbe761, 0x32c73fc33b99b2b6, - 0xeee9456abdb21ce2, 0xebdef852d7b33a45, 0xa4318dcf69a86561, 0xc4ca2ec9f36e9b1b, 0x89fca5165716fe0f, - 0x49815cbf361743af, 0x0bcea31c3555ae3e, 0x5113422a7ac24e5d, 0x2799d2978e932490, 0xa4ccf00133b1d221, - 0x66c73e6ccab4c8f8, 0x43eb805f76202c12, 0xaba0edf187736882, 0xbc92bee99e2385d7, 0xc0eae70f6505aaa0, - 0x0d2651dfc613fcea, 0xe6cfcc80feb378b7, 0xba64a517e9d7b16f, 0x9367ebd728223835, 0x87c2f17472b83200, - 0x83e108111922f19e, 0x638cea39824dca7b, 0x792292b23daca229, 0xe4601a5846118edd, 0xa0419cd6d95652c6, - 0xe15df82b3341fa35, 0xc95b92ec86164b37, 0x1016167fd4376c2c, 0x86b6fde04dfb9226, 0xa737f8074b15266c, - 0xf919352b6385bf40, 0xdf6fd67ec2db25d1, 0xbf9a7e9ed24ef865, 0xf78a9fc2352e785c, 0x4f139512961cf380, - 0xb65fb0f1c2e848ea, 0x58393a985c1f7e3f, 0x2f5f2143416fd75c, 0x5b6aad3d5e244a22, 0x46c912b10059cc09, - 0xe8d22f21302039c5, 0x6fe13424e195ca07, 0xe55e4f9a5fa65fdc, 0x1affd2d696e7b50f, 0x4a93565d12fd9562, - 0xd164645d7c7e01b7, 0x28d445c0c65a51b6, 0x456157768e46720b, 0x393799a102810aa2, 0xa72a01d8e426918c, - 0x1cbdd8ad96e1c2fa, 0x3b6370d5c101d079, 0x4e7a157eb919c66f, 0x990bcf93cd518c93, 0x1585c40e47ead612, - 0x4220063b6506d66d, 0x38c4cbf19e91f9c1, 0xa6b9a4f30d5f9b44, 0x7afe391d50d3f0b7, 0x2944ed9fd385340e, - 0xfe2a13cc7f4e1fdc, 0xb60f9d58a620cf78, 0x41f93d915178a54b, 0xda717925cfb1e962, 0x5a534a854e477de9, - 0xc97b386e27e5fa4e, 0xbb507248b46e064a, 0x7d1b33c15746a7d3, 0xee718f792221e5a4, 0xb7442218ac25c341, - 0xd98af0968243c157, 0xbe8b671862e0c2cc, 0xf8ab3b3af8caea5b, 0x335e5cef6cf2d3a4, 0xb5980be85c2a13cc, - 0xb415d90b3a107948, 0xd20883e3644cf980, 0x230e361435ce2c89, 0x18d06eb3e79822a0, 0x6be491ee6792da77, - 0x8b43e0d45626b6f8, 0xb4ca935f82b1d7bd, 0xf825e804c7f160ed, 0xd86176f6c9b72c9d, 0x011d7a445da84a71, - 0x74e5df1c8e481519, 0x6cf4605f502b6e5b, 0xb8f898a55d30a3b6, 0x235ccd0cdf43cf4a, 0x7ab3b989ba5a2eee, - 0x40f84a771161cfd2, 0x9704ba99d85d116b, 0x9641284d802d855f, 0x5a2762881742e7bd, 0x34bdf77a3b9edfec, - 0x784312b642e56135, 0xb89d94d76286d004, 0xcaa1786d34175e74, 0x4bbd53e88bf6f8ab, 0xe1228968c87b427c, - 0x8d04d0e699219d2f, 0x439aa99c7807ff75, 0xa7cb691796f3eb8f, 0x1e38777579654d93, 0xd9f45c0a7786d87c, - 0x8165c17a81b1c66d, 0xf8dc2c5d0cd3945e, 0x4ed7c0948bd50603, 0x0115ab0db2bae077, 0xaa3d789de458bbe0, - 0xe489dceacddadced, 0xd6c6dcedc507cfef, 0xb51abf2d35aadb8b, 0x4f1ffed86afc13fe, 0xf5ecd756e39fd2af, - 0xdbf4eb9ff1af87cf, 0x5a8d7fcebf1e3c6e, 0x35fe05fddadafeb9, 0xd5f897f4ebe66d6a, 0xe6c3d275fe788adf, - 0x6fe8d78fa8f3afe8, 0xc7bd3b2d5833e0c7, 0x2f48f9ed774aba73, 0x07bff6e9d7f613fc, 0xc28b8b406835fe0d, - 0xffb8db6afc5bfa71, 0xebdeed56e3dff1af, 0xede556e3dfcbaf95, 0x56e33fc8af2badc6, 0x7f945f575b8dff44, - 0xbf1e6c01a8ffcc8d, 0xbc7cd06afc1719c6, 0xcd56e3bf725f5b48, 0xfb6f9c76bfd5f8ef, 0x5cec3932ff07273d, - 0xdda6512cdf64f830, 0x8aff493f7ec08fff, 0x453f9ee0c7ffa61f, 0xcff1e3ff70d547b0, 0xdee4ee65fcd7efc0, - 0x55efdc9b2f5fe0ae, 0x4a267aabb736f716, 0x33fd76f1d1d62d2a, 0xf23de6faede28f0f, 0x51131fcbf471f311, - 0x261e1f2bf4f1e0a6, 0x7c5ca18fbb0fa4ce, 0x55ce913ebebf461f, 0x4f9f6ef1c777f471, 0x5b3f30fb68fa194d, - 0xff87efbf978f9ff8, 0xe3067dfca2395bf4, 0xf1e89e348db1d2c7, 0x73fed8a68f27987b, 0xfcbe25dd60aaf171, - 0x5b3e30dbf8b8431f, 0xb7b6b9b11b3c9c47, 0xcfb136f8e0e13c7a, 0xce756ef0709e4a9f, 0x377838dbdb3cb61b, - 0x3c9cfb2ff8b78ce6, 0x110fe0868c463f78, 0x344f1f4a7d1ecdd3, 0x1fb619b61b3c9ca7, 0xfac1c3d9a61d830f, - 0x1ece53da641f6ef0, 0x681eca9adee0e13c, 0xc29ae3378f66eb91, 0x64f0926d012bb835, 0xdb3f861b353cd7a9, - 0x1d109e6f685f9cfe, 0xf6dbebe6dcfe7150, 0xec8272c5a745db26, 0x762418a3ed9659bd, 0x52e804c580c4759b, - 0xa27d9bb0b28dfd4c, 0xf866365e780fbe1d, 0xb8c3d0450d34ba51, 0x18499ac7144f1440, 0x5b135d98d4cf8cfc, - 0x295615ec9a201450, 0x8ab03d6e6ff531ba, 0xce4734386e41624f, 0x8c8ba0cf947b1164, 0x9d06fd70eb81579d, - 0x00e6303e770295dc, 0x484621e94493c3b4, 0x1373ce98d7a5398f, 0xecdee068a46e3035, 0xb5137eba86bc4728, - 0x705f4e4c35bd046c, 0x12000844819ea52f, 0xf5cbeb4b9bc602ee, 0x048afd243e6c621d, 0xcf7c5ab0469326e5, - 0x14a123426051dc4d, 0xfd3e5c58f4610413, 0x80c0fca877dd8fb8, 0xcd9c203f5da6c0b6, 0x23db582afa470bdb, - 0xe4e81b4189a0cd15, 0x7dafdc881396bf4b, 0xbeaf27dfdffb7039, 0x13c086b182732110, 0xf5661eedc592616b, - 0xf0f1994e9330ed38, 0xa4f732427a837b56, 0x6a389c83fabda1b2, 0x0ab73ddcd18bcfa3, 0x71e2f4804dd9eb7c, - 0xfc262ebcb9082d1f, 0x7158a525bb2858cd, 0xd2d24dc417628ab1, 0xa694a1051a4ace51, 0x7c1283e16f9a226b, - 0xb2498f61c78ab80b, 0xc01ddaf03404d05c, 0x9db525524835afad, 0xee35e151e9220abf, 0x859f00840f6a8bab, - 0xd21e095310310aff, 0xb056e0f4e9700fb6, 0x3a50a6adf0c4d5f5, 0x81b827000d17df04, 0xf484edad4e9c4a90, - 0xae153688f3abe5d6, 0x2ef63717b7c0ba69, 0xa32e243a7b240f6f, 0x38615a8a607b50be, 0xd2d5b05da2beb1a6, - 0xaf09c55fe41aeb67, 0xa9caf739a8b5d3d7, 0x511bac2164521b36, 0xb99a6973e83cd3e6, 0xa8c7db350833482d, - 0xf28851f464743c1c, 0xdd65b442a2b98865, 0xef55b98ab53fe82e, 0xca957af1b67311a7, 0x6755507421c8ca26, - 0x5267d49b845bc1d9, 0x2dd1f8e15e269c42, 0x15c3c17ce3e843dd, 0x75edb53c47d38b29, 0xd7b037bd64a0f239, - 0x43e97d5cf677da87, 0xbdbe49392798aaba, 0xa2535b14073533b4, 0x47051948c6510894, 0x5f6c18b4db4de20a, - 0x106663be283337ec, 0xf8ba535e37f14981, 0x6cc693fc80554c22, 0x8fa1b22a979b13ea, 0x844c5da9a49b6a62, - 0xad60a9ac02973e85, 0x4834417753a83092, 0x78d2993f5d03fd1f, 0x3fc0f9c17db522b7, 0xeaf4fe6645d10bfa, - 0xe03ea1607e07f40f, 0x4890a5ea27fc7774, 0xdcfa8c6dbedaf89b, 0x25fd5fa31abd7dd3, 0x26e2fa2f6b733d60, - 0x5ee778ef1851c358, 0xc1c611d37d675bbc, 0xf9fa6f2e7cfe7d4c, 0x8ac2fc179e5bf82f, 0x024cf1df7ef3f4f5, - 0x6a7d99d7a73d2cd4, 0xf6f1710b9c54eb0f, 0x25a5bfd6cab56bd6, 0xe7dc687d7de5ea97, 0xc1fa3ac8b3e1fafa, - 0xf75ffacd8d8d8d25, 0x6ee00920c70bc7b5, 0x00c5e518621eab76, 0xe5f264c056df2543, 0x9f910ab2062214d4, - 0xe6fe123cbb9eaf91, 0x41543835ac730464, 0xfa530bfe90a9c18b, 0x04f465fc837906ad, 0xa8a4220370c2fc51, - 0xee55ca9eaa1e897c, 0x6d6cac5ca5da88cf, 0x6609cbdf7102b97e, 0x9684eff9fb55ab1d, 0xd73872095ae3d025, - 0x708d356c8157f321, 0xe3ed60e155f3d24f, 0x706edd6d1d45197b, 0x0bb0184106b6ca61, 0x94d15938a40c0679, - 0xbff5179d4c5cb807, 0x5d146e565b9cc653, 0xe912551d9147bf2f, 0x23df3a3ded2fc268, 0x188f8468cddb6ea5, - 0x05729e472298af5d, 0x4385def1c3a33658, 0x59f12a63f2e19747, 0x9d645f1881443986, 0x036f8e0b0a1115c7, - 0xf6d7d62a99409426, 0xb59c3d8b00c8a3a0, 0x959edbf3b3ef2611, 0xbf78f6e012bad434, 0xdece0e961ec12f9e, - 0xc5b5c72f549176a8, 0xcec18e4dca2e418a, 0x6e410d0d40d5cd9d, 0x342b9e9f7c4665a7, 0xd07cc15d330dbee7, - 0x3b1cc9ced371fc14, 0x0a9a4e2e51d7556d, 0x87025f4daf15969e, 0xfbcd1613390a0a07, 0x271d7958b064112c, - 0x7e012b02f3a74b27, 0x741e68160fc535d2, 0x472c263732f08d60, 0xa5ac899d6477277b, 0x3bdad9bb6855d7f0, - 0xc90f375b431cd8e7, 0xc181fd24b88c5606, 0x6cd9b5f1e8a39ad6, 0xd4d9ea9a0edb1adc, 0xa4ab78c8825eb784, - 0xc4865fe254d7abfa, 0xfc9e79f1edce1d66, 0xb80ec6fd8ff47e6b, 0xae911b6e98195750, 0x0feb0fdfb4fb86d5, - 0xe1a6a22bfcd65663, 0x6f78049f4fe31688, 0x0e8685b8dbedd10f, 0xa376872e41159e2c, 0x83efbad71eef1d7c, - 0x3e0dd11ce39e112e, 0x23e4cc5dfe9b9ddf, 0x3aed85fdddcf57aa, 0xef4f2ff79acd6378, 0x94460684feaa7cbd, - 0x470ea8afaeea5261, 0x4b416d0e1e6cd10d, 0x041e7d5cdd9068ac, 0x90f3a1234032071e, 0x3e3c3a318e488bad, - 0x5457d262c01859b1, 0x2bd5d5b4983f731e, 0x4d3058d7fe9f82f5, 0x535eea6a756d3af0, 0x381602fe75059f8f, - 0xd5480ed15c3e0e6e, 0x87ee2fc30fa752fd, 0x46a17a4d6dae656e, 0xea6deda9c2e66f73, 0xbf1d5f9afbadf379, - 0xb9ba72dac4ef6aca, 0xf71c272c7d59fef2, 0x5b67f3b74564cd37, 0x29bdb9f95bf332e3, 0xca81e1ca7055063b, - 0xa4831d2ec0606705, 0x29e15c0f76ae2025, 0xc24c48bbb6eb641a, 0x9bcb32c03bfd2126, 0x98b29a4d415de559, - 0xa6a72078a0e7c7b9, 0x6775a2d8b5caeab9, 0xe740d516dd1d19e7, 0x2065c51c894226b9, 0x4570a24d9c4aff05, - 0x018c73e16a89e75b, 0x70a545cfe6c63777, 0x19c841b1880e3757, 0x3fede2dc039ddc3d, 0x84df497adcb942c2, - 0x97fb09a416cdc957, 0xf6af7baa16a357bc, 0xdb5292e75380417f, 0xefc27c2ba679bc86, 0x3b9ec30e2de39750, - 0x273db933e9152e11, 0x28ef9db06b5ab085, 0xa31b9f59d5166ca5, 0xc72413dcbaf3df76, 0x6bc07f4f5a430475, - 0x5eba7263e5fbcde1, 0xe5e595c51b2b3ed2, 0xf4dc707e718988ad, 0x65fa53ad2c5ea558, 0x1d7d57a19f55e8e7, - 0x15f65a6d57a19d55, 0x686715cc76f5e4d2, 0xe2caf2ca77f30797, 0x16af2f5f5b99dfbb, 0xb4b8747d65a534ea, - 0x15581d34e7c866d1, 0xb3ef476b88d3104d, 0x2a53ab4248f6cb34, 0xe4b9be0665e9bb9b, 0xf1847eebfc63e8b6, - 0x027bada12bd2a1df, 0x5ae415fd1682d01f, 0xeabd88ca6b2fec19, 0x5dd889324e163a46, 0x179629c99cfa3b1d, - 0x94083dd6d4376209, 0x32da6cbee608485a, 0xca62260d92cfd5af, 0xdd39a2fed6d11669, 0x5aaf8302a136e1da, - 0x48bb0011cc658acd, 0x1c5133dcce21b520, 0x446dcf6a6e4da8b9, 0x2f3575020f37b636, 0x8f56f78dd57bc468, - 0xb9e35b7a35a1a58e, 0x83e195c17036e8b5, 0xd3571b879b9dd523, 0x83a1738a892fd1ab, 0x11ed1c2d83df2e07, - 0xc176e16d243baa13, 0x6cba57c1a63bf29b, 0x8ee12d41bb32d7a9, 0x5e5547cde2505668, 0x11e19a549461d6b0, - 0x18a0983a1be0d1bf, 0xa27f1019a2b9d6ec, 0x2cf837f792e80fb0, 0x3a68e7d222e8a2ea, 0x554df62bc93eaac9, - 0x3e92ec6f855b5f2d, 0x1d7e9fbee2f7e951, 0x74bf0f50bb73b217, 0xa0c1e8e1f057bd10, 0xeb68104b217f8ee8, - 0x0f2d87e702324882, 0x0e44411709842864, 0x5de2728a367c39e0, 0x0d59a0b89cbe477d, 0x393c48ffa156aa37, - 0x201a1c6133dc5a45, 0x6f2ec855f589e217, 0xca2f935ba4a1bc4c, 0x06c1abab35c21d70, 0x0186cf7c07b826c1, - 0x0671410de83e7f2a, 0x5c7a1079deffb472, 0x9a57361b4b8859b9, 0x3af60f004c075e35, 0xee363e5e1f43b644, - 0x5756f3f2dc31ff5d, 0xd5bfd0eee4bfece6, 0xf99734b6c4adeed4, 0x00eba4624f5c73b5, 0x1302efee0d9e291d, - 0xa25820aa94c4fdb7, 0x14daf1ad70c1ded0, 0xc71bfd888a9bd72a, 0x795f8d4e992fcdd9, 0x5e5cbbb27483ae55, - 0x92e7b2965e2ac815, 0xfd4f71fa070df738, 0x37ec8dcb44615da5, 0xe9653215a4887dd4, 0x00d35dac77951059, - 0x6494d33b842f5f7a, 0x1c7661d443cd6d91, 0xf314a9e3b6838e5f, 0x46e6c172df3a089f, 0xcf20ed827dbf5794, - 0xe49be82b16cb3b21, 0x3e5a8760af3bfa09, 0xae3aa1eee4adba07, 0x24d98d73ef769c71, 0xd7fbe1e8dd3618db, - 0x6c4cf6f7b82fcc84, 0xc089017b26df2b36, 0x343faf212e6048ea, 0x1da4174112434eb6, 0x70ef75102831eccb, - 0x195a03b0ae9a0967, 0xf565d7af75e7e7c9, 0xfeba5c68a7bb8bd6, 0x497e6224524d6330, 0xf0a1e713d4d9215b, - 0x358e0cf420b1125c, 0x048e2eb4462c32a9, 0x818ac2ed698f98f9, 0x50163541e39edc03, 0x80214baf18908281, - 0xf02769aa4751a4c9, 0x85026eeec131b97b, 0x7b666881037b817b, 0x8b007a2095118c01, 0xa5286edddb39649c, - 0xc8c74dfa709aa564, 0xd877b0ce19cf46bd, 0xc3c36e47b4b571ac, 0x0f646601c8b0dda1, 0x5d811870f13631a1, - 0xb17d071b995cd205, 0xf3e44aecbf454edb, 0xe4f12ef90d250ba3, 0xf46061b0b16c3c3b, 0xe7ad5a56e1890808, - 0x47b81187d06519f8, 0x71d01eeeacefd9ae, 0xc04e246d59da627b, 0x3b9d5d509aad03cc, 0xc8103392018489c9, - 0xa0391d9ab8381c9b, 0x1e5aede4cb97f74e, 0x65a1465ac6222d37, 0x1c53819f61387b18, 0xcedefa810d67cf0f, - 0xe760670fc3d1dd0c, 0xc389b431a7e3630f, 0x2798f47a393379c0, 0x111f0fc4e832394b, 0x7a6a967635f00c5d, - 0x68c25522e61b21a0, 0x21e4155dc67d8844, 0x64d0b6c1f96a4f39, 0xa76d0cc1b86b36e1, 0x59c7edb0e3648f9e, - 0x584bb42ff7c688ad, 0xd41dbdedeaa8fbd5, 0xc9ce01e64560c546, 0x8a613df1aa16ea65, 0x9aa643ea3e1bd2f2, - 0xba7668e6aa3e7c89, 0xd61551136ee11252, 0x1432a849c8791bef, 0x8c76e9f8e29de667, 0xa6e76626df1a3c29, - 0x3a237c04e5f080b6, 0x3f906f3dd6edc296, 0xa38e4edc29a3c082, 0x7dacdb7a0b9113e7, 0xe857ab4da0e1d8f7, - 0xc18a413217a3dfc8, 0x2050e7e747bbd5f9, 0x7ef30dc899776b5a, 0x7733aaba4a63a393, 0x70006612378bda75, - 0x6301ef170a027057, 0x7b2e5a18363817ac, 0x050d049b164cdcda, 0xc889c6d746360d70, 0xc0a073485e84817b, - 0x18f6016072f87b67, 0x04f37e0284f2c0b1, 0x0d4a81e594957284, 0x3d1717b6144e84a0, 0xfb112b7dafc5dfa3, - 0x850551a628f7efcb, 0x42d98c6a1701a02a, 0x9e68ede20b7da315, 0x94a78f752a4ba118, 0xeb8a61b680a489a6, - 0xea0d4e10edddcefb, 0xe678c7662d9806f8, 0x4cb0db740cd91f28, 0x0696fd2d41f6b70b, 0xfa2120271f728c2c, - 0x6deddaf56b4bdfaf, 0xb760ca71bcdec2c7, 0xb5ef3de578332c78, 0xe3eaf5152b77e3bb, 0x2bcbbed88561508c, - 0x1bfff285abfa22bf, 0x04f1ef8999041633, 0x71d057ff9e220692, 0x149d7f9d821f407b, 0xa926bb2254b10a2e, - 0x3ace0705c5b18000, 0xea1500b25cf23773, 0xea7ba54ad66b5aeb, 0x5488dc291a92c46e, 0x31cf7f220aa823af, - 0x8cfa3255c9442972, 0x064fa5257dc9dcab, 0x80e94c468e02cc7b, 0x404cba7917012787, 0xa8df0773f13ee997, - 0x99469a064b7e4a62, 0x16687a2d9daad75c, 0x2ee9cc4e619324c8, 0xcea2d16b2e072504, 0x7b344946e441672c, - 0x99f5dc3b15e1c513, 0x0aff16ce327965e0, 0xf71763800e1137af, 0xcaf783a19b125186, 0xad7f546f8b829721, - 0x7b507f30bcf93625, 0x73e0acfc707d38bf, 0x8ce378d8c25f1560, 0x82c5b35441f7bb51, 0x3dc48fbbf8ef1dfe, - 0x7b44c4154d63759f, 0x24e58ff8e7cf2c39, 0xefe19f5f08fac7dd, 0x16d9632fa0c53dfe, 0xebd0de47a0bd8feb, - 0x876b1f09dfe11c1b, 0x5d659a148eae6210, 0x9e152810a5ae08e9, 0x3c63cad05004d760, 0x95bdf7ad8f1bad4e, - 0xafbaddfa587d489a, 0x605652a062f6116d, 0xbc02c2c1ff5fbcf8, 0x5e56e045eb95446c, 0xc6a9db024236d520, - 0x54bfab0b4a5a862f, 0x0859413243637bd8, 0xa2aff9e5b587eb2f, 0x808ed61e627cef2f, 0x5e6ca1ba196fe70d, - 0x3ca4da54ea3cd49b, 0x87a8b8b48bbf1b68, 0x0a88fafd2614d3a1, 0x0ef881b7f32f66ac, 0x68e3000a2f11bf15, - 0x03450d34f9df05fa, 0x6e6226f863b97ad6, 0xfa104c6273156b46, 0x39cc927b500be847, 0xc2f37fd7c23ea1e9, - 0x1a56e36eeb313cbe, 0x6096a18ef571bdb5, 0x573d0c1d01675668, 0x98a1dbedbdc08262, 0x6bacabdeadd425c2, - 0x0bb07aa911920812, 0x30509b614895e0a4, 0x6b9f960ec9b0fb3a, 0x4751f43f40e2fd9c, 0xd493c434ebcb174a, - 0xa03093f2cd4194bb, 0xa442beb504dd4eec, 0xd06797da0b27fcc6, 0x409c272a7c7308cf, 0x7d4dfe791761707a, - 0x14dea03abfdfdc37, 0x3dc9bad821476d78, 0xe1145f1580690b3d, 0x3db878f1119e2ce7, 0xf1f7fc234ccd077a, - 0xdcb75a77090acebb, 0x78f10826bb3aa177, 0x80ec24aa04410d9e, 0x40abf50e253f2c0a, 0xb7a1dba11f487c04, - 0x2d371af010d53180, 0x56eb3e7e9cff3bfc, 0x87c099e71fe2033b, 0x96c11ffcde3bee81, 0x938cb0cf4fe65bef, - 0xbbabf817a3dc9a9f, 0xf75728c34bc0ee47, 0xdacd4f9ad56c0376, 0xf88016e22e9607ac, 0x8b77f883f7c323fc, - 0x0961270c31ee1286, 0xf8b94b28e2410580, 0xb1b311ad1cd28adb, 0x8061d8fa88b9ce75, 0xf84cad0e41443b5d, - 0x9074186c7da1bb03, 0x28ffb0f66f8789a5, 0x5f840850072a7b5c, 0x26702b9d5900f58e, 0xef60c4c7a80de2ae, - 0x5479e10d36d33b34, 0xa199ec381551081a, 0x9b493124ad7226d6, 0x5476605ac467aca6, 0x5d903b0cbf9d0626, - 0x92c6fb85c49e0d68, 0x3e49bd228496db5c, 0x133a96ab489be50a, 0xd65f589cc02f1746, 0x4e54341846b182cf, - 0xb76a7ad1aef2177b, 0x42f3672f9df53748, 0xc56c8727322dd2e3, 0x742d0483b2bc04d4, 0x14ad8df058f0a9c8, - 0x900a970bd008b6a6, 0xb6f65a5a73035ab8, 0x80a3e636b94b6629, 0x28453b7ee23013d9, 0x4b09d6391fb5ced2, - 0x431768bc49ac853c, 0x1f2a1ac8db37153d, 0x74e8d1a6881f5f43, 0x543977e1f32d52e0, 0x7355785c714b6846, - 0x02d520700e2cd35f, 0x7bb7a92f641ad2e2, 0x45e22d5454ece037, 0x2d1ca92bdf1ddc64, 0x9b7771a041c8cb2f, - 0xea8bf5ef310d2fe6, 0x5b90514d1ac9117c, 0x5d1ef7765ec09b1d, 0x82ebc4f8db2f842e, 0x2b999ecac62a4db5, - 0x2c38dd83ef10281c, 0xb8f52deeb77467d0, 0x8bd6651362a0607f, 0x6500c3932c371204, 0xe03c6b77a054ced3, - 0x5575c7510a117948, 0x851d20a7de74e5a0, 0x1713a668b97dbc70, 0x787f609792a735a1, 0x69f6f561fda2d527, - 0x8aa675d8a5065f30, 0x042026ba783d8d5b, 0x50a7449b5b03beb6, 0xc7e3ea71af3ae2d7, 0xe5375ec02f9cb312, - 0xf6124df6d9e4251a, 0x77170894b9176924, 0x30ec3bcc1f20b9b6, 0x74e5caf27757bf67, 0x500ba59c36d2f277, - 0xd7af5f5f59be568d, 0xc7c582205a0856bd, 0x1c834e3068d70966, 0xa5542aefe431889b, 0x4241d0c994110dd5, - 0x39c4860787f34720, 0x747069cf01c8e957, 0xc76670affb6851a2, 0x8ab71ae4dd1d889d, 0x495a86e66c0c6394, - 0x14f8705a6971a190, 0x5a2220f2b929162b, 0x4e4eb124099b30fe, 0x04a5466ec5f540f4, 0xc66b7a53c1485bd4, - 0xa6b4f5ef56f9ebca, 0x956bd7ae5ebdb2b2, 0xda1bdb513feceeda, 0x5daaf8f5cd5b20d6, 0x43c2a0c13573ce06, - 0x4455bdaacb619704, 0x49983127c7ebb21e, 0x8059e3763ae2d17a, 0xbf7aedf716a24490, 0x0208146cff7e38c7, - 0x4d40601ac9912a48, 0x8de0c125016169d5, 0x6eaefddee61c0fc1, 0xefa5d22056ae5d47, 0x13b075a1a2beff53, - 0x9da4317499833b8b, 0x76d7f354db0fdd54, 0x8bd72890de94190d, 0xb16dbf4be8f65b70, 0x379e668cab751a8f, - 0x00d0fd1e4c9b4f0e, 0x4d3a8e290568ba88, 0x7d2c220c18c68a3a, 0x708fc6b3b14fb3c1, 0x9762714905bdf955, - 0xedf3aaf27ad24f59, 0xd9beacac851da905, 0xe98540f2b80728f2, 0x5d102e3d2bbccfbe, 0xe8d3e722d80d1e86, - 0x7d7f76c2d990bd71, 0xfa8b773db6ef63cc, 0xb67ed17bfa1c539a, 0xe6b717982822f537, 0x41cdaf26b43bde35, - 0xe61d2c666804171b, 0xe61b8018a3031636, 0x3f77c5a37547e0dc, 0x6f561f5bb78dc1b6, 0x7ff162f18dd08123, - 0xcdd2644416b54e08, 0x50bf0fc1e60beb8b, 0xda053478be7c0127, 0x4dd5463930a4b720, 0xe4dbd74b0eacea36, - 0x6e34d2efacda2c31, 0xc263e13cb17ea1fc, 0x23add0de42d7a4d3, 0x0c9753a4cf8ba24e, 0xb5ceb8ce5f03ef65, - 0x00aa0779736515fc, 0x92368e7249b31a2e, 0x14bad510aef1a1fc, 0x5bf5c9679380c519, 0x509c24d8e6285f7f, - 0xb73737c9bba1e3d5, 0xb7cd10d26deab16d, 0xea0b9fdb4c35611d, 0x89514d1e4bb2b9f1, 0x72efb183b7de5bc9, - 0x41bbbf1fd5d73350, 0x2a4b8f4a578e5dac, 0x1a78e25d1522e031, 0x8eda9b13d8d86aac, 0xcd8a9c04d1ca6439, - 0x3836b04bbef0b98b, 0xf88af03491f31f02, 0x167a890fe7cc9f42, 0x3e9c493041b99c1f, 0x6d9e5f7646993157, - 0x6eb3c77cff11fedd, 0x1c6fb4e80b1666f4, 0x83d8d3e375ca609f, 0xb323e632afa70536, 0xb8aa2fd1dd908c2e, - 0x6a2e839d435fd873, 0xf48144fc72f5a425, 0xe941ca71152925bf, 0x6a32a326c0ed061f, 0x577da20f3924d58a, - 0x98baf8485566f222, 0x2e28d8e704aee190, 0x2b0efc0835099a66, 0x566d3199d57a77ad, 0x094fa7f3c726c93e, - 0x66c6f1cb925b7559, 0x7a31f605578ad956, 0xacb77a650551cbdb, 0x1fa1a702950d2d80, 0xede37422f88b0da5, - 0x9c105e94c9a15b40, 0x3eb1ac98a4d21d86, 0x37383d1435fd10da, 0x2838792e629593f4, 0xfbb053df126f4a5c, - 0xd3ecd1465fd0ae0a, 0x81a77c23f1de6f8f, 0x7aed85036666e019, 0x86b9f286c6411531, 0xb73a80d23ba16970, - 0xad1078cd9babc5c5, 0x68b67eee8e0684cc, 0xc5a5a6cac4ebf854, 0x35116588b5ec06a4, 0x910a94b22b4c98b6, - 0x553347e5b65cf005, 0x02f985aea9ac9c8a, 0xba6a7a199ca917b2, 0xcb75f676aca8dc50, 0x2681d9d2d574333c, - 0x5337c3bac1443931, 0x00ba84d90ed50b13, 0xd2bb09314520a89e, 0x127264523664b893, 0xb287e560cd697c34, - 0x0b3ae542304c0b5c, 0x950c350d42700089, 0xf447f39313072d20, 0xa4c17ae0730b37f0, 0x3f6b506a68143ad6, - 0x4842d74675a0aee3, 0xafd3ec0b7e8cb1ca, 0xc58b3d9726280431, 0x759214422a2ed825, 0x232713ed38dc6462, - 0x1dc54d4e43cb2325, 0xe778aa706023cb52, 0x4a985096bb731ef5, 0x2c25f09f97cc3129, 0x2b645b93e2a5c088, - 0xba5c61b95c61545b, 0x61e5ac3d5c99d283, 0x2e3d2b8b25fa04a2, 0xfe03620e94b4497a, 0x89400469c77809a7, - 0x9328c42dd80a349b, 0x50b7fc2e203b690f, 0x417c4e3227de4391, 0xca836646e4a4c20d, 0x10206c361d72920b, - 0xc50db6c807a69a93, 0x80034372ebf956e3, 0x26c5cfd2df771575, 0x9ae52e6f5b163640, 0xa705f0118d1b129e, - 0xd04de276fa5fa0bc, 0xceade0172c68acbe, 0x070c5d0fbd330469, 0x97621211c16d74e2, 0xf034a890d04ae9d2, - 0x74776da0b06888bc, 0x9ca81dcf1580d15b, 0x1ceeefa31716145d, 0xbeb2a25eed0f8feb, 0xe3a918aa884ef541, - 0x1b34b51265ce7f4d, 0x41262b19e6719ca9, 0x3a88490d6d384fe4, 0x834e21759bd018e8, 0xcf721dc98d6bb21f, - 0x0750e2f64d48d07f, 0x2542de30f66e24e8, 0x552c669e64042351, 0x0456b71f93961485, 0x448dc05702c98d40, - 0xa592ee0313774c4e, 0x0ad948945e3cbd16, 0xbdc22ed052442e6c, 0x22aabf30809a0bb5, 0x801fedc0221b5b1d, - 0x0a5f4ee7824489c4, 0xdb82e301daa86d8a, 0xc840df5fbe9cac63, 0xb3963a2f2cad4e50, 0xb6b48a14b3958510, - 0xb1b0b28065c2caaa, 0x0b9ee2ca9e242bcb, 0x9a24e1e232ad2c4f, 0x0b01cfcbf6432c11, 0x8e0a5c9f0537c536, - 0xc3d6fbcbf280e57d, 0x6560205485076193, 0x825d84b9b89934a5, 0x3c607a4504f5515c, 0xdb2bcdc0aa963d43, - 0xe39a3f53eb3d31bc, 0x4fd7916a15165279, 0x31d9aaebad1b170e, 0x2ee8bcf97ccea239, 0xa9e9a80453a11bcb, - 0xf8039bac879cdfe8, 0xa7fec9f5d26b05b1, 0x3ef5a1bcad5e1db7, 0x8ce93a3c5c10071c, 0x5d88f9de83485868, - 0x54f7405c4a369dd1, 0x46f597917d83cf84, 0xcfa17d8225d9a8de, 0xf55c2e71ab1bd5af, 0xaeb8c3428dea01b4, - 0x17ab97670a2242ea, 0x2a155b1454876940, 0x116a9e9c32396d20, 0xa73d647a402eea5e, 0x31d488a9ffa48149, - 0x4cf9e7a0db477774, 0x6dc9e3cef47f4854, 0x0bb7f1ff97bb2fef, 0x6aebc8f6fdff7d0a, 0xacdb9d059644183c, - 0x4ac85cf0d07126dc, 0x38e93821be8e2c04, 0x281612ad2181b679, 0x9ffdfdf654d3a973, 0x246c77dfb55ef78a, - 0x39aa71d7ae69d71e, 0xfb932d1f3b04c402, 0x114fa62a649e4a12, 0xfda45ed6c3db7146, 0x35e94db926938548, - 0x8e7493ce139c3c26, 0x1477be87d6a3f984, 0x1bff597cb8bab991, 0x980174ae0c3bb45e, 0x24dfc5b23eec1357, - 0xd7398b51f5715a4c, 0x7facadf7c9058eef, 0xc5e3ab5ad61fbe8c, 0xc36ac95be95b1730, 0x352a5470e7616ff8, - 0x6ce1655fcaea8113, 0xdbca7bed2951c2cc, 0xfad5e11094a9aed6, 0xc720a4583941cb2b, 0xf72acb145d76bcde, - 0xcf4e875407b541a1, 0x3332fea517855388, 0xc228f84007a2efa6, 0x6c4ed376fba8e009, 0x27d6e460f43bc64c, - 0xbe124e7c433eb194, 0x9d182ca567b866c7, 0x932b78f3906978ce, 0x1ebca16dfa8f59c3, 0x66c88a5b18d1780a, - 0xde4c351e54b4e796, 0x0d101e2ed065eb14, 0xa7ba0489fe84a228, 0x17709e0c3f06efbc, 0xf281c3a34c0d657e, - 0x4552ef109b552d42, 0x67862b55b6f86dbf, 0x8be77aaec5283275, 0x11b7fad0af466fb4, 0xbf13d64066472425, - 0x98d5c62c651ff3d1, 0x1c06f1aaa1d3c5e6, 0x218d21e93646b694, 0x0f67e23b61aec2cf, 0x2eb08fae2ee33bc4, - 0xb74c0644c78bb8a9, 0xbba8c59ea0962a28, 0xcfea1b14252e859f, 0x0c283b8402237281, 0x5f3c62222f7279bf, - 0xfbaa4eeb7d83891a, 0x333fd4d54148f632, 0x96bcdb3ad692faa1, 0x3b29b676cc3725c5, 0x6edb9d9469ccf92a, - 0x53615905b8a1e9f6, 0x22e446b2b5eadec3, 0xa104e1272a07ae6e, 0xd82afa77376d79e7, 0xd41cfb02d3375a49, - 0x11f206565e220c1e, 0xb110c70a76d9ed5c, 0xdabca2683116b31d, 0xd0ca2c74c08eeaaa, 0x225f548ff5cbcc92, - 0x0a9a2c0961b16080, 0xa58d962fd2741859, 0xcfee590c27cefdaa, 0x5aae088c43b8f5b6, 0x2b3ee24440beae15, - 0xa24d2f1a4449fce8, 0x05235814d679c99a, 0x74b1621bfed9a929, 0x0d668f95ec3de298, 0xc3f9ec45fab322e6, - 0x5c929cc877a111f5, 0x069e336c17b0301f, 0xc693eb95f5bfbcff, 0xb67fbd42e28d95f7, 0x2b1ab4adb53218b1, - 0xfe222b7eb657d406, 0x64657363e3af6df8, 0x2e99c062a93b6c42, 0x5e713a6aade01468, 0x5fff56898b886b68, - 0x7cf01cb91bce6b3e, 0x226158248b9d8f59, 0x51e5ed2c5863e12e, 0xa096208a76b4ab93, 0x6d160811b7340a39, - 0x9f7555145abfc182, 0x78bf7201fd126437, 0xf951386dad90dcb0, 0xbd229a042b90bc07, 0xca2cac55d0867f9c, - 0xd1ac79c2640b9558, 0x9ec8b1ba53dccfcb, 0xd6540187d644e85b, 0x926e1a942c176d62, 0x51c3366a0582512c, - 0xcf417d8951af3b75, 0x6020c00db5a87315, 0x0e9eb4af04019054, 0x54f742bbac05ebf7, 0x55ed8764816be889, - 0x872062a165872fe4, 0x19faacee2de8e853, 0xfa213270d9be448e, 0x69bdf18ac579c289, 0x744c88c8e637d692, - 0x7fe31466dfa44df3, 0x1301081d5951a895, 0x97161abb42745e95, 0x15e325f0df701a7e, 0x429137a64000007f, - 0x0f25b3bfe2df95b7, 0x1c8e0698a2d83406, 0xb69cf3ed956b9dda, 0xa8f628aa7dd99c9e, 0x75e14edd9660b6ca, - 0x98aa688d54db90f7, 0x94a8c4eb7e0a379b, 0x64ecf5283099665f, 0xbbce0b4d0d4667fd, 0x09942d334d58e585, - 0x8b55b604fe7d3770, 0x1b439b28da3bc449, 0x6e5a019d8b774240, 0xa0d9cde90a9e8e17, 0x4d9c550013aed8b1, - 0x53ab56d627808125, 0x93028039fb4f0240, 0xcb3105016be0e340, 0xa8ee5c7a5a625555, 0x2eaa4f07223cdf42, - 0xccd039b710ba955b, 0xf00b82cb1e01d8aa, 0x010d0b7e12cc6a0b, 0x03e0f40b54cec5e5, 0x0acce021a92be04e, - 0xcb3445d2d95a69a2, 0xec27e28cd768787c, 0x2c3e97a52acb5971, 0x03ae6ce0ff291e29, 0x50f3276226dcc4d1, - 0xe128182ae0267b80, 0x321e3d0109aab1b7, 0x4a54e44a931a595b, 0x7c6502ce577c4cbb, 0xf0f92bddb76815fc, - 0xd036519ead958d36, 0xec2c60d04c1fff6a, 0x224053ff1210b6f3, 0xf44b394670db41dc, 0x61fd81835bd2677e, - 0x0d97eaf32fb3ad3e, 0xa9c33223012349ec, 0x09760421cc6b0a88, 0xc70ad9105c81ab4c, 0x6103d616e2fff709, - 0xc01fd21cb8fe458f, 0x14b7c832159725aa, 0xba9e925ad4f0d820, 0xca21c701b704d1c7, 0x2092a6750c9a7806, - 0x0699e7db5f12326b, 0x6fd941e7fbba1926, 0x14fefc422950e94e, 0x01a7c81f8d5e69f0, 0xe65164f885ccbd52, - 0x5644b3c0f724a596, 0xda4f354460a1202c, 0x19095399de79a8c3, 0xe459fda9257e5f2d, 0xf19f30e7e4c5e0b2, - 0x0fbf23d81c2ac0b0, 0x7758a938248054d5, 0x16aa589e19d112eb, 0x04783f1d054687f3, 0xd9b1038166e8b863, - 0xb1182987acacd25e, 0xd81d2be9c3233c6b, 0xe69641f368d0d600, 0x9f19167c22e0f02d, 0x8f2f48074bf07dd8, - 0xa7175b18daaf0437, 0x0be451657e144a25, 0x9b899a4cca50c896, 0x84fcbdaa5caa9561, 0x6324c34f7a6b3a71, - 0xd7675d4cd2c7fe70, 0xee951a4b24a82a95, 0x7867c8d458a360b2, 0xc1654919ff0d0a3a, 0xda059b9e2dea8364, - 0x61b90eaa228564fb, 0xb64cebbd30b5aa8a, 0xe9b4f0b2821e8e36, 0xc30b11b078d9a53f, 0x062a1bbf199a9c4e, - 0x55d5aa33bdade83c, 0x56b552b34ccf560c, 0x5584cc4ac5149acb, 0x6ba50a224ed3afb2, 0xb4e89990bba2c565, - 0x63fd1ee7e76b893a, 0xda8b19c32447d813, 0xfd891897a77c96b1, 0x9e18265c3c5391a6, 0x158c1e365eb7e739, - 0x85626ec2e1cb8ec3, 0x61e38c2d2f5aaca7, 0x75b64b7f5a94d0e8, 0x3687f040a2d19ca4, 0x07f2a101ed292ab2, - 0x01479f43f28820b5, 0x4bdd4add0c14767d, 0x29be57d03ddc9590, 0x67a91bb450f72175, 0x331c7932a9a47020, - 0xeac1141e863180ee, 0xe71b40179dbfa198, 0xa3a5bb2f6c0a8ec0, 0xca1a521d1f28a49a, 0xe3b4251423a05927, - 0xd298520ac2566269, 0x81dbab9326a2359b, 0xfa6dbd2b42eb0a3e, 0x2f9b792d2ad424cd, 0xd902e777540e6d20, - 0x25b07a241423cae5, 0x469558d8865ac328, 0xd531b1bb926c5712, 0x3fbbbe6321f57b0b, 0x09966a652cbaa66e, - 0xa063f1ffb300db54, 0x8f9df7ccbca0ca05, 0x3ff3d71114a9ddd5, 0x1228a3975f87d826, 0xb812dfc266b44ef7, - 0xe6d8ebd32e0aeee5, 0x7c0e060e4d605ffd, 0x6232f803934bc7b3, 0x3105f689d5b2ab16, 0x7b8b38085cd81dfa, - 0x8b1be7b7c2b28d73, 0x61773f2c2a6daf58, 0xae15f830ecc38721, 0x4866f25ea8ce2dcf, 0x0879acb26cf13083, - 0x79823b43f8c10a7d, 0x83f6c437284c356e, 0xbd51b77db06c4fe6, 0x727d7dbd405b78c7, 0x5b6fa0b7d8c3f90b, - 0x956868319236e382, 0xc32bdd350d7851c2, 0x34e2b8a540aa8587, 0x9cd3e9fc0d0fba37, 0xd3c2834fd9d7b6d1, - 0xbd8e8f1330919128, 0xbaf74a3cfdf5cb4d, 0x18eb5c6ee19f2bfa, 0xbaa22fbe5a28bc5d, 0x41b7e7e35a027199, - 0xa910ba829bec905d, 0x04acf46072c59ff0, 0xf725d7a6adba1c31, 0xd69e78d573bf47c8, 0x7b3b7b6a2de66166, - 0x382fd852aa2c9ef3, 0xb9c8fddbc2cc6e54, 0x8a1d251b157f31f7, 0xaed53936ea9876a4, 0xadbde5b698b9665b, - 0x6ecf984bb68fdb33, 0xe750913d875fc576, 0xbd0e355bf1c07f4e, 0xe3e03db397d933e7, 0xafe11d058e42dd9e, - 0x39913db3873d73a8, 0x7b66ef867be6b071, 0x0217511df88f257d, 0x5fd2fbbde99e19ee, 0x9e9351eb6ebfb5d1, - 0xc2fe19eec2d11cf6, 0xe0eea0355e6b6e22, 0x89f6d3751b3ac86c, 0xc87abf71097d9697, 0xab0f1aa4ecf772f5, - 0xa118b46e923b47fa, 0xbba916ad9b5b6ae2, 0xbab92d36ad3f6b38, 0xb7df9750664ed596, 0xf3819ce5d656c354, - 0xa522cc4c951f29c1, 0x7b32af886b3abbd9, 0xb269b269edc24d6c, 0x64bd03bf05988c53, 0xb3208bbbb05b3f1e, - 0x818b86b474436ff9, 0xeecbdec7686c3965, 0xd3ef8425a6148cf2, 0x6c8e6a9e8480aeab, 0x1109b5d70da78e6a, - 0xe64bd04be483158f, 0xac7f40ca784ce512, 0xdfe53c25ce224ae6, 0x049ee95d0b91ce5a, 0x326cdf0f42b6484b, - 0xe63f817f90d76969, 0xd192e5173becf0eb, 0x41ab2ac3435645a2, 0xc75098d993010f0f, 0xcb1cab5323137e85, - 0x35fbbbaed95f0a2e, 0xe7132b2b59aed8aa, 0xddc92913e438fd6c, 0x52a6407b27e3e6f3, 0x0d02be0e8868dc1b, - 0x1dbfc469c0b40db9, 0x8c10e325b252c03f, 0x8320611058bf49bb, 0x3666a72fca891687, 0x93e2abbe55b33007, - 0xfa2f93c5fbcd5905, 0x989900221de1a7e9, 0x4e2c88af1e5bb52d, 0xe7bf2e57f34626c0, 0xd906a250e53fd542, - 0x2bba6cf9a5b5ded3, 0x7a5546e2d9b2454b, 0x712d1d613af3d08c, 0x5b5b0bb656645059, 0xdae9c7c6512d6d30, - 0x36895d4a97c418cd, 0xc906f87e7efed69d, 0x5e497f81c9e31a6c, 0x1e1b8bcbaaeaa557, 0xa5a6ad810df1c7a2, - 0x0db1e0f2b12d21cf, 0x59d6533e4087ac22, 0xf498d348f0d6c07f, 0xceca7b669e4ef509, 0x9cc4df33652157da, - 0x4e42f20744ec7c21, 0x13566bbcd96b0358, 0x877ef1059fd41670, 0x767f7cb93725996d, 0x49e693becf5d2b06, - 0xe32293159c80c7ac, 0x49b272dec70ee84d, 0x21c743d4418bcb05, 0xef5b7ea57940d91e, 0xfb66937f338525d1, - 0x63715ace39dc44eb, 0x3e3d53f53290a55a, 0x4057bd90ae984a57, 0x0ddf025f57df02d9, 0x93d482e9ba65f327, - 0x04a7d06cd423f41c, 0x4c20e3e1b9f3d3f9, 0x2ff36ee3d8c5c5f1, 0x739721374264a2f5, 0xe4029c0a2838c077, - 0x5f867e38354244fa, 0x074fcdae42d45b86, 0x444a8b05299139d3, 0x78f413f7b04c9b99, 0x9271626c28159137, - 0x71410a479647069d, 0xe95212729aa261c5, 0x5f486ef76777e284, 0x2069f5609c8e7a70, 0x29c5f6be754c6b99, - 0x77a2a8d8bacf1bf7, 0x04d30b2bf9c50dbc, 0x85d0a2a43ed1e644, 0x91c9a416a3cc502a, 0xf965b002eef929bf, - 0x415a909d7bb430fd, 0x28a389600a295e41, 0xdc338c0c0a242065, 0xab72b51711726907, 0x7a0a6ababe3dcd63, - 0xfcd5a440820a33c1, 0x77b1abd926d37616, 0x8905542ed3800878, 0xdeff6ed09b8c67dd, 0xe9bbc0e62abfc5dc, - 0x0425d9b8484ed38b, 0x24390ed2a3406e76, 0xc16a721c887c8f28, 0x9dbe377a8b36cd15, 0xdc51ffbb762c889d, - 0x89ebdb2384b87817, 0x131ca4cf30f7cf4f, 0x9e0cd89addf135f1, 0x36a6f1a4a260ed2c, 0x1c6c612dc4524a5a, - 0x419e712855628414, 0xcde9c41ecadbbffb, 0x9258977ec7bbf51e, 0xe37ec9deca10c0cc, 0x987ccd687bc599eb, - 0xb89a10afd0f67708, 0x51a3867b861e5dc1, 0x2e2feb5c7acf6665, 0xc65a40bd3d9dcaa6, 0xcf392b0c164bb0f7, - 0x2bdb4ea4cf34afce, 0x6e898f89cc7a0bdf, 0x33a48783fbffbbfe, 0xf1a00b4e50ef8c0a, 0xedaa40d6e138d3c8, - 0xe75b926550e49ae0, 0xc8b55c6cf537b936, 0xa07f78bcb2eadbf0, 0x3a66957d5f1f5f40, 0x450bcee2aa61a047, - 0x50251694c91eac46, 0x159596b548d1688b, 0xed38d16c2920cbcf, 0x48293e43cf1dc909, 0xa407af125d7f5fee, - 0xe9ada71e71015f4c, 0xc67fc0da328c2b96, 0x3b37a2a2deb12389, 0x1ba430716dad009d, 0x24e1851557b6f026, - 0xefd532b2c5c69a01, 0x511f1767d5b90304, 0x66015dafa11832a5, 0x3492cb00515f2876, 0x88774ef07860fee0, - 0xa407899ba524ece3, 0x2145dde670bdf0f1, 0x25c179296a3730ac, 0x6e0001e7280c168d, 0x02e814389c5d81ab, - 0x0305a9da05161a9a, 0x6a92ac8cbc378f97, 0x2bcede678d1c4720, 0x981e83f2aa3960a1, 0x1b1c9d58d2cf4842, - 0xe1e6f875100b509d, 0xdc85ae0c34765028, 0xc69f77dce85910ec, 0xa23bbb5035127791, 0x7ed757bb88babbd5, - 0xc29c7e89b369ee02, 0xee7011faf925a490, 0xbe26f19d1dcb9b92, 0x29dece805ad9a436, 0x8206929288084191, - 0x795082bd44bc2a09, 0xdde2557788879f0b, 0x8a17ba43e84be83f, 0xe87a4651b374bc40, 0x97dc310e6725c697, - 0x01abce6dc9a0fb85, 0x8ce2c5a595b30625, 0x2800fcdd18c4d161, 0x9fd5171cecb65031, 0x751e689ebfc540db, - 0x0493443e837c564b, 0x700fed6a6043f133, 0xcd6c7e3a29f9662d, 0x0a02a849ccf850c2, 0x2f8b112941a7267b, - 0x4b621dcb08aac951, 0x1358a6379b0ab85b, 0x4f818017d9b45166, 0xea63a96a2c26b091, 0x89574f4cfdd78d57, - 0xcaf6ec8f9659c98f, 0xbbc321a944faa55c, 0x74c061e4aeaaad59, 0x153aa20bfeeb9c12, 0x3f945ae044dabd00, - 0x8a16cefad4c03c60, 0xf87b5135f3cd1a25, 0x3a2fca51aabb7070, 0x8e1dc6f0855e5ab3, 0xf0cbd1efd80571c3, - 0xee224dfa5b349e89, 0x78104906143c0011, 0x9275a290065e21e2, 0x5e708d4981284812, 0xeba3cdc536b0437c, - 0x748d654f61aa304b, 0x3ec11ccc5a054886, 0x5c8206588a7efa9a, 0x6e4bc50510e8b565, 0xfc77128ac1bf56f8, - 0x23ad8f9d186663cd, 0xb5faa6f955b240fe, 0xcd58268bc330c5eb, 0xd46597538a2e1b9f, 0xb9c2561c64926582, - 0xbc4b3acd9843492c, 0x5e7cb1c73135758e, 0x302798c769d6f727, 0x5d84d67492032dd8, 0xa2873583394e8bce, - 0x003e1d2c270731b4, 0x7a73c94e2d04aa4d, 0x4e2d2429b5465e05, 0x2bce11a117672384, 0x286e7f0b6f04a3c6, - 0x7b0a52d83d011fff, 0x1fa0a88820a7e9fd, 0x0a3ea7a1be83e0b9, 0xfd83979cf2c31429, 0xf4983a195f72c24b, - 0x4a780ec2867ffd44, 0x159e5f9c814bcfbf, 0x7fa4dfdff64fbbbd, 0xaba7c7a792f68cd3, 0x10cb471ad81fe0e7, - 0x77dd1efff865861f, 0xdf43bf837f7d4759, 0x0295e48ef15b5e06, 0x534e783ad530fbdf, 0x817abcbae8032117, - 0x9371af3f9deed4e6, 0x08f8509b0d66304e, 0x052f57931b2f069d, 0xef06bb10231c23f4, 0xcba8fbc7e0b44bac, - 0x2b5cc593bd53729b, 0x71902f0041f30c88, 0x3f6fbc9c765e0c28, 0x7af4700e2d94d59a, 0xe202e28e67dd3887, - 0x068ce45fc69d2fff, 0x677575f7568ff1f8, 0x010f9f0956c5dafa, 0xdaed290fed4b7260, 0x0817e42fa03ce688, - 0xbcaf28e430d174bf, 0x8ced5edf60b28ebb, 0xe7f7d4ea973a55bf, 0x7eb9faeb717ded4b, 0xc7df9d92541a0eb8, - 0x3f7c701e90b77637, 0x5a8e3425d7991220, 0xfa9759e7a806e4c3, 0x2c653c3d83e806df, 0x28d187a723fa7cf1, - 0xe2b17cdc7bf04d0d, 0x11786d6c0750c8fd, 0xa9db01ae107062f0, 0xa20befb13ffa9f34, 0xfbb5c653acb49a4e, - 0x161ac1d7e63df9bb, 0xbd257f1f3f4ddbdc, 0x1fa01147f4d77891, 0xd4d61ec1a1c30fd3, 0xce97bfbe7d3c3978, - 0xf9ebdb2f3dbe680c, 0x93dcd5ebec9cc1b9, 0x0a5e37d0f5b8ee8f, 0x98b1e5432f7399e4, 0x7a627767d8832743, - 0x4a567fd2da868601, 0x956aaa45af5aeb9c, 0x2631a2df0c5e536c, 0x1efd364f5959f792, 0x6f06a441a71b34e0, - 0xe3d15ded8f8b4249, 0xa73617a4d9516859, 0xce656d082d906003, 0xcc00e0eee2a85d3b, 0x4cf8264880d2cdb5, - 0x8e58dcc21ce63b40, 0x533d9e3370aac862, 0x03713237c8fff9fa, 0x0cb4da619f78fdac, 0x0b474190254c7d15, - 0xee39c267070f2dda, 0xa184b5f511b178c3, 0x91e7e7c41df6b809, 0x361b85069a38a071, 0x1cb8c8a3643540de, - 0x2a532007b737d7ef, 0x3ea22747b3bfd3dc, 0x022bd6a2d6825d3e, 0x5afd8d2058e14587, 0xa779afdf47e4a515, - 0xe0015669f838ee77, 0x8fd9a4eded157820, 0xdc190cad84ca1667, 0x1c6815f83c9f3ab6, 0x87ce9d5d69938efa, - 0xb2b4c575dd789e32, 0x5c113db338793e9e, 0x3c8246634c602ec8, 0xad1e69ea3e510029, 0xdc04cd6bba2e11e2, - 0x83fab50620684d2b, 0xbaa8e3050cd7673a, 0x88f7114ee5f437bc, 0x83de6a166a1251de, 0xb8bad93035e779b0, - 0x0e05dce28838252d, 0x78ddf87ad6b9f51d, 0x490d334dd1352304, 0xd3eed5b4f57cda18, 0x551d4cbc1c5824fa, - 0xf58cd8b07e9b704e, 0x62a72169fee472e7, 0x5298ad69c60dbaa1, 0x27c49407efc8ab92, 0x68a82ee469f21a37, - 0xbf87a1bf41f37998, 0x79eecc1d99222e22, 0xab39fa175d922808, 0xb7f807ec2a46e0c8, 0xba1cbf45c3d0427c, - 0xc2cfa42e22a655b7, 0x3698bee0f6bcf070, 0x84cd397d86ab53e9, 0x2e9f03b2048814e3, 0x0371587830827200, - 0x62cc07359d2e7aa1, 0xba3c805928ef14af, 0x244dfdbe38096560, 0x4584a889ef79afb7, 0x948e44eff699da06, - 0x915b4e2ff6702fde, 0xa5a41ff9d2c58c44, 0x7a29c8e81fffc3ac, 0x3096e8abb24e5976, 0xb6df65fa49da2db4, - 0x238661b29517b597, 0x299b26273258eaf2, 0x49ff2d36510fa050, 0x7bd0515c85e2a17b, 0x3805eada945c1ae2, - 0xb1c46d5ed285bb1e, 0xae46bd83f90c8ccc, 0xaf24063bf77d6962, 0xed62f341bf96e21f, 0x77277e375060d172, - 0x2e71b15feffeaecc, 0xf15fe6cd1988537c, 0xdbd5b694c5d621d5, 0xc4dcb02560d94832, 0x75cc0b354ca6f96b, - 0x8f7459c9bacab761, 0xc79488a8769d07f8, 0xffa817cb940b982a, 0xe9a5782bd80b161b, 0x1e12de5d78b4434d, - 0x46d9a5d197b64072, 0x8f1b54bf99222604, 0xcbb0e8ffdbf0eae2, 0x8c1e17e551c19019, 0x19f0d26fe76c4b95, - 0x388b1a9df229d61a, 0xd10fea0409b9684a, 0x48c6d8e04da0cfd1, 0x1fa18e86ee1442d1, 0x108d9c908756a6ba, - 0x5261244e3aecddc8, 0xd16b8436effef1a3, 0xf1e634c0016fa0e1, 0x1d2ab17a83d9a9db, 0x14d0390f3e491ba3, - 0x00c959ea5075d9b9, 0xa707275ea67ceb1d, 0xe815be8893e90d78, 0x97395122fd979edf, 0xcb15fdf7d083296e, - 0x849e24131e67781a, 0x048c66b2c8ae689c, 0xd98c78b4d472b944, 0x47aa20406f8df56c, 0x234e8f47165158c6, - 0x347d8e46fa466a52, 0x246dac3f9a012c61, 0xe8d452101ca5977c, 0x88962201a5a27839, 0xe6f9400711396299, - 0x1908cdf2ae1de3db, 0xd158146cd217842e, 0xa767a0e2c5ef1bb0, 0x506a1bad5b6915e3, 0x6a5a9b88aeb1582c, - 0xe2222f27659c8e5e, 0xb1d53c2de81ee629, 0x116a84b759f7fadd, 0x1370038d6ba82919, 0x4293c4a9be6a310c, - 0x8303d0505b6c63c3, 0x9e845e6054614145, 0xf7357852230a3c2d, 0xf7b633b929dce4b2, 0xf59d615912bfa1a4, - 0x92e2a58d9876789f, 0x3bb66a9f631d81ac, 0x8d5ed703a4623be1, 0x74f062f532a2dba1, 0x31a1800cf9810180, - 0xa19e9d24c4c6710e, 0x49f1360e32fecdd8, 0x8b70525c29861c64, 0xa7a3f10b29398292, 0x3186ab2d7d9c04fa, - 0x245113cb793ee0e7, 0x894c63eac240b2d0, 0x683ea3e0d5a00ac8, 0x60aef38bc1b839a5, 0x6f0756c9d167549f, - 0x5f500344c74d1e06, 0x55854a5f7ed7d8b0, 0x05671381d448ae3e, 0xb47ca0dace7acf3b, 0x63b712fbd8783e6c, - 0x9a963b5772dda1bf, 0x5c72656fe5575bd1, 0x17add393f26f5c3b, 0x43976a456d30e266, 0x8442f3b35b788b06, - 0xaa56a5bdb057100c, 0x58b2dded7dcb29fb, 0x84f5880be38a2682, 0x5ba79316ab062cc2, 0x5a12e200a686450a, - 0x6ba09b88fc1f1d33, 0x6555bd1f6cee639a, 0x2a27914d14710a87, 0x65b60ad64ad87072, 0x8baba16de6e61121, - 0xe882452a6c6fa2d2, 0x71f3eecdc09ebae1, 0x322cd4df5d773cb2, 0x04214bb9df29270a, 0x6e025575574b9105, - 0x55ee6bb220243352, 0xa04988a558fe6c2d, 0x74068973f9c88272, 0x55b82e734b93efbc, 0x503aeb78265b558a, - 0xe4bdc8642b689905, 0x9e5fca6fb8400f36, 0xbde38aae83f3b79c, 0x8bab9787b004a69c, 0x77854aa406051319, - 0x5309e702dc62708a, 0x9d211f075c1573d5, 0x62c055365bbdafc6, 0xaa0fc456f5efaa00, 0x73998ba916295464, - 0x98bfa11a4caaff32, 0x1ea944c1d9d0c954, 0x18a394706fdf8822, 0xce14163d2bc0070d, 0xc8ad4005272864f1, - 0x88a5c544deaf348d, 0x0bcf817e1275013a, 0xa821926945ad1819, 0x44e56db9447039a1, 0x1c893a685c05cd7d, - 0xcb58a48f91886b4c, 0x8ca9b5239d839b51, 0xb02e849dc73e5648, 0x63b3bf8d4d6e2207, 0x471d6b8781d5e562, - 0xfda3485214b69222, 0xc7e498ee71e63019, 0x2a39c25a5488b670, 0xea887c7373711d1b, 0x3dc52ba5312ba854, - 0xfd270615aaa87eed, 0xb439edc9ef5c555d, 0x42d8e8fd56494049, 0xfb49de9b6098a182, 0x601de2dfba704930, - 0x6a587bf529b921d0, 0xefbfc47912e591da, 0x24b744336b61dc99, 0x3c9aeed69ed45a35, 0x48fe9f0d440c49f2, - 0xc849132ca9ef0770, 0x6280cba23dee8c1e, 0xcdac9c86a2744547, 0x4d0cbcdbf9577795, 0x0a4d5b136c96fa2a, - 0x1c12addd167707f5, 0xcdfa379239694d49, 0xbf517b477f5dd787, 0x5778455980ed8595, 0xcd4d9f874ec23ce8, - 0xcd927f92a92f009c, 0x04dab2be110ac72d, 0x493e38e7c66eadd6, 0x0210fd21d7c17fcd, 0x538aeb499eb436f1, - 0xaf9624103174540d, 0x804483c93c4ea932, 0x0d8f64c6d210bed5, 0x1f84a074b4d6fc87, 0xc21722614c3dfc9d, - 0x17065e81612f98c5, 0x6834328bc5c13cda, 0xd81d7706d429dd22, 0x2de8f5eb240d3031, 0xff8c1b093ae6818f, - 0x91039920e972600d, 0x44a3eec66376b0ab, 0xd62a89f0b3a3769e, 0x20c638b2c73b1106, 0xda6373a432ece898, - 0xa9ebbdda2e5c2a6c, 0xb6dd8af7be2026f5, 0xe1edf1da2e98433f, 0x4dd8f117ccbdeb75, 0x0b223af0f031244e, - 0xf84c4a062e0ca26f, 0x0dcb7ad21904ad89, 0xbe01cc2da6503cc1, 0xbf3b1248b2bdd687, 0xc240b68926ed8da4, - 0x1185a6efa149d0ae, 0x73e7d7a365944e61, 0x63ba03fa6f0ce733, 0x50ec7944f668e31d, 0xa82a3dc6267c52f3, - 0xfd2812dd4aa78dba, 0x8732fb41195de131, 0x2c9d2979f5c1cc23, 0xa439e360956c60a0, 0x9b496ebf06f01d30, - 0x64840c7746310a4c, 0x0d635c876f0c7283, 0xd100f2c68f10fe9a, 0x7d05edae76eb1d57, 0x050cf3d114ca547d, - 0x3987a1e2d3ff610c, 0xbf06a44931a46d86, 0x0548bb64a331c57f, 0x43ac8dd62d6a8e5d, 0xb5dca821b400176c, - 0x68ca00418b907637, 0x9b6ec577eb3703cb, 0xe30f7b21585940f0, 0x01107c54b386dfae, 0x3f7df9b8deaf07e7, - 0x107617d79886a173, 0xd4f10b8ce005e3ba, 0x8dda839d29fcc4d6, 0xb1e2b071dd4a2232, 0x0b414a3364965d5e, - 0x71e43fa5aea042c7, 0xc4e5de70c8022d0a, 0x542b39b1c7ca6f4d, 0x3788ef334790dacd, 0x78b378b29291eb3a, - 0x179dd6754dec76f8, 0x1e374744969ff0dd, 0x0bcdee1e6d34e086, 0x4e6885101a33db89, 0xbbd3e8a6519a500c, - 0xb03d723db3cd0698, 0x07e087b31966520b, 0xad4b9db89dcc1050, 0x32209b0ac0ebddab, 0x1a4a4bc60234aa80, - 0x3d0295bb2d7aed4c, 0x07622845b73083ae, 0x85589035af346adc, 0x281992944eae23c3, 0xf4455a1ce7eeecaf, - 0x65597c372f405002, 0xcbe66b0980a531aa, 0x4a230dc171cfebd6, 0x5179d79fd638355d, 0xd202c2f866a746d0, - 0xa50cb47072249672, 0xbeb17fe3acfc3b71, 0xe3df55c583846d31, 0x7248786d377d21f3, 0xfaba6ae596a3086a, - 0x8085b61433b7c8f2, 0xafbf7b6bb345237b, 0x4401a9b149642ae8, 0x07e6891c8792574f, 0x7dabff30199ca7c6, - 0x107177f6a428200e, 0x619a33432e141734, 0x9415ce95ddd9d017, 0x6f7ab413bf519fb1, 0x298c7910f91ace67, - 0x9147359262058f1b, 0x3cc0f9d2c34ad708, 0xc2eb578f384231fc, 0xf0a6be357e93ab77, 0x0537f1291425c93e, - 0xf42fefa5f0e57503, 0xba915af17a0d3efb, 0x47e472e32d9426a1, 0x7c3de9237405da96, 0xf2d28dd5d04eaf61, - 0x33ead6fa6d00c32d, 0x355d3ede27da934b, 0xbb04f1c057ee9369, 0xe7ee46e3674417be, 0xdbf8bd4bdfafe8df, - 0x8dc62fa0947ebddc, 0xdba835beeeb2a016, 0x6a134f2f2f567f81, 0x27825378db60bba0, 0xc1a769e1598c61e3, - 0x8ac431868d33e2e2, 0x673aadbc9812a8d2, 0xc93b273b344bb420, 0xc489ae9f05228eed, 0xf14c752fc3d8b108, - 0xc5e07a9fca3b750f, 0xfd0062cfbd21e932, 0xf97530ebfef1e41d, 0x79ed6344fe3384ed, 0x091c14d0eb1aebec, - 0x1cb1fd0cc2e1f157, 0x71547e9f11130fb1, 0x079030db932b8ee7, 0xc42ae76c9ae79bae, 0x540c2baf90cd2ba8, - 0xa0915c60490db462, 0xb0e4a481a4f184a7, 0x58dd7cbe7021bd00, 0x3f772c534c44f374, 0xa94114cbe7b2a2be, - 0x78291063d3193f3b, 0x3d0e397719cfccf9, 0xec39d75394f4e345, 0x658d1f2f7cf99059, 0x361efd88f5fc7c04, - 0xae58c0640b9d66eb, 0x11991ea94e6e88c7, 0xc379e2a7224bc3c9, 0x230a0c37ba381210, 0x25ad4ceb27d75c46, - 0x7b2d6933cd750a39, 0xb2279dece39ce375, 0xd3fc6158990e9d31, 0x9d787c340c30b3db, 0x9b3ce5a2f28a513c, - 0xa39f36b7218938f4, 0xcb0dd529f76168ef, 0x7b4ceb2adfbc7452, 0x48bb826422fa9a29, 0x14001f50469fcf77, - 0xcc5d3db636614612, 0x960f0e347e01c4b7, 0x63c1e5187b2fcf3c, 0x74e2baf270585893, 0x281f753618beda22, - 0xff81651d1243a3aa, 0x612383d8133d9141, 0x44e9103b007fe065, 0x10d73effd87c1d43, 0xce2ea73e1708ccf8, - 0xa4fef5a584c7f212, 0x7e8d61f3e3cd0e33, 0x4bb4d3d916c31132, 0x979601c5ed23f23f, 0xd276282374ec1ea4, - 0x3ad7efeef13e67a2, 0xb03d078f86ff1a6b, 0xeb0c0e80ab580c73, 0x10626cc7df1e8921, 0xd219e828e73b9e20, - 0x618a931a955ef5da, 0xd2d2d58d53656a9f, 0x9dd40fc1bd356869, 0x2c20d737db5d8117, 0x6e6e11d25f209e47, - 0x2e8be1cb76d110ba, 0x444bb6e7010f6c37, 0xd23fab77ce5a7e70, 0x8c78b778a4cb6ed4, 0x25a7c3597375af6c, - 0x838eb181b94713d8, 0xee7ef145b71c82b9, 0x4100f7f1f68a18e1, 0x0172b13aec3c1a9a, 0x3fd9d5af41c0adc0, - 0x41c3faef88d7b4fa, 0x74bafbdbaf93fff3, 0x5bebb7fff39b0ad5, 0x0acc115dbb25a746, 0xf97917c9865df9e2, - 0xad2b5e379da172a0, 0x9dc009b1656ee095, 0x2493fbc9d6be0e5a, 0x9cd5fbb085310dbb, 0x68f32bd6bd8f9c1c, - 0x2de45538a2ba3e9e, 0x4d20bccc8d24f68c, 0x92d042a14acfa213, 0xc84b8c4acea0a2b9, 0x45e5c1724d26d053, - 0x3818e9bd7beee792, 0xa62d745f684e2064, 0x59ab13085cab76b0, 0x95c36b24e682431b, 0x8a74b74676702bc0, - 0x1368e75247215cc2, 0x04be06c420c02380, 0x531ff29f07a405e0, 0x1ca1dbd70252be80, 0xcaeb8d314a0f733a, - 0x07b014e9853ae137, 0x3afbac80b36697ae, 0xc727fdc0839dcf7b, 0xf94605bacb2893eb, 0xbae2f6a3a248da22, - 0x799c22287f02c87b, 0x3391c617b1e89e6b, 0xe4359bbc1d91ff9c, 0x5d766a031f4eb4e1, 0x253449e6e64fb8b0, - 0x4714a58a5fabc475, 0xb7d72cceba9086cb, 0x335bf1363795840c, 0x73265f3fe0efe2e1, 0x162a7f96ac657b73, - 0x8f9cc43d400f8493, 0x4ea1a4aa23480036, 0xa19ca54cd3e4c8cd, 0xb098f54458fa5495, 0xa6f9c9112ade941c, - 0xe981c9689ffc0564, 0xb4342bc87cbb8c4a, 0xc6adb38abbba6406, 0x0931e58c506c9b9b, 0x0d3d7c66b84b45ba, - 0x8c72f41c77ed5e97, 0x4d7874c085ac05f1, 0xae24a572b1a2cb03, 0xcf9406c9277a03fb, 0xc4c842767cd36cb2, - 0xb71afd03f14905ef, 0x9cbdcf23a69c0de5, 0x293d37436e851f0f, 0xfcf12c3248c88e6a, 0x8dc8136faab6ac87, - 0x1cdb360316b80d76, 0x2057db68ad0e1e91, 0x0fb841b3037974b0, 0xea020deae613ec5c, 0xfa6ff065e70996c3, - 0x974ed20a0d80c0a2, 0x78707bf5e72e699d, 0x61f19f8de7c3e367, 0xe349cf5f6381e6e0, 0x2f33a8e7778770c0, - 0x7ce5eef25267b4e7, 0xdd9eda9bd0cdc76d, 0xfa17490bba546783, 0x136a4939a58e20a2, 0xfe1cad9ee1f92080, - 0x8d7d376e5154c239, 0xe27992dec296794f, 0x0f6359e13cf625e0, 0x14c4493aec8d160a, 0x3ff2a337151352ff, - 0x1a5f9013af2edc40, 0xc843b1bf0e87d5b4, 0x52346e8bdb64455e, 0x57fc6824b80c03aa, 0xb567e6135832b45a, - 0x28ae0610070080ac, 0xe33ec21e5190a8cd, 0xa8f04b50bdd0f3ca, 0x94db8aca3d19cfd1, 0x69aedcb64da4dbe1, - 0xb013b282f6a63f3e, 0x5e4cae52d80edcd0, 0xf9a2a64d17c5838f, 0x5c8d3acd9a8a32a4, 0xa3cadbd279d0abf1, - 0xfa207ada390d4f39, 0x43f958f44bb53bbf, 0x885af5bc23c797f0, 0xb3cc962950a6a375, 0x6a5bbc5267cb2a04, - 0xb4b46f0dc8fdbdcb, 0x946fd95be1336154, 0x3af8b720b5bce9c5, 0x785da05ee5705739, 0x0b8b2649480a6fb6, - 0x54d877d10d9897da, 0xe46ee44a1ac8ddb2, 0xf1d60d4fbc5222cd, 0x8e90525ac7f4f572, 0x0f91e08483459e7b, - 0xbea0efdd6d38b1aa, 0x2040aadf277a9ae6, 0x6adac1b980a88bbc, 0xb857504bc40728ef, 0x8c18046d3c40c96b, - 0x2261cb396ccd1626, 0x727f4037051b2854, 0x350b3e02dd1c764c, 0x969481c651f6a88d, 0xd4889377004e4cef, - 0x832b336314bd2877, 0x2a2ff36c244c5434, 0xbd15a92913b10b02, 0x9c792c4603246bc4, 0x3dafdcf57f6bf517, - 0x930b7e2c11e0c6e7, 0xb9f5b213e4a67d7e, 0x7e4ebe4f67fde8ca, 0x5d66c1c56467baec, 0x4c77a098432cb1d2, - 0x3cc89a5be447c933, 0x126fbaf74b40473d, 0x5d27c15d6a566155, 0x9c05bbe3b3c0aa6f, 0x9c92ad525e13fc4f, - 0x35df28c92d23cd2b, 0x9920e6aa5557dc0f, 0x637df49522a48c8c, 0x8a119c23d2cbcf40, 0x1c0920770a9786d4, - 0x8486dd278c3a6dcd, 0x4bc6cb70acd139ab, 0xf8d6552b8d990fd1, 0x33d242362f3c2ea5, 0x361b628e161c81aa, - 0x795171004a095d6c, 0x45f454d6c2a1b94a, 0x116de9a956765c4b, 0x49e1b65495c18092, 0x6729c7910b492a26, - 0xf48dfa2f36e19c3a, 0x674f161b483ad1ce, 0x39774e64295cc72e, 0x172c59280d8a1402, 0x7855819b17347138, - 0x4c17b0627594aee3, 0xf2833fda01375be8, 0xe5bc99c81f2ce2ef, 0xd14bba540b0d1145, 0x12de87b39cf83878, - 0x9d21451e308527e5, 0xad3b6b7513fb065e, 0xa1ddf352c3c417df, 0xa07e632e62e6e7d8, 0xe03b741a0e765e41, - 0x3ab1fc6b1ae5f80a, 0xa55b722a24444034, 0x96ab033a43ca72ae, 0x47cad4ad64d3a80a, 0xcac73068e0249318, - 0x995f7c41fcd3c0a4, 0x8278a8eea79d62b0, 0x84a062c4c8645954, 0xaedd25ac5a20f801, 0xd6987410a401d92e, - 0xc458581102a4d353, 0xbc5ebab32eef41b0, 0x23f945cb723765ba, 0xd276e6cce727050b, 0x2d35ab2dcdfe3cd2, - 0x4f7202700b22965b, 0xb788be2b93be4ad8, 0x2367c39628c7d85a, 0x132be00452e5a61b, 0xf5e1628e9bbffb54, - 0x9dc67bc28f356908, 0x9ee0502fd40b412e, 0x2b228cfb9256b2f7, 0x425ac05f0a95a335, 0x8be87caec762a249, - 0xe422be244a442eda, 0x60a294640cf645fc, 0xd74425c31e1125e2, 0xc450b1c4bb58ca69, 0x9de0b0e11356da8f, - 0x354dcc1639640193, 0xad09f6c8082a9333, 0x67463f1efe40b6ac, 0x1334450a31f0cd19, 0x4a34064e9a4cae1a, - 0xc1b01cb54726431e, 0x0380e1b87b4c6225, 0xb2448a14bdd6f8a8, 0x41bb3839cd84202e, 0x4105845261726477, - 0xd26cb6c68fe824c5, 0xf4934f8949bd4391, 0x4f4d923b210bee82, 0x94e833c8674bb8f4, 0x2ca65af884d73590, - 0xb2e4ab4f16f16044, 0xa7bf7f8f99015b46, 0xace824bef957e766, 0x86505a060c61f32b, 0xddae0e493620e943, - 0x75d39c78544e3d04, 0x2f338b2b9255d518, 0x76c601fd4a27849c, 0x66c3b0852e0a2dd6, 0x718058c582e82eb1, - 0x8a87ac11419a0d73, 0x04d4a5efe61c5174, 0x11861eff41d3b071, 0x4e2bfa84fc32a122, 0x503067cb24680688, - 0x3bd839c598f49958, 0x8992dd5e9b379b62, 0x4173b6d375927057, 0xf20c9aa5561251a4, 0xbd9ec72103d138e0, - 0x3fed60fd1f2a3dbe, 0x7a0c13a44358b034, 0x82cc03ca04277cf5, 0x0d320fb0f71861cf, 0x3b5c44d173e0b618, - 0x81f59c36d1ea79bd, 0xf31cb7ec19ff596b, 0x1fd2687848cee492, 0xf045b3ffb20fd7c1, 0xe406194ebedc7e3e, - 0x7437b4dbd16b70c5, 0x5a5d82413367b2e1, 0x3ebfd141e0d0d07a, 0xc723b9a877dea1af, 0x7993fe600940fa83, - 0xdc6b9e81831d40a4, 0x3300c407f3b1dc30, 0x0fea8b869929f139, 0x86b9b5eb26548789, 0x09a36162c2789858, - 0x3a947b7d8d0feef0, 0xa433aff79ac7750a, 0xa99cd83467a8b6b3, 0xe6bc7e5c7fd3bc68, 0x9e6bd044a230baeb, - 0x538ea542aac84421, 0x9d332c3528c3d08e, 0x0725471194c9084c, 0x08c5e3fe0ba8c890, 0xb771a2dbb7e4d83f, - 0x2c6c685a5fa87e48, 0xf502abbdc3b8918a, 0x70f341eb079e21a0, 0x2753a93c14c892de, 0xe968202d2125480f, - 0xa4a5e7a56757f340, 0x44e9ed9366e77963, 0x0f3b046421d9ca62, 0xfcf5bd12025b1ebf, 0x0962961b53116338, - 0x22186391956382af, 0x08e919b490c617b5, 0x24a32704acb50fb0, 0x8e309e03e320981a, 0x942aca9c3424bdb5, - 0x8701c7c2fa821643, 0x743508a1af07a32a, 0x22ec6cb4d7f4332f, 0x88e575c833d4cc73, 0x8c6325072ebacc8d, - 0xab83732370bca722, 0x27d58dc00993cd0a, 0x9bf4f77834eaa085, 0x46a39f15a3018dc2, 0x9b2904b2d29c2aec, - 0xa26e9cec526b1c02, 0x419fd1153098b3f1, 0x0ae581c590ed2a50, 0xad14b8c6040104b2, 0xc766c8344e8e6ca7, - 0xf153fedec531e8db, 0xf2919f8263933cc1, 0xdb9c2a073b99d1ec, 0x939740912d744884, 0x0d58d2545934ad74, - 0xddbfbf8440e40a43, 0x053d349d5db34218, 0xd22a0e162a0cc30e, 0x0a785aadc9a16d56, 0xe873446a6c1fadb1, - 0x0340606cc28e3cb6, 0xc5538777e0f1841d, 0x7adc13ff1ef73582, 0xcd0372e4f1bad157, 0x37fa5fa9a54ad65b, - 0x3502d375112c421c, 0x55874e3d28e36886, 0x5799f158e537ca3a, 0x7eaea41cf55f7706, 0xa4242c2e3922d526, - 0x2da2dc585f41b55c, 0x134726068bb8b9fe, 0xa90a6c2006315e49, 0x85fd2b339581ae85, 0x26d0601e937ffac8, - 0x49095431fc2039b0, 0x941449a370a29c0d, 0x861ba29e527f2748, 0x4a1bb36269735cd6, 0x35180f58326387e0, - 0xac32e23cb8701884, 0x7ee7e0edef5835eb, 0xa0f1fbe4f8d68556, 0x4300847f218c9874, 0x5efbafadfef69ded, - 0x7b084d1126f67a1b, 0xf85f9278a7ffb0bb, 0x512879a75b2cb97d, 0xe7deddee9d24f1fe, 0xddbb1bf7df26891b, - 0xf71e3e78d84d128f, 0xb78feff74e92c4bb, 0x77efdebfbb9d24f6, 0x4fb61e6e3d4c121f, 0x74fb5bdb69ef27bd, - 0xfec33b699bf7b71e, 0x9e143aea1edf3fe9, 0x3e288ca8bfd5df4a, 0x7ba7fff56ad836bc, 0xb71fde6d6c6ee3bf, - 0xfb771b5bb00edbba, 0x7bd7ab82c308a2dd, 0xdfd9dabcd786df00, 0x774a1df5bfdcbef7, 0xd77b1f40e6e31ec5, - 0x2ffd013dbaa3fe5f, 0xefbd6e6b208af798, 0xe0d6efd433969fe8, 0x673626a76fbb9c76, 0x880f53da84517adc, - 0xe19db0bf07f5feed, 0xcd8d9246f1ff62a3, 0x948846cd79c0f51a, 0x8e5d5e5f2f679d08, 0xbbfc3fa0e79b4194, - 0x4eab8857c76c982f, 0x0f1d946f068d1f07, 0x1d86a646fdaf0271, 0x8d15ffcfc6faf61a, 0x3c4f106477b61ede, - 0x7978effee6e6fdeb, 0xc6dfbb9d9760432e, 0xb0a85b3626b9faee, 0x7d4cc16af944f8c9, 0x8e88b3eef0c45cfb, - 0x66b2632fb7d5f64e, 0x9992716264e3c41b, 0x7dda2122aa7fca9a, 0x5a2d0c983cbce82f, 0x204e7cf6b66643fd, - 0xdaeb5110eed660d8, 0x7077062e38abae57, 0x8bcbda776dfd408f, 0x6989b5d9fa71902b, 0x7170d18578a3f5e3, - 0x3a84dbd019e3495b, 0xf3059f8f94b7b4b0, 0xc962c992a6d5a1cd, 0xe4255cb7f627be38, 0x0a421cdc1bccae56, - 0x818ff5ad42d1afc0, 0xbe292f7fa7505eb4, 0x274a2bdc85d70834, 0xf80778078773f8ef, 0xdc0765d29fd05c60, - 0x8083d604c26a7e24, 0xad412d3c58264a2e, 0x44698dc262d25285, 0xf4eb28242cec9bb0, 0x9acd93721066f787, - 0x3370e3f35e9f035a, 0x6a46a596f515fdf2, 0xa2df833ab289ed85, 0x135ae2e33a08021d, 0x027f633fe8f93e19, - 0xec24b4ef4d06ac0e, 0x9b651f150267732a, 0xc7049636115de13a, 0x261fa508bf0328d8, 0xb9eea2ce37a042fd, - 0xcfc64bf2cab3eeb7, 0x25e7fb9f3811295f, 0xb667c7d67858a141, 0x15241fc7247066a5, 0x65332faa23a57090, - 0x72cdeabdcdb0658a, 0xf086cb5696bd9987, 0x61516f5193950744, 0x0c57b1e8a776b5e4, 0x282a618cbaf0872a, - 0x98da99d4dd68403e, 0xbd71315db36338df, 0x5ca77301be01f901, 0xcd649a1bb41fc107, 0x90318505f360c78d, - 0xe5d1ef0fbc45451b, 0xb88ccbfaaf465f0c, 0x47f572c8c2535945, 0xe042e9b25b439658, 0x592e46e47b0c3637, - 0x6e974cabc905936b, 0x3a2952dafe9d5cfb, 0xe98594eb202d53da, 0xc35dee21738371ab, 0x9974505654832eb7, - 0x4e70b9490a49dcf9, 0x808369dcbbc64458, 0xe69a05693b65c1e9, 0x326590bd9e666c49, 0xc629e98a52d696cf, - 0xda96ac2b303ca135, 0x8fbc6d9f77c7ba9a, 0xf729e78ecfb92b39, 0xe75d0ad2d7a5ccbb, 0x3ef39e64f6aebadc, - 0xd93d9f735f72fe3c, 0x1bccb8c5fb3eeb81, 0xf6c5a2967d1bdc03, 0x5fe0615800b66594, 0xfd3018bbe185f3ff, - 0x662345b22fa2f891, 0x223fbb1123dd9751, 0x54191c3272a4fa12, 0x8a3129f19dc70032, 0x7c21439d488e1413, - 0x48f525148552e227, 0xc3089261d3b22ec4, 0x74ff780f458d05e6, 0xed5ab805a7bf712f, 0x296fbcc4481238da, - 0x99b020507b1fd537, 0x7596c29a47233c83, 0xfa92b9a68a6f59ba, 0x42a98a02d194e457, 0xd14e09dded6d0fe5, - 0xd267fb70572db4b0, 0x8c52976d2cad2721, 0xeabcca43ecedabd8, 0x15f4183c66dbf5fa, 0x40030c4afb82d381, - 0xa9ee142b22cf04fa, 0xd33f07142c1220f4, 0xa01c8207d63d47a7, 0x0aecfeb2c9b5e6b3, 0xdb6f11d5ed5d5b5b, - 0xb91fb7125043b956, 0x7c76dcca83b815a5, 0x99722d4896d63e16, 0xd38bb8328f1b5ca6, 0x529cf4c1b7047b6d, - 0x7072a54b033831ca, 0x52e76de9e9cdaeb4, 0xcc92895f7325880f, 0x9f78255875efbe22, 0xbae4515240851de3, - 0xc428c39b5983577f, 0x45ac8b30d0e837de, 0x438fd7c8994dae8c, 0x76f66f780c1b6a35, 0xbdb3f7ceff12bbc7, - 0x39cc39fe5d5f5f77, 0x7a7238ae260338fa, 0xa097f177dd0b3b25, 0x587c4e116c656513, 0x9f8cb964ca308b09, - 0x736d433864de934f, 0x94671561d2852e9e, 0xe27820374c696f51, 0x15fd8b778b760edd, 0xc842206b2b2c79c2, - 0xc22c292279881338, 0xac0afd4731563035, 0x8291c3a90bfc26a9, 0x3c8e4b51b7626ce8, 0x6b2774651c95658e, - 0x21897aad5c029c2b, 0xacd04970c6e7808b, 0x821ca23a26cba1fb, 0x158d711dab0a5e4f, 0xe094080fb1b1b0e2, - 0x9b90dcd15f629ac3, 0xb58273e8494188f5, 0xc680f3c86287a87e, 0x6cf2fc82c7a7a318, 0x96d770d9345b1f51, - 0x486e84c5bc60ee0e, 0x96e88fdf7ff3fdc1, 0x4fdfc3bb04b78b42, 0xd428c513bd5e27b7, 0x4ec2dc1aae693412, - 0x2744d96057090236, 0x0ca0f42c65657367, 0x30305a022884f89d, 0x926f0be95d00eb8f, 0x7a5734740f7077b6, - 0x02459c81b8697d8f, 0x2bed1aefd0d10936, 0xe16c8ab890b333a4, 0x5ac7d7e4b06a36e8, 0xad7427a76c3a83d8, - 0x9ece541690cc6803, 0xf56962a0aa24ecdd, 0x7eaff31ef75eaf0f, 0x41c571ffedfcb4b5, 0xd9188c4ec6adad06, - 0x05196d6d37fa047e, 0xeb4e637c72d2ba0b, 0x6e42af53c3553b39, 0x5fff7dda5aa93506, 0x9f876f361c9f7e0b, - 0x9ed5b0735713e424, 0xfc5693039d9a8f61, 0x0058eb210f20ed80, 0xa8db1e2f357eec5b, 0x95f4b96fe97656fb, - 0x067413b991f47b2a, 0x142b672f58591878, 0xf7614df46df75f57, 0x92d51dbe80c0ea9c, 0xef92f84ef70b0e54, - 0x9006a7eed39ddda9, 0xd9e18b08d510f622, 0x89fe61751bf413eb, 0x2d95f4064b27d03e, 0x88dab0aa91661b25, - 0x78f6f043d591dc1b, 0xcf7a6bf581ae2c5e, 0x4fe80fbf9cd4c246, 0xbae3f5bf09a8655a, 0x27051d92ba5914e0, - 0x05e5d776772d4c2e, 0x124444c22bbb1422, 0x6752b03444dcde27, 0x41447bac1420b33f, 0x5d1e206aee63e0a1, - 0x7a021087142e03c8, 0xd9762e0d1035f731, 0x00513d0188cf9d52, 0x88eedc18226eef63, 0x40e28a02d3751bc7, - 0x5d40f20c54c839e8, 0xf19f7fddf02c8475, 0xb5ca60f518a45087, 0xd8eafda7e7030a2e, 0xb820be2a17953249, - 0xc590fd4ffc0e5c32, 0xb3a5da94a2d66654, 0x316e93f43a976a91, 0x0a5a7b41a54840d1, 0x9d4cba574cb6ecd1, - 0x9769e91b76a2f8d4, 0xac63e70c185de071, 0x3ab25d8582772bcb, 0x20ba272816594bba, 0xb98007ced8fccb03, - 0x16b81c9fe0349e88, 0xcbf120d0963d59a1, 0x2bb136389ad8ab81, 0x07a8b701896baf7a, 0xb8bf455b70b26641, - 0xe4050ba6f31bac8d, 0xccf0e58aca0e5649, 0x011aa916d067a2de, 0x7b0aa2bf55c264ba, 0x60e46609e0c64d12, - 0xb93354a4f799664d, 0x45ce1543855a0093, 0xe18130bbba3424fb, 0x4c833902b5a27834, 0x385c7df10271f63e, - 0x86d528548720b5ae, 0xa6263e493dd4ba4a, 0xd266bc8ef91147b6, 0x27617fec36be07e8, 0xc8919b5b62a939a9, - 0x5bdf29ad5843442d, 0x50a8c32b48dfb995, 0x953fcffa84603826, 0x1567a683e90ac5ca, 0x8137d09826ff4ca3, - 0x31cbb7e5d00da533, 0xf1d336e0e04df905, 0x599c82eb8bf1455a, 0x76d91e9bdce7944c, 0x3244bb9e290f4235, - 0x9696e717f5c12f8a, 0xea0d9879b4b0af11, 0x56d0e242e09ed8de, 0x35e529ddbde9712c, 0xe65bfa6268a81917, - 0x42c13921bbf9bb31, 0x84b64770c4df1e41, 0x177509304c316d29, 0xa00172c24f338272, 0x29ccf4eb849b0938, - 0x6cac9917fbe34a6f, 0x8cecb09d1a9dad32, 0xdd3296aec794df1d, 0x6ac7932d6c865556, 0x380ce9c300c3b37f, - 0x7c122cbb09a00311, 0x18ec68b75e079074, 0x58c50723717ba2a3, 0x95a35246c751e100, 0xaf27e753d37e6700, - 0x21452072efa1be11, 0x3484a7da20c2870b, 0xec3ff978dfd9801d, 0x8ce9cd6bc7858345, 0x1c1adbf37005c163, - 0xe8b5c9bea1709650, 0x33f5c90e18359903, 0x893c23332088f220, 0x90ac20a2ec10773e, 0xbc255f8de1579927, - 0x7a054a1abc341e05, 0xec488a38b1d91e43, 0xcfae3db635cd3741, 0x7d5c57dd33be4bea, 0x633566c5d6ad0fea, - 0x139d5effc41ea155, 0x6a349e15730c905f, 0x406d5dd576741467, 0xa35e7114ca2a88b7, 0x4c708ac828b007c3, - 0x51503413b67188ef, 0x333dea0a374fbdbf, 0x969ecdfa3adfef6c, 0xf3df57890e16cdcc, 0x13b0a4ba80a7f1ed, - 0x1456f8bff495f4cc, 0x44cae270af1a2440, 0x35169d8be7def81c, 0x243112de9bc2a163, 0xa4cf66c466b46456, - 0x8fa37e7f848ef0f6, 0x96126ab7f7cdf818, 0xf65dff0478e37352, 0xaa24e33752141e4c, 0x1a089801c38b187f, - 0x33709e894322f853, 0x331ed88a05245487, 0x7d9612d329347713, 0x1dbedbfb75a836c1, 0xc0f28bad8d87f737, - 0xef6eea25a827962b, 0x040d652b6206ee36, 0x5c2802b606bb8f29, 0x4671ab566bf41f3d, 0xdadaaa2acc3616a4, - 0x22ed2ccdc34c770d, 0xb60642e1043cb500, 0x1a31c32081961d75, 0x086252688d558423, 0x25471e6f67f641a1, - 0x83b5dbd6eb9d9dad, 0x2da339c252dc7a00, 0xecc69a2b4e08550b, 0xedaca22437408820, 0x76e5c2825f6c82cd, - 0xbef570939b7d8637, 0x585951f1e1ba5f51, 0x628b7cdc4f490043, 0xe692557dded97c78, 0x677b635b541e9d2e, - 0x7ce91a71314e3e7d, 0x62dd5a2377865aa2, 0x1254ed9139a8622c, 0xf349707a0068d5ba, 0x1fb47a0111fc5acc, - 0x703c5481b4f5fa8b, 0xbbdbf71edcdfa029, 0x734626a1ca280e13, 0x14240690cc440867, 0x77445b0eea2aa749, - 0x2aedb1f5b769ea16, 0xa56a333626ba1691, 0x2623a203c229c7b8, 0x4112f7e9ede9175b, 0xf71edcd9be7be7ee, - 0x3dae62e791b1ecc3, 0xe349eab0a2ac1b4d, 0xaee3cc268b40c974, 0x9cef0df52c295644, 0xd6dd677da7796c3f, - 0x7e729a2643484b1d, 0xdb009ed1f189b578, 0x21eb5ae228617e96, 0x840d8fea2ad83e0c, 0xe814c84086bb2e07, - 0x19754bf15f1d44b0, 0x74532ca7361bd15a, 0x2e5fc4f50eadddb5, 0x9615c91e7f28e2f2, 0xd7ea5c01819f3a4d, - 0x6d1561bc3bfa8986, 0x30aa4d1e15593153, 0x293d95b6a9188f37, 0x878a09d86f44a7d2, 0x709ca2363dd3fe2a, - 0xe3518304f34ae3cf, 0x4db1c533f65c7ed6, 0xa0c4bf815b0f7a50, 0x7d797b18a51ac6de, 0xff67702346859a7d, - 0x21fe37da4d04318b, 0xaec819223f2931eb, 0xf72f52e0ec2ab95f, 0xfbc5fb950a12532d, 0x2466307b606104dd, - 0xa3da24ae3621139c, 0x040901b84ba0232c, 0xad88013b961e470b, 0xb0bf24f6989e8831, 0x981f7d8a3842668c, - 0xbab019f772749829, 0x102c1f8dce4f5c56, 0x4965b5e114d3a0e8, 0x1ead6ccfe6429d53, 0x079341e6b82018bd, - 0xe15505c0d26b7401, 0x21ef63f647da07f6, 0x41691fce7168b607, 0xb84fe5f6db338a6b, 0x378b6644a623be30, - 0x353a95bf4408c7b0, 0x755245870518f89c, 0x23fd9431f9a58e68, 0x82ac7542810cf846, 0xa4bd65ec177d1816, - 0x6804cdb87de7f6b7, 0x884ce893d5d6e9ed, 0x15245dd29d320d6f, 0xefb3ef12796c99df, 0x20c7eacad78533e3, - 0xdb77f435967f4fa4, 0x95c901fb5adb5932, 0xcbf60f6b20578d61, 0x5cd5f0c4c7511f6c, 0xcf0069d8a8b9ed89, - 0xc7367716b410c034, 0x9d436b8e7a65a8a4, 0x517d98bd833790e4, 0x324bc3533a464b10, 0x99123a8753888411, - 0x7cf268fcbab10963, 0x410443c46a9313d2, 0x6918ebed0839a19c, 0x54c54e236220edd9, 0x9cd5677b1e55f41c, - 0x9318e83e8a91652f, 0xb5066675d1b261db, 0xa3d1fce23bf84498, 0x5c855cd11bad3e8b, 0xb655b1701c0bde42, - 0xb756ac8e5963d346, 0xb4717d3210e2c64e, 0xbf82e8353eda5575, 0x2a3c4b06e9590276, 0x60e27f2d786f9b1f, - 0x9cf4bdbd44a761fb, 0xd7bdf1c5159d162e, 0x5ea3e733eb676001, 0x57c49ca225784b0a, 0xc62274d9543bd2a8, - 0xc03c70e642c41542, 0x65b70b92354c9a54, 0xd1cf32b643da60bc, 0xc273eb539a4ed32c, 0x5aa5713e66fe1b8b, - 0x720c8bcd7051218a, 0x3e0ed985c713d0e2, 0x70124c500c737c1a, 0xc4a34e1f3f803353, 0x3919736ec0593cf8, - 0xc51f8c3b42034254, 0xe302227e175c233a, 0xa99981a06f3fc78d, 0x9e09413a5b8b766d, 0xf22a77974abd5886, - 0xd80a6e4bb2f4eafb, 0xf1fee967ed5eb75e, 0xfce2ddd8dedebc77, 0xe7c10d40a3ddc4c4, 0x906ca93496ad2e0d, - 0xe6453a191aae198a, 0x71425076c1de74e3, 0x982361beb3cff15a, 0x827e5707f5ee1afa, 0x9ebfee8c8fc02ed4, - 0x1f6dff03a02f7aef, 0xa18ddc72476a4296, 0x76092a68cd720896, 0xff6dc8e4ee89aeaf, 0xdc8529309b878d30, - 0x7a8cbbb686475db9, 0xb6e61cb2387d48ce, 0x9b6020c747cd1cfd, 0x936e8a387b712e5e, 0xdc331bca48bbbb14, - 0xcd79b02b07a67f06, 0xc2ab51ea8dbfb87b, 0xa040448ed4ed9a07, 0x635e59d916f7b80f, 0xc6b15b471ee97de1, - 0x67c25f8d3d7b110d, 0xc8be0baf68982f0f, 0x8905345c6bfdc9f1, 0x1c46f50ed4b6dd5a, 0x9499b56b1057c61c, - 0xce12548a0a13cece, 0x98d6fb870feede23, 0x2f6a96df18855116, 0xa7d960ce8192de10, 0x5d0d77827d4a6195, - 0x35e4ce101e73841d, 0x5ec7c26145bdb93f, 0x7dd6884d82c82d7d, 0xc6d059e7488a0e55, 0x3885b9f7c472500d, - 0x7e6d2cce4eb17938, 0xd1809ba82139c4eb, 0x020ac405f2805977, 0xbcfe7ae0991f7726, 0x83d5b3468f22a1bf, - 0xe96c925b1ee9f9cd, 0x8e55d3a93a91926f, 0xa8e45ee7a479d180, 0x3b9de631bce9b815, 0xb1d7385c6b9f1df5, - 0xc04c8c0e8fb3a337, 0xaf1b170d94651742, 0xc7f08f818ea15e80, 0x55d203990e9f406b, 0x0d38993940f79dce, - 0x89bada0128282b8f, 0xba1e2e71fc41db70, 0x36927b31a08f4cb7, 0x54ba8142e8b28e67, 0x0375ae4d18e14099, - 0x78fc5e73f5e80978, 0x8c09072b9e864e7e, 0x8a6cae4f42749e90, 0x3b9fd59347bd0f1f, 0xce8e4e18b0642fb0, - 0x8b7cb83969ae9de3, 0x2575cee5c7aa5059, 0x772d9dc3205212cf, 0xb179a229b3e539f6, 0xa1aec7bc1e8d897a, - 0x4412008a0c3f837e, 0x02ec9c3da842f3ba, 0x3b99685e7acb02a4, 0xb153283d02294546, 0xd15582da71736432, - 0xcb21849508433e04, 0xd6b0dd86dc2bb520, 0x272d5cf7d318c676, 0x8bbc1f76af205983, 0xc8b347b50fd90dd8, - 0x710b9bcb8d055310, 0x8d2525fa42253f6d, 0x5e156d31da806991, 0xd1091499d4007206, 0x94c41013d2cdc300, - 0xafe751987d601471, 0xf6396c15a26ec129, 0xd523acfc29a287ce, 0x10b20ab6387388da, 0x35a38b538570ce01, - 0xd5e918e0bd33c42d, 0x237c83e67087de9d, 0x1a45ac09cf45ac60, 0x7f0de4c996c78d49, 0x6d8f893e1e3d82ff, - 0xcad55113c718cd15, 0xe76377e359e257fc, 0x48577c7b0e57b3f0, 0x8522c7c67c17ebb8, 0x8553d0e27ff11aca, - 0x44ece7cec2b770c0, 0xc1329374e2f71717, 0xb23e776f7176c05d, 0xa12d8820fe5a29da, 0x96d859807e06ceaa, - 0xcfda10e80d329cb9, 0x023aabbacf55ab1b, 0x1fd9f8ebe4c2c747, 0x5d7f229ef92858a0, 0x89e638858241c023, - 0x83d1d383e3ce7cb4, 0xfe66845bf8398e01, 0x6764aed5e5022ad3, 0x2c0bcbf83aa2b325, 0x9a1e850882d09a76, - 0x3e034dd868a09a1b, 0x8f1078d5e0e2b139, 0x875ebe2b7164d8f8, 0xde0c298231ba179c, 0x4ff2572e26df1484, - 0x534948509c970bc5, 0x39c67de7b1d4d964, 0x616b6f04ccf11740, 0xc333ed6b32d45fdf, 0x6f8f38a4dffbda6f, - 0x88c9ffeb7cebeee3, 0x7bb546573e1f6ed5, 0x1a6ff9f3cec6c35a, 0xa3a79f8f6b8d63fd, 0x7c0221a37eeed51a, - 0x27f8bcdc4784df53, 0xfed8ac35ce2473eb, 0x0e34aab5dc7eadf1, 0xbb34bff9a0d678a7, 0x9fa834944f6afe5c, - 0x53516d249fdb481d, 0xf3e7f63e7abad04f, 0x34f64fad8616269a, 0x8ab2f095c09f0070, 0xa68d21752e9f04ce, - 0x1fda2e3effd45414, 0xb8d4c630f02bfedc, 0xba8702ffd2cfbbb5, 0x46ed3da36963fb31, 0xfaab7d109c6ddda3, - 0x1fd7f4e3726f1b9f, 0xff973ff7efd7ae81, 0xdef53d60f7bf2c93, 0x53f64df30cc88729, 0x5a90dda8fdb7d47d, - 0x8acf237c0e7ec7c7, 0xafbf4a2246537b8d, 0xcf0f06c8e51e70c8, 0x609c380868f806c1, 0x1de9ef31a69a8c02, - 0xdf7393bf5e3ec6a0, 0xacd127986f6e14c9, 0x34c0ff91546a8497, 0xc4e5534cbdf6f694, 0xeaf1a02f9f5135e9, - 0xf02955930e9f3d96, 0x0e0f73637a4a5812, 0x00689118004fef3b, 0x00f6e853bba25eb5, 0x2bfad4ae68b8d215, - 0x46ce5dfd1d5d15da, 0x7f8a09ccb4ff144b, 0x4707f894102c037c, 0x46a35ab2d767fbd2, 0xeb37ae5786b912ad, - 0x8ccb2a04026bd6fe, 0x9367d2fecf390406, 0x5d952090e1d75105, 0xd3e6d6eae533424c, 0x61544f75da9ed23a, - 0x81e5a18d8d07a463, 0x23706d6c54b372c9, 0x0418a57ada37552b, 0x5d32bf2c18f11e8e, 0x1307007d0b00fbcf, - 0x5c578c13ed8a0a68, 0x57ba0bbfa2b1c1c2, 0xd58d8df0f39fd90e, 0x47b54ecdef729e98, 0xe28aa5d4852bf68d, - 0x9bb8e2d25db4b478, 0xe9f24d30eca8a398, 0x2db8e4f94bce2554, 0xe49a89e245a97175, 0x0f6e1aab2d5ee250, - 0xeaaa8fc36eb42d18, 0xb9b8ddb61ff601ed, 0x5ff998210097d3cf, 0x99764162fe6c59fc, 0xeb55f40b6e5be921, - 0xce82f757b06f65c6, 0x57984fbed0fab3ce, 0xd70adf7977f20e2e, 0xdb3c4141112b3892, 0x7a859a8f3a9e2423, - 0x6098d3cb932253fe, 0xcf3eca6fc316d968, 0x15389f85bd2d5ee3, 0x9ea839674631a583, 0x6bfcf7791f5e1788, - 0x48f9da05ee0ef35f, 0xa885940be34eaecb, 0xca3dd9a9c23a7c89, 0x67cbb09371479d88, 0x3dddbf2c521bab9e, - 0x20ba626fa6ee6285, 0x50f44d9aaf1231b3, 0xff614c1e5f8384fd, 0x314288a9463c9737, 0xe207c89f5ffcd07d, - 0xfb12014b286435f1, 0xc814e5212d632273, 0x9b0e56c9f0027c97, 0x4c3a19f8274df6da, 0x145e59c0dce6874d, - 0x9a827dd85e21cd35, 0x4618426883249f15, 0x8ea2b5901b48bc5a, 0x92e12499f1a092cc, 0xaaa1153bb1c1147b, - 0x28c929196c5c8a55, 0x9d86ddd13b760518, 0x6ad750ad5f8c9a2d, 0x5b93f19cab012607, 0xe076c74a4a774799, - 0x2a42149f9f4e99d0, 0x02ec62b1a99ab6f8, 0x707e3e3237c6b157, 0x793e77447dfc4a34, 0x30f958725a4a1c3d, - 0x50459ad26ae9ae08, 0xc3e445903a8eac45, 0xa75075f5725b3973, 0x5bd17be701e90d77, 0x7b43bca248746363, - 0x390440da71800ca7, 0x840ead547a005ac8, 0x00bc065fc5113268, 0x40caafc34353b8a3, 0xd286bc1a749e8259, - 0x266dcfc8b59e9ee2, 0x32a77a8aeb0ffb70, 0x262cff9b474c2824, 0x0e6c41c255f88a0c, 0x73c9397725681426, - 0x8a947373abcf78b3, 0x49324c64030438db, 0xda403048db6267e6, 0x189bc26d2c5461a6, 0x233cb6cbfaf1de6e, - 0xe108de0d4f85b5c4, 0x18f2f13680173029, 0x7cebc1ec837bc1cd, 0x163adbb16d4173ea, 0x98ce15be4739d4dc, - 0x94224898786261e1, 0x17b32b36d0c761e3, 0x2ce76f56793e181e, 0x7f3f3f7fdb9fb806, 0x94a1ed97b11d47c0, - 0x8d8afe784cc4a82b, 0x8eba782c406fdb94, 0xb738195ad5e0dde8, 0x1aa7d5ef1ae25fe4, 0x53bb0a0211f13b91, - 0x453c198f3019a634, 0x1e2d96dc6444058a, 0x606bd04b0583ec4f, 0xf4869052e10830ff, 0xb2aac33597582528, - 0xa0511c1a588d31bb, 0x33c8f1c602435df4, 0x7228b810ab012287, 0x14fc37384592328c, 0x4d5f46c9beb89024, - 0x72a9688f057b4fa4, 0xd197893fefcb06e9, 0xb5d84915e75d1143, 0x195c501bd9154409, 0x2110af92f2921834, - 0x181c56e4f3ba785e, 0x114fdae8c1c3fe09, 0x9cda3cb508a73ef0, 0x3c52c51b833f231e, 0xe1008e79bfc54382, - 0x188b9943621c1f12, 0x21ed18128966ac51, 0xa4499da398c9a3f5, 0xcddb857e7dc4a13c, 0xb55ade6e7f049f58, - 0xf08ae5edd5df9293, 0x8cfeb12850685912, 0x3a5d97e4a8501b01, 0xb52b40507b919bc1, 0x4c0a127a652ae7b7, - 0xa2426632881d0f49, 0x543217156d60f218, 0xd181fe0854f63737, 0x36948ac0189def10, 0x2270d205e490b1fc, - 0x29ea1ac431169ea8, 0x2e186e4c75d9894d, 0x4eedf13cbc985dc1, 0x083faaf8a8b3b5b9, 0x7ddf9ce424f52df4, - 0xcd321709f90072db, 0xc0bbf225372b1c4c, 0xd4f9511c4e155829, 0xff2dac7e882d8a5a, 0x0a84a4bf3c87bdbf, - 0x66b083a1a470e430, 0xa51c42a927842591, 0x45c404d7b0aa3cc7, 0xc1860527be703217, 0xe95f501eeafe3d20, - 0x0e44a00a4950d030, 0x49aba204a83bb100, 0xc6fb8cf043da3bfe, 0x7d3e75e13bf8f93e, 0x0201eec53464b9b3, - 0xa042acfc9cc00c47, 0x21b22720a6587904, 0xe7eec179cf4126e4, 0xb7bf1fcd2029a633, 0xa26b38be2f21b773, - 0xb7165f11aadaa7f7, 0x6078eb0678c60d1a, 0x710ab257c6005786, 0x0d3f5c171fbf06f2, 0x2882a8894eeae4be, - 0x8fc3b9913e1a283e, 0xd2a710895181c063, 0xb16f1781a3ba6134, 0x836e468a030a2616, 0x39cf3b501f505973, - 0x581957777badd055, 0x1312acc67c7d3e62, 0xfbb7551538eb32d0, 0x700fe162a6ece72c, 0x8b7ebe33accf4d25, - 0x2d9242437a756439, 0x2adc4d8046f01888, 0xe8207e0b360e4986, 0x7b56cbaa37de84fc, 0x221f61f1ca4c8d63, - 0xc4eebef1936fcf12, 0x79e62564421defe7, 0x62d9a8b1926a8ce3, 0x8b50aef91c73f97c, 0xe7b8fddc5404348c, - 0x49f4927ac5e1122e, 0x64bdbf5bbbbe703b, 0x9f0484ea6c5a3ceb, 0x7bb4d6c70d6c0d0e, 0x93d8ba1039add5a3, - 0x49e34ab00ebe3099, 0xb643df66e3a4d33b, 0x3a078c1a05e71c1b, 0x4692a4ec5ec74dd0, 0x314a1f7644c1abbd, - 0x470bd326df513d87, 0x8d135e1773d4f71e, 0xd9c4b198262782fa, 0xf9d1de6b449479de, 0x38c17fcf69ecf842, - 0x60900c3c28868c43, 0x79bfeea900f49d9f, 0x9b3d6cdcf6210955, 0xe78d77c18ac16916, 0xcf808d8827a277f4, - 0x1c0137a16281bf4e, 0x3580124d03e0a073, 0xdc7c23833ec81f67, 0xf27307b49b9d6c46, 0x4407347625911dbc, - 0x3ebc3b85dcba2a2e, 0x3f988b361de51f05, 0x29e4c6c3b3d0f52a, 0x20e4cec28872fdb9, 0x0e15395f81685f8e, - 0xd492dc45433acaba, 0xe1423fa1732d43f4, 0x9ca0d36ec042f0a7, 0xcb89dabc6a88a9b0, 0x16c590c2ca138d95, - 0x117435d444326469, 0xdc1c67dc1b825105, 0x305736423190ea14, 0x110d8a1f540b4732, 0x5081d3f25842783c, - 0x3aabbff1aa657b9d, 0xe375db90fe30e73d, 0x83851b3ee3484f01, 0x8d357c796c087482, 0xb91aea66174d0c04, - 0x58324d8c42dbd8f1, 0x6feac52e195ff57a, 0x4f5534d25e1bdd23, 0x5802eb3e37e51f41, 0x85699db19e8b0e77, - 0x485a2e0c0b0e9710, 0xa7598b772acd8a3d, 0x5c4d00d7c327384c, 0x09a5d997a5a8cb44, 0x9d14ec92cf4355b6, - 0x4cdc32b1fb857a4c, 0x643d1f10dbde2fd8, 0xeec84740f371cf58, 0x258e8c0b4ba29c78, 0x63468a34a9fcb204, - 0x6e710f12aa6f1147, 0x4d22d3206456e6e5, 0x915446a9a83ad45b, 0x4cc586839f40c386, 0x62a5c0930259d005, - 0xac2d75d037bbd521, 0x5eb41c52242ed190, 0x22820d04cbfd838a, 0x13034f0f2815a9e0, 0x89435ac0cae1e400, - 0x392e384f85af70e9, 0x9d153e64996b9778, 0x835d079d0968f011, 0x07d09801296fefb5, 0xb6bc02b812945d11, - 0x571e2178db5e91dd, 0x6cfb03ca5e82c6b4, 0x10446817a1b6af49, 0x8de1069dc0450875, 0x120ef326bdf1d3f7, - 0x3b1113395d954896, 0xe3b795049108054b, 0x762ed2611ca643c1, 0x519442f439936425, 0x7129ad31f30482d3, - 0x04be587262250177, 0x6f383488ab01c60a, 0xb00590000c039b18, 0x60a80039a822d999, 0xd34a716c8d101e58, - 0x560a287e2f1189df, 0xc3191c7b75b1d64c, 0x49931c23874ef0d2, 0xf09be40e1049e48c, 0x44be28843802da1a, - 0x8cd7e00a95b521a7, 0x59d00a4c76e4e063, 0x5b5c4aa92345ceb4, 0xca9644af2edf9282, 0xa5bf11014ada8ba0, - 0x54d81fa5dd635825, 0xdd93fb3f551f0ad8, 0x261a8453304daefc, 0x612f1c276696aef2, 0x5b93d515a5592029, - 0x90e4200d445e7c66, 0x8a5c25febfe8e5b8, 0x9437c4ac6c18da51, 0x7140d76ac75bd9b2, 0x6972e8860b9c309c, - 0xb99fe668d10b6902, 0x578bc662bb69a0e7, 0x4f0efb101cc80138, 0x8914044c0f1db92e, 0x83d17882a72f6fc6, - 0xbf0c10d3d474d3a2, 0x4e73403bf9273780, 0x8b3a114a39b74a43, 0xb135a1d69de6dbd2, 0xad87a1777556a543, - 0xa743974cb1c68e0f, 0xaa29ff47ab213474, 0x310f309a839e8c60, 0x1abaa384afd87513, 0x6a70163756c80dba, - 0xe062d2795a4c52af, 0xb93460ff9e7f4a2d, 0x373f6153ce999654, 0x74bc4b9d824b7388, 0x349c11733bccba0a, - 0xb294fbc4df856b22, 0xcdf329ffb9895873, 0x18d91baae42d708a, 0x96c307aa396410e8, 0x85c5e8d713e12682, - 0xdfa18a7113673954, 0x15078fd2371e39d5, 0xc90e5b17826c4e3a, 0x3d02351b0525c808, 0xe02da4c6cb57c2aa, - 0x450971ab696ed074, 0xa12539f5df91ff9d, 0xc753e8fd8e6ee6ff, 0x7130fd11b7adf081, 0x23dd97f1081ec031, - 0x8aea033e2a633f23, 0xbf8a3818b9f1ea76, 0xa232f6336c870522, 0xeee512d1bc94f5e1, 0xc346e39d69e5b2bc, - 0x245f96b2a8ec632b, 0x2bc75b36d4d59979, 0x542cb902b46ae19a, 0x637a2319092f3e10, 0x0d61c872e6091001, - 0xc16791b4969c45d6, 0x85d48b9661c0fd55, 0xce3bb8c8aa518d41, 0x52f0fc00737a9a33, 0x66d478c8da2e2e61, - 0x378fb265a801bc72, 0xa86e0b41baf04ba3, 0x68b7269c68bf461c, 0x5b2db8c5821efca5, 0x5e5c70d772611304, - 0x6cf61a8c4c0db011, 0x77dd5e021419e1d8, 0x71eb1a30b9f9f0c1, 0x182276f0c88218d1, 0xf30d4e8138942c39, - 0x3ed1247801d2a4b7, 0xa714c705a1ec630e, 0x608089a43bd21718, 0x450eac44de87b964, 0x0e0dacc04dc0088b, - 0x843455448c224df0, 0x8248e6a6a9398212, 0xaee2c2b03d449e25, 0x39be6977d7929c73, 0x47e6e831336f046f, - 0x2411bbde74ec7cba, 0x9291437033a051e1, 0xf21b5d795f25b3c3, 0xa664890c5813c8b1, 0x00bd596d94cadb4a, - 0x1af8f0418be3c1e2, 0x8381c334ab09e13d, 0xace615a8c8b71c72, 0x1a5d344f525b5782, 0x98ed01bc223b2e74, - 0xe6a055a8fc8a0ef7, 0xa1db7a320bccb229, 0x6c2a597aec8e0ece, 0xe8d8a2c4893a4ce6, 0x5772846ea8490e66, - 0x5ef4100c1cbb0d8b, 0x7bc0ccf4b4063093, 0x60dd31c70c9fd890, 0x3646f06c4758d09a, 0x4396824e57233b6e, - 0xba34704d043e8447, 0xea4318417264bb3f, 0x00db86f6fbd61d8d, 0xceb00f40dfb5402a, 0xcacf97b3ab216c09, - 0xde0ec744654b1ad3, 0xb870dd2ebf2cc091, 0x9684288c6692ca22, 0x82c4f9df86571767, 0xd31608db639ccefb, - 0xe3e1f10f64fe30da, 0x97182f1cea8173c7, 0x3df6127880c83e13, 0x440a6a112fa17102, 0x868b0c0cc248d0dc, - 0xb8b16bb81c61d3e0, 0x325ef6112702fd23, 0x8450eb6ee304528f, 0x67ddf3c1107602e7, 0xe3d19875e5501cc9, - 0x2f71d0b510e092be, 0x7fea53efad9a5cc3, 0x922f690421868b7f, 0x611b718afcfe3e1c, 0x82bfc3ebf2f805fa, - 0xfc7fec7d89761b37, 0xd2eeabc81c8f4346, 0x2d9bfb2651bab22d, 0x279a899723399924, 0x8aae4c9394cd0945, - 0x2a5c12fb4afc9ffd, 0x7e5585b51b4d3665, 0x6792fc674ee25613, 0x0d140a85ad50a865, 0x4097a2441d6ae3d7, - 0x02053f06242c3ba5, 0x4046e377f06d4f24, 0xfcba3beee3464bda, 0xa15d49c370003eb0, 0x6154c16e9fe59b3d, - 0xc5b44b838afaf972, 0x7c84f830b03da533, 0x262e18a94afd8586, 0xd4f1f81a365fa09b, 0x24ba44e08c08e473, - 0x32e8222c92c67776, 0x3599ccdf0bc99e2e, 0x109e18bb2430bdea, 0xaa63ccf1ecf960de, 0xa59c26e90916909f, - 0x2182431404136099, 0x330482eaa1568c38, 0xbaff3e9df7879c0d, 0x177a93dfe0ae804d, 0x700eaf8726cdc6bf, - 0xea71bbdc9353bb89, 0x898ce5a10db958fc, 0x828ff2628781c7f8, 0x018d92119666905b, 0x0f307ce31145480b, - 0xba330aecdcfe711e, 0xc97db6e20c08b273, 0xc14d05ed453c7f74, 0x4338b7735bf9c2d9, 0xf9cdf28be8272877, - 0xa30152c3739ce895, 0x6223f502182f6034, 0x3f9a8cb8410858f0, 0x02f114da12bb0053, 0x8162308c8e88c961, - 0x4cbdf055a873198d, 0x7b9d33331ad5f0cb, 0x41e700cf323f2bfc, 0xacf293ad6a72757e, 0x36f8d9e4670bcff3, - 0xa8bf462e90900a8c, 0xdd83ec6aee2d90d3, 0x4f549c9cdce0dee0, 0x266c36b4ce15e049, 0x187a946c1f496f70, - 0x2f81102dca0127dc, 0x57ef3a3eac67dd31, 0xc6f3ff1b1c8efb88, 0xe93da4d807520ddc, 0xa6c0592ac770c12e, - 0xc82d336ed3c98daa, 0x703f860f343e72d5, 0x4f4269a89d61308b, 0xad322645114f24f6, 0x700c206d537a6eb3, - 0xbc53f15b36437c25, 0xe35cc4fca5480e78, 0x3f7279419fa2b025, 0xddbf217b526c2a4a, 0x67d35606212505ba, - 0x9d8c9f2392d0f01a, 0x136353c8e4955f64, 0x4b53e29576109e60, 0x48523b0e31e95047, 0x090da908fb82e51e, - 0x4498ad64e8911708, 0xa7c2a5246008ecee, 0xb772f76fa6cb9c0d, 0x0f126f0582b18325, 0xe4aefd34f89a7b5c, - 0x3d7ce25d86fa298a, 0x8adeb4bd0fc6a36f, 0x6c9ccb3e8b5ef547, 0x770c80be10b901df, 0x89e82d261e00ae3b, - 0x105a96c2d2bb49cb, 0x5de5ab00a1a1b0de, 0xd1da894545790251, 0x23580226a377525b, 0x28823f2f6056ced9, - 0xcb736df25b0d0e6a, 0xd8e1705285e8deac, 0x076732494283aac3, 0x658ebc7f9337deee, 0x16a278e09619cf05, - 0x2b4f52289825686e, 0x6361e5bca5131539, 0xb5b8d9ec6e9b6bc7, 0x1268fb650c55b091, 0x21549cc6acd20415, - 0xa7d25e07c6acf042, 0x8c7d52df7577c63d, 0x8ce0de68d1076b37, 0x44c0ff36d7e756e7, 0x302d002d9c167616, - 0x3411cc10e7b09bb9, 0x42c813e631c1f64a, 0x49021101b6b0b613, 0x79de0ee0001f8bee, 0x1cc363ab140999da, - 0xa0d13046a360485a, 0x8d163180a5c8b080, 0x65f5ced1b3f24344, 0xc12e3cc23f0f9e23, 0x0465445ddf11d69e, - 0x08ea4d014fcbe92d, 0x28ae684190f75284, 0x4bb0238a7ae0a4b3, 0x578eb135f865d11d, 0x6dcd272b1121c655, - 0xd54bbc2c57758f46, 0x08393248a9ef0a5c, 0x29d5864135980e7b, 0x2ba05bae80ba076e, 0x3a60fd2486e5c6e4, - 0xdbf55fd1436c31bd, 0xd8ce48334f58e6db, 0x5bfe81fe03c7427c, 0xb14a806faf9ce36d, 0x804dc63b35514897, - 0xa18f937d6ec2eb41, 0xce988d2b45487610, 0x84c385380a9a150e, 0xcecec145583b7d5e, 0x3b0b1c95678ed972, - 0x003729e76d7a3c78, 0x4035910f03529535, 0xa60d62186e5ca528, 0xbfcfb80fa7fb19c5, 0x254140fb3e91032c, - 0x18b82166268519fa, 0x27bcac30a3673f20, 0xe9badba7c4b7414e, 0xda3d76a818b3eed1, 0x43254dc0dd095f89, - 0xbb4dc81a067434ef, 0x4ab839626fc1e93c, 0xc3c6cb95cf3e8e7b, 0xe8fc3196c7fecbc5, 0x9c396570794e8122, - 0x5a335a233f133f2d, 0x3eafe45f9538e1a4, 0x12b727fe55cb541f, 0x20b52d0c66075653, 0xe067e470fadbd7c3, - 0x3e0273b9e239c77d, 0x6d9a09bdcd213f62, 0x82397362580d269e, 0xcd4989017c0c31ea, 0x540b6bd3ae84dc3c, - 0xfa670cce09e63902, 0x0dca6af27ae2db92, 0xa40922d38ba47c75, 0x2b45ec4458c06016, 0x2cb4767c7fd07b35, - 0x65791e8d48fef61e, 0x71d83c0157e65250, 0x68a0931df501b3fb, 0x46d6654c41d2aff4, 0xdd03941b13468bbc, - 0xfd3b2b2db6d0a189, 0xd6d93239e74672c2, 0xc312055796b09a82, 0xca4382adcd191aea, 0x5b7c2e48dcaafc1b, - 0x9a9a38a76d91fb21, 0xe2d406c4a925734b, 0x1caf9c971b81c140, 0xdb825ca721a62fd6, 0x94793e972bb0db90, - 0x71671f6222d7f9b8, 0x11dfaa49a0231aa8, 0x4e9111a8ba450be2, 0xb37587f629b1a279, 0x60e4003d7b0355fe, - 0x954d847c1951d553, 0x9aa826946a24897a, 0xb0a22951cfb34274, 0x0a46620c36f3345f, 0x66c9cf48497efaa3, - 0xcecd8b972f8eda37, 0x3c2b66100250ac4f, 0xec85f336e180953e, 0xfabe54349ff9cc2d, 0x9f679d7d12976140, - 0x8cb18555b193b1bc, 0x7a4232a9d2c1bd52, 0x1b6e637af3e90803, 0x3ec2275c3cf20b0b, 0xfde8153a87cbe8bb, - 0xd738d05ae8ad1878, 0x03b0525e464f4f0e, 0xbf3259cb70b3ec64, 0xbd87ca243370a9c0, 0x3b91835a05f51cbe, - 0xf8c114adf88dc0f2, 0xefecdccf67ae771c, 0xd5848352bd0d6ff6, 0xf8c5d81f54d52f34, 0xeaa08977bd75baf4, - 0x38c80f6e3bf56a84, 0xa7460d6253fe2599, 0x1e40baa35f11524c, 0xb2e320a0d39a9256, 0x2a3729d169dc0152, - 0x2be5b693c63e7825, 0x3b4510971dfcd5ac, 0x231a55c6069ac64d, 0x74891e7f7af4ecf0, 0xdb6f5e53eb9575c2, - 0x19b71b4bd376a58c, 0xdac040c90b9826bc, 0x58a77e7043b25fae, 0xd5206884b37ffd56, 0xe6370ac5f7e6a70f, - 0xa5c767cfefdfbc82, 0x5a0e85d55eaa5784, 0x87d6afb0bd5ebe59, 0x46a75f9d38f5fb8d, 0xd13440c7570f7257, - 0xb08c7f9e5328480d, 0x7bf76f04618ca1dd, 0xfb378cb0bc006154, 0x3457355cbc3afefe, 0xe89bd3cf58d107f9, - 0xf35155b28cba9f8d, 0x71e841bc988d73b8, 0xb886dfcf09dff0d8, 0xd81963ac1de86d27, 0x4924b1e42394f292, - 0x2f3837fd4815b0e9, 0xa4d0c60b220b298c, 0x45fd6040311a8945, 0x51d775daac6732d6, 0xb0b3488b8279e3c9, - 0x6a73368eb129448c, 0xebb2af3fa2a3294a, 0x42854997843fecfe, 0x0851811c7fdaf162, 0x974e31dd6e14bb94, - 0x62ae0a0ae94619c0, 0xcec5afa13879be1c, 0x522e03c7c9653a41, 0x72599d040332a89b, 0xa0bf4a81299888c5, - 0x6c20024209911f2f, 0x66b1098139172ad2, 0x65609183b1c57010, 0x5f54caf0c76d58f2, 0x94b418ff3c9efc36, - 0xded2b9cc8e161e62, 0x5a7b24d1ad36deb4, 0x57a14254297678c3, 0x324c29fdd56996ed, 0x07b7596e4fa4374b, - 0xe70a37cbcc10be82, 0xb5fc5f7c5ed1060a, 0x1746f6939d5a6aa5, 0x555f6333cc98f127, 0x67187c818e673894, - 0xfe8bbe19de51c55e, 0x226e6334effe406b, 0x18022fc9a68483d5, 0xed2d0424c66c97a4, 0x84ca12407b1855b7, - 0x4dc34753d8c0a896, 0xe268f6d1bf5431f0, 0x617d630e859244dc, 0x2dc05aac1e3e7df9, 0xfce2e9d137af0f65, - 0xa93dc84f1e7510b0, 0x432415d0f434c00a, 0x7b35f6c4f765e761, 0xc53a3088b71c969d, 0x40cd11ca18386925, - 0x0a852f53bf215e72, 0xa96dac400319fede, 0xa1f82a19da76f8d5, 0x91209faa30164d96, 0x61623a625768028c, - 0x5447315fa15e75ff, 0x1d0cc48c73051b1a, 0x94b6ac2d95bc165a, 0x5f53a28c669cede2, 0xa4a33bd2eecb21c0, - 0xe8452bef2695ed28, 0x03482539f112ce29, 0xaa1a74a2d19c14e9, 0x663aec8ff711d161, 0xf547e612ed47dad2, - 0x5973d314e58f1610, 0x1c660beab8c3e66a, 0xf9afc744c626ad4e, 0x6071942ccffa20a0, 0xb340f73db88240c6, - 0x63d9915c01752796, 0xdff04aae395562ea, 0x95c529ccd3bc38f2, 0x7aa10b557c4efe11, 0xaceb3fad9595404e, - 0xaf5346dddab02264, 0x411e3f2f2172556a, 0x3e7bd81d12d7648e, 0x3e66e51b207939f8, 0x807bcce15811d1b8, - 0x2ab9818c0d629d7b, 0x88328459bbb89657, 0x0452c175f13bf901, 0x16991468e5075863, 0x9ed4aa489d64e16e, - 0xefd83553af9c1f48, 0x43e6e1071a0a64a3, 0x367cf8d19055aeef, 0xf580e68ff8ab062b, 0xffc45fdb09ea05b9, - 0xcd8083009f5fed40, 0xe34479e5f981492f, 0x80f1c2b9463014a0, 0x2ca3b959c93981df, 0xe81807fed23fc6bd, - 0xc3d5bf3ec675d531, 0xee259c259d35eacd, 0xa8d9689d4767a552, 0xad16e1d1e4f73ae2, 0x3794ea70cb7a56aa, - 0x96915ead739e6aa3, 0x84f786a4372af45e, 0x95f73abd37e4bd45, 0xef9c1f219c223ce4, 0x1dc170f0e03cf512, - 0xe0d42b70238cf76a, 0x13ef55aeb75143bd, 0x8d3ac36cd41bf42e, 0xe90d4a6f54e8bd59, 0x443a1ef28ebaf0e0, - 0xf72af234eb757a6f, 0xd500b3c565cbc572, 0x232a172b357aaf14, 0x6b111e94a75cc141, 0x8b1ef2dec27b43d2, - 0x9b25bc37a98df843, 0xf99b0ca75a2c4778, 0x100ee56aa582f78a, 0xbcb728bd851852f4, 0x8eba70b94aef35e0, - 0x460f7eaf14f15e61, 0x98b53ae0d7ea9cbf, 0x5e463a1ef28ebaea, 0x65c6a18ef3261e92, 0xa742e9156a6f1992, - 0x78bc331de0d61af0, 0xeb2d2edb000de9c1, 0xef35e0d6603ae30f, 0xf234ea92a70e3878, 0xf07bb38ef726e769, - 0x9680331efc8e7ea4, 0x87bca3ac8c8d7293, 0x68d26c72bdcd16e0, 0xe341ef2da2091efc, 0x5e45593cf08eabe6, - 0x66440f7ec71d043d, 0xe8bd54a94678701e, 0x0c2cbc5789fef853, 0xa777aaab52aa35f0, 0xcee3b002078c70bc, - 0xc5f8e34f85dea9de, 0x4a19e3811ef28eb2, 0x651e7b95720bf596, 0x5b0ca7023cf1a0f6, 0x56aae8777ad03bf5, - 0x053de41df96b5579, 0x277cf0a0f73afa97, 0x1ef20ef875958e39, 0x52a973df61b4a05d, 0x78c83bdad5e03952, - 0x69608ee021799a94, 0xdee4f426e56932fd, 0x2b44437ac83b60e2, 0x21ef683b1ef4de42, 0x3f565a3c9ef10778, - 0xb60466ab0138ad06, 0xe76f11fc568b7168, 0x0126c628d10da3b4, 0x89f70abf97aaa508, 0x0fa233fed4e99d60, - 0x564b986b785059fc, 0x41593cf81d30f120, 0xf8d52ac655b5ce73, 0xaddac258a207de6b, 0xad623dc283e0d75a, - 0xa8abd6621ad65ae8, 0x173c0826940bca11, 0x1e04b35e04fe7850, 0x59402be19dfbab5e, 0xc438a487bcb7f0ce, - 0x7d572f61eed083df, 0x41733c383fc64e44, 0x0f7aaf42d88007b5, 0x0b7f90bfca38d4ab, 0x68173de4bd41ef0c, - 0xa78ef15caf37391d, 0x41e5223ca88df516, 0xfa851ef20e7cd008, 0x7ec75ca387bc037f, 0x3cf0de2842e2d4c0, - 0xa242eff5523d6ac8, 0x9cc572d5c43bcf97, 0x26d69b080fcad32c, 0x63cce341659b9843, 0x78e7fec21fbc2310, - 0x00bd432b2382977a, 0x5e57cb150c507a12, 0x76a57215dd474fc2, 0x0371034ae81c7aaa, 0x5fe8127acaaf6a8d, - 0x7e71ef62bc1269e9, 0x49bfe0f8148d4478, 0x01a644ad58c3373c, 0xe5579908434ffe55, 0x2bd32f5aabb05540, - 0xa7e40c24c3a8a427, 0x6768968ae83f3c99, 0x30f80bca344b25ee, 0xf226053ca3271313, 0x7f018a9ebca5b44a, - 0x556c18f4871b8617, 0xde705a252637bfc8, 0x77b51db5ca25da84, 0xf08797fd52ab52c7, 0x06427f083ab2a101, - 0x91fc51bf3151f107, 0xe3437e63dda3df2d, 0xe07d8eeb1d2bafeb, 0xe1a6cdcaebc885be, 0xf6364d6ec6498f0f, - 0x8e9c2089c2ff9050, 0xee930f6b1246995d, 0x5c4c0229e2b178ea, 0x86ebfefd7dc82991, 0x73ca39217481caa2, - 0x660d0818d221d91a, 0x72e0054e8f790201, 0x27417bf2a5d2bcf1, 0xc441ea04497756c4, 0x66e6ea39b6e7873a, - 0xdf0d2c8875d08fa6, 0x5ce551d7d5493580, 0x55e82936f68cfd00, 0x43cf4b255164a60a, 0xd823e7377648ecf8, - 0x36a98c71849ea4e9, 0xcfe5a11684b87b90, 0xedf12b62edd1abce, 0x8a2e29625096d153, 0x9c1943178b0ad4cb, - 0x1d68588bca118656, 0x91849526199b5a15, 0xc3120c868331926b, 0x456ce5343e3d9490, 0x4033b286edc34f2e, - 0x4303b15ec392eb27, 0x030a3d4b6407ec59, 0xc9bd7402d4cc0b96, 0x0c2fc9368e429eca, 0x4be91ce69ccbe56f, - 0xbddfe2b145f7204f, 0x8545e11ee886b3e2, 0x7c8f697e80a623ee, 0x25c6d61cf3a64019, 0xf63ba54a094893d1, - 0x6207ec48bd48a24f, 0xa4d22b44b548c586, 0x8ff5f9a0dc86c11f, 0xa4ad4a6163084d84, 0xb81f0b8b07dc54d0, - 0x999dace4485ac35a, 0xc25a4de490033ee2, 0x9e40fbf8268d1632, 0x7ca72069edf13ef1, 0xf3d078a0cb296e0b, - 0xf243d50f77505a55, 0x04aa2070e3833941, 0xda24623070188ed5, 0xeb48b97e85921214, 0xe395f44c00e6495a, - 0xe1cb46acd4d06880, 0xb1b84f4bfb6252be, 0x843e9898215d2a5d, 0x5ac773b6777ec264, 0x5653c54b4603194d, - 0x44ea8515f87cd823, 0xe12b11eaf4fd6431, 0xeaff0371cb6c1f23, 0x825a899499200af3, 0xf226c2cc62de3fa8, - 0xc43291d8fc9fac94, 0xe3e633b942f4b671, 0x8f6dfdf506988852, 0xadb0b757c1a1f341, 0x052f2568c360c441, - 0xae1cf35d6ea965cd, 0x26493ca60841da57, 0x0a9364282ed37fae, 0x44ed3b291816a839, 0x82349dcff39c6820, - 0x52bcd35439dab7e3, 0x21dd5c691c499c36, 0x4f88d38c63ab7827, 0x262a3252444f7ae8, 0x3b584f94d223055a, - 0x0ea1891ea8d99987, 0x36562e39a23043c3, 0xee2a1cee211e6b49, 0x45b1e7088d26488f, 0x73433766af1cb40d, - 0xd7f71056e5c164af, 0x53c396d66202a310, 0x34c4b56c4ef96fd1, 0x18294f09f0cb1083, 0x87f2e5e25e07b108, - 0x1600d6a8542b0793, 0x4e7eb2c39514a013, 0x54ae6e2f7638d736, 0xaf656dedee4a835e, 0xe850386234e1af54, - 0x133282e8e296c49b, 0x2498fb26c5996223, 0xb2a3e8eec473437b, 0x2c42a55d506da4d7, 0xa64170495cd53781, - 0xfc6a0dbb5eb1b1be, 0x1b9162b5f5c52b9e, 0x85c995b02fc2551f, 0x9480549b7dd8dcca, 0x27948246934454b6, - 0xcdc8539fd490d6e0, 0x7c3818c95c52f937, 0xf6bc66d92c5a68ae, 0x203ab6e71a2ab7dc, 0x703c8f711fa547a6, - 0xb657701c179824b1, 0xcfb03f21073d5039, 0xc49a1e17f81b01c0, 0x60c636459b8e630b, 0x3338ab90ba246d60, - 0xf2067684d99fef86, 0xf03a069142133c5e, 0x235af43ae00ca29e, 0xbe2c8b79b2462904, 0xbf4351a56061bc05, - 0x6a3d8dee87d3c55b, 0x886ebb5733f58503, 0x100df617bdc4aa94, 0x4be616452fa55af6, 0x8e17eda9689701ab, - 0x9c5aa64853f14afc, 0xa122ca9309bce687, 0xa1d36305f118a582, 0x787e637c62722884, 0x13258ffb1f0cc757, - 0xaafbb5e1128dd6f6, 0xa75073c27834a6ba, 0x928ac6c53ff4e9f7, 0xf10c5fd8b24a7627, 0xbaf7d5601d33ff19, - 0xb39c7a31330b9013, 0xd8c5d728e38b5cda, 0xaadce830140f50db, 0xcd80a726907e2968, 0xc3c69649379e2d24, - 0x5ffdbeee2444a0a4, 0x6b3815d0862ee024, 0xd57036583d02d1f2, 0xfca1a29d32c4bbde, 0x89c6281d6c8332ca, - 0xef703c3d24da9e72, 0xe2389a342a96e8e3, 0x60cf7b19d1e92168, 0x4866805eb7274782, 0xcd62c74070645046, - 0x674cc40709a28fcc, 0x27d24f9aa68e1f21, 0xc76386e9325ab91c, 0x1742423a56e57585, 0xd16e7bf0717fbfa9, - 0xfdb0c53f3d80c6c0, 0xee7467c87e5b04b0, 0x8c1f168893d2e3c3, 0x1999ac3d848187f2, 0xb0674130476b46c7, - 0xdc5fdad3266a6c1a, 0x7ed2043363d471f6, 0xec6771170d75d1e1, 0x38700da1a08f8fec, 0xa1740fcb73625d63, - 0xe5d419abc6eae56b, 0xa744f7c5a2924dd6, 0x3483be5ecd7c823b, 0xd818a30a9f307b7b, 0x4d653d9618be4e87, - 0x3b70b6b70169ffbb, 0xe1c17743786471a7, 0x731a518ad13de12a, 0x13317b5d4a6823b6, 0x181a9688f109ee51, - 0xd3e9badf8da0eaa6, 0x2586a0478fc05aef, 0xd20e5ef7b6b7974b, 0x72c5a973b8079640, 0x599e30859df037cc, - 0xb3c23e87b6f4c0b9, 0xaec5932548549256, 0x91b932da81632575, 0x27e4ac863a1631dd, 0x6db2d99a57353c18, - 0x9855c50da61a5e55, 0x3e7df9c00665a291, 0x3a48b2c16b6ca1c0, 0x28e5d161a8e338e5, 0xf68620ae75128b66, - 0x9c0ed2edcab9b40c, 0x451308d414d27786, 0xb1d1e96a74ead6a7, 0xd72475c8142489c1, 0x197cc2918114fde9, - 0xfccff4c05a89e200, 0xb03d8fbea30b3ac5, 0x2dffc2d1d5ae56f0, 0xcc17c42e98601ffa, 0xb0f68b564142342f, - 0x8a83aa7cc7b2a9d3, 0x2af180caf2ec6d87, 0x0da6b42e12ea405c, 0x929beb2e2e8f5947, 0x1bb7fbc6c92eb40e, - 0x2f31db5e637e2ede, 0xbd27f57273d453c6, 0x552eefac9120ded9, 0xf5a69ff87816db9d, 0x9c6f66801bd74637, - 0xeab4cd6a8f8ab351, 0x0e80600e45b7a8da, 0x204a1b5323f20818, 0x7371ee64d00c2019, 0x0b6ced7ca1d3812a, - 0xf90cede7180b7108, 0x20e43c212258d50f, 0x6ae989f7832f57f9, 0x6568364d33036418, 0xe09edc306efa40c3, - 0x9d87f1477da7c726, 0x27b99d48eeb99c2a, 0x022174ddcfe4ba0a, 0xea72f042639657a7, 0x12bbef1a7cb5232b, - 0x1a8d7a7595710bf3, 0x277670ee34450b1c, 0x620457102009063c, 0x25e0f0b055281ada, 0x2970c37e943b7d7d, - 0x78f21a7b81e72d5e, 0x1328d8e4b97639e8, 0x345961babc80aab4, 0x76e86b852d597179, 0xf52d348a8e358018, - 0x4ec6274a0c27b881, 0xc68e18c7697a8e19, 0xa021d1c181091970, 0xca24c42e2d7dc49d, 0x6f74f60b8ca6128f, - 0x2627002d1d18e037, 0x808f0ca4a3548338, 0xc42d52b615122eca, 0xca8632ef559bb7b7, 0xb5c61e24a46e818a, - 0x1fe61c234426aa21, 0x18453535effa8556, 0xcae94eb5a94a99c1, 0x8f094e9b9e5eb71d, 0xe22c69bc72907637, - 0x54846e7b28ad62a3, 0x461b7268c0aa799b, 0x0ec3a317142d4fba, 0x5ced9d640513ee73, 0x7806c115878b8399, - 0x61e4e2c19bddfe54, 0x067360fc8aa80cce, 0x0a6d7bc89db1680b, 0x05c2452349f8c9bd, 0x4e638ea5d4f131c7, - 0xa48400024422bfbb, 0x342cc9320ca64a00, 0x0af368e86f42f873, 0x35c4c5882724f2ab, 0x343c7ea2059da9f7, - 0xc9c19dc835a40ad9, 0x3bad9d156c2d1742, 0x931af69f410c7246, 0x351ab3ac7ad03dbe, 0x56d2fc60e84e3d7c, - 0x4c30308e2b6fc4f6, 0x881df4cd107e3d95, 0xbcc04e7b9d4fef23, 0x4e3e67eefb1f8d45, 0x0495ddee98a5491f, - 0x9ec8fe429d854a83, 0x86999a6935416d48, 0x269be661dd51acb3, 0xe1660ec9fa628ed5, 0xdffd05df8b994f91, - 0xed133d68641f0fe1, 0x660026929dfd3588, 0x61e860b9f5637ba6, 0x661d280eec07e6c0, 0x2e56716019f82a35, - 0x247eb06c19295369, 0xa6ed33715d9f9dcf, 0xf881f88cff727296, 0x934b705dfec2ff1f, 0xe2bc16e3f793c9cf, - 0x5999af1fec32c463, 0x6ec9854d4ce324af, 0x20f9fceb9e64cfdd, 0xde02f046db1f2958, 0xe6be7ef9f29f8868, - 0x1be37afcb5db9200, 0x57fb905bc6b99e21, 0x022a531b2059ff04, 0x468cd1f9dd7831d5, 0x470ec3b13972dfbe, - 0x106afdf519064d8d, 0x3f3fcf60e7d61fc5, 0x3624e6eb32fa3714, 0x05c8c3ef70f7df50, 0x36d5d24b509136a8, - 0xef83d145b3b111ea, 0xd2e4df7a5b72d905, 0xd563faaa56726a61, 0xfb7e09c2122d562c, 0x9e1f908b4b96f1b7, - 0xffadd1ff73302266, 0xe47d265e4455a22f, 0x1f36634c0cb9d791, 0x28c9a8642faa1997, 0x67b315e3024e3146, - 0x098d255ca4631f78, 0x3ab8ecc2038db3d3, 0x7366d1cd99efed55, 0x6fb1ee62104adf90, 0x82b6cd7436604134, - 0xaca728df545c558f, 0x015967f52f95cc7d, 0x14056a4a40c1b592, 0x01b48c7ec6f1156a, 0x64ef7b1d7d97aac4, - 0x947287f76c964704, 0x75f8c6d01e15d89a, 0x83799d485a47ba4d, 0x628a9bef460b3017, 0x0bba4255efeabe82, - 0x7f918c2e8f2b4d28, 0x1571541ee8e094ab, 0xd0de1116a58c3ae4, 0x5557110df3655276, 0x55d118265ca204fd, - 0xaa11eedd1d8292ef, 0x3db205553499c297, 0x5f99a26f304dc8cd, 0xc3a460bf4283193a, 0xc5a4b28d7f50b31b, - 0x4515bff8300fdb52, 0x5443f504be419d0b, 0x2a80feb77c0997b8, 0x08ee6613a06e3682, 0xda181828938352a0, - 0x26e98283c638298c, 0xa33652202400a4e0, 0xa5f2d70402ac8254, 0x0a6ae694966358ab, 0x218d513686eb9894, - 0xe01c0448030eb974, 0x82cad3449287d318, 0x85f09f5b0c804d82, 0xca039ddc88ad7275, 0x9e2af2e80495073a, - 0xc511e9b139495003, 0x8ed0cdb6580dc574, 0x82ca0315e588d4ec, 0x4c1ef4a54d800630, 0x747d7d94a76845cd, - 0x2471193741939af4, 0xc131e0a8f7a1b50a, 0x9dce78dfca604b92, 0xe40c2aadad6a44fa, 0xcb4441dd47aaee46, - 0x3c69ec25f1d8a004, 0x3b58808697a38571, 0xe276b542074abb3c, 0x532a94dbff049d65, 0x52668406ae4f74a8, - 0x1843913882162929, 0x915722e8ce060b82, 0x80f12fbab66abc36, 0x1f26f5b3d7a93ca3, 0xc9421be4345fb88d, - 0x6e42ac12fa146b12, 0xa0902a26e1ec0d08, 0xf3059ab0f12fd41a, 0xd44c8328a5a25a92, 0x760a1cfa33a522cc, - 0x3033defc2fe5e417, 0xb2eca08a308f134d, 0xc2b72692d0b7894f, 0x3036687255f14f67, 0x50116f41a917aac7, - 0xa1722dac5c549df7, 0x2d0fed501e402d7f, 0x18b640179dc43de2, 0x26f8633ef045b519, 0xe8a0cae0286a6114, - 0xc1d352ea58e1a2f1, 0x3589d7206f11527b, 0x029123f4516118f8, 0x06682082ad42d638, 0x2f290623f44d3506, - 0xdf56b7460a2731e7, 0x2103eac5a804e468, 0xe13289829c971443, 0x2ef44dc3a79117ea, 0x058c7e2917c34b8f, - 0x7f7ca4ff535616d2, 0x3e4fff4a35c63ea2, 0x51587fe97f7f0d8c, 0xa54a5b69dbf033c2, 0x2a075b1dd6615a84, - 0x4151b2aeb2a3f8e7, 0x81dab8ed6f6f5dc7, 0x6f6f8dc16f7f5070, 0x8ac5648983f7db35, 0x7e1e3bef7b712f04, - 0x1c7a874f1770146d, 0xd9f9199c9cb0d488, 0x058d1012e9237b1b, 0x522cf58e63093e58, 0x00f8d17b0f65504e, - 0x57c227783663435b, 0x11572a3db9050238, 0xc3f92aa72572799c, 0xb13aaf7869eec9c5, 0x461a23ef9eba02c4, - 0xbae90dc8a8911414, 0xbdaaa12a0a3e55cb, 0x6820ad0237291e06, 0xb5c86af061d05bcc, 0x07360b39f4d61f7b, - 0xb3a15fd62b39eb85, 0x4bb1234aef936990, 0x838dd18075110c22, 0xb54a1067315c95cb, 0xa2ba2a57d0ed65d6, - 0x1a3263bc06178ab1, 0xa21481673d743b74, 0x34421e26aeb40bc7, 0x8b7e6f969eedc264, 0x733b451bd17afda4, - 0x3c42aad24706cb3c, 0x423f8dbb70dbfbd3, 0x4fb925bbe821b720, 0x72ca36c6de1dd8eb, 0x603da99febdb2e56, - 0xea1fd0c8bc1c7e50, 0x56a8f2c39c44939a, 0x2993f1e8e3168ec3, 0x5b6f3f42dcd89dc1, 0x010395d8c20ca630, - 0x0aac9522f62a1a96, 0xe718289a3e78502f, 0xee4fe10560bf5e49, 0x8257d0b4fb3b9c1c, 0x3095df0db68a1f2a, - 0xbdad870fe9ef658e, 0xa3ce914750725b8b, 0x49858e81e269324d, 0x37a39cd28cf96f13, 0x6ec68cdae1956455, - 0x1bb7497e2ce5703d, 0x501b99e80878f11c, 0x0e11a0410d542be5, 0x7dd8d98ef6ab8d24, 0x726ed11029ca4521, - 0x4519a4d89deeed75, 0xa08d720b9566210b, 0x0f05eb813ed0879c, 0xc300eec27fe9183a, 0xbe4c0a00549e6e15, - 0x1caff708f12179da, 0x2127f7fb43b2424a, 0x68defbc00dd6705c, 0x88824b429c5e4be7, 0xe4c6501da24c13c6, - 0xd174c983d6c65cd3, 0x7a384a0b7097cca1, 0xe4b41af0214426d9, 0x5046a240c8fb9da6, 0x15c02b5f7c704dff, - 0x6f520f87df2a9206, 0xc0319a59d6aca72d, 0x6ffd23fd4e88debd, 0x9cc18ca185d25c30, 0x381335eed5dd9fa3, - 0x67cccb62866ad739, 0x761d221faf899b88, 0xd8777d19a1a59dfe, 0x6713dc4ec807d153, 0xf23e62d241380175, - 0x1f010bee89ba8f18, 0xebfb8889731fe1b6, 0xcab899716a5cd5be, 0xf88545e672d46fb6, 0x6273a3114000bb1a, - 0xdb901c79abbee713, 0xc7df0fcea0d2e90e, 0x76f293230d8d41c8, 0x5a3edec635d993c8, 0x069a17e704c8018c, - 0x0cb227660f5c3dc8, 0x4c4477bb6706c756, 0xec7b7c6cf99f3ff7, 0xd8721b632c139c1a, 0x03cd8a937b5d7622, - 0xb7ad26496a8fafb2, 0x647eda9b7964f6af, 0x5cf53e6ff6687369, 0x97c480ae52b8b12e, 0x4873d56d20f9777f, - 0x493022d83420920d, 0xb1a002578190776a, 0x545fc65629af6586, 0xd149b48caf841849, 0x1780311933e5bc76, - 0x48c4215b2089b52d, 0x18c69a268bc31b39, 0x53c465a2d4faede5, 0x0c660c715b31c39c, 0x2c2704974ceebda3, - 0x3b30dc74757a0826, 0x7ed291c29c9648b1, 0x4bd480cccc8e7f34, 0x8a4dce0773bf8e79, 0x0f9d3042704ab133, - 0x98fa24ef8ec61198, 0x9d1480ce812901d0, 0x3938c5bee18c666e, 0x939caff630679c9c, 0x3b5ff5e9ae335972, - 0xaaf6aca224f11452, 0x1da16f8a51d7de8d, 0xc4d1b5ba50898690, 0xce61ca27029b8a8d, 0x32cc66ff2e8ee7ab, - 0xd45a3493969201d7, 0x9f0e7778054b041c, 0x97b754e874f65ebc, 0xd587b773f8a1a690, 0xaa43f84102470bef, - 0xc25b8ab2d1d63b78, 0x4a8237b1c5f51601, 0xc7ab62f4547ce550, 0x4f21cef28a9ec25d, 0xb172de9e4254f6e8, - 0xbe552167d744827b, 0x58eadfef43d75dae, 0x53a1354f03b28b80, 0xefefcfbd2b2458f9, 0xa97b540423a6aee9, - 0xaebdab0c0fa5f751, 0x57dd3e86c7b5e344, 0x7bab9a09cd3f04b5, 0x3aa146912752071b, 0x05db8e2f33ea6e90, - 0xdcfc94e16d8affd6, 0xc99d7f57e3d7659b, 0xedb2bd6a0c4e39b8, 0xf9fcc4b5ca6d4b6d, 0x83b6d8a59414aefe, - 0x340d49f65ba6e560, 0xdd8a9ddc5dc2cd78, 0x50aa99e0f58bce68, 0x7701edd5eded8589, 0xa440c45d9c1b277a, - 0x8e244ddd3f266aa3, 0xfbc8fc780f179007, 0xe3f6cf608ca2c9fe, 0x7e554ddf725b5776, 0xd5596051435d577c, - 0xd2be42e45a5c6953, 0x7588c40f5f057420, 0x048b8e1eda0390c0, 0x11090bf322ba82ef, 0xacce15d60ea33b0b, - 0x80ff8b412d9dc15f, 0x51ba50f173c0182a, 0x06291fa07310e6fb, 0x61709d3ea2dc1957, 0x6c3b3f4a1cb122c1, - 0xe9e46fc0a88bb474, 0x81104114d48a5cdb, 0x9b112238b8291474, 0x8f268571b6c6bf22, 0x99432a51198574df, - 0x4284c27ef9e12c11, 0xafdabec441abd1a6, 0x01d60b1c2c3cf034, 0x50c7881bd4e91df4, 0x8c5e109c288a5ca0, - 0xaf57eade593f6d43, 0xe9675eb53d7ea712, 0xf5a27e34a1ebf3ee, 0x6e9f0247274f08fa, 0xd0e4a01a53a7c8d4, - 0x5dcd767fb2a5a7b2, 0x9a83b59647514f49, 0xc65d5b9b896cc6ee, 0x8d82284856846ca1, 0x0bfb4456313e1a43, - 0xedbcb0fcedfd1061, 0xfcb0aaec91230f59, 0x510a1054d1d0c73d, 0xcdee0201eb9d8a35, 0x7aa6ed90e5782990, - 0xebb8f9e1b49bfafb, 0x2220a408f5f775e7, 0xe2e022d9df086227, 0xfd7d7176edeeccd7, 0x77ebe36a74115deb, - 0x3ebeb67decca1302, 0x7d9cb15b4b5a0ff2, 0x33eca1a5b2826537, 0x7b51035a33003d18, 0x95d0ba9e58d6695b, - 0x85fb74de5eebea6f, 0x43d6411e0c761db4, 0xb89002546021742b, 0x67662b23cbe2ecf3, 0xa16eab47b8fa0193, - 0x2ffd66f880c9a7ef, 0xf6d93ab6aafac239, 0xadbac6219aeb8911, 0xfb0a2a41e97b688c, 0xb416f47ad232af98, - 0x85815a43d6da1f46, 0x5661af3c6e68423c, 0x8f52fceaf73a8ffe, 0x6ffeeca77e77e7f2, 0xbcf0d3a3d0ebfd5b, - 0x93e3a6bc74be247f, 0xb9592bdec7c42f37, 0x6bd5fb98f875ff51, 0x744978aaa4edfb8f, 0xac8f8c7fb18f0cf6, - 0xace55a5a92fbf7f9, 0xe41b58f54e9fa023, 0x317e68a736e2b2dc, 0xf4dddb768ee623f4, 0x6da1bfac34baa0b9, - 0x259a7ffd1e1c9d0c, 0xe0148acb199939dc, 0x649d1f946aedc159, 0xf5fc008271bc34ce, 0x0f4897ac4d1e58b4, - 0x31ed9913bc89994e, 0x388dc8535938fe44, 0x497a36f85982db2a, 0xb8327d34fc92a4ec, 0x6ecc27a75899b3d6, - 0xf8d994627095b6b6, 0x5885b3d6f9d99262, 0xa480618a9dc3ca49, 0x6b315abafc4d8842, 0xacbfa10a86e8a5a1, - 0xc78307675081e28b, 0xf4731b80cbb89828, 0x185b6495f2a84217, 0x65a46750b46e07e8, 0xaa6cba57c1226904, - 0x0b06735debe0cb69, 0x847f301c26a42546, 0x209fec0fc650f36b, 0xb328010c36fdad1c, 0x8cc161c34fd67ed3, - 0x89d16486c8d75ea0, 0x071a17ea2e047049, 0x995961ba573ec815, 0x73db83f6c01cc415, 0xc3506d6b254ddcb8, - 0x68be425764361165, 0xd23d84bb0cd50452, 0x31330c82cebfeda2, 0x7635e2f84f4084b0, 0x3b6351cb7967a603, - 0x13d028bd7f03fc21, 0xff292c1ff12bc43d, 0xfa15b21d0ab040f3, 0xf8aad7b9c9e573b8, 0x9dcf157288dd91fb, - 0x32d72e47b9ed5cbb, 0x12e57638e5215296, 0x1182fc887bb3e862, 0xd42915ed447acba8, 0xf0549aed4387d1f8, - 0xd2c07af4afe19863, 0xe8c25ada482930eb, 0x140fac7ce1c1cf08, 0xb930869f606417aa, 0x68a2d0378e7f86c8, - 0x47e663c5f9287568, 0x1568bd15c4bf5324, 0xd757c30f18b67a1f, 0x70aaee822131b0eb, 0xce1732ed471438f5, - 0xa5e1a18b7856b3f7, 0xe69bee54bf46f6e9, 0xa33933a73ddd0f7e, 0x7bc086d9af97b8d6, 0x9670acf6bb4b2958, - 0xd113785a8f0d0711, 0xffea9303bb7ca278, 0x8c1e5899bc2c701f, 0x0e0412b95ce22017, 0xb9c14ae47149612b, - 0x7348517269e1d5e5, 0x642abb2441a66348, 0xd85e0fe723d5e672, 0x9222ee5777f4d02d, 0x88fbcda5d6f5e4da, - 0xfd941c373c76d5ca, 0xa05c36fe3aead410, 0x74f71d49327f5da3, 0x50a3a5b3505585ca, 0x2fa478243b7c8bd3, - 0x44a6501fe2d9291e, 0xedc38d00a2437d38, 0xe1c494b3bc785090, 0x894e9ef5d02684bb, 0x95641dc08380b2cf, - 0x76fda1ab3e2cc469, 0x9b4e5eb82a40d3ce, 0x7bf7a784ae37dade, 0xdad711f6382cc2da, 0x308156cfa7030229, - 0x39118f4a5534bf6c, 0xba1fe6fa8304d5e3, 0x6eb21605406a4cf1, 0x726d8a934d549320, 0xbaf3f3c692c1d81c, - 0xcee7ec8abcf3bdb6, 0x2bd097bd1449597f, 0xc5d63298e2223d91, 0xcb44be7a8c799029, 0x049993d14b0bc738, - 0x3b9145e68402f367, 0x819ecc1ffa945697, 0x754db6ae169bd34f, 0x4c89d4a6e3ec650b, 0xd216cb9dfc90520b, - 0x44ec12f3e07137a8, 0xda93ac295022fc31, 0x5c2356070af6a842, 0x219c0c483f2553c5, 0x2b0aaecc1343e3b0, - 0x54fa480be6ea3a63, 0xb96c4200daebae76, 0x02b50298cd647ec7, 0x404950420a77bd1a, 0x5a229f9b148349eb, - 0xf0b301cc9f56428c, 0xe5b20931682a80ca, 0x4a585e1e132bdf87, 0xc3ab4d96b046c98c, 0x5e5a9c8014e27e0d, - 0xed9c2cea9707c455, 0xd1b486bd3a48268e, 0xc5df9336a6fdf903, 0x7e223e2156dfbef2, 0x58538c8c24522b6b, - 0x5ecc281875772421, 0xf83be4d91e8eedc9, 0x017e532faad6f9a6, 0xb34d989bd721fc9f, 0x620942347704f594, - 0x65fe4715a0dadf03, 0x7d07af6a63490f69, 0x1857484ccfc95126, 0xf98d6326911a61af, 0xb31fa8aca7a2f4c8, - 0x4fa364280d22e620, 0xa0af90876cd22a42, 0x26e2fee5be558e50, 0x9f9c1ee3c210b2dd, 0xad5c74631508ac5c, - 0x8aaaf075af7a052d, 0xd1ede310a29cb221, 0xe47612af80460e5a, 0xb816a7a3d3279be3, 0x144620ac37930989, - 0xef8f9e7cfbfac822, 0xc22fbd6035018505, 0xa27f7491a5075ea6, 0xb4b6074fce3ce4fb, 0x1159beb52f825507, - 0x343c6cd5e45844cc, 0x8f7112bee85cd8ee, 0x4a8d7769d07afae4, 0xf40e03c3a07cddfd, 0x389a206e6e186b4f, - 0x71cee0ab6440f8a4, 0x926205032a4d5ac1, 0xf5ff40bf554f1e89, 0xfbcbfc3b50ca00c3, 0x53c96ce7d0e00054, - 0x092ff4cde012c86d, 0x80d8a10342d6b86f, 0xaf3f112b17a46075, 0x42b1bf3742eb7102, 0xada7e8f48d403c49, - 0x80783699fed69df6, 0x3782f23401e531c6, 0xf0c6608e12605ee0, 0x18445bee46609e25, 0xc0bcd222c98d617d, - 0x95804543f2f0ed6c, 0x32c292b411a8af93, 0x68a9fd702330c769, 0x3d06be692340ff70, 0x00f1f1e478fc146a, - 0x7d23ac2c3d8ac999, 0x01922874b7730766, 0x58af066a0333ad47, 0xef9f4948d27b77c6, 0x6d05c44d10fb26b1, - 0x4af1997e23da3f77, 0x608862e3e6305e25, 0x606cb05a2a18a789, 0x5528ebc2a600bc4e, 0x00d87809fa3ede2d, - 0x9b37e3c7d4f567d3, 0x49f1c68544bec027, 0xb33b4df6ae03e7bd, 0x9ee7278311f4b910, 0x577313486f1d48d3, - 0xc1350c55cc6a4684, 0xc25e8dcc9b00ecb9, 0x5d8633f0532895f5, 0x583631441cb1c10c, 0xdbfa1562ae6583a9, - 0x67d9be9965ebc09f, 0xe25030ee67ae4041, 0xed3b50c969f85dfb, 0x65e0c0f9f593fae5, 0xd2ede1efeeb494bf, - 0x73404081e70969b3, 0x6e04e0bd47eb39c5, 0x92dcacdbece21800, 0xa562cb6f84d1c81b, 0xad9f885310d85db0, - 0xba8acd6a3b1a3702, 0x33f6565c1ad62434, 0x5f6404926c5f1abc, 0x8d9a18e330ef19e8, 0xd76e8f4e2e45a2f6, - 0x895ceb2ffe2811e9, 0xcae9fc23544a3621, 0xe4d40723a29013e4, 0xdf7002cd5c38dd5f, 0x0782cf4620e60e08, - 0x91f82a11d9465016, 0xfe48a58ba74d7089, 0xd1fb0b43ef65f244, 0x8435ef2a2b76a970, 0xff27c93bdc1dee17, - 0xb92fc2e383b40228, 0xa628fe0c329e0462, 0x18df0f8ee6a98834, 0x6569c9c8bc39b3ef, 0x2e752458cea4f1d1, - 0xdb878f8fbe61fb4c, 0xcef81652787b445f, 0x51ea9b67b6106d6d, 0x245ecc54f0bbd777, 0x2cf8ecae353e39b1, - 0x057b70c63decbe1b, 0x9cc8557326fa9c3a, 0xe4018336bbeee266, 0x3a4bc9af9da662a7, 0xcc54e6f4a52dc371, - 0x4d5f42c52653c1e3, 0x58c1e32ccd3b1c3e, 0x3c7ef1d496643586, 0x6ce55eb8e366ac8f, 0xbc998a7efddaa129, - 0x28734a0a3b29d3c1, 0x31e129b2cdc135cb, 0x2a45b809e82c3f26, 0xf98f4ea02b52bae7, 0xa2349a65ebe18a2d, - 0x83c00d40c900a11c, 0x80a011cb50bc1a28, 0xfe722ad71dc7d423, 0x833e0b9bb3416b06, 0xa07d8d201153cc1a, - 0x08203351c425751c, 0xa367ef364006ce18, 0xd2213dde085288c8, 0x1a92ec5b9b404394, 0xbc1838b5056e4ef0, - 0x52925c0ad686a44a, 0xd04a81d98c4e4942, 0x799bfb3a50011bfe, 0x8632e18fb32c1b80, 0x68ba207c66630328, - 0x24b25bb356ad284d, 0x92baf52bd60a0024, 0x0ccbba6e058a93fc, 0xc4a1011b80f368db, 0x0448c705827076d7, - 0xddfe213ca30d7b6c, 0x74c53bff06d0f693, 0xd05e2cae0688a2be, 0x29243a411b48a4bc, 0x239cfb0610e86061, - 0x47998922064f6f99, 0x414cc2202a1b80b8, 0xfd7410c4ff7e6243, 0x88d50d80489521ba, 0x20629ce2dfbd3b05, - 0x072831baca5b9e8e, 0xbaf649e049eabc0e, 0xbc5160ec911f86f1, 0xc03565cc545d5e57, 0xd74b54a66b419eed, - 0x54b67d05e84206d0, 0x85bb81fe3203e82f, 0xef067a3b03e8edbb, 0x81dec9007ae76ea0, 0x1f6600fdf06ea01f, - 0x6500fd88417b4a5c, 0x5940ffcd8c756f3b, 0x1335c5c3d1f0ddf8, 0x0a9792afba73d294, 0x0ab2c2ae8d93e162, - 0xddab50b682cae748, 0x4d9eac63f927dd83, 0x82994d258663ad9f, 0x7e14a5432eb105df, 0x0ff505bd7b621411, - 0x8ebe4cc56718f143, 0x9f50eb7ec5e3a13a, 0x4a6329a6d80143ec, 0xb8e75ed72ad1d1c8, 0x08996abb2a1a2173, - 0x6d4f672364b1ad95, 0x383ae325531b2aad, 0xd89f262332413e24, 0xbb646badef74065e, 0x79ddddeb541e3c50, - 0x263bd093c5f10f8a, 0xc6444c9596574eae, 0x98ebbf1a4c7064a3, 0xc1817efcdbe9372f, 0xff75f1faf8f9d14b, - 0xf8be2e44bf8e0a85, 0xf3028ea1a4004cde, 0xafc87d0dec1fe219, 0xc5f61aaad190e94c, 0xe00e16b702e3fc1b, - 0xb1a096ded786d45b, 0xf3eecf3452a092f7, 0x4e07e6ba7ff3eb68, 0xb975357b43aa0917, 0xa4a12ad60ba4f278, - 0x8c43736a67527052, 0x48bfa129b4988e8e, 0xfbd67e5d39ef305e, 0xab5dad90871f8c71, 0xa797fc51acdc93b6, - 0xa33210c82ea0cbda, 0xd2c6578d322ae14a, 0x131a956b7a9d9cf8, 0x7acd0a7733b470a6, 0x301f5939024d7352, - 0x466060781967f05a, 0x177e7f419e8d0306, 0xb87a246e2fa07a6e, 0x8c1f8383cec43f49, 0xa84abc5126f35ba4, - 0x9e81eea61880b02a, 0x832a7f4e744b7307, 0x6f28b0f0008185db, 0xfc160f1808cfbc12, 0x2e1096939dfd90e3, - 0x222c37d63751ee0d, 0x9c2325153734ae62, 0xf190f84c816e07f0, 0xa0e5229ba73e9b61, 0xaf0de00cbfc0e064, - 0xb13ee7c4753030eb, 0xf92e690a6da314e5, 0x0c0d6d7fa0896f02, 0xd224b370b7acd7d6, 0x3551c23448a8fdd3, - 0x89a96ba396794a5c, 0xe24be484b4d8607a, 0xe40c0213a5a00725, 0xe39ec170b7b7ddc1, 0x479e55301fc56030, - 0x9f0ee857dbd40ba3, 0xc424a1026ac46a36, 0x00618442932fbc90, 0x27a9a52d781d5563, 0xafb0c4ab4b292b9e, - 0xd432cd5728d1ac30, 0xe82275f00bdad6d6, 0xcd566364730fab85, 0x32cbdd8c229b91e0, 0xd31a8d59b3a6d13d, - 0x7266b9b6d15ec40b, 0xbdce62a3809bb3d0, 0x528b2f1358160514, 0x48391eb8ef59233e, 0x76b1e26faf501694, - 0xe0c63bab329067a5, 0x82f1ce1187cf0688, 0x9fa386ddf7121331, 0x96075be5ccb63da0, 0xeacd34201f9db0fb, - 0x36335b075a48c2a2, 0x70cfa089cdba5895, 0x155bac288eb96e5e, 0xc8d6c18f70ad4ba9, 0x9fd6a98467a000ee, - 0x425fe528b6f264d0, 0xc5e8a4d3384c2c43, 0x6850806a437ac72a, 0x8206b4ba93a3d2b8, 0x284218ea2e5bb961, - 0xc94f66bfe24c725f, 0xc3d569fd61873fa0, 0xd52839fa6c3cecd0, 0xd0e4c8d8a10f9aff, 0x8e0f17dce3fffc94, - 0xd282e0423ab10f3f, 0x3c78a0025c5e8819, 0x0cc7a40fe4437f49, 0xe0b20bbe09c46dc7, 0x33daf3d0dc6b6c75, - 0xc106a00cf993c572, 0xc893e83ab60e24ec, 0x46cd11f70ab62a57, 0x1cf15e1c5488556d, 0x04c71664ba3a9291, - 0xf2b2333a0bedbee3, 0xc2f9ee4bb6757f19, 0xdb013922fda5c2c2, 0xb74b8907821f4798, 0x3393ce218e156ed0, - 0xf94b69c9a1f3c189, 0x547f59884e3a8707, 0xf142d7050a6a7d99, 0xbfee5c465d3bdb8c, 0x1e3dcfb12784b8ee, - 0xa124df698a79d637, 0x649c4b92b8d7134a, 0x545d902c1ceaf715, 0x832b384cb6273b27, 0x884440bd8158b842, - 0xff8be838c8d4ee9c, 0x704f863e754e82c8, 0x6c6f0793294c7d32, 0x59f48e1e4fe6f3c9, 0xd576e92038d67776, - 0x820b8f14356e331c, 0x1b1d8a91474c5210, 0x9a8a0a1c5c3c8305, 0x52f3d302f919d701, 0x27443eb0ffbc6b4c, - 0x74c2ab82eb7be147, 0xc4e5bfc0b279fd91, 0xe6ff8c1680fccbe8, 0x1893fc84ae4c778f, 0xf716bb8597e1f5e1, - 0x187d2c8b81b5fd0d, 0x0d9005168d09fbea, 0x522eb106c4eb1fea, 0x09e0e7362371edda, 0x85c8f2e5dd0b9a30, - 0x06a5d713c2325ce0, 0x25bb44330bd27107, 0xc31f31ae8e29264f, 0x618315901b0dcb88, 0x029d474d6b7aa4d9, - 0xad2ff88992c1b211, 0xea0c0d1634f505a4, 0xc48c3cc40d91d378, 0x106ff52a4dd4955e, 0xa0729b34833666f0, - 0xb593fda284dadcd9, 0x99dc8d12aed3a5d0, 0x2ed0b90e2e407b8b, 0xac3b95b222bf7701, 0x2f5cb327203b96c2, - 0x70c68d363345b7b0, 0x29cabaad37d5b3a7, 0x09c1c3c22652fd9f, 0x43efff9e76b8ccaf, 0x9e644af1ebe9aa0f, - 0x03c485d987453573, 0xda12f6483b344c65, 0x983c4d98c2c1109c, 0x741b0b8a6f3790d2, 0x846cde34d3056f22, - 0x0f82700d6288542f, 0xbbab60c5f266f381, 0x997e0b28f8e00e90, 0xf011ad8e98fb4ccf, 0xf0524e09d83c9656, - 0xb522e648f44e5c5a, 0x7a676125c105d8fc, 0x68320aef3e1f6c24, 0xda3fdf2e8b2d76b3, 0x1d568df7ccfb6b08, - 0xfce7d85efd68859a, 0xd461bce96011deb0, 0x0cc5ee3828ac41a2, 0x1d7771cd1c7ff4c5, 0x8706957094719c88, - 0x7fab4e40eace95a8, 0x210721ffac4ed7d2, 0xb8f954ca04618ef3, 0x830d779ca0c93d66, 0x9083b0d2e89b5687, - 0x17ecd05661c3a685, 0xa8e208e162e33275, 0x66bc9e5c878becad, 0x9b4dc162771da207, 0x768c6a31fc7f66e8, - 0xdbc91fa3655a87c1, 0xc79172cff219cfc1, 0x03dae357b002bc7f, 0xae6703c263463b74, 0x4919e39848ac9b16, - 0x8fb2ba7e6d509307, 0xa33e95221ffcb07a, 0x411a7b89a495713a, 0x9f5c9bc9975d3ce2, 0x9f49c91e9b179720, - 0x51204446bbad7e5d, 0xec42c497d8b8d7ef, 0xa61869d7652c857d, 0x0ca5e294d7f40a0d, 0xb1e01cf8d0b14269, - 0xf15804072ad0890b, 0x0e86f0d699414834, 0x99c2eddef8c054b5, 0x6615b088ac5a6282, 0xc8600f8dd512da08, - 0xd7b41450eec8ca5e, 0x184d70d701ffdd36, 0xb40c040dafd85ad8, 0x1ceca6302de11c29, 0x78bc4f0566027aa6, - 0x6c6f1b13ee0a62e5, 0x24e552a05b2a078f, 0x53619cd1c6a5b158, 0x35bec382cbf72a52, 0x99681b38ef2a06cc, - 0xc1bd18ed98f137c4, 0x958d3967dcde42cd, 0x4631607e7e8a46e3, 0xe562c6c5dab0ae42, 0xd59d3521ac3faec3, - 0x76436463792ca6da, 0x5416c87aeb97dbad, 0x5e59baaf30a58d89, 0xec8ae2093a79108c, 0x756c0c8247c7f0a6, - 0xcc6c5fc83836088a, 0xc7ce5a409e656cbc, 0x5176f4c69b849529, 0xbc22580cb571553a, 0x50734f08476cb602, - 0xf2724715c0f744b2, 0x56a92066e3f779d0, 0x4e5afc6d3a44e236, 0x6ee97805451329ad, 0x4d5abcadc02b38f0, - 0x1d4bb7e04871be2a, 0x7e48acdaacdb420b, 0xd34c5362b70fbcf8, 0x1e5e7300447b8ff5, 0x9b79dea6a2502809, - 0x11814a756ee0b620, 0x3e5dc924d489217f, 0x4726cd6b09a8238e, 0x6b11f27d3778e058, 0xcda1294a2496863f, - 0x0daa1479208e6adc, 0xbe675d17430743fb, 0xb175d464debebbed, 0xd42af566a3d8a200, 0x8cd0e481b8f2f696, - 0xc70418f16089079d, 0x1d5d048108892354, 0xe6dc82adac63a23c, 0x45879509077a97d0, 0x5d773b6b20aece88, - 0x8c6f4738228b7c96, 0x80af11c586c51d90, 0x2247083f9f1f7907, 0x2af0026ce0e837c0, 0xe0edc7cddf086f84, - 0x6483e44f6260df09, 0x5fc3f4046f935959, 0xe339f81c480356e1, 0x11c1cd88d7de9873, 0x00dddacd8efc3cbc, - 0xa7da0ba433ee943f, 0xc8223be70d52efe3, 0x5a9ecd78194a0eae, 0x695872f6214829be, 0x554e933280bcf03e, - 0x9ac6b4efa2223547, 0xe3c3634a25d737c1, 0x730cfd7b510392f0, 0x204b5ac2dcb4e327, 0xfe7195a82c3494ec, - 0x789f6e977c790468, 0x6857b33b51ca77b7, 0x5eb6bef4579e9ac1, 0x86be1c1f79235962, 0x8b847d4b5197ae20, - 0x34eb3c2974a229b9, 0x7547ab20b0b8dbdc, 0x9f4214840caf61cd, 0x8fab02d1ecc3f22d, 0x7758bb53bab80278, - 0x45b30de4b57c5b77, 0xf746aad1a45af789, 0x7de6476070239805, 0xa8a5bccca7ceb531, 0xc923d3071e16a42b, - 0x565a34e119025457, 0x8285f0215e547310, 0x4a3e5c9ef4725697, 0xa71c6e79e3448ec5, 0x33b8ad566eb6cd16, - 0xed7a39d12bac17d8, 0x27b36c35b4b6a6ad, 0x072bd697cfb15c7a, 0x2bda4638a42f53a5, 0x1860ed867f43c081, - 0x96f00ae8f5cb1d6f, 0x81d09daeb719a364, 0x1d97168459be300b, 0xb9429c2dc7ebb08a, 0x9cdaafc2a2029ff7, - 0x0cef36a9025ca315, 0x1d1260a54b289404, 0x4d2b1b870a07ab93, 0x0909affd2b396299, 0xff3a9021ce7dab74, - 0x3654b6943d110bf2, 0xe35177fcb3339412, 0xf761bea077cd4691, 0x75aeb9745a759277, 0x9d11fd6f1d62dcdb, - 0x9f34d056155e31d0, 0xb28d30847b5f3fbe, 0xb00bfc25c797ebd6, 0x6fddf8fa9cf742fa, 0x1c8a1d7eb85ed126, - 0x2692b9d3c1e98e42, 0x615ee85d775e7f18, 0x9514127f5e2a1987, 0x6521c9c35a398737, 0x9d36a193bd8bc930, - 0x4f3707ac96983f6c, 0x7aafbc6af2a7b9e9, 0x035f64ff1fec0545, 0xacdfa5238804eb7b, 0xe1fb3f86e2ecc234, - 0x5534f8fb6fbac15e, 0x4edd8d9d7ba4b5da, 0x106e2096bb9e7c77, 0xc7deea0516fcaeab, 0x13a25a3b7286f51c, - 0xfce7ef69710bfbdf, 0xae4eef6a773bff8b, 0x76b5efdbebbf9d9d, 0xadb3835cc95fb2ff, 0x7d1f6cffedff6ceb, - 0xfaff9efe77fcdefe, 0x61fcbe77bfb5425c, 0x17939e253414fee3, 0xe78054afb8312592, 0x743b33d2791dc6a5, - 0x0ab1e3cd3861fc85, 0x9b8da0b5fe07c868, 0xb54de2e7d1bda498, 0x5662878cdbc345c2, 0xc4baab64db5fe292, - 0xe63de4fa7acef6f1, 0xdedfd35f77851a17, 0x9d2e2493f0a34a86, 0x0db083eb176e6f8b, 0xbb0881bebd7d0e0b, - 0xaefe76e7629f0308, 0x1e94db25b690eb21, 0x2a9305590248b2c4, 0xeb17166cf9f3af21, 0x7086db4ef0caefe1, - 0x59631b99dda92306, 0x9d0b7c652772b835, 0x4ef7386c350a1cda, 0xef23b4bea2d77096, 0xcfc1abc2f42a079c, - 0x6dd2f4c3aff31d65, 0xbee77f11c5c65c41, 0x2901b9ca65a8fb1d, 0xbc3cd0f03ba23027, 0xf0fb878815dbb9b3, - 0x83d26eb997d38a40, 0x0405ddb6f890335a, 0xa1d9a0d40123b5c1, 0xd607f2064ddea411, 0xfbc5dd72a3be5bf4, - 0x1be2136a2378cdda, 0x6eab1687a7089305, 0x90d3ba6d38b872a1, 0xe84eda88befbcdca, 0x6eb5582c56182751, - 0x02003043ceb5b777, 0x4453f24ab84d1e12, 0x74c8c9019b0aa1cb, 0xc4ef27a0e9713fc4, 0x541a5a9f0343dccb, - 0xc66f9d87fa6644c7, 0x8d5d65120cf33cef, 0xbe41dfa6c410563f, 0x1d130f53d0def2c4, 0x1c23df116b7d97b2, - 0x4a03139ba3768f26, 0xbbd23f071f67f1a6, 0x683849255eed34a8, 0x18fdc3a893adc856, 0xca96ad9c2d5b85b2, - 0xb988ea90ed19ada0, 0xdcf87de69e302600, 0x1ecc1073305faa94, 0x53addcedd59d17e7, 0x4c8c373cf4ea19fa, - 0x433462ad1f20ab15, 0x06d33a0f5a230334, 0x6bd51eeb5213953a, 0x6d748ad21239c58c, 0x95acd632d49bb025, - 0x8901a96b5224e3dc, 0xe027c2476d91dfca, 0x2de57f69d0df7286, 0xe99678e27b088741, 0x1b0d6f0c6c14b394, - 0x4d89e3a65c420403, 0xa6fbf10f55f42752, 0x979ae062b093fbbe, 0x54cc79441ee801b9, 0xb6e877afcbc558e1, - 0x62d1ccbb75a59f9e, 0x1c7e152f9cb9eac3, 0x173fc4cb8696bb38, 0x65691394207c018a, 0x9a387c496a02bc1e, - 0x41c9ce7f7af4e4f4, 0xe835e7d91a4fe65b, 0x088149030103203f, 0x1b0cb6fe56ae151b, 0x855c1c9e3baf024d, - 0x3d1a637704a7d5c9, 0x9d7e75126b2a629a, 0xaec5a5b4012e887e, 0x9a1d978b57c7df1f, 0x7d73eaa1540e4daf, - 0xe14cd680af877d04, 0x76c251c6afb4da94, 0x32aef3d1580e3586, 0xbd1c329d1b6d9d47, 0x2f28e198688c3f7a, - 0xff70a4b43ad2b4cb, 0xd2d13f1e4391b43b, 0xc2821a9a86099f24, 0xbf4e86fd2d473322, 0xe374c544ca327edf, - 0xf27104ddf9aa8b15, 0x26b88197b32cd8e4, 0x9506fec8c6d42a98, 0xcb20e87b603fb771, 0x137e5706c41b179b, - 0x30203a367d12e13f, 0x8e05f11af3bbedec, 0xcdb0a2c7efb7b1eb, 0x5bb5cfb7b1fbabc1, 0x261bbb57f2ae1bbb, - 0x0764d5c6ce63845c, 0x9d916dead67c8255, 0x757a85adfe13f773, 0x4dd00df673b33bdb, 0x9d76e36df3c5cb17, - 0x479fb86fc696f1d5, 0xfbe2c9e9efb72f3e, 0x3d7a76f8ed37af37, 0xda1b059fdf676f0c, 0xe1936963f4795cb3, - 0x31c65c6a27f6c6bb, 0xed842f78f8aacdd0, 0xd1a71b9e936a3ce0, 0xaae36facf6bff206, 0x19db60eebc4126e6, - 0x6c5adb92fb928de1, 0x613d6feee65fc15d, 0xecabb3570f5fbc7c, 0x7d7172f4e4e5572f, 0x8e7f3c7ada299ed3, - 0x4475937211650363, 0xd729e11bfe4ac2c9, 0x11259591c46f92f8, 0xeae8e4f9e18ba317, 0xafbff9e1823e57f0, - 0x399696cc2890aab1, 0xac02b550c84f6f6f, 0xc9848505925a6abe, 0x827ad18dbfeeb427, 0x1ccad34e96f668e9, - 0x4071679511583ae0, 0xa31b3588db8b8874, 0x19dbef75696fa8eb, 0x5a29d6e968deee2f, 0x3b0be3782875078e, - 0xae3bf9c3e804ae5d, 0x21bd4c4879dedcbf, 0x6141cff2ecfecdf0, 0x2097a3b02d4b78de, 0x5ceedebf3959deff, - 0x08079ae4dee8aa73, 0xd8d93f244f3ed165, 0xd0eae4e092ac490e, 0xaef39751b5d0a61f, 0x55fe71854ae30c11, - 0x6cff284349b257e4, 0x57b9a8f2939723cd, 0x01212725c21d0a17, 0x5039c661d64481ad, 0x70ae8b74c6e3e03d, - 0x72358b10bad20b44, 0x086856b1adeaa89b, 0x3a843150401b26d9, 0xeef0ea53d36d454b, 0xe523374a7ceef4db, - 0xcaadb33bbdfa58ae, 0xa98ff7bab1955365, 0xa8ea0ce380370885, 0xb7453cb117eb2cd2, 0x08d53dd8665d5ce5, - 0xa0abb1c5ceeb7ee4, 0x73acfde615a463aa, 0xfda43b7d6cf753fb, 0x515aa1ebc73ea832, 0xb3ef1d3a039aaca5, - 0x58d6523cab3ea299, 0x1255e986922258e3, 0xf656a5db37dd373d, 0xfcd434a135d7a09c, 0x5c594daeb2256f72, - 0xdd34a37479b1b886, 0xbf583e7649c40a65, 0x1b0553242d7c66ab, 0x2b184ec216ab58a9, 0x94ead56634809555, - 0xa9de6834caa57a84, 0x0f4fe192887d2201, 0xc2c9578ff3670ce1, 0x1cd550e11a18672a, 0xc1c55b8808821295, - 0x4aad56ad56cab7d3, 0x07e55a0d7b1eecb4, 0xe4fec441435f099e, 0x913328764685ffce, 0x71b152249fc7bbfd, - 0x09fbfb3b1b6d4fce, 0xed141f6e8fceb185, 0xc28fc3e9e22d1c7c, 0x232d8fb48200eb22, 0x23dd98789f706d42, - 0xd0b6c6300a55f84e, 0x3ab8ad22d08bed12, 0x81ef9e2dce777f7b, 0x3f44ac99eded85b9, 0x3779f060b13da21c, - 0x7b6395a2371ac64c, 0x830386303ebdbd55, 0x2970b9c529b5826c, 0x8294acea5cea3a46, 0xdbf664c4d99d1af4, - 0xf9a9db29ef764d3a, 0xee5dba85f159976a, 0xd821833a7ec7cea7, 0xce5463ab9f5f69b6, 0xb19fbfd3de0d6343, - 0x803ea1ed2538513c, 0xabd0a34a8fdab9b7, 0xf783239ac2dc2e15, 0xc4dbf5206a0442bb, 0xc2eed857188e4d28, - 0x6208ecc2aca36c3c, 0x29b20edd839b58f4, 0xc95a53f20751d1b7, 0xb823f2ad3ee90d66, 0xb36f7521e1088616, - 0x39fb6a90cbdffb9f, 0xc1eded60bf469688, 0x031a2e4e26533dc7, 0xbf83cf8021687adb, 0x29d79bd54aad8a48, - 0xf670aa4b6e6470b5, 0x7a49268bfa4383a0, 0x48b38e142c445ed7, 0xf8611929d2f919b3, 0xed5de77bea25f092, - 0xf40662f3fda3206b, 0x5f0db24e520c35b2, 0xe44da11af0aa374a, 0xc566b38e299bc42a, 0x162c511413f49015, - 0x9b4e67df659bcd98, 0xcf5edba88425276d, 0xe246e940f968b67e, 0xd19d8c66326055d8, 0x9dec0d7727902238, - 0x17b493f308f64c15, 0xd01a6a0895c601d6, 0x43a6b8598ce8f76d, 0x47af66b7d39d0a36, 0x5614a94a912a1711, - 0xbb525b842c539d22, 0x5529d29222ad2cb5, 0xb48ab74d2e846d85, 0x4b958a596a426e2e, 0xc766d1493a8ee553, - 0xe940d557a9964b28, 0x8a89c67c8680d39d, 0xca8955c1d51d9b1e, 0x58674ef86beaa400, 0x47e2de523a29a09f, - 0xdbb80dc7ba4fa06b, 0x0a0b63c2cba90d95, 0xea61d1d408171b95, 0x46b5d42c4b724b25, 0x974bd546b559c1d6, - 0xc3c965d510bf79e5, 0x924f108b39223509, 0x4665ec63aa6774d9, 0x16d3d84d5059855a, 0x760ed42459d1cb9d, - 0xb3690443b82a4509, 0xf04b7a4068db6449, 0x1762242a11721052, 0x9a1eea8310e48125, 0x48437ab665b03233, - 0x562847abc403357e, 0x6a820cd80a3dce9c, 0xcc444f5a4862992b, 0xcddb5b2ea4fed69a, 0x07936d350b631bf6, - 0x4453b9a6075aac37, 0x6b4405a1b5dfac1a, 0x6364d62ffb6ad62f, 0x2729b613802d1827, 0xd626350b8ac54c64, - 0xd123603535d22418, 0xdf8e7f1e43c5790b, 0xf36f0b214964396c, 0x6ffd1d72287030d6, 0x24de0b0a8bc532d5, - 0x3039249e58710a2a, 0x8edfc44488e97e5c, 0x60ce16d4d5829d9b, 0xb2a8cc58298e5e74, 0xde9a2e4f74e5f664, - 0x1d8a56bbaabdff11, 0x840f92182bb14dad, 0xedcb86dc5f75f757, 0xad22bf9ccb751339, 0x37ee2a63e59d4b16, - 0x314bba6618d4c6b0, 0x69af511c5b6183a4, 0xa546760bc548d7f3, 0x2c893dcbefed17ff, 0x0eddffe863830ba2, - 0xfef72998d2b71f52, 0x4db3528b808ec6d3, 0x83e15e5df70fe088, 0xb294356cabef3a22, 0xbdacb47ab5a7f94d, - 0x04f7a298e1464876, 0x0c240c0355c431df, 0x955c50101b66a3d6, 0x57a5e3a810872702, 0xb00cf8b9127d29c4, - 0x8e10f5cc0547ac6e, 0x627c5d8e8c68e4de, 0x8e26bd9f3d49ac12, 0x9b6791217a90cc16, 0xe041ab09b42c9244, - 0x1fafee54c1618db6, 0x6967f8f732ed1e81, 0x056615c5a69ed28d, 0x17b63ac5fa052172, 0x944292eef43d9c11, - 0x613aeff8282a28ad, 0xdee44c96fd98fda0, 0xa41bdbe30cb54f1a, 0x9c2b579361d85d91, 0xb79e80f30c5e37b1, - 0x76951f1b5b0e02f7, 0xe055d869ee865e85, 0x938ac7ca8553094c, 0xa7210e5ce5a7ee2a, 0xa56a9b223ee1a81d, - 0x5b6d215443453355, 0x93c435d546f2dec6, 0xa0075286927058e0, 0x965497057e7f6452, 0x61b31b56139b555a, - 0xafd246966654be9c, 0xfbfb5bb9dc965543, 0xfce694addf1ca138, 0xc7cf55319316336d, 0xfbef7cd3ab7b22bb, - 0xea910b78164ec9c1, 0x2e1ce926dfc5a064, 0x3180b22147ff4d54, 0xaf3fe8bafd8c898a, 0xfdcfba568f0a9504, - 0x1556b64a7d36f185, 0xd328465e8f92cd4b, 0x47dac235918f83a4, 0x60b8095d3eab7311, 0xe737425b6f5635ed, - 0x35bb71d850fa2fb9, 0x458b3a827385b692, 0x8c416757425b6845, 0x87bd40aef4d3c974, 0x0e3a2564aec7dcbf, - 0xf9e44ac5c22775a0, 0xaca1e13a5287993b, 0xf553c170a9bcae17, 0xac6bae5510538ba7, 0x7ad294ad556664bc, - 0xeb9cb9695c744ec6, 0xfc1b60618d212bb5, 0x7249ebccbf38203d, 0x130145720643849b, 0x2dfd0cf2256c4f2a, - 0xa2da2eaeaac5878e, 0xd9b0946afd18024e, 0xb53241806dde89a9, 0x7bf47f7fea6fdf7f, 0x8423eea047815d94, - 0x3b32364938c6a630, 0xe65ca7a33c84d878, 0xe14b8c835c61282b, 0x2647a5831343d653, 0xc6251efc1c13d326, - 0xf2e17f9154661781, 0x64bcccf0682299e9, 0xea0e812fbb08aeb4, 0xd4e2d0612cba1b2e, 0xac2893900f660d42, - 0x141be9dc616eb4aa, 0x34934171ab70e693, 0xb09d98b1d52d393f, 0x61cf3974be37a943, 0xf86fd2777463ad3d, - 0x8e751091ed4d9514, 0xf812a263297b704f, 0xab06212ac270f6de, 0x6683e0345ed2f1a4, 0x9a1e372701c7222e, - 0xbd8c20b674bf815e, 0x44d6bec4961e75f6, 0x4712820b2ea66100, 0x921bf63bb8ecd14d, 0x99801711a17c670a, - 0x99a46a6c051609fe, 0xdd7b284a6460254c, 0x0848d6c598d477ae, 0x7e48201dd1802302, 0xdd0cfbed71b4980e, - 0xdb4378464c028c0b, 0x5958af3e41abf541, 0x2f3f4b73cc79661d, 0x82ce043ebd1ef4a0, 0x14612e98b4ffbcc4, - 0xec95f95adc1defe9, 0x690c4f5b79788c55, 0x4ba10347bb8e2ae0, 0xf6651c6dc3a52e05, 0xb13b1b93bc9b2669, - 0x600e9df933360013, 0x8a1f4b5c9598793c, 0xa1794c4011662a38, 0x2d15483dafc320d5, 0x649f00b47754d1e4, - 0xd151f403ee445328, 0x88fb43e7a30e9f9f, 0xbd3caebb9c8f6edc, 0xfcec30cad418ded3, 0xe3eb331d4206fe95, - 0x43886865d0c35e36, 0x8497f3e480a0eea6, 0xaef6d66eee221955, 0x13bb7c4bc761f9a6, 0xd081de3a5c56fd35, - 0xc1fa9b7df555cd4d, 0xebae601b5545e55a, 0x5d5aab81a4f5d96a, 0x200d1fc8aa8e5b0d, 0xa8a90091b753f698, - 0xb02e1e0527736999, 0xde2991f97d287f56, 0xd300db80178b2b60, 0xd4cb88fc1fa9fe28, 0xdb7f28e87c7637fd, - 0x196d804c4d3ad9b5, 0x87935942077ce5f3, 0x3d8c14a902b5f303, 0xb97f443c726d00b8, 0xa2f2abde19e5c725, - 0xf1002fa573486a04, 0x1bc4119681e7b734, 0x4b3893bf66349dbb, 0xc7ab4b097f719a1c, 0x27199d39d38ce205, - 0x87758984e3720ce1, 0x33f5c12a6293ad3b, 0xafdbc1f81aeb9cca, 0x5b53f7744f33c4ee, 0x1f8d0614b97e8533, - 0xdce0599b36ca153e, 0x6c363519beabf3a0, 0x6cde493fc9dc5da2, 0xfdad1cef09cb77c3, 0xca5cc28a5c6e63d2, - 0xc277b99715415d7c, 0xb5a93188f5d7241e, 0x85b0d30fa61495cd, 0xe4529ea7d382fb07, 0x4bc72e2257e7bc0d, - 0x8a481ea8d29555a5, 0x89ef520b72e2ea2a, 0x6de5564b325be41e, 0x8e86efc634965fe1, 0xca1310d138993d64, - 0x7efe0b22ed500443, 0x7cee94f6f6cae5db, 0x7a0b0a2469e220d6, 0x615921ec89d937f8, 0xc623a91e5b89154f, - 0xf78f9d3e3bb687e1, 0xe8fb8e8761b89aa0, 0x839c38ce06557ce7, 0x1086954b9f2e87f0, 0x8ac5932519be839a, - 0x28a350b660be4555, 0xf6fdce91a50bddd8, 0x4dc4c9f76fbaf827, 0xef3ffda45464c39e, 0x0ae597f15e90aea5, - 0x3beadcf0950ef839, 0x7321d3ae46b84e69, 0xd797fadc4b11783a, 0x9d2f72bf7c71f0e6, 0x55e9fe540baedd9e, - 0x1ee29a583b8aa7d8, 0x9bc565ee97376d29, 0x77fdc5c11754ae5e, 0xda2de107a7e6a688, 0xbb2fc0a0dc6822b6, - 0x94482cae13f4eeb9, 0x9c0aa4dc154e6354, 0xa678959384ad5f0c, 0x94d1d9c4bd123adf, 0xc9ebdf7cb5432815, - 0x965bc029f7aa787f, 0x8a38fdb1356f4d64, 0x9b58cee532fa71d8, 0xe98dbab3d90da609, 0x96b3450f6c741e71, - 0xea03fdd199cba6e2, 0x46be5fba3fa4104b, 0x1e56f4a75ef67134, 0x5e998b9ba6567280, 0x96f9c5c04516a3ea, - 0x69cfe55e0ae03497, 0xc09013a49947e4b3, 0x641fb71ff977f0b0, 0x1fcd21561b74de41, 0xe7d285ad6128e8d0, - 0x570b821f08783b7d, 0xa4ed09ffd8abc288, 0x2f7741fce7f9b353, 0xe47b563847576049, 0x598c31d5c1f5e390, - 0x3633cb6171af0316, 0x68b64787a65fbbd3, 0xad8b5ea736684447, 0x23e846476ff1a318, 0xbd1b4b3f6e897462, - 0xb6f5d4eb51d27a58, 0x4032825dcaae2813, 0xc8bad4cfdfa6c3b9, 0x5a5f70f0d4f78ddd, 0xd18863eed9a46bc0, - 0xa680fbb40915559a, 0xb4eee5e525095475, 0xe270463cfbbf0096, 0xac5f6064a1961724, 0x3e01d899c9d81ff6, - 0xbfc59e783c16230a, 0x953a1953d101d4b9, 0x66464ca34544795a, 0xd97f550d0965f4d2, 0x1e62c718cf9710bc, - 0x224ca6a9c9ecaa7e, 0xf5b840a49284ba52, 0xbc84e810acbd48c6, 0xf449d83462df4c36, 0xb75dd269a4769ba0, - 0xd9b655214cd05d8e, 0xe3d6478026bea4fb, 0xb239539de1e63d7a, 0x2b5143b82b94f053, 0x098715c95c3cb43c, - 0xd80d4a86ab636c36, 0x9e8187c14fe7c756, 0x84dd57c7c975078a, 0x370dd440b17a63a1, 0x1638368596b2d239, - 0xa6631215ed5ff420, 0xe5c2f4daa2117234, 0x9da285392eb30571, 0x5c770b8ec9117412, 0x02b9680b26255b97, - 0x23e424ee00ab349d, 0x5dbb4ce31142c3e0, 0x404b054474ac1cdb, 0xbb145282368b843f, 0x050c7b6a875678b8, - 0xe9367e9611622218, 0x0cc7e3c1946780e1, 0x49e5b2e26a30c1c8, 0xcfc39a259931d06f, 0x9f820adc9c58e0a4, - 0xda0bafee4523e5bc, 0xbdc55284f1774501, 0xba1f42670d88f270, 0x4c23b5a77a206436, 0x97198932eadce666, - 0x264d7d6f308fc9dd, 0x39dd60685dfc4567, 0x3f81d30e74628f46, 0x07eb68578c16e640, 0xeb244f91bc8bddbb, - 0x4b5a01009f071bb5, 0x183c1f8229987767, 0x3f332c8c0a1aae0b, 0x48b9c1785c0d67ac, 0xc8341921e411d8b7, - 0x022e25de0fc6f9ae, 0xe946373a8ca179a8, 0xbdd4365c4a230870, 0x60ee9945c3e9ec1d, 0xe83aaace4ea18358, - 0x08a86192a98bb4bc, 0xc04ddb7f4b51c493, 0x9b4e6019721ca2ba, 0x1012632eb920ad29, 0xe9cfd642b47e7298, - 0x087cc9765bf9bfa9, 0x3ff661ed52e8983b, 0xba1b971c04c126d0, 0x96bfd89c4fbb2059, 0x262e28f49e8a6d70, - 0x3a1cf09d10526989, 0x7cded572025aee1e, 0x7f94eb27fdc944a4, 0xe63b19d4e54a2542, 0x3c1bfb567f88db26, - 0xbd615a431704b097, 0xf03bd08f51c17628, 0x5ac0a2734335b7e7, 0x116e7c5ca43144f9, 0x98d386e188e1e0bb, - 0xd8ed297ec9643670, 0x3a6a3aa06860029d, 0xc2a133b68ba86bc5, 0x044edb5846b1008e, 0x989c11fde529058d, - 0x4fa3dc8973d51108, 0xf5f1b80f69242daa, 0x7a85f1c8a78f5f64, 0x5be309f6d150925c, 0xbc9e301a388ff571, - 0xaa745a4c29bc8f4e, 0xd2a982e34c921c10, 0xa9aaa404864cc2a1, 0x26d8c4126c929d60, 0x239859196982d752, - 0xa2d8e821aa8f8855, 0x0e531461a2faf499, 0xfe2e7d1230dbedaa, 0xd57a85d9cb9cdcd0, 0xd28d841c6d49b486, - 0xe02b9d7d39eb82ff, 0x82319977820e9e18, 0x1c6a02a282c5fb11, 0x1cce4db39382ccbd, 0x30ed801afd648109, - 0x06bf7f944eb6e1e0, 0x21252e63bd630ae2, 0xfc4b5363b94b0a53, 0xb8391c2edf5030ad, 0x40f52ec15423ace3, - 0xaf5de246f9f6567f, 0x538ea3872c99f362, 0xc828bb9e392386ba, 0x137cacdfcfe2b212, 0xd9d1d5c18e361986, - 0xb000a475096b9273, 0x7c596047a595ea35, 0xf9de884e373c8f88, 0xd284082fb0587e3d, 0x008966f3614fafee, - 0x1ef3ff1184d02be6, 0xe3e1181eea561f11, 0xbc3cfaa71c0c0c1c, 0x5e9e57427172c88f, 0x18041de37c359458, - 0x2e2734ba0f0dc240, 0x5849ae86e5e5d13f, 0x63703eef39ca8095, 0xdb985510b183e210, 0x3d86f13f715c7a6f, - 0xa21ca3b10c2f5fa0, 0x1382d5278d55cbd7, 0x26e1d1eaa35ef35f, 0x87a006c3c2c5ab5a, 0x015fd4368ef91305, - 0xb4186646e759a866, 0x5dd8dea5dd1d9761, 0x765cc63a0ca0ad57, 0x1575847677c76494, 0x1d93774a23caa9d7, - 0xc1c4b5f5bf3b3add, 0xece84c1561e295ab, 0xf2ca0be527637498, 0x7d14ff438595f2ab, 0x0e5f552a84b26070, - 0x6dc281ad43e0471d, 0xd7caafcbf0a89ede, 0xce0618607fc888c1, 0x4c8f56bf2e5b1c87, 0xe7af599ea3f9017f, - 0x010a86170f362a31, 0x1613d324b4a604b1, 0x0b8fa3605fdabb49, 0x85f5fd8738707190, 0xe5640b9d2dc39c12, - 0x74421252b2fcdaca, 0x7c5e4aef22cedd14, 0xfd5c8bb32bfc97dd, 0xd1406023dacdcacb, 0x0e6d20c8cf94d6fa, - 0x25b5c28092c58bf0, 0xdd727c5a46afd221, 0x93c804d5ca0d2def, 0xe81e0513d2c514a8, 0x710756e3e7501118, - 0x5e8f06729321eaa1, 0xf9b39ce286484122, 0x17e95fafe61f73e7, 0x9145402a55a600f8, 0xe8c148c320d1dd42, - 0x292d8d48c6ebbb01, 0xcbccb19257f80f92, 0x987f4655cf1bbec1, 0x4bd92090f8e5ec8a, 0x4cfa92d63432294a, - 0xf0968477e33cb3f5, 0xf670ef60c897b2c2, 0xf5af9d2c6ea77bec, 0x51e8040f2619a781, 0x2d43e3844292a41f, - 0x5e0f8d2365272dcc, 0x5bc5632a32570609, 0xdbffafee4b1b9b4a, 0xaeb4bfe757184d0f, 0xb11bd98d0d4d771b, - 0x84c718e826c3166c, 0xd2ddaf9b17842cb0, 0x125972b40413a3fc, 0xf679ce56fbbdba82, 0x64962c58f756d5b9, - 0xb5d7a9b33c271d3c, 0x10d8533b63d8f0cb, 0x0806fd1564530139, 0xd594bc36d25a16fc, 0x3a282b2931eab3b2, - 0x7b086555789efadc, 0x9a493a4cdd77e202, 0x65f037926cba0221, 0xa0dfda00c63962f4, 0x582e4998567db26f, - 0x0ca4caf920fbc454, 0x35901945e127aba7, 0xe1dc0f23cd2388df, 0x7450833c984a2395, 0x4913a5b5c1746d3e, - 0x9af48783eedb617f, 0x0d1372ed0354b96b, 0x6ffb3006a3bbe1c9, 0xda743c1e9121155d, 0xab9ca028aba1ab16, - 0x2c836803e2309a90, 0xbf647b590e794d85, 0x14385024ebd3a7dd, 0xa7e84a3891f0af01, 0x7e6182397f827efb, - 0x2f70e6c2d5cf5e0c, 0xda070e57b0884748, 0x64615f298b200ea1, 0x5cb419e22a690021, 0x09f1e7fbbb54c067, - 0xd252cfbbef83c080, 0x51a6af654c540767, 0x058ec6d8769c0233, 0xc85f8cc31a6e7a9e, 0x821e29a5afd611e1, - 0x987bcdbf2241529d, 0xa1fbd2922c30b01b, 0x7f58271e75d95a1e, 0x4c7bba174a4fc74e, 0x08e1565951c251ba, - 0xdf9bae482929e128, 0x1d4c072b524a4a38, 0x4acf566e5d52822d, 0xb7e76e7a2c397713, 0xab9de403a1dd4fb6, - 0x561a7a3757fa4467, 0x18849aba58526515, 0xec527859397496f9, 0x461289db2cb07b3b, 0x1f0cc966f46d7f12, - 0x8897caeff7fa00af, 0x21093929d061f600, 0x79d039589a24fb9d, 0x9ded1bdfa9c3e3d2, 0x7a1083c49837b435, - 0xf6d547a33fa2cd54, 0x1b9b0b94d64d5753, 0x2972120b07369b5a, 0x468a4dbb9791fb5b, 0x7738d725db27553a, - 0x4e64e760e899f9f5, 0x7bc027048df511ac, 0xc78ab2039cde61d1, 0xc2c4bf84134477b8, 0xdbfaa9b560461134, - 0x4b9b0f8c6e48bb14, 0xb9535656bc7320cc, 0xa13f59c7ef70b222, 0xf2a28a53c156c067, 0x87657fef7b9d4b20, - 0xa31cb7ae836ddd00, 0xb70a20cae3d6361e, 0xaee0e1dbeb78d8c1, 0xc37fd0c3361e6ee0, 0xe1dfe861070f37f1, - 0xf0153ddcc0c3b778, 0xf8777ab889875b78, 0xf8fff4f02d1ebec3, 0xc3557ab88587eff1, 0xf0353d7c87871ff0, - 0xb08e87edef29e936, 0x9e76f989d23a78ba, 0xc64f54bd36fe7b87, 0x9fa87e9b787a4d4f, 0x3f50050196d1bacb, - 0x4f54c36ff0b4c74f, 0x54c53778fa079e76, 0xb6a91cd1b9a427c0, 0x121fb77efb0d8f9f, 0xf8910abec2d3829f, - 0xa8e0ef5beddfb77e, 0x0fc9bc33f0780403, 0x8f3664bdde92ca9c, 0x317a745d1eee6239, 0x92cc5fd6ce026a88, - 0x7555b543aecc7640, 0x9ff0025086f4b8a3, 0x8fbdd96448cf37f5, 0xf9ac3febd2f3f778, 0x3607e52909780f08, - 0xa0cd2264f31b5a91, 0x2f1f2133df605e9e, 0x2366cbf8436b6fb6, 0x37e1548d68f16cbf, 0x0577a7e0c5315e14, - 0xca53e0bf0a0af753, 0x0a7851a0c001e52a, 0x481ca424f0a24082, 0xe23d0a0562c5121a, 0xf7521af7626c5742, - 0x04a364dfa9addfde, 0xb676df6edd7ff0b8, 0x6d1d4f1eef0111fe, 0x9de0f26283f0e386, 0xd327fae6ff33777f, - 0x7bfdd31134153201, 0x52e457e0f4688574, 0xd085c8dbad8317a8, 0xd5c18baa823b00e6, 0xf11fadaa3aff4b6a, - 0x92228d1bdf493b74, 0x3e19585cdca5c7db, 0xb75bd7d611a77ae3, 0x5a0b63da60dca34f, 0x685735fe04c6bcc1, - 0xbc883ef1fd8a9fc0, 0xdc6e30ff232cbaeb, 0x2b7e02d3b0c1cc4c, 0x30adaff819859b86, 0x9ba1c990b68e77fe, - 0x11cfe99bb776d3aa, 0xdcf055f947fadd1b, 0xff88bb2f2f1d34e4, 0xa7bc21781567ff29, 0xa6f76d1dbd87393d, - 0xbc8ab33f8ce9ddc0, 0x26e07648d8f0633b, 0xedece09d2de0b8f0, 0xb7352dff3669f9cd, 0x0265fa5a99f2ad1a, - 0xcab762cadb8022ab, 0xe984e749f167cf93, 0xd237ea4aff312dfd, 0xc7a4f4cdbad22fd2, 0xd2499c09c015d594, - 0x3e4c4bc72121b681, 0x699195ae1b91ed64, 0x48b6b7bfcb097c57, 0x47e0bb94c0f73981, 0xefeb087c9f12f821, - 0x27f0431d811f1202, 0x601b52023bd76b08, 0xec5c4f096ce70482, 0x31c8096ca704f2d9, 0xb753b723ec245bc2, - 0x36d02c320237eb08, 0xdc74044ec4414af6, 0x4bb783a55b9b1d56, 0xf8697baa6360ee76, 0x6e01d1d43d02eef0, - 0xbad645ccd4050916, 0x37294af57ccfe62d, 0x60e3ba274296db71, 0x4d78faf2b14f022c, 0x2a34ed017dc0c635, - 0xa1ffedf6b59defe2, 0x4f7c7bcb7d02fc43, 0x94045e32ecc1380d, 0xc8ce96f6f0304922, 0x2b004bfcf1509c74, - 0xd7d09bf03585ec06, 0x1e9ec5de5397fef7, 0xbd6347edd5de161e, 0x42de52ecc736c2b1, 0x1b3afa75fd6f163f, - 0x7e6b0cbbdd37e01a, 0x824fcd8bdd0863b7, 0x700ac0726ebe351b, 0xbf844bc3e400538e, 0x404ec26acdc55127, - 0xac168f6854f78033, 0x96216eade1608c0a, 0x325473bf7b025691, 0x2ed227902d051ef4, 0x28090f7adf364e17, - 0xbf79002d071586a8, 0xac8bc885b3f1e3f1, 0x877285bb218fb590, 0xdae30e1b4ff5f272, 0xf0fc7cd8561a03cc, - 0x033e9300e1cc4919, 0x917c2204030784d1, 0xeff531c04cd589c7, 0xaf8d6ac86ab86e7b, 0x4decb535f1e521ec, - 0xe92ce53fc214f47b, 0x0224b336616bf63e, 0xd9873e507b91b27d, 0x1ba4c2f8a8336ceb, 0x523c496f942ee8e8, - 0xfd933fd175353056, 0x7f37c45d19fa474e, 0x3c82cd255b1ffcc1, 0xa80ca60f290366a0, 0xe5f1f6e762eb4280, - 0x0a18e494e47d49ac, 0xa3a8592842ab0a13, 0xcc989aaa9e5a08c6, 0x0d4853b366987cc2, 0x194e17da61063c51, - 0x3b8a9483d654120e, 0x9a2375f543c3340e, 0x506e343fd76c9e40, 0xb15d5e1e59685a7f, 0xc466b2819e2dcae3, - 0x833125b4452c0291, 0x4d929dd7acb9a324, 0x65e05503851e018c, 0xdbb7649ec1a44fe5, 0xaafa4ca67162c47c, - 0x1d768234e412d134, 0x1f5275e42a36bcd2, 0x817f049c6007e910, 0x52331f61adc6ecb8, 0xff6ac32218db3b5f, - 0x882214ed09e203e5, 0x6cf74176571ec34c, 0x08a01a2d2353b657, 0x4c42ed511de1a063, 0x55ec95cf3e873a55, - 0x2278b766ecf90dc4, 0x4966681618d897eb, 0x605e9ce19af2e0ce, 0x58cca1c5aa75185b, 0x1bd2c6299215526e, - 0x589629663f41b861, 0xb429031404e90804, 0x1dd9c760b069a2fb, 0x1a70db7d406ccb43, 0xbebe31f443794da6, - 0xab225c96158bc22d, 0x3767ae1753161b7d, 0x76967480f1fdbe85, 0xd90e3acd3e5cd14a, 0xd40d0677d64c9d10, - 0xeee326e8ce370bf1, 0x34b1c597542e5c7c, 0xa34d040c960556b7, 0xb83661df282b09ab, 0xd0c70f96d59467e7, - 0x75452b01f51fed61, 0x35ec0e8e27143e38, 0x6cdf285e0c1696bb, 0x7edf2c6e8ce59d30, 0x5f269a647d5efc52, - 0xb24ac2b9608be46b, 0x19ac47100077f5ac, 0x6cb65aea36ecb0fb, 0x446f942d0e58d15f, 0xc1cb3b58387d700e, - 0x7939075e543d9b10, 0xf5016be5e3a03f3c, 0x31176b4bfed2898a, 0x2300f3e241b7777a, 0xef2367216bdaff63, - 0x1d63be0b3ee99fd0, 0x2b2ccbcf94f09fd1, 0x21c75b5b704b719f, 0x78255a0250263d99, 0xf684ea3a68411796, - 0xb184ebbf8d23afaf, 0x5e3cf009ba36b87b, 0x97c297573665826e, 0x2073fbbbb38d0181, 0x803afe1d6b7fa3df, - 0x99008799618ac4af, 0xcdafa012a94dc099, 0x52b7dcde986c6e3a, 0x0761073cd65775c6, 0x4b389db53f22c047, - 0xfba8de9c39b56606, 0xc6c918cb925455bc, 0xa33d801d6be76e7f, 0x8fad61d485db9b30, 0xdf77b909a595543a, - 0xcb6c756b4a941353, 0x63e7200b9b1934ff, 0x5c98bd90127dc891, 0x131592450e239da4, 0xdac6041d954ecd20, - 0xc94f31a73676892e, 0xda8376ed60aa66fe, 0x27e60529aa726ad1, 0x7f9251003b1bd8b4, 0x1b58b1d83b20506e, - 0x9103c82049866fb7, 0x4b6f7b50dbb0c6ca, 0xc3d035bcbaaf0c4a, 0x69127c0ea8793935, 0x65ba9d0565c5202b, - 0x3d87e0e474d17654, 0xf6497757ddbd1b40, 0xe7b18a146a616a51, 0x3a7afcf7a7fbb383, 0xbe586df83839d729, - 0x348e3ba187e5cf26, 0x27188c44469da18b, 0xea78b1b7475446d7, 0xe05d62ef3e0c4e66, 0xa77b7b7075c00e0b, - 0x7fd3fe1da090ad5f, 0x4100b220d3b0fbb1, 0x3fd9db6bbd65838c, 0x162df40921bdca79, 0x337407846f42d802, - 0x00fa99af6650d5e8, 0x4c19a05a772fb139, 0xc0bf26ac2c768a97, 0xd36bf0d82f56f725, 0x5cb8fb773e925910, - 0x57d867aba8f008f7, 0x0e52adb6ff739a6c, 0x3e0ffab5ce144ad7, 0x9cbb698a102ac283, 0xb3012164c8da85b3, - 0x4ce64c4099d40020, 0x2e92ee1e3247aa08, 0x45c93e7b44a487ce, 0xec9fdc7bdf216577, 0xf4ee61f84e16273c, - 0xa5e447648cbb8525, 0x046d76ffc38b3954, 0xdf6a180009c7d23c, 0xce1ece166ea3cc9d, 0x16a1ba0071814dda, - 0x60c5f09e4388b940, 0x532976893510bc27, 0xcaa59f4a0818baa4, 0x15fa3b2448826256, 0x57ca0c195cb104c0, - 0x515f738d3181fb4d, 0x6a8cee2fd7382110, 0xd518852a6a9c948a, 0x6b8c62a51a3f7cbf, 0x70bb90b36ab449a4, - 0xe8383cdf030b0439, 0xaf0f7b149aadfda8, 0x284bc205e3b06704, 0x01b689e94d7ee5d4, 0xa74eb0045c33d4b5, - 0xd73f3aa5c88de3e1, 0xc993430791008a16, 0xd2f189872fc0f4e7, 0xe9d105e08f847b34, 0x1037ba13a4ed9848, - 0x1ef5367d74ffea55, 0xde53cdfbb49c89f6, 0x737e436df09670d0, 0x6b1fa0b233bab374, 0x66deca6606130240, - 0xc6066637dae956c0, 0xe1a7e305505d1c58, 0x873dfa9262e23730, 0x7b7acbd09e611c3d, 0x8d070ec8431ed2f2, - 0x0e835892c190eff6, 0x15c734770327cc4a, 0x15be441d6e0c7561, 0x8414d9321e1f2fd5, 0x801bafbe0679e319, - 0xf556563d7a0e2ab7, 0x5419e74d5ea8cda6, 0xc12ed4cd0cbb48a6, 0x43dd115b1c41fbf6, 0x1ec9666b1ab530eb, - 0xbb628bedfe52374d, 0xab2a63a6273886d4, 0x9fdf910d00cf6c12, 0x79814a34330aaf65, 0xda3a27e1804d9ba5, - 0xb0d56eca917d9726, 0x86f391e6533abb8d, 0x7571358bc24e68b5, 0xe277d16ec07746dd, 0x512e860860c8bf3e, - 0xb05be3d1acdeadd1, 0x3888f83a802314b5, 0x062297ed2564a977, 0x8f6c50bd4bdac4f1, 0xcc5417e72ee7db82, - 0x0d747ea6f7899f21, 0x44f7cedb43604349, 0x7c07b22593deb5fd, 0x890d098fb0358fa6, 0x40760cb05de4fdfe, - 0x68c413b8d36aa957, 0x725505312883d17d, 0x04a524ac2d072243, 0x61a6066f07802885, 0x26613443161cd700, - 0x3d60d71f05995b6f, 0x9d0cfee6a020cb65, 0xc05ba2571f839165, 0x86a285de9d9c6d46, 0x791d05ee8b46df0a, - 0x73d29a7231e2d65b, 0x308425d78a21be58, 0xcebebc429b33e08f, 0x85850d548f7ad9b1, 0xbe1889a1ded96d1a, - 0x082cd890a45369d1, 0xe3a189a7a459fbe1, 0x078ff0bda70ccc59, 0xaa30a17ee19885a0, 0xc09c1562babcb76a, - 0x45c6e7f7e84c8653, 0x0d8719a566f6a937, 0x011d1ddab84699e0, 0x22ee0e6ae1543f8b, 0x8647660c6a77fd15, - 0xf5321ba41b9df5d6, 0x3b2ad1d2dc55552e, 0x51cbde38c1c3d2cf, 0xd4346cc9042e76bf, 0x4b767e9f6ea9d6cf, - 0x5c9f2f9d8894b249, 0xd7e0f1a8943b9ee5, 0x5d80cb6e522aa63a, 0xa8e00e49bf576e89, 0xa79f7ff1be1e8145, - 0xbf9b476eabe65d8d, 0x4361b38d2bbd250b, 0x543d87ddcac0ad99, 0x3a2387f139e862a7, 0xc205960d72d7a29a, - 0xc35b82d8ccb52323, 0x3246fda1dffd30f4, 0x80a54df61c06b56d, 0xb419c439f9e9c578, 0x8cf0738d76a53c7f, - 0x71b3a9cb1f0e917d, 0xeb084712ef0ead4d, 0xfe0febafd7badbdb, 0x40aca4ff4081dd8c, 0x605d9f7d619d90a1, - 0x58a374fc55e0b17f, 0xf2e76e0f8fae1bbb, 0xef48d0313ab1e59a, 0x57c321f1ac44f22d, 0x26edc888d6b73c71, - 0xa7739f314f4982df, 0x0ff73f7b2b4190aa, 0xbcf22232b4543c19, 0x65cb68ed800a8f2a, 0x703690a909b1c0bb, - 0x2fa7d684c03e468b, 0x6c33d266c9bb2614, 0x9c7d7beab9c824de, 0xfcee4dd36a1c75df, 0xa6b5e0574dca93d8, - 0x2629cbafd860b741, 0xf97bc3f9246800df, 0xda1ebb3db0ba2723, 0x6e8e6523987553ba, 0x1aabf34571647cae, - 0x12e5c7ebe3764b40, 0xa691058c1ce8b432, 0xbfd043cbb0cc21b4, 0xc0eaa19ee793cfa8, 0x60313d4f0dde45f2, - 0xe14becd895db8bf8, 0xc339e78d8a2ddd72, 0xe55c81576843c61a, 0x4c9fd06790715cfb, 0xb7a12257ce2c98a8, - 0x643264e5f885397a, 0x95d8ef3b1708c51d, 0xc79e713cb853f199, 0x08254e55343dd22c, 0xa7048c5907309b13, - 0xa464291ccf19abca, 0x7b1fe6d5730060a5, 0x9b43a713553ee02d, 0x66d8cda9abd19dd7, 0x3aaf070c7c83e1a7, - 0xe026e97ac8ba262c, 0x8ccb46cdf76171e0, 0x17a8ebe4ec0bed6f, 0x7e3bbf2482d8e016, 0xdfc0460cb759f65a, - 0x2cf6aac2d511e48e, 0x9f86a11b67cecf60, 0x2ec965972e750506, 0x9e8919571322e226, 0x7915c596a2ee84e8, - 0x3c90972998aeb70b, 0x0126140247772472, 0xb41aea4578bfe2d3, 0x770ddaf22ec58798, 0x77867bf0e8ec8ea6, - 0x433a6c8d20c40b7a, 0xbdd53f5d740bfafc, 0xb4e329c03c33a841, 0xbb1748708c8d1ebf, 0xba4d586df3300ce4, - 0x7a2f1ec8df2ef6e1, 0xea93de511913aad7, 0x46b07ce8d9809d16, 0x179a57e52794805e, 0x898325192c4eef19, - 0x9a509103afe8986d, 0xe1ee6da738e14263, 0x687e2619fc7acf01, 0x1c121f49e34b6b18, 0x6080ec98bc28beb5, - 0x99172fb158095cbf, 0x468a04420fbfe802, 0xeeb697f8ca148587, 0xc1e98f89e0d4a4e1, 0x7071e437186f56de, - 0x7e7608059101d62b, 0xfb97b0c7840e9cb6, 0x7609b3aa3497a379, 0xbc78c3388a283484, 0xe21b8b86a6224c15, - 0xa89ee824434763e9, 0x42b73d77a143f760, 0x280988c4bc211272, 0xaec485cbe62e1c26, 0x412e82425eda225b, - 0xcd9d08b09206cdb7, 0xaebef9bcbbe7bc41, 0xe9da2ba54451e5e1, 0x3d6d72f1f7e220d7, 0xe0f9489a8ca55168, - 0x6f03aef754c0eebf, 0xa812bcbf966b10de, 0x0bf0a9ffdb977fb7, 0x1222576a9ecf9bdb, 0xbb45d94683750935, - 0x09ad7476efa4c012, 0x238b1ec2af10d9e6, 0xfcd1d959ff048039, 0x7dc0849e77df8be6, 0xdb6d1819af178967, - 0x530ec85bc845f671, 0x4b447e1c60dfbe23, 0x827a17d3882dea28, 0xba34baa47b4eaaf7, 0x5047e12eb9f20b3b, - 0xda1684d6a7e309cd, 0x26a71f773dcb277d, 0xf8258fa77c252cf9, 0xe9131eb9e3980ecb, 0x6121d4dbea8bc0c0, - 0x672458856fc613a8, 0xc034ef5a17d202d2, 0x7141481000ab0e3a, 0x9723a422d0b12fdb, 0x1e3344a77b27889d, - 0x0bd89f595e47d567, 0xe5579a93ba667d00, 0x013d2cc67be33360, 0x8df4ad479fab6611, 0x8732256f5c252a5b, - 0xf79f1dbc7cf2e0e9, 0xd1ebe7cf0e1f1d3d, 0x7af6f4f5f3170f0e, 0x1edc7ff4f44758f5, 0x734ed20ff30f729d, - 0x96af022a517e90a2, 0xfb1842e8579de349, 0x1b06a1ed25df2e2d, 0xc78dabeb15553978, 0xf6f468ffd1d307f7, - 0x5fdffbf553459e87, 0xcf1e3f7ef633aa4b, 0x55b13e2dae7a840e, 0x82d7370501a2b0bc, 0xda7de0cf4d2a549e, - 0x3dd2208bcb1b6152, 0x47e7009be7431ba0, 0xf1aaa5c72afb61f4, 0x658d7663244190a5, 0xd1306e9436456cc1, - 0x9eae43580c2c6baa, 0x4e8cb0a9e3ceba10, 0x9f1bf1d3055d9d28, 0xadd79903f544e0b6, 0x607041c297bd39c1, - 0xdbe0ab546f9439f1, 0xc1c07a7b4b5881ed, 0xeb1bb0b2a2f39a71, 0x40206f507db1ad34, 0x013321411d604c06, - 0x2358910c4eb6d65e, 0xe0a4a12ca27042e0, 0xb936ebf3a982affd, 0x3819e7476c6d4f76, 0x93d765fa809ca19c, - 0xf40d2254fb81f3ce, 0xe99dd7d6bfaf8f4f, 0x5fedbe8e26026cc4, 0xf41be7a650f4fb0e, 0xa06d3078d7ae9db4, - 0x11d67ea37d895aee, 0x9e50a83a7c7ef71c, 0x7618c3ce984c70ba, 0xf823d0af57d6af80, 0xe9b9023e82365cbe, - 0x16dc054331fef0e9, 0x133f60a1f2238098, 0x893ce8dcc50bf995, 0x8b38b507d7c0cfe3, 0x429fea8e34ac14be, - 0x22e5210342f9f63a, 0x7f60931f36be2e34, 0x094952e09afb32b4, 0x79916cca5db29a9e, 0xa35fc6f40471534a, - 0x939f3605cc5833e2, 0xb5c02ab1f2c45fd1, 0xa3a3f65fa43cc13e, 0x1ae293e79d721786, 0x8c4b98cd0a3eb7c0, - 0x4cfd8b59980a318d, 0x4528ade8b408fc79, 0x19ab50127edbc263, 0xa4bfb2220e384624, 0xf5a65bce5b0eac05, - 0x0bfcacd2419dc94e, 0x3fbad187ed094372, 0x8532b8139767ab37, 0xc5ff61f8b575da27, 0xb0818dcb676fff8c, - 0x25b605593cee8ef5, 0xba83298567695fb2, 0x8597bf28d57faa8b, 0x05ae46618bf38b37, 0xed77a076880558b8, - 0x6879fb19c942f91d, 0xbe5a3e3370d12aac, 0x1263ada2c55e9264, 0xb8150993dddb6661, 0x1c2f387226a9198a, - 0x7c12c3f0b878132f, 0xe6c48e5431c297c4, 0xffa2ab758c3a0dbb, 0xda8f2af75c528780, 0x2c4b4fc88ec234e0, - 0x143d986290d11282, 0x6ce4603840255fd0, 0xcebb2143e790c293, 0x53ac0f086877d6c0, 0xa352d88e2b939851, - 0x99e81ebdbcfafc31, 0x60c5a4f57c832016, 0xc3fe2feb8830f40d, 0xc2e3be81a502ac12, 0x188879bb7d012bf4, - 0xc3f59d76176be310, 0xce89c07a7905a305, 0x41663e550cf97ae3, 0x05987b24e60baa41, 0x71d60b67214aeba0, - 0x68b760d60c31ecae, 0x59335028235c64fe, 0x36084a8c83b403b2, 0x03138b2f52f705fe, 0x770340fee0e3cf38, - 0x588b414777a732b7, 0x03ff3d099845d733, 0xec211eb4f874fc81, 0x203b5f5a90a87ab3, 0xe7aaec8594c442f2, - 0x27b46c850f55652f, 0xa4d4d9575f3eb5e5, 0x5dea44afbacdd352, 0x0717b234e28ee6b3, 0x26369691aeb5e143, - 0x245cac90e99e330e, 0x6e8a3ba9db5160de, 0xc4148240d8eea40e, 0x0798c4f7b942249a, 0xa7ed164f505023bd, - 0x77f08168f298182e, 0xfb68e30fd0d96ee7, 0xae6cb14cfe095ec7, 0x4aee46d460f6e534, 0x900135c2b0f90c6a, - 0xf3f302ad97e71125, 0x817c0c9b9e45ccb6, 0x2463185d0303ed47, 0x3c55c4b2cf383b33, 0x9e25707b9f093b4d, - 0x5ce77c5b11f67a90, 0x0632f2e327be7d24, 0x12a51b1d99fb23fe, 0x1f59f8d5f8586a38, 0x647289649965a076, - 0x77572ed3bd2b724b, 0x7db6cd5332194666, 0x9522985921f589a0, 0x33925d395ddb2fdc, 0x091da76d5d50eac7, - 0xaad48f749d0cc7f1, 0x27faa0f70388b377, 0x08ab2ecc17ba3ef9, 0x1d91544b5bf0544f, 0x1757a46a29ad43b8, - 0x9f3d1c4b34903e21, 0x881596a7ddaf54cc, 0x174c21634668fbd9, 0x4fe50f413e122eff, 0x0506780e12b56175, - 0x80e48b633e7c05b1, 0xb9b3f32ced59b8b9, 0x917b46d43fd9b6a6, 0x86ff08960faf0fff, 0x480e0063aeaa1921, - 0x5fbd1a3f332c5a1c, 0x2c35216e7156a23c, 0x7c645114109ddfe8, 0x519dd1c738995f39, 0x3f8ac211ca9fb777, - 0x14a68ea33be08a31, 0x504d634513897981, 0xf883e416a69ae8f7, 0x28feaa2386e12561, 0xe408e6c764603186, - 0x949213280f89f310, 0x1a04fde1a69a5fa7, 0x91f09f945567dd73, 0x8e85744975dd45dc, 0xa3301e5da16ea418, - 0x1a4131e498aefaba, 0xd51f511c2cc1adb4, 0xa51d183bd7c95d8e, 0xa3964e4934397aef, 0x5b5ff3559a05d565, - 0xbd6a87e602821227, 0xdbd780eb1c6e5ea2, 0x751d69f0aad8ca10, 0x1350363b322d54b0, 0x8a312cffa00be9ca, - 0xdc64d182d8906c7d, 0xbcd3dfbbbe5b48b8, 0x80a2307a0dce0ec1, 0x990d5e3107048e89, 0x50ee0bd70ec8a46e, - 0xf7ee744e6ff7a84e, 0x2c873bed4e491f87, 0xf5a3b14b8608a90b, 0xab5d43422313a81e, 0x410ae24a5a31daea, - 0x6b14187217fbde1c, 0xfb22216131ab72f0, 0x5090f905a7bd8a13, 0x0d55affd103769e8, 0x74cfd55f80ad0ad6, - 0x193e02383eaa3cbc, 0x97602c2cdfa228ae, 0x389c114fb5b8514a, 0x1f1392ee6df2cdc0, 0xce602c8cecf84ffb, - 0xcc91d2277ce8c172, 0x4d3e731de02a53b2, 0x6aadfe46380f97f7, 0x0cc155a3fdd81d8a, 0xed871adada8fe675, - 0xc1ab54f500106464, 0x2a79989194a372ca, 0x5de639e80d95f4a1, 0x7f8b7ccfcb733d50, 0x752a04f96257c32f, - 0xe77d6cd389aa77f5, 0xea839e8e6bf45e3a, 0xa67c903af54ab363, 0xd7bb2ba6495b3c74, 0x90eab806643948c6, - 0x6db620e179cdbb5c, 0xde67387e4b1c24ce, 0x7dc22fba024cf48a, 0xef449b187c882bab, 0x1cec5e30aaf0473d, - 0x253ea6db41c23a57, 0x744aa996ce63c967, 0xb65bd2975fc21c17, 0x67333a9a7649459a, 0xcfbc52f155266332, - 0x85649be029934f27, 0xd821e5bd89219bf5, 0x11f1cdfb55ee5efa, 0x78cd420f8eb3de75, 0xda39125db95e4886, - 0xe65bcbb6cfc7033a, 0x5c2572f567508aca, 0x2fda8329f3cffd93, 0x5ddc37831113ae3a, 0xee32ed86f22429d4, - 0xe472d156312300d0, 0x507752e8925d3681, 0x9367b9db88be10b6, 0xec125be56e6086e8, 0x3b17dc0df52ea290, - 0x55358bc21cee22a8, 0x9a0f7b9d942dad23, 0x4ea8a689abc4a434, 0xfccbca39db8cbc8c, 0xeb7b17a54ced77fd, - 0x2d6c367eff1e6808, 0x7a0793f0d8505c31, 0xfd96046f0be280af, 0xd8677e527d467fd5, 0x535ca1b75c99557a, - 0x8a7c239da0484f1b, 0x999ddc27ee3652dc, 0x7c3cae7466b42a16, 0xc900f2816fec3960, 0x5bd4ca80fa66e969, - 0x48666f124b9bac20, 0xae030e909fae6d2b, 0x52523572bd73b2ab, 0xce022af04d1e9d78, 0xcf966587057c7e9b, - 0x1c16e4555e71fb24, 0xf96879b51b23f7af, 0xd884c1f26597de21, 0xddc131aa74f1f5bb, 0x93b2c6d593b672fe, - 0xb9f91448c79a4dd2, 0x9a0938e0f8fe2b6f, 0x1070952f7b6025ab, 0x1df2b0c1164b61c8, 0x16827f20f0eec078, - 0x91d28a08cde978d0, 0x9d355d83b9289aad, 0x48222b64755e6f5d, 0x406565bf3f6e8ef8, 0x896f44fa57dea9e7, - 0xe3ed75bb9a1744ca, 0x6a335190016f8817, 0x34dc320356e69f32, 0xeea66efba78cbb13, 0x107df6b8ab3577cd, - 0xd0b3909723877227, 0x04439f722bd9b0db, 0x20a94226bfd62218, 0x6b7c2d46b8fc709b, 0x585e50069e2eed35, - 0x99211c740834bcf3, 0xc00278b4a8be3e04, 0x281b6ccc79301e4f, 0x4e5896508c2b41df, 0x28079c60cd5f10c0, - 0xf6f262774486381f, 0xf167fbd5d2fd99ae, 0xe755ab21502519ed, 0xeddd7efbe336c2d4, 0x5eecec4eda1f013c, - 0x4ba615d3625429ae, 0xf3bbf7bb638a2b00, 0xad952ab7eeab728b, 0x02189072eb21fdb9, 0xd91e4ea0e33a45f4, - 0x5187ad8f7b12daec, 0xc4d9539e1374e3e5, 0x1f0463190d2ca744, 0x6fd22c8466196761, 0x30cc6094830cfc1c, - 0x2787e5f999812f3f, 0xa6a04287a3582107, 0x66d174710e2e88e6, 0xf5e0dda0ec6fe702, 0xa3be15ed7c6766b2, - 0x73f8b9d07d510245, 0x048a327d7fd8ef8f, 0xa297cfa18cd5c82c, 0x41eef908923fd287, 0xf74f082c95303903, - 0x955ba0287fd21d21, 0x064f7d1db1b5c9a2, 0x278542bd822ccb17, 0xbe4a746f0c145a47, 0xcc67e0df59dc550f, - 0x83521d7735c8638f, 0x6980d4d8267389a6, 0xb198397b9f7ce268, 0x30635f94a5e4f38c, 0xd1bb84ec3d5225d4, - 0xc7d3f539e421a1c0, 0x7627b5b161c5a36a, 0x4916f33d8b806b6a, 0x73c3a1a759e69f11, 0x65eb194c7e6ab369, - 0xd81fe76b6867d6ea, 0xb12f8f1a47dfbc67, 0x17e7ec7321f79e2a, 0xcf9bd7e48f4e48be, 0xac2643173336ff60, - 0x4d5d5c589a506cbb, 0x42a8d40f60a49747, 0xb5f4911e69fa054e, 0x6a3a1f052666354a, 0x868c41ee3c038756, - 0x263e4008a6c7fb3e, 0xc13ce13716fc9e70, 0x6e16486ca52f1da2, 0xbc387784de7574b5, 0x92b72b579cd42439, - 0xc2da2a3434c691a2, 0x1e41324bf09cd60b, 0x5ab9380fe17535fb, 0x84e0023962ea4347, 0x2f95576c10783125, - 0xe9767f8788e65fad, 0x4c2dd80b1db9e0dd, 0xcaf46ce372c4929d, 0xecb308626f8be8f9, 0xbd6e45930b3710ec, - 0x04622f85e91a54b9, 0x29ab858931f4f049, 0x38c3d9c9e367a178, 0x432b11bdcbee05d6, 0xc77bb939a479fb93, - 0x4b26192338de2635, 0x4570090255a76135, 0x75b1a45135f97510, 0xd552bd77b37cf436, 0xcae67c9db3acc9f8, - 0x65a5c891b458c80f, 0x5254c68e9fbc90a5, 0x68f67cb1843afdd9, 0x29facfb6e4243e97, 0x5c767067815d9b46, - 0x7e1ac01b0856951a, 0xf7690701b4264035, 0x73085d709eebb4b6, 0xaf47011e7610580b, 0x993cf09864da4e32, - 0x215812e2b9f10294, 0x0c3b699407a4c380, 0x6dc0a9142042ebb2, 0x705523fc7a17914a, 0x749d2f0d538cd0ca, - 0x260428cf24f4ca1c, 0x369e26ef18aa2a4a, 0x3f56d2af0c0820cf, 0xc758a2cb4363c2d6, 0x9031fb17af606bb7, - 0xb8fdd5e5d9902edd, 0x5f5dbe9b6e1d1e2d, 0xde44b17570b58172, 0xd355528d25a38f9f, 0x8d4f06ef60434a55, - 0x206ff4615cdfce9f, 0x1d861a2056794102, 0x314d30abcc19d48c, 0xc22bc9427dd82510, 0x9932ad45386aa5fe, - 0xc1d9819b87cc3737, 0x5f4c9de603210afc, 0x5ac220d5ed0a4120, 0xd864ce6be057d12f, 0xf581cd286b9ad3e8, - 0xb686fda3ab72067b, 0x5477a94bf595128c, 0x0312d57b87283015, 0x7dec775df01e1423, 0x308a7748d69f7b4e, - 0x9d9b5f5a648ff17a, 0xff40181a588b5495, 0x5b852b14599f83ac, 0x281275b108d5651d, 0x7db00f32ea1b5a88, - 0xf00ac6f1f9845575, 0xd472f2ad5566435b, 0x543be52d4ecb2343, 0x1fc9a5ef2c8c13a3, 0x731b79409f7d90e3, - 0xd74d06db8685115b, 0xbccd77601bcdbd2d, 0x494c5ba89b763cf2, 0xd2c5e63fee70f1fc, 0x44326b0c7b2ac4cc, - 0xfca774d0b3ea0e32, 0xa955dc477ade687f, 0xbc9e2260afb5340c, 0x23692d35eda8b603, 0xbe75dcbf8f462684, - 0x77ea51367f6351d1, 0x4ffd212d4bf2c3e3, 0x77a3f74ec71acde2, 0x82f75f188d56243f, 0xae3b55ab18b9fe8a, - 0xb5446ca327c2b518, 0xa24d0b5dd820c01d, 0x0552417feb6a66c2, 0xcd12347c528cb771, 0x81f1d7d34646d45f, - 0x8fe1b31335aab111, 0xb65600cec42bda6d, 0xc7d3566cb887088a, 0xd8995f6b9d5fe8fc, 0x4dd2e1e7d9e95627, - 0x33e1ceb03a839ac8, 0x8faa73d0e8fdb434, 0xd7dfc5f9a2b5f96d, 0x8b70ff06b31f87e3, 0xb75d8a5fae7c258e, - 0x056cf3051c0f3546, 0x75b6a8bdf1f9c716, 0x6690328e3093091c, 0x3baf5efd132e11b6, 0x85d87b9ba3641a26, - 0x1314c5ffea325a55, 0xb3651d61c33abd49, 0xb97e8e48eb1c8a18, 0x18f11658fcb42941, 0xcec3a9b220959903, - 0x8b5e6a3c05b8855f, 0xce88c2365dbdfa7c, 0x546e0c5c8a7168a9, 0x5b4445b7c408b8d8, 0x9c4e67f050e8fd45, - 0xba75fa3344c1d473, 0xe66f593d2e10a15f, 0xccf030971afe37d4, 0xa97dcf591254d6ab, 0x3bbfe851d1acdb80, - 0x47f2a44915f92a11, 0x4c50e72c52350120, 0xea245b69a0b33bd1, 0x27dbf9b04169c59c, 0x884acb2887e5d9c0, - 0x68050a6063a670e0, 0x0a49b0f4b5318de0, 0x086021450806941f, 0x0f69ee32c450f527, 0xe6e727383a83fad6, - 0x7e4272a329ab7d84, 0x31be1ab602791bb5, 0x81efd441bdf9d92e, 0x55c59e8ec4bd21fc, 0x53561d69a69ebbf4, - 0xdebc9b18e99e00e9, 0xcc88a79f3b7e1a70, 0x1d62feff750efe60, 0xbad65d937bf39a71, 0x17f09f733ef60062, - 0x0542c9893100c3f1, 0x7bcfd90036c9d363, 0x20bc359867afc163, 0x08727c5c3ce10b6f, 0x34c18575679c4ac0, - 0x7addd98cc197d766, 0x6324f4d7ee3f7b92, 0x70387b5b98d76085, 0xccc94f6f76c48f38, 0xa57ae617a80bd09a, - 0x5149c119c0175c0b, 0x0513d72b30ab7208, 0x85a59f723eff2a67, 0xd52cd0ed4545e25d, 0xcd723d83a2740289, - 0xa6b6b82a3974c336, 0x823e4c807d71498c, 0xf394683c1c86405c, 0xe7731973a827035c, 0xc28733dcd0eb387b, - 0x73fb5b7201308842, 0x0023a4aeb326d589, 0x6cd2927a5aa73c9c, 0x74df7385eda826fc, 0x75626fb521cd5b99, - 0x962c9b0f5826941a, 0x149c7e131a4a3a3a, 0x619ad7282a56ae8e, 0x64f19893c9de159f, 0xbea1d711fc0f3887, - 0xee3b7c373824e68d, 0x629519b953de9b3c, 0x2a65f3be4c4a962b, 0x2f99dc0d276e6ede, 0xb709cde200c467b9, - 0x5e29a26d7c49232c, 0x9bb9cf3bceb6a605, 0x9bbe50ca0e17c054, 0xbb6ffbc356fbccd0, 0xcfda47f023595aea, - 0x0c7b0f6ef523f274, 0x7ed7853c67d9a7e6, 0xb331f6b909367a94, 0x00d04393fcddf3c1, 0x0c7eae8482d5a0c8, - 0xf41c9715b6afafac, 0x9373c3f638d9d1c1, 0x18ef5ce007cffb3d, 0x48697b91b405f38a, 0x2dcc0e6770a79533, - 0x9d1ce3bb27cf4643, 0xd5c3d66c8141599b, 0xd6ae7a9f43c44455, 0x39fe76852263b914, 0xe70f2ae6778c4672, - 0x908467cfde9e1c55, 0xa6e3d32cd02541fa, 0x89b34252efb4e62d, 0xcde80e815dc2b808, 0x831fd6eaeebacefc, - 0x363f9197f2490a28, 0x605b4c51f014ec32, 0xd58448ae930353c6, 0xf29daacd2adf1b8c, 0xae1337421e4faef1, - 0xabeb40ff6c3719eb, 0xdc72159a76b6b71c, 0x8f6be430a30201eb, 0x0ab59c392fbf6515, 0x7861a31de903824a, - 0x31a2dd1f6037f539, 0x1ae39e33765f560f, 0xd818d77dd34f98d0, 0x53fcb3d7dd1fb5db, 0x6976976e824d6bed, - 0x10f9621959333cd7, 0x0ad358b7769c7188, 0x5aec59ad9c32cee5, 0x8c29e312c0a9a295, 0x1bab56ce2d6a77cd, - 0xa0efae70ae2725d3, 0x533148664ea9544e, 0x2e3c2bcc9faf749c, 0xe25b7b5a95c6db40, 0x55c10894a079ed7e, - 0x693cbbef5758e606, 0xae65899af2f3e7f6, 0xa94a3a92192d3c8d, 0x71e461d7c0fa6d36, 0xf9e8a2e5382d224f, - 0xbb58d7daeb42e176, 0x69387cd1ac837c4e, 0x2734766617b023ca, 0x820e71594293585f, 0xaeea16edf5f3a12a, - 0x39ad006b3b7d4ea7, 0x6188c4e555200311, 0xaa4035fd1009c59b, 0x47d6e1736700d025, 0xb2c9819652c80d3e, - 0x7212a9f987dd473e, 0x7f26fd5d676d645c, 0x5ede2813eaf6edc0, 0x6c25c03c240768d1, 0x02864888636ff56b, - 0xba19e51dd54ec68f, 0x5c2a45fcfc26f675, 0xb1543711a8b04d57, 0xf91fcd5836134897, 0x7b29cd56d95b562b, - 0xff6eab8b9d049583, 0x1fecfc9c85805244, 0xbd099a7f30857f0c, 0xada1520bc27ac3a8, 0xead6bce89f80a5ae, - 0x3aae8a3094140640, 0xe0eac76430857f05, 0x7f4cb291ee6d957a, 0xa0d3e6176c08ed55, 0x0834094bfac17172, - 0x533078cdf43ec480, 0x6aa5dde42b68e62d, 0x64a881e88b45869b, 0x46917d8ee4d80837, 0xb6ac09b620d2b5bd, - 0xb7c5c19d0fb1c3d5, 0xc0a73459083f365b, 0xde35ca0a37bc59ed, 0x53075acfcad01543, 0xc745b2a273bdc1fa, - 0x749ff5fa168923a3, 0xab9733eb950a6993, 0x84fdd8e49a6ef238, 0x40ec605a8e8ca6e4, 0x369226a3935ef136, - 0x01ff225dfe975c95, 0xd32a6697b05abb86, 0x80bb2c053414fda1, 0x6b759466a7f7e76f, 0xc26f6d652422b4e2, - 0x8c8cabb9ac57a29a, 0x7297983771b10d70, 0xa030797452177d1d, 0x55e67f477f38d7bc, 0xe40ab975d6ef4ee7, - 0x1cf1b0e650757b92, 0xd7d4aa11046408bc, 0x143dbc9fe7d362cb, 0xb3266dfa556a5fbc, 0x3cd71cbe35fd90b2, - 0xfbf2d6b1d1b01bf1, 0x2d081008cd26413f, 0xea1d3f282489020e, 0xf463469dc4754c48, 0x4c5bd5696648f0ca, - 0xb1cc9174345d1fd3, 0x9f88cddba7664207, 0x9d8a4ae38f20b121, 0x984f6fb716c86777, 0x4f3b377680d029fa, - 0xcbc0fd18f00637dc, 0x7b17289150f611f9, 0x56dedeb9b1673f77, 0x6f6093f329d3abdb, 0xf0a0f44f37812aed, - 0x9f76f676766f0416, 0x690e080a95b94ea1, 0x024af4b3fc7c0ea0, 0xc47693121f4efb10, 0x8692e11b7a5bccbf, - 0x7ea657a101187974, 0x55a561b4d0356019, 0xa3eeeee1c3089f3c, 0xebfe4a83d123c751, 0x4296cfce197295c1, - 0x0cf454793863ce04, 0x9eb8ce4483bc72e5, 0x1dd969ec996d0755, 0x2f939221eff9842a, 0x6750d9a8db69a777, - 0x875c58a96b6ea6e6, 0x8d9ac920270865db, 0xe21ecec3df776fee, 0x5d812b54de1ab534, 0x0a5cbde00b3404b4, - 0x0afe6d13142d03bd, 0xb62ff0f7022e5a5d, 0x58e6e890ccdb643b, 0x871fa7edde6c32c4, 0x94a03fd07fb7bba8, - 0x198c0c871466b9cd, 0x28f178e4bf78016b, 0x39b9bb5eea446111, 0x639bc7547eca8480, 0x862678a4e9cd8f08, - 0x0be94bc298719d46, 0xd34f7907dfe4c412, 0x45d0580756368219, 0x23ff847990fca40f, 0xdb46de8088e84582, - 0xb28e3fa1bd6b48b8, 0x28da3657d9285914, 0xc0bec98468e417d7, 0x552ab008ba204afe, 0xf4899317a9b94999, - 0x3f1a8fe01641f2fd, 0xa19e704c4b39a46a, 0x3136f4bc8fc1fa0c, 0xc9c4540290396086, 0x4c037c0fdb26ccbf, - 0x4899cb555e139e69, 0x57557f5995fa17e7, 0x436cc0c2b17157ad, 0xcc8d555c9b3c8387, 0x780d55d57d39a27d, - 0x9e2afc0ede8e5195, 0xa1f95e6667b75275, 0x8c37c454bdfafd9e, 0x4e17a283090b8554, 0x86ae1beadc7c6637, - 0x49e901d1de7cc22e, 0xa8349ca4392196f1, 0xa362dbb750339eac, 0x15b5928d1735e21f, 0x408920c85acc4a6c, - 0x404491dfa25afcb7, 0xba4a4a45f3fb8256, 0x8d1deb9ff939eae1, 0x7e5b7bb1566d483f, 0x7b91839a7deda67d, - 0x8d969fff1e3dd917, 0x7959aff0cd7c4f08, 0x1fe4cbeec695df63, 0x0cac88d7aa701c4b, 0x32e557ad4174bf52, - 0x98b4611ee6810bda, 0x3d15b8e2cdaf5626, 0xa7cba63aac72e743, 0x58b64e7ac19599a2, 0xa599b731ed816e1c, - 0xb2adb6622dacb059, 0xd7aea66854e28dba, 0x88c0898ed4f9aa9d, 0x78c5e6adf787a864, 0x416a93732ec459e3, - 0xaabd28d92df20d9f, 0xfc2014eb5d389498, 0x436046e87f964f11, 0x763e3cd498a73aed, 0x88e1b23f92aaaca1, - 0x215586051e5f0344, 0x0e4b86747bad67ad, 0xddd6716be39a6b39, 0x58a1d63e5edef3d0, 0xdecbada74f3d1a44, - 0x5845b816c47b980f, 0x791e063c8f3b2c8d, 0xe4b5c86d211c4869, 0xba36e0cdc78b43f0, 0x9b6575108073dda9, - 0x27c22b449aa2cc2d, 0x153e549f4a497658, 0x7c0746f2b9d5be37, 0xf0866683b5f830f0, 0xca47ab90cda17534, - 0xb186df588422c8a0, 0x739d342a11fe46d9, 0x377673912fd1a895, 0xf84ae6e790aa787f, 0x8588c0d75263f3a4, - 0xd40247e323c2c7cf, 0xf36b40f66a60024f, 0xe11ea3e1b3c3472a, 0x1228b7f3684cdf88, 0x7b904ce26992ca80, - 0x8735a9ab08955aa1, 0xa6fc5975da0202f9, 0xd292b70712802cab, 0x13d6015b2a13b103, 0x82bdf80cabe98518, - 0x031e94fc7982887c, 0x45779f7e5438df6b, 0x93e2590610283a10, 0xa35ce611d8c8f318, 0xcdb1f72eb89ba8a5, - 0x1334bfb2cebada58, 0xf30c0d40e8e13532, 0xb284dd2404eb144a, 0x3c327a2bd374f524, 0x178ab05115d29dc1, - 0x822436ff8d4da8ad, 0xbcaf0b3eae13b062, 0xe593cfd75977f217, 0x89a6973b7d010d96, 0x13dd003de1e774ac, - 0x353336614d5fe2b1, 0x722d18f2fbce8b3e, 0x9b419983bd1b97a8, 0xd022765a886964e7, 0x4aa5f4dcd3a0034e, - 0x550f11664fcebf85, 0x01b7242b75e91757, 0xc6bd2085ea6eab15, 0x1175803932b16c6a, 0xa5449c63516d538d, - 0xd5bc6435d02e0066, 0x9655e990320a084d, 0xb3acdbaf166df005, 0x4d683f189d34a34c, 0x194177b148439155, - 0x721369461de07d40, 0x13d4b0203e8fe6cf, 0x4ee5aa423ee322f0, 0x38f08c7086f6a2fc, 0x7484f6e241be0a1b, - 0x79cc33e78740416e, 0x678e62c2a0825579, 0xd245fcd0482171d6, 0x55d9fea3e993fe0c, 0x7e9db8d2b0744a5c, - 0xc980315b6560af9e, 0x16e448104efa40b9, 0x8323f0d9e825befc, 0x887473fae1709730, 0x1bf3f01c8d4e50c7, - 0x3010938a465185c0, 0xd0e3d3247321c09b, 0x160922f5797f38fb, 0x71d23d3f6d7900cc, 0x123c8e32e093cea3, - 0xa19dc62bb3dfcac4, 0x851d1b2b7a927e65, 0x2976857d30440e13, 0x165aa30d3720b8b2, 0xdf3b062a156ce1d1, - 0xe9147219bed4dee6, 0x68d7c04d94a5676e, 0x8930885d2e78ef08, 0x093fe34d67313d3a, 0x1d4c4e58b075c861, - 0x2cc3a60a0c3ccc8f, 0x99b0b967065f695f, 0xe199815c3c2c983f, 0xb86e89f0937fcbe4, 0xe29f67e817fecd39, - 0x7d2c44d44dded079, 0x778031d89fad5fdf, 0xb8dbb9f56d31e14e, 0xe70777e143b4685b, 0x70f9c847d3b40c9c, - 0x84167078406e03aa, 0x822bdad12f3424f6, 0x78f0c2cdadcc03d6, 0xfb95128611abf52f, 0x510e008bf8b77d32, - 0x3ee305bbdb77aaa5, 0xdc49b7f6aa2674b8, 0x8f97082653ad250d, 0x86743c8bed65384a, 0xd7531ec20a7c2a44, - 0x81cee74604e2a6fb, 0x4b54bb7c8381f4cc, 0xe600bce0ddd418d8, 0x7ca02a0ea68a6c12, 0x666f969bb54a70bf, - 0x87b20ae711d955fb, 0x6dc1568f601bd096, 0xe19cbdf626bb8404, 0x0ac27845738ba240, 0xe8cfbb37bf935d5d, - 0xf0a64b305d10107d, 0xf1d68dcf1ff57cc0, 0xecc844a2b86b5441, 0x834965cd634d6e30, 0x7e61e4f9e3a348df, - 0x7bb0e72f3f8becdb, 0x36cbc849c5d6f006, 0x8577b20746565863, 0xa1cd87d3418f7603, 0x1209d220dbb30235, - 0x52291d9eb490dcc3, 0x3c517ae6fc9c2ab9, 0x5dd5f407b0ad2908, 0x6aba46e8a74e340c, 0x8f1e854b7748d227, - 0x01d34542796f9100, 0x9d2e0954151f2724, 0xdd2406ff840d2244, 0xf6cc46d9788baa7d, 0x0f932672bf23d605, - 0x872188535f721229, 0x5869d1480463e255, 0xa1f0a010b016f0c5, 0xf1a0c1e270fdd67c, 0xbb8ad9a6b0197e4a, - 0xd5a1df59d030aa7c, 0x734958d07b7e9e62, 0xd70b1489129b91b6, 0x3cea1c03ec973095, 0x1454d85b2d0691ca, - 0x03e301cf4d254605, 0x60d1ff449126e99d, 0x5b5b558607e62d27, 0x929fa05688b612e0, 0x07054c6b420a413f, - 0x8c9630d476b5c818, 0x341263267c1b4b36, 0x95b0be631ae021e4, 0x32e8f6ac089f8000, 0xb0740a66b8054b6e, - 0x8f267b2e843a8752, 0x3c6320cd37266a47, 0xf20ec1127c80bd6d, 0x0bb01787d58b3ee7, 0xb198f53505a41b76, - 0x01f54a62a25f5cd0, 0x14679a262bdb5866, 0xb9e044589df5223a, 0x9a6ce4cd24fdec3c, 0xb991ea2759cc70d2, - 0x2cf4f3318e235dda, 0xa513443d3799e8ab, 0x15aa3a92f086e9a5, 0xfb7a985e218faa6d, 0x38cf25da5a303df7, - 0x6790e1061ee391b0, 0xb99091c2ba04906d, 0x91a32b15c8634629, 0x2088dccb9bc2b0c8, 0x6036c524b14a2550, - 0x6de12617bb39a85d, 0x4b0cbde402b3360d, 0x6709e88a87830b58, 0x7c624ff34653cb0b, 0x8b6a2328bd0a2ad3, - 0xf14d40324d089769, 0xb098a5604c5158e8, 0x66981d61230cefb9, 0x2942c8e736e1166a, 0x3fa626c01dd99a00, - 0xb983f1c7b2f79b14, 0xc62d3e4e161d2071, 0xa7ee4a5c193e3e8a, 0x1a8fab2d4c159ccd, 0x14b8409c200e2a57, - 0xd91cba19ddfaf429, 0x7afe2e79fe9e516c, 0x2f14c53682aeb565, 0x04a11dd93f1dbf5a, 0xb8b05897b6179a55, - 0xbbe471316e6fcfee, 0x62c39c6d6e2a8496, 0x241fcf5e812d1043, 0xb420c4d670dc3dd9, 0xa70ceb509099f8fc, - 0xd232027258b3c2e2, 0x467f21b883c0de53, 0x74876d33d9d03af0, 0xc60baec9e5ee785b, 0xea0fe0eacffbf235, - 0xa520595d6414829d, 0x2ee5021231ad3edc, 0x1ceccb31020fdaec, 0x4322e34a688175c2, 0x7ee188c73eae8ff4, - 0x09e21d830d807603, 0x513865ea28a780bd, 0x2d93fa1e90c28b7d, 0xfdb56d8405c08404, 0x09005c01a7be0577, - 0xb446fdda3f215970, 0x506b66ebac675852, 0x011b69372a2ef896, 0x545b633bf511d909, 0xb38d26ca87d24441, - 0xed9d401f2708cb8c, 0x71c3925e2cc000f2, 0xfd4b520532907ba7, 0x985192281705c793, 0x09228cc71d586261, - 0x966579fd42327b65, 0x4944673812f89f0a, 0x10d334eaebbf6e2c, 0x3852eb10f3e1682c, 0x3c3915a3959cd7b0, - 0x2aab76d81f345e6b, 0xdc61d48c503dd451, 0xdc5dbe64f6176405, 0x4abd1a7dcd72f210, 0x59dc4730fabfa61d, - 0x674c4390e7978a3c, 0x179cc71468959498, 0xfd60f4376ccc95b9, 0x28b1663c0bcc18e5, 0x16655d1c9b3ae7f7, - 0x043ac386964689e5, 0x8844e029ae7b3c7a, 0xee7b3c88dafff753, 0x7cee245e6e1a2797, 0xf67c1724172e4312, - 0x98b1013e732167fc, 0x32c2571e210a7017, 0x563a20f18741008a, 0xe1a0f42443bb257f, 0x9da408f7cdfe6444, - 0x2178aa8b220f5078, 0x2c63e0ff17e4b1aa, 0xb1f909ed7b11fa6e, 0x586bef7d2666320a, 0xf3290f6188eeb80e, - 0x9cec0294159a1609, 0x93e4551002a4292d, 0x343322e49a8d7e4e, 0xf64eb1b4510043ec, 0x4f481bc0d976820d, - 0x933e4e7fd6825ee3, 0x564a523a93e52d36, 0x4d5aa595ed936e32, 0x82290d975049869a, 0xa693f845edaecb53, - 0x76e635a4d3818955, 0x789f89e3c1d2178a, 0x3901d64408b2b3f1, 0xfe64d2fdc8903738, 0x05ea88557cd0ebed, - 0x7a7a095f5a912827, 0xaed5b086a1ca9090, 0x3bae4e1dc98acfba, 0xea3c98f61a5627c9, 0x491fae2b5c55ccde, - 0x3f6bfce124277db8, 0xae70553199348f57, 0x99347102a2830c7a, 0x601033653766241f, 0x18989f1aa13f6f4c, - 0x52d6f206bbc69fe4, 0x5593d2510168d852, 0x12b5d58eb2a2b1d2, 0x2f8f7a9d63b2ec01, 0x3c428bee90ad57ed, - 0x9774ddbf3fac3d29, 0xf0253d2982fdb418, 0x1b816a1531523581, 0x142e1ca8fcf9fc2d, 0x982dbdec752e81f8, - 0x1a344c6f0d0b6536, 0x11b5294f04202e16, 0x31c2a78c029067c2, 0x062131d918181b76, 0x9174a0084969442c, - 0x713c2c36c8685834, 0x97e997381e571021, 0x9bc2b652a82da0bd, 0x05af16b74b51d2cc, 0x272f6a30451ac1c4, - 0x2d575878ef473d6c, 0x95bde11c1a36eae0, 0x747f7f23b9d75a5f, 0x5dce162da0658d00, 0x9535fc48a611346d, - 0xb839fdb56044df90, 0x3f0d7d8eea45acf1, 0xfef92044f18c1a5e, 0x9041028e6bfc2128, 0x9b73ebbf8ee7629e, - 0x4115a0afa74560b4, 0xc17526bcaec9bc4f, 0x7fc96a1a124aceb1, 0xb6ff1cc203c3bf8e, 0x589cb0869c64b960, - 0x1332c17659cec789, 0x9a3374d02ee6f619, 0xb404dd7d2bf25292, 0xe682f0a62213f92b, 0x481ee2f91ef6f3bb, - 0x8166b464cdadd06d, 0xe5bc92e872b21cb3, 0x2a27256a4e91b955, 0xe49444cb9938e656, 0x14897369d9007fbe, - 0xa25c90c360c52783, 0x59ff79174186abba, 0x27c8c165545e55cc, 0xad699c0f707490c2, 0xa7d9e4ad73f59047, - 0xe62e5fb810a3a0e4, 0x7634c9c00475bbcd, 0x3e9c2d2abe563d8e, 0xc83101538816ab6e, 0x899c9336ea622e4a, - 0x908b0e76f4620e4a, 0xa886aed6bb866bbf, 0xddb2f2adfa7edc1d, 0xd61f52a0c64eaad4, 0x1f41f5cc7e8a0990, - 0xf9807ac9996445db, 0x50696d002c445c12, 0x804a65ee6d49b11a, 0x4b777579fb0578f1, 0xbba07211e3c6b7fe, - 0x74b4735d52fe36a3, 0x5f61dafd17fb3f72, 0x12d97e4729fb4f7f, 0xe504385feb7bd587, 0x5c16cd22a80dbb8c, - 0x8351309908dee2f9, 0xbc0b37c234b7bc6f, 0xbf8599db5ffa4054, 0x7c4e86939a2d7fd9, 0x164594a497bb97c7, - 0x8004229a4ffc858e, 0x88142ef75cb2df1e, 0x431a3818e967e4a1, 0x4d523b2c0d126c74, 0x19665f93b3f73829, - 0x15ac5a73b8e73641, 0x64e01419914d3042, 0xaf43836659b28436, 0x49a9a20ff9170bd9, 0x4bf4f84c177c78ee, - 0x324b651971ce3a1d, 0x071f982abd8b4a1c, 0xf75f7566f8c7e0c0, 0xc39b8b608047f0ef, 0x92a2af20d840cd89, - 0x49259b9a30834b20, 0xb659903dbc8c04fd, 0x07707c0abd0e2e0a, 0xd524094ec43dbb02, 0x82d2193385faaad6, - 0x20362e519f738971, 0x6c35a952deb2a16c, 0x2afa892e0949ce4a, 0xcbd88c48ed36544d, 0xa5c672d5b7b59676, - 0x1d81d46e74065d61, 0x5cef74f48bd5b6d2, 0x45abd1c63d219f12, 0xf34989f52f9fdcba, 0xa098415861a46290, - 0x9fa232c0ef6275a2, 0x8fd75a9f72b13883, 0x5996aac8b16a0d38, 0x9b7da11115aab531, 0xe5ec71862af3d1fa, - 0x723e639595a5ecae, 0xcb0d2b8316e4b694, 0xcd7782b454a0b010, 0x6da5573a443e0055, 0xe463e25189c82562, - 0x150256a2e42211e6, 0xd384d40fa298d3d2, 0x625784556ae58a38, 0xf57e3a80a0fe8118, 0xcf703838d5bf950c, - 0x43d5e3e459a2efca, 0xbb37bf4d7ef7868a, 0x8ac343bc79da3be7, 0x48b4ca99e04bc49a, 0x717766d0ab1ae5b1, - 0x6f79a2320ed45591, 0x86cc50478274065a, 0xc0a8c0aa6cd05ba3, 0x3319974f7011fe4c, 0xa68b34ddf7cece67, - 0x8f0995d4af394327, 0x5dd0c53aca82cf22, 0x91ea0fda6de6a3c7, 0xe327f3dea930069e, 0xc4eb88449c094490, - 0xac4470f14efa93c4, 0x0fc20dbc846bc13b, 0xb002b817434c028d, 0xe13750bc0ca64fbb, 0x4ff10ccbb397fd7f, - 0xdf667ba9dc4501cd, 0xa72bacdcc309a1e5, 0x7c36055f219f203d, 0x77c57e5bf171580e, 0xd5d6807edd81a549, - 0xc38a88a50524c241, 0x8d16b7e1450d4dc8, 0xe5fde11a5469e664, 0xb1b8fdbb6fbef9b7, 0xb5e9780e3fcc27e0, - 0x3e31862f5f3cee30, 0x02edd6d99fc966f1, 0xfc77ff05410b413b, 0x8a43050000000000 - }; -}; - -} // namespace webfront::fs::generated diff --git a/js/core/WebFrontAssets.cmake b/js/core/WebFrontAssets.cmake index 73483007..17146274 100644 --- a/js/core/WebFrontAssets.cmake +++ b/js/core/WebFrontAssets.cmake @@ -50,27 +50,6 @@ function(webfront_add_embedded_assets) "${root}/js/core/bootstrap/bootstrap.bundle.mjs" "${root}/include/webfront/system/DeveloperBootstrapData.hpp" DeveloperBootstrapData DeveloperBootstrapAssetFresh) - # Terminal component (include/webfront/system/TerminalFS.hpp). xterm.js files are vendored verbatim in - # third_party/xterm (see its VERSION file); refresh them with cmake/UpdateXterm.cmake. - _webfront_add_embedded_text_asset( - "${root}/js/developer/components/terminal/index.html" "${root}/include/webfront/system/TerminalIndexHtmlData.hpp" - TerminalIndexHtmlData TerminalIndexHtmlAssetFresh) - _webfront_add_embedded_text_asset( - "${root}/js/developer/components/terminal/terminal.mjs" "${root}/include/webfront/system/TerminalModuleData.hpp" - TerminalModuleData TerminalModuleAssetFresh) - # Browser side of the wf tool manager (include/webfront/system/ToolManagerFS.hpp). - _webfront_add_embedded_text_asset( - "${root}/js/developer/components/tools/wf.mjs" "${root}/include/webfront/system/ToolManagerModuleData.hpp" - ToolManagerModuleData ToolManagerModuleAssetFresh) - _webfront_add_embedded_text_asset( - "${root}/third_party/xterm/xterm.mjs" "${root}/include/webfront/system/XtermModuleData.hpp" - XtermModuleData XtermModuleAssetFresh ON) - _webfront_add_embedded_text_asset( - "${root}/third_party/xterm/xterm.css" "${root}/include/webfront/system/XtermCssData.hpp" - XtermCssData XtermCssAssetFresh ON) - _webfront_add_embedded_text_asset( - "${root}/third_party/xterm/addon-fit.mjs" "${root}/include/webfront/system/XtermFitAddonData.hpp" - XtermFitAddonData XtermFitAddonAssetFresh ON) _webfront_add_embedded_text_asset( "${root}/third_party/react/runtime.mjs" "${root}/include/webfront/system/ReactRuntimeData.hpp" ReactRuntimeData ReactRuntimeAssetFresh ON) diff --git a/js/developer/components/terminal/index.html b/js/developer/components/terminal/index.html deleted file mode 100644 index 480c7245..00000000 --- a/js/developer/components/terminal/index.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - -WebFront Terminal - - - - -
- - - - diff --git a/js/developer/components/terminal/terminal.mjs b/js/developer/components/terminal/terminal.mjs deleted file mode 100644 index f910ffe2..00000000 --- a/js/developer/components/terminal/terminal.mjs +++ /dev/null @@ -1,360 +0,0 @@ -/// @brief WebFront terminal component: an xterm.js terminal whose line editor sends each validated -/// line to the C++ commands registered through webfront::Terminal (include/webfront/components/Terminal.hpp), -/// unless a browser command of an extension module (Terminal::extension) handles it first. - -import {Terminal} from "./xterm.mjs"; -import {FitAddon} from "./addon-fit.mjs"; - -const ansi = { - red: (text) => `\x1b[31m${text}\x1b[0m`, - clearToEnd: "\x1b[K", - clearScreen: "\x1b[2J\x1b[3J\x1b[H", - left: (count) => (count > 0 ? `\x1b[${count}D` : ""), -}; - -function commonPrefix(words) { - return words.reduce((prefix, word) => { - const limit = Math.min(prefix.length, word.length); - let length = 0; - while (length < limit && prefix[length] === word[length]) - ++length; - return prefix.slice(0, length); - }); -} - -// Reads a line for tokenize(), one word part at a time. -class Scanner { - constructor(line) { - this.line = line; - this.index = 0; - } - - get done() { - return this.index === this.line.length; - } - - next(problem) { - if (this.done) - throw new SyntaxError(problem); - return this.line[this.index++]; - } - - // The content of a quoted string whose opening quote was read. Inside double quotes a backslash - // escapes the next character; one ending the line stays literal, and the missing closing quote - // is reported next. - quoted(quote) { - let content = ""; - for (let char = this.next("Unterminated quote"); char !== quote; char = this.next("Unterminated quote")) - content += quote === '"' && char === "\\" && !this.done ? this.next() : char; - return content; - } - - // What `char`, read outside quotes, adds to the current word. - part(char) { - if (char === "\\") - return this.next("Trailing backslash"); - if (char === "'" || char === '"') - return this.quoted(char); - return char; - } -} - -/// Splits a line into words like terminal::tokenize in C++: whitespace separates words, single quotes -/// keep their content verbatim, double quotes keep it but honor backslash escapes, and an unquoted -/// backslash escapes the next character. Throws a SyntaxError on an unterminated quote or a trailing -/// backslash. -export function tokenize(line) { - const words = []; - const scanner = new Scanner(line); - let word = null; // null between words - while (!scanner.done) { - const char = scanner.next(); - const separator = char === " " || char === "\t"; - if (separator && word !== null) - words.push(word); - word = separator ? null : (word ?? "") + scanner.part(char); - } - if (word !== null) - words.push(word); - return words; -} - -// Browser command output uses "\n" line endings, converted like C++ output. -const toTerminalText = (text) => text.replace(/(? 0 ? commands.get(words[0]) : undefined; - if (!handler) - return runInCpp(line); - const output = await handler(words.slice(1), { - line, - bridge, - signal, - write: (text) => write(toTerminalText(String(text))), - runInCpp: () => runInCpp(line), - }); - return output === undefined ? runInCpp(line) : toTerminalText(String(output)); -} - -/// Imports the extension modules listed by C++ ("\n"-separated URLs) and collects their browser -/// commands. A module that fails to load is reported and skipped. -async function loadExtensions(urls, write) { - const commands = new Map(); - for (const url of urls.split("\n").filter((entry) => entry !== "")) { - try { - const module = await import(url); - for (const [name, handler] of Object.entries(module.commands ?? {})) - commands.set(name, handler); - } catch (error) { - write(ansi.red(`Terminal extension ${url} failed to load: ${error?.message ?? error}`) + "\r\n"); - } - } - return commands; -} - -// Editing keys, as xterm.js reports them in onData, mapped to LineEditor actions. -const keyActions = new Map([ - ["\r", (editor) => editor.submit()], - ["\x7f", (editor) => editor.erase(-1)], - ["\b", (editor) => editor.erase(-1)], - ["\x1b[3~", (editor) => editor.erase(0)], - ["\x1b[D", (editor) => editor.moveTo(editor.cursor - 1)], - ["\x1b[C", (editor) => editor.moveTo(editor.cursor + 1)], - ["\x1b[H", (editor) => editor.moveTo(0)], - ["\x1bOH", (editor) => editor.moveTo(0)], - ["\x01", (editor) => editor.moveTo(0)], - ["\x1b[F", (editor) => editor.moveTo(editor.chars.length)], - ["\x1bOF", (editor) => editor.moveTo(editor.chars.length)], - ["\x05", (editor) => editor.moveTo(editor.chars.length)], - ["\x1b[A", (editor) => editor.recall(-1)], - ["\x1b[B", (editor) => editor.recall(1)], - ["\t", (editor) => editor.track(editor.completeLine())], - ["\x03", (editor) => editor.cancelLine()], - ["\x0c", (editor) => editor.redraw(ansi.clearScreen)], - ["\x15", (editor) => editor.killBeforeCursor()], -]); - -/// Line editor driven by the terminal's input data. `write(text)` displays text; `run(line)` and -/// `complete(line)` return Promises of the C++ output and of "\n"-separated completion candidates. -export class LineEditor { - constructor({write, run, complete, prompt}) { - this.write = write; - this.run = run; - this.complete = complete; - this.abort = null; - this.prompt = prompt; - this.chars = []; - this.cursor = 0; - this.history = []; - this.historyIndex = 0; - this.busy = null; - } - - get line() { - return this.chars.join(""); - } - - /// Resolves once no command or completion is pending. - async whenIdle() { - while (this.busy) - await this.busy; - } - - showPrompt() { - this.write(this.prompt); - } - - handle(data) { - if (this.busy) - return this.interrupt(data); - const action = keyActions.get(data); - if (action) - return action(this); - if (!data.startsWith("\x1b")) - return this.insertText(data); - } - - // While a command runs, Ctrl+C aborts its signal once and the other keys are ignored. - interrupt(data) { - const running = this.abort?.signal.aborted === false; - if (data !== "\x03" || !running) - return; - this.write("^C\r\n"); - this.abort.abort(new Error("Interrupted")); - } - - // Typed or pasted text: printable characters are inserted, a carriage return submits the line - // and the rest of a multi-line paste is dropped, since commands run one at a time. - insertText(data) { - const [text, ...rest] = data.split("\r"); - this.insert(Array.from(text).filter((char) => char >= " " && char !== "\x7f")); - if (rest.length > 0) - return this.submit(); - } - - insert(chars) { - if (chars.length === 0) - return; - this.chars.splice(this.cursor, 0, ...chars); - this.cursor += chars.length; - this.redraw(); - } - - erase(offset) { - const index = this.cursor + offset; - if (index < 0 || index >= this.chars.length) - return; - this.chars.splice(index, 1); - this.cursor = index; - this.redraw(); - } - - killBeforeCursor() { - this.chars.splice(0, this.cursor); - this.cursor = 0; - this.redraw(); - } - - moveTo(position) { - const cursor = Math.max(0, Math.min(this.chars.length, position)); - if (cursor === this.cursor) - return; - this.cursor = cursor; - this.redraw(); - } - - recall(direction) { - const index = this.historyIndex + direction; - if (index < 0 || index > this.history.length) - return; - this.historyIndex = index; - this.chars = Array.from(index === this.history.length ? "" : this.history[index]); - this.cursor = this.chars.length; - this.redraw(); - } - - cancelLine() { - this.write("^C\r\n"); - this.chars = []; - this.cursor = 0; - this.historyIndex = this.history.length; - this.showPrompt(); - } - - // Rewrites the prompt and the line in place, then moves the cursor back to its position. - redraw(prefix = "\r") { - this.write(prefix + this.prompt + this.line + ansi.clearToEnd + ansi.left(this.chars.length - this.cursor)); - } - - track(promise) { - this.busy = promise.finally(() => { - this.busy = null; - }); - return this.busy; - } - - submit() { - const line = this.line; - this.write("\r\n"); - this.chars = []; - this.cursor = 0; - if (line.trim() !== "" && this.history.at(-1) !== line) - this.history.push(line); - this.historyIndex = this.history.length; - return this.track(this.execute(line)); - } - - async execute(line) { - this.abort = new AbortController(); - try { - const output = await this.run(line, this.abort.signal); - // The prompt starts on a new line, unless the output already ends one or leaves the - // cursor at home (such as the 'clear' command). - if (output) - this.write(output.endsWith("\n") || output.endsWith("\x1b[H") ? output : output + "\r\n"); - } catch (error) { - this.write(ansi.red(`Error: ${error?.message ?? error}`) + "\r\n"); - } - this.showPrompt(); - } - - async completeLine() { - // Only the command name is completed, and only with the cursor at the end of the line. - if (this.cursor !== this.chars.length) - return; - const line = this.line; - let candidates; - try { - candidates = (await this.complete(line)).split("\n").filter((word) => word !== ""); - } catch (error) { - return; - } - if (candidates.length === 0) - return; - const completion = candidates.length === 1 ? candidates[0] + " " : commonPrefix(candidates); - if (completion.length > line.length) - return this.insert(Array.from(completion.slice(line.length))); - this.write("\r\n" + candidates.join(" ") + "\r\n"); - this.redraw(); - } -} - -/// Mounts a terminal in `element` once the WebFront bridge is ready. Returns the xterm Terminal, -/// its line editor and a `flush()` resolving when every write has been rendered. -export async function mount(element, {bridge = globalThis.webFront, terminalOptions = {}} = {}) { - const terminal = new Terminal({ - cursorBlink: true, - convertEol: false, - fontFamily: 'ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace', - theme: {background: "#0d1117", foreground: "#e6edf3"}, - ...terminalOptions, - }); - const fit = new FitAddon(); - terminal.loadAddon(fit); - terminal.open(element); - fit.fit(); - new ResizeObserver(() => fit.fit()).observe(element); - - let lastWrite = Promise.resolve(); - const write = (text) => { - lastWrite = new Promise((resolve) => terminal.write(text, resolve)); - }; - const flush = () => lastWrite; - - try { - await bridge.ready; - } catch (error) { - write(ansi.red(`Connection to the application failed: ${error?.message ?? error}`) + "\r\n"); - return {terminal, editor: null, flush}; - } - - const call = (name) => bridge.cppFunction(`webfront.terminal.${name}`); - let prompt, banner, extensions; - try { - [prompt, banner, extensions] = await Promise.all([call("prompt")(), call("banner")(), call("extensions")()]); - } catch (error) { - // For example a page served by an application without webfront::Terminal. - write(ansi.red(`Terminal unavailable: ${error?.message ?? error}`) + "\r\n"); - return {terminal, editor: null, flush}; - } - const commands = await loadExtensions(extensions, write); - const runInCpp = call("run"); - const run = (line, signal) => runLine(line, {commands, runInCpp, write, bridge, signal}); - const editor = new LineEditor({write, run, complete: call("complete"), prompt}); - if (banner) - write(banner.replaceAll("\n", "\r\n") + "\r\n"); - editor.showPrompt(); - terminal.onData((data) => editor.handle(data)); - terminal.focus(); - return {terminal, editor, flush}; -} diff --git a/js/developer/components/tools/wf.mjs b/js/developer/components/tools/wf.mjs deleted file mode 100644 index c8a477f9..00000000 --- a/js/developer/components/tools/wf.mjs +++ /dev/null @@ -1,341 +0,0 @@ -/// @brief Browser side of the wf tool manager (#234), a terminal extension added by -/// webfront::ToolManager (include/webfront/components/ToolManager.hpp). 'wf search', 'wf install' and -/// 'wf open' run here, because the download speaks HTTPS; 'wf list', 'wf remove' and 'wf help' run -/// in C++. An installation fetches the packument and the tarball from the npm registry, checks the -/// tarball's SHA-512 integrity, unpacks it and sends its files through webfront.pkg.begin, -/// .writeFile and .commit. - -const blockSize = 512; -/// Files cross the bridge in chunks of this many bytes; the browser sends a large one in several -/// WebSocket frames, which the server reassembles. -export const chunkSize = 256 * 1024; -/// Largest unpacked tarball accepted, against decompression bombs. -export const maxUnpackedBytes = 256 * 1024 * 1024; -const utf8 = new TextDecoder(); - -/// Splits "name[@version]", where the name may be scoped ("@scope/name@1.0.0"). The version is "" -/// when absent. -export function parseSpec(spec) { - const at = spec.indexOf("@", spec.startsWith("@") ? 1 : 0); - return at < 0 ? {name: spec, version: ""} : {name: spec.slice(0, at), version: spec.slice(at + 1)}; -} - -function registryBase(registry) { - const base = new URL(registry, globalThis.location?.href); - if (!base.pathname.endsWith("/")) - base.pathname += "/"; - return base; -} - -// The registry encodes the slash of a scoped name. -const packumentUrl = (base, name) => new URL(name.replace("/", "%2f"), base); - -async function fetchOk(url, fetchImpl, signal) { - const response = await fetchImpl(url, {signal}); - if (!response.ok) - throw new Error(`${url}: HTTP ${response.status}`); - return response; -} - -async function fetchJson(url, fetchImpl, signal) { - return (await fetchOk(url, fetchImpl, signal)).json(); -} - -function resolveManifest(packument, name, requested) { - const tag = requested || "latest"; - const version = packument["dist-tags"]?.[tag] ?? requested; - const manifest = packument.versions?.[version]; - if (!manifest) - throw new Error(`${name} has no version '${tag}'`); - return manifest; -} - -/// Checks bytes against an SRI integrity string ("sha512-", possibly several hashes -/// separated by spaces) and returns the matching "sha512-…" hash. Only SHA-512 is accepted. -export async function verifyIntegrity(bytes, integrity) { - const expected = String(integrity ?? "") - .split(/\s+/) - .filter((hash) => hash.startsWith("sha512-")) - .map((hash) => hash.split("?")[0]); - if (expected.length === 0) - throw new Error("The package has no SHA-512 integrity"); - if (!globalThis.crypto?.subtle) - throw new Error("Integrity checks need a secure context (https or localhost)"); - const digest = new Uint8Array(await crypto.subtle.digest("SHA-512", bytes)); - const actual = "sha512-" + btoa(Array.from(digest, (byte) => String.fromCharCode(byte)).join("")); - if (!expected.includes(actual)) - throw new Error(`Integrity check failed: expected ${expected[0]}, got ${actual}`); - return actual; -} - -/// Gunzips bytes, failing once more than `limit` bytes come out. -export async function gunzip(bytes, limit = maxUnpackedBytes) { - const reader = new Blob([bytes]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(); - const chunks = []; - let total = 0; - for (let read = await reader.read(); !read.done; read = await reader.read()) { - total += read.value.length; - if (total > limit) { - await reader.cancel(); - throw new Error(`The tarball unpacks to more than ${limit} bytes`); - } - chunks.push(read.value); - } - return new Uint8Array(await new Blob(chunks).arrayBuffer()); -} - -// A NUL-terminated header field. -function text(block, offset, length) { - const field = block.subarray(offset, offset + length); - const end = field.indexOf(0); - return utf8.decode(end < 0 ? field : field.subarray(0, end)); -} - -// An octal number, or a base-256 one when the first byte has its high bit set (GNU and star). -function number(block, offset, length) { - if (block[offset] & 0x80) - return block.subarray(offset + 1, offset + length).reduce((value, byte) => value * 256 + byte, block[offset] & 0x7f); - const digits = text(block, offset, length).trim(); - if (!/^[0-7]*$/.test(digits)) - throw new Error("Corrupt tar header"); - return digits === "" ? 0 : parseInt(digits, 8); -} - -function verifyChecksum(header) { - let sum = 0; - for (let index = 0; index < blockSize; ++index) - sum += index >= 148 && index < 156 ? 0x20 : header[index]; - if (number(header, 148, 8) !== sum) - throw new Error("Corrupt tar header checksum"); -} - -// " =\n" records of a pax extended header; lengths count bytes. -function paxRecords(data) { - const records = {}; - let offset = 0; - while (offset < data.length) { - const space = data.indexOf(0x20, offset); - const length = space < 0 ? NaN : Number(utf8.decode(data.subarray(offset, space))); - if (!(length > 0) || offset + length > data.length) - throw new Error("Corrupt pax header"); - const record = utf8.decode(data.subarray(space + 1, offset + length - 1)); - const equals = record.indexOf("="); - records[record.slice(0, equals)] = record.slice(equals + 1); - offset += length; - } - return records; -} - -// The entry whose header starts at `offset`: its header, type flag, data and the offset of the next -// entry. -function readEntry(archive, offset) { - const header = archive.subarray(offset, offset + blockSize); - verifyChecksum(header); - const size = number(header, 124, 12); - const start = offset + blockSize; - if (start + size > archive.length) - throw new Error("Truncated tar archive"); - return { - header, - type: header[156] === 0 ? "0" : String.fromCharCode(header[156]), - data: archive.subarray(start, start + size), - next: start + Math.ceil(size / blockSize) * blockSize, - }; -} - -// An archive ends at two zero blocks; one is enough to stop. -function isEnd(archive, offset) { - return offset + blockSize > archive.length || archive.subarray(offset, offset + blockSize).every((byte) => byte === 0); -} - -// The name field of a ustar header, after its prefix field. -function headerPath(header) { - const name = text(header, 0, 100); - const prefix = text(header, 257, 5) === "ustar" ? text(header, 345, 155) : ""; - return prefix ? `${prefix}/${name}` : name; -} - -// Entries naming the next one: a pax extended header and a GNU long name. A pax global header names -// nothing WebFront uses. -const nameEntries = { - x: (names, data) => ({...names, pax: paxRecords(data).path}), - L: (names, data) => ({...names, long: text(data, 0, data.length)}), - g: (names) => names, -}; - -/// Reads a tar archive (ustar, with pax and GNU long names) and returns its regular files as -/// {path, bytes}, in archive order. Directories, links and other entries are skipped. -export function readTar(archive) { - const files = []; - let names = {}; - for (let offset = 0; !isEnd(archive, offset);) { - const {header, type, data, next} = readEntry(archive, offset); - offset = next; - if (Object.hasOwn(nameEntries, type)) { - names = nameEntries[type](names, data); - continue; - } - if (type === "0" || type === "7") - files.push({path: names.pax ?? names.long ?? headerPath(header), bytes: data}); - names = {}; - } - return files; -} - -/// The files of an npm tarball by path relative to the package root: the first path component -/// (normally "package/") is removed, as npm does. A later entry replaces an earlier one. -function packageFiles(entries) { - const files = new Map(); - for (const {path, bytes} of entries) { - const relative = path.replace(/^(\.?\/)+/, "").split("/").slice(1).join("/"); - if (relative !== "") - files.set(relative, bytes); - } - return files; -} - -function packageJson(files, name, version) { - const manifest = files.get("package.json"); - if (!manifest) - throw new Error(`${name}@${version} has no package.json`); - const pkg = JSON.parse(utf8.decode(manifest)); - if (pkg.name !== name || pkg.version !== version) - throw new Error(`The archive contains ${pkg.name}@${pkg.version}, not ${name}@${version}`); - return pkg; -} - -const isTool = (field) => field?.kind === "tool" && typeof field.entry === "string"; - -function toolOf(files, name, version) { - const tool = packageJson(files, name, version).webfront; - if (!isTool(tool)) - throw new Error(`${name} is not a WebFront tool: its package.json has no webfront field with kind "tool" and an entry`); - return {entry: tool.entry.replace(/^(\.\/)+/, ""), title: typeof tool.title === "string" ? tool.title : name}; -} - -const pkgFunction = (bridge, name) => bridge.cppFunction(`webfront.pkg.${name}`); - -/// Options shared by search() and install(): -/// bridge the WebFront bridge (globalThis.webFront) -/// registry the npm registry URL (default: webfront.pkg.registry(), set in ToolManagerOptions) -/// fetch the fetch function -/// signal an AbortSignal stopping the downloads and the upload -async function settings({bridge = globalThis.webFront, registry, fetch: fetchImpl = (...args) => globalThis.fetch(...args), signal} = {}) { - return {bridge, fetchImpl, signal, base: registryBase(registry ?? (await pkgFunction(bridge, "registry")()))}; -} - -/// Searches the registry for packages with the webfront-tool keyword. Returns {name, version, -/// description} objects. -export async function search(term, options) { - const {fetchImpl, signal, base} = await settings(options); - const url = new URL("-/v1/search", base); - url.searchParams.set("text", `keywords:webfront-tool ${term}`.trim()); - url.searchParams.set("size", "20"); - const result = await fetchJson(url, fetchImpl, signal); - return (result.objects ?? []).map(({package: found}) => ({ - name: found.name, - version: found.version, - description: found.description ?? "", - })); -} - -// Downloads the tarball of a manifest and returns its files with the verified integrity. -async function download(manifest, packumentLocation, fetchImpl, signal) { - const tarballUrl = new URL(manifest.dist?.tarball ?? "", packumentLocation); - const tarball = new Uint8Array(await (await fetchOk(tarballUrl, fetchImpl, signal)).arrayBuffer()); - const integrity = await verifyIntegrity(tarball, manifest.dist?.integrity); - return {integrity, files: packageFiles(readTar(await gunzip(tarball)))}; -} - -// Sends the files to webfront.pkg.writeFile in chunks; an empty file is sent as one empty chunk. -async function upload(files, {bridge, name, version, signal}) { - const writeFile = pkgFunction(bridge, "writeFile"); - for (const [path, bytes] of files) { - let offset = 0; - do { - signal?.throwIfAborted(); - const chunk = bytes.subarray(offset, offset + chunkSize); - await writeFile(name, version, path, offset, chunk); - offset += chunk.length; - } while (offset < bytes.length); - } -} - -/// Downloads, verifies and stores "name[@version or dist-tag]" (latest by default). `progress(text)` -/// reports the steps. Resolves to {name, version, title, entry, files}; rejects without changing the -/// installed version when anything fails or `signal` is aborted. -export async function install(spec, {progress = () => {}, ...options} = {}) { - const {name, version: requested} = parseSpec(spec); - const {bridge, fetchImpl, signal, base} = await settings(options); - const packumentLocation = packumentUrl(base, name); - const manifest = resolveManifest(await fetchJson(packumentLocation, fetchImpl, signal), name, requested); - const {version} = manifest; - progress(`Downloading ${name}@${version}…`); - const {integrity, files} = await download(manifest, packumentLocation, fetchImpl, signal); - const {entry, title} = toolOf(files, name, version); - if (!files.has(entry)) - throw new Error(`The entry page ${entry} of ${name} is not in the package`); - - progress(`Installing ${files.size} files…`); - await pkgFunction(bridge, "begin")(name, version); - await upload(files, {bridge, name, version, signal}); - signal?.throwIfAborted(); - await pkgFunction(bridge, "commit")(name, version, integrity, entry, title); - return {name, version, title, entry, files: files.size}; -} - -/// The installed tools, from the pages of webfront.pkg.list(): {name, version, url, title} objects. -export async function installed(bridge = globalThis.webFront) { - const list = pkgFunction(bridge, "list"); - const tools = []; - for (;;) { - const lines = (await list(tools.length)).split("\n").filter((line) => line !== ""); - if (lines.length === 0) - return tools; - for (const line of lines) { - const [name, version, url, title] = line.split("\t"); - tools.push({name, version, url, title}); - } - } -} - -/// Opens the entry page of an installed tool in a new tab or window, and resolves to its URL. -export async function open(name, bridge = globalThis.webFront) { - const tool = (await installed(bridge)).find((candidate) => candidate.name === name); - if (!tool) - throw new Error(`${name} is not installed`); - return {...tool, opened: globalThis.open(tool.url, "_blank") !== null}; -} - -function requireOne(args) { - if (args.length !== 1) - throw new Error("Wrong number of arguments. Type 'wf help'."); - return args[0]; -} - -function formatFound(found) { - if (found.length === 0) - return "No tool found."; - const width = Math.max(...found.map(({name, version}) => name.length + version.length + 1)); - return found.map(({name, version, description}) => `${name}@${version}`.padEnd(width + 2) + description).join("\n"); -} - -// The wf subcommands running in the browser; 'wf list', 'wf remove' and 'wf help' run in C++. -const subcommands = { - search: async (args, {bridge, signal}) => formatFound(await search(args.join(" "), {bridge, signal})), - install: async (args, {bridge, signal, write}) => { - const tool = await install(requireOne(args), {bridge, signal, progress: (step) => write(step + "\n")}); - return `Installed ${tool.name}@${tool.version}: ${tool.title}. Type 'wf open ${tool.name}'.`; - }, - open: async (args, {bridge}) => { - const tool = await open(requireOne(args), bridge); - return tool.opened ? `Opened ${tool.title}: ${tool.url}` : `The browser blocked the new window. Open ${tool.url}`; - }, -}; - -async function wf([command, ...args], context) { - return Object.hasOwn(subcommands, command) ? subcommands[command](args, context) : undefined; -} - -/// Terminal browser commands (see Terminal::extension). -export const commands = {wf}; diff --git a/js/developer/vendor/check.mjs b/js/developer/vendor/check.mjs index ecc99892..9132542b 100644 --- a/js/developer/vendor/check.mjs +++ b/js/developer/vendor/check.mjs @@ -4,9 +4,6 @@ import { readFileSync } from 'node:fs'; import { gunzipSync } from 'node:zlib'; const root = new URL('../../../', import.meta.url); const assets = [ - ['XtermModuleData', 'xterm/xterm.mjs'], - ['XtermCssData', 'xterm/xterm.css'], - ['XtermFitAddonData', 'xterm/addon-fit.mjs'], ['ReactRuntimeData', 'react/runtime.mjs'], ['BabelData', 'babel/babel.min.js'], ['JasmineJsData', 'jasmine/jasmine.js'], diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 4934343c..97831848 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -15,8 +15,8 @@ set(TESTS_LIST) list(APPEND TESTS_LIST WebKitGTKPolicyTests.cpp ContentPolicyTests.cpp HTTPServerTests.cpp HTTPEncodingTests.cpp AcceptEncodingTests.cpp GzipTests.cpp ModuleHTTPServerTests.cpp EncodingsTests.cpp WebSocketTests.cpp LoggerTests.cpp MimeTypeTests.cpp) list(APPEND TESTS_LIST JSFunctionTests.cpp TypeErasedFunctionTests.cpp MessagesTests.cpp IndexFSTests.cpp) list(APPEND TESTS_LIST JasmineFSTests.cpp FileSystemTests.cpp NativeFSTests.cpp ReactFSTests.cpp BabelFSTests.cpp) -list(APPEND TESTS_LIST DefaultFSTests.cpp StdnetShutdownTests.cpp TerminalTests.cpp TerminalFSTests.cpp UISubscribersTests.cpp) -list(APPEND TESTS_LIST WebFrontTests.cpp WebLinkTests.cpp CEFPathsTests.cpp CEFMacrosTests.cpp ToolStoreTests.cpp ToolManagerTests.cpp) +list(APPEND TESTS_LIST DefaultFSTests.cpp StdnetShutdownTests.cpp SafePathTests.cpp UISubscribersTests.cpp) +list(APPEND TESTS_LIST WebFrontTests.cpp WebLinkTests.cpp CEFPathsTests.cpp CEFMacrosTests.cpp) list(APPEND TESTS_LIST DeveloperTests.cpp LifeTests.cpp StructuredShutdownTests.cpp JsFunctionSenderTests.cpp ApplicationTaskTests.cpp) list(APPEND TESTS_LIST SignalDemoTests.cpp FrontendUrlTests.cpp ApplicationUrlTests.cpp FrontendContractTests.cpp CommandsTests.cpp) if(WEBFRONT_USE_MDDLOG) diff --git a/test/unit/ModuleHTTPServerTests.cpp b/test/unit/ModuleHTTPServerTests.cpp index 5e684168..8b28bbc4 100644 --- a/test/unit/ModuleHTTPServerTests.cpp +++ b/test/unit/ModuleHTTPServerTests.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include @@ -23,7 +22,7 @@ namespace { struct ModuleFile { static inline std::list names{"modules/main.mjs"}; }; -constexpr std::array, 9> dependencies{ +constexpr std::array, 6> dependencies{ { {"jasmine/7.0.2/jasmine.js", "jasmine/jasmine.js"}, {"jasmine/7.0.2/jasmine-html.js", "jasmine/jasmine-html.js"}, @@ -31,9 +30,6 @@ constexpr std::array, 9> dependenc {"jasmine/7.0.2/boot.js", "jasmine/boot.js"}, {"react@19.3.1/runtime.mjs", "react/runtime.mjs"}, {"babel-standalone@8.0.7/babel.min.js", "babel/babel.min.js"}, - {"webfront/components/terminal/xterm.mjs", "xterm/xterm.mjs"}, - {"webfront/components/terminal/xterm.css", "xterm/xterm.css"}, - {"webfront/components/terminal/addon-fit.mjs", "xterm/addon-fit.mjs"}, } }; } // namespace @@ -55,7 +51,7 @@ SCENARIO("RequestHandler serves JavaScript modules") { // WebKit does not advertise Brotli over loopback HTTP. SCENARIO("Embedded browser dependencies support gzip-only HTTP clients") { - using Filesystem = fs::Multi; + using Filesystem = fs::Multi; RequestHandler handler{"."}; for (const auto& [path, sourceName] : dependencies) { WHEN("the client requests " << path << " without Brotli support") { @@ -83,7 +79,7 @@ SCENARIO("Embedded browser dependencies support gzip-only HTTP clients") { } SCENARIO("Embedded browser dependencies support identity-only HTTP clients") { - using Filesystem = fs::Multi; + using Filesystem = fs::Multi; RequestHandler handler{"."}; for (const auto& [path, sourceName] : dependencies) { GIVEN(path) { diff --git a/test/unit/SafePathTests.cpp b/test/unit/SafePathTests.cpp new file mode 100644 index 00000000..a85cff77 --- /dev/null +++ b/test/unit/SafePathTests.cpp @@ -0,0 +1,47 @@ +#include +#include +#include + +#include +#include +#include + +using namespace std; +using namespace webfront; + +SCENARIO("Paths from the browser stay inside their directory") { + GIVEN("a relative path of plain components") { + THEN("it is accepted, component by component") { + REQUIRE(fs::safeRelativePath("dist/assets/app.js") == filesystem::path("dist") / "assets" / "app.js"); + REQUIRE(fs::safeRelativePath("ui/main.tsx") == filesystem::path("ui") / "main.tsx"); + } + } + GIVEN("unsafe paths") { + auto path = GENERATE(as{}, + "", + "/etc/passwd", + "../x", + "a/../../x", + "a/./b", + "a//b", + "a/", + "..", + "...", + "C:/x", + "c:x", + "a\\..\\b", + "a?.js", + "a*.js", + "ab", + "a|b", + "a\"b", + "main..html", + "a/b..c/d", + string("a\0b", 3), + string(4097, 'a')); + THEN("they are rejected") { + REQUIRE_THROWS_AS(fs::safeRelativePath(path), invalid_argument); + } + } +} diff --git a/test/unit/TerminalFSTests.cpp b/test/unit/TerminalFSTests.cpp deleted file mode 100644 index 9051fa34..00000000 --- a/test/unit/TerminalFSTests.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "EmbeddedAssetChecks.hpp" -#include -#include -#include -#include - -#include -#include -#include - -using namespace std; -using namespace webfront; - -namespace { - -string readAll(fs::File& file) { - string content; - array buffer; - while (auto bytesRead = file.read(buffer)) - content.append(buffer.data(), bytesRead); - return content; -} - -string read(auto& filesystem, const string& path) { - auto file = filesystem.open(path); - REQUIRE(file.has_value()); - REQUIRE_FALSE(file->isEncoded()); - return readAll(*file); -} - -} // namespace - -SCENARIO("TerminalFS serves the terminal component under its reserved prefix") { - GIVEN("a TerminalFS") { - fs::TerminalFS terminalFS{filesystem::path{}}; - const string prefix{fs::TerminalFS::prefix}; - - THEN("the page loads the bridge from the root and the component module next to it") { - REQUIRE(prefix + "index.html" == fs::TerminalFS::page); - const auto page = read(terminalFS, string{fs::TerminalFS::page}); - REQUIRE(page.find(R"()") != string::npos); - REQUIRE(page.find(R"(from "./terminal.mjs")") != string::npos); - REQUIRE(page.find(R"(href="xterm.css")") != string::npos); - } - THEN("the component module imports the vendored xterm.js modules") { - const auto module = read(terminalFS, prefix + "terminal.mjs"); - REQUIRE(module.find(R"(from "./xterm.mjs")") != string::npos); - REQUIRE(module.find(R"(from "./addon-fit.mjs")") != string::npos); - } - THEN("the vendored xterm.js and Fit modules and CSS are gzip encoded") { - for (const auto& [name, size] : array, 3>{ - {{"xterm.mjs", fs::generated::XtermModuleData::dataSize}, - {"xterm.css", fs::generated::XtermCssData::dataSize}, - {"addon-fit.mjs", fs::generated::XtermFitAddonData::dataSize}} - }) { - auto file = terminalFS.open(prefix + string{name}); - REQUIRE(file.has_value()); - readEmbeddedAsset(*file, size); - } - } - THEN("each served file has the MIME type the browser needs for modules and styles") { - auto mime = [](const string& path) { - return http::MimeType::fromExtension(filesystem::path{path}.extension().string()).toString(); - }; - REQUIRE(mime(prefix + "index.html") == "text/html"); - REQUIRE(mime(prefix + "terminal.mjs") == "application/javascript"); - REQUIRE(mime(prefix + "xterm.mjs") == "application/javascript"); - REQUIRE(mime(prefix + "xterm.css") == "text/css"); - } - THEN("other paths, including the bare names outside the prefix, are not served") { - REQUIRE_FALSE(terminalFS.open("xterm.mjs").has_value()); - REQUIRE_FALSE(terminalFS.open("index.html").has_value()); - REQUIRE_FALSE(terminalFS.open(prefix + "missing.mjs").has_value()); - REQUIRE_FALSE(terminalFS.open(prefix + "xterm.mjs.map").has_value()); - } - } -} - -SCENARIO("DefaultFSWith adds component assets to the default WebFront filesystem") { - GIVEN("DefaultFSWith without a document root") { - fs::DefaultFSWith filesystem{std::filesystem::path{}}; - - THEN("the terminal page, the protected bridge and the fallback page are all served") { - REQUIRE(filesystem.open(string{fs::TerminalFS::page}).has_value()); - REQUIRE(read(filesystem, "WebFront.js").find("WebFrontBridge") != string::npos); - REQUIRE(filesystem.open("index.html").has_value()); - REQUIRE_FALSE(filesystem.open("unknown.txt").has_value()); - } - } -} diff --git a/test/unit/TerminalTests.cpp b/test/unit/TerminalTests.cpp deleted file mode 100644 index 98461e8d..00000000 --- a/test/unit/TerminalTests.cpp +++ /dev/null @@ -1,268 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace webfront; - -namespace { - -// Records the functions a Terminal registers, like BasicWF::cppFunction, and calls them directly. -struct RecordingApp { - map> nullary; - map> unary; - - template - void cppFunction(string name, auto&& function) { - static_assert(is_same_v); - if constexpr (sizeof...(Args) == 0) - nullary.try_emplace(std::move(name), std::forward(function)); - else - unary.try_emplace(std::move(name), std::forward(function)); - } - - string run(const string& line) { - return unary.at("webfront.terminal.run")(line); - } - string complete(const string& line) { - return unary.at("webfront.terminal.complete")(line); - } -}; - -bool contains(const string& text, const string& part) { - return text.find(part) != string::npos; -} - -// A shell with one command per accepted handler shape, plus a throwing one. -struct SampleShell { - terminal::Shell shell; - vector received; - - SampleShell() { - shell.command("greet", "Greet someone", terminal::adaptHandler([](CommandArgs args) { - return "Hello, " + (args.empty() ? string{"world"} : args[0]) + "!"; - })); - shell.command("record", "Record its arguments", terminal::adaptHandler([this](CommandArgs args) { - received.assign(args.begin(), args.end()); - })); - shell.command("lines", "Write two lines", terminal::adaptHandler([](CommandArgs, ostream& output) { - output << "one\ntwo"; - })); - shell.command("answer", "No argument", terminal::adaptHandler([] { - return 42; - })); - shell.command("fail", "Throw", terminal::adaptHandler([](CommandArgs) -> string { - throw runtime_error("command failed"); - })); - } - SampleShell(const SampleShell&) = delete; - SampleShell& operator=(const SampleShell&) = delete; -}; - -} // namespace - -SCENARIO("Terminal lines are split into words") { - GIVEN("lines with whitespace, quotes and escapes") { - auto [line, words] = GENERATE(table>({ - { " greet \t Ada ", {"greet", "Ada"}}, // whitespace runs separate words - { "", {}}, // an empty line has no word - { " ", {}}, // nor has a blank one - {R"(say "hello world" 'a b')", {"say", "hello world", "a b"}}, - { R"(x "" y)", {"x", "", "y"}}, // empty quotes give an empty word - { R"(pre"fix"post)", {"prefixpost"}}, // quotes join adjacent text - { R"(a\ b)", {"a b"}}, // a backslash escapes outside quotes, - { R"("say \"hi\"")", {R"(say "hi")"}}, // inside double quotes, - { R"('a\b')", {R"(a\b)"}}, // but not inside single quotes - })); - THEN("the line '" + line + "' is split as expected") { - REQUIRE(terminal::tokenize(line) == words); - } - } - GIVEN("malformed lines") { - auto line = GENERATE(string{R"(say "hello)"}, string{"say 'hello"}, string{R"(say \)"}, string{R"("a\)"}); - THEN("an unterminated quote or a trailing backslash is rejected: " + line) { - REQUIRE_THROWS_AS(terminal::tokenize(line), invalid_argument); - } - } -} - -SCENARIO("The terminal shell runs commands of every accepted handler shape") { - GIVEN("a shell with sample commands") { - SampleShell sample; - auto& shell = sample.shell; - - THEN("a returning command's result is its output") { - REQUIRE(shell.run("greet Ada") == "Hello, Ada!"); - REQUIRE(shell.run("greet") == "Hello, world!"); - REQUIRE(shell.run("answer ignored") == "42"); - } - THEN("the command receives its arguments without its name") { - REQUIRE(shell.run("record 'a b' c").empty()); - REQUIRE(sample.received == vector{"a b", "c"}); - } - THEN("written line breaks become terminal line breaks") { - REQUIRE(shell.run("lines") == "one\r\ntwo"); - } - THEN("an empty line produces no output") { - REQUIRE(shell.run("").empty()); - REQUIRE(shell.run(" ").empty()); - } - } -} - -SCENARIO("The terminal shell reports failing lines") { - GIVEN("a shell with sample commands") { - SampleShell sample; - auto& shell = sample.shell; - - THEN("an unknown command or a malformed line produces an error message, not an exception") { - const auto unknown = shell.run("nope"); - REQUIRE(contains(unknown, "Unknown command 'nope'")); - REQUIRE(unknown.starts_with("\x1b[31m")); - REQUIRE(contains(shell.run(R"(greet "Ada)"), "Unterminated quote")); - } - THEN("a command's exception propagates, so the JavaScript Promise rejects") { - REQUIRE_THROWS_AS(shell.run("fail"), runtime_error); - } - } -} - -SCENARIO("The terminal shell completes and documents its commands") { - GIVEN("a shell with sample commands") { - SampleShell sample; - auto& shell = sample.shell; - - THEN("command names complete by prefix, in order") { - REQUIRE(shell.complete("") == "answer\nfail\ngreet\nlines\nrecord"); - REQUIRE(shell.complete("gr") == "greet"); - REQUIRE(shell.complete("zz").empty()); - } - THEN("arguments are not completed") { - REQUIRE(shell.complete("greet A").empty()); - } - THEN("help lists every command with its aligned description") { - REQUIRE(shell.help() - == "answer No argument\n" - "fail Throw\n" - "greet Greet someone\n" - "lines Write two lines\n" - "record Record its arguments"); - } - } -} - -SCENARIO("The terminal shell rejects invalid registrations") { - GIVEN("a shell with sample commands") { - SampleShell sample; - auto& shell = sample.shell; - - THEN("a duplicate or malformed name is rejected") { - auto name = GENERATE(string{"greet"}, string{""}, string{"two words"}, string{"quo'te"}); - REQUIRE_THROWS_AS(shell.command(name, "rejected", terminal::adaptHandler([] {})), invalid_argument); - } - THEN("a command without a handler is rejected") { - REQUIRE_THROWS_AS(shell.command("ok", "no handler", terminal::Shell::Handler{}), invalid_argument); - REQUIRE(shell.complete("ok").empty()); - } - } -} - -SCENARIO("Terminal output is capped below the bridge's string limit") { - GIVEN("a command writing more than the limit, ending in multi-byte characters") { - terminal::Shell shell; - shell.command("flood", "Too much output", terminal::adaptHandler([] { - string text(terminal::maxOutputBytes - 1, 'x'); - for (int index = 0; index < 10; ++index) - text += "\xc3\xa9"; // U+00E9, two bytes - return text; - })); - - WHEN("it runs") { - const auto output = shell.run("flood"); - THEN("the output fits a 16-bit length and ends with a notice") { - REQUIRE(output.size() < 65536); - REQUIRE(output.ends_with("[output truncated]\x1b[0m")); - } - THEN("it is cut before the first character that would not fit whole") { - REQUIRE(output.substr(0, terminal::maxOutputBytes - 1) == string(terminal::maxOutputBytes - 1, 'x')); - REQUIRE(output[terminal::maxOutputBytes - 1] == '\r'); - } - } - } -} - -SCENARIO("Terminal error messages are capped below the bridge's string limit") { - GIVEN("a shell and an unknown command name as long as the largest bridge string") { - terminal::Shell shell; - const string name(65535, 'x'); - - WHEN("it runs") { - const auto output = shell.run(name); - THEN("the diagnostic fits a 16-bit length and is marked as truncated") { - REQUIRE(output.size() < 65536); - REQUIRE(contains(output, "[output truncated]")); - } - THEN("the diagnostic keeps its colors") { - REQUIRE(output.starts_with("\x1b[31mUnknown command 'xxx")); - REQUIRE(output.ends_with("\x1b[0m")); - } - } - } -} - -SCENARIO("Terminal registers its bridge functions and built-in commands on the application") { - GIVEN("a terminal on an application") { - RecordingApp app; - auto terminal = make_unique>(app, TerminalOptions{.prompt = "demo> ", .banner = "Welcome"}); - terminal->command("greet", "Greet someone", [](CommandArgs args) { - return "Hello, " + args[0] + "!"; - }); - - THEN("the page reads the configured prompt and banner") { - REQUIRE(app.nullary.at("webfront.terminal.prompt")() == "demo> "); - REQUIRE(app.nullary.at("webfront.terminal.banner")() == "Welcome"); - } - THEN("lines run registered commands and complete their names") { - REQUIRE(app.run("greet Ada") == "Hello, Ada!"); - REQUIRE(app.complete("g") == "greet"); - } - THEN("help and clear are built in") { - REQUIRE(contains(app.run("help"), "greet Greet someone")); - REQUIRE(contains(app.run("help"), "clear ")); - REQUIRE(app.run("clear") == Terminal::clearScreen); - } - THEN("a duplicate command is rejected") { - REQUIRE_THROWS_AS(terminal->command("help", "again", [] {}), invalid_argument); - } - THEN("the page lists no extension module by default") { - REQUIRE(app.nullary.at("webfront.terminal.extensions")().empty()); - } - WHEN("extension modules are added, one of them twice") { - terminal->extension("/a.mjs").extension("/b/c.mjs").extension("/a.mjs"); - THEN("the page lists each once, in order") { - REQUIRE(app.nullary.at("webfront.terminal.extensions")() == "/a.mjs\n/b/c.mjs"); - } - } - THEN("an empty or multi-line extension URL is rejected") { - auto url = GENERATE(string{}, string{"/a.mjs\n/b.mjs"}, string{"/a.mjs\r"}); - REQUIRE_THROWS_AS(terminal->extension(url), invalid_argument); - REQUIRE(app.nullary.at("webfront.terminal.extensions")().empty()); - } - WHEN("the Terminal object is destroyed") { - terminal.reset(); - THEN("the registered functions still own the commands") { - REQUIRE(app.run("greet Ada") == "Hello, Ada!"); - REQUIRE(contains(app.run("help"), "greet")); - } - } - } -} diff --git a/test/unit/ToolManagerTests.cpp b/test/unit/ToolManagerTests.cpp deleted file mode 100644 index bb5248e9..00000000 --- a/test/unit/ToolManagerTests.cpp +++ /dev/null @@ -1,306 +0,0 @@ -#include "TemporaryDirectory.hpp" -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace webfront; -using webfront::test::TemporaryDirectory; - -namespace { - -// The project directory of the tools, chosen by each test. -struct TestProject { - static inline filesystem::path directory; - static filesystem::path get() { - return directory; - } -}; - -using TestPackageFS = fs::BasicPackageFS; - -// Records the functions registered on it, like BasicWF::cppFunction, and calls them directly. -struct RecordingApp { - map functions; - - template - void cppFunction(string name, auto&& function) { - functions.try_emplace(std::move(name), std::function(std::forward(function))); - } - - template - R call(const string& name, Args... args) { - return any_cast&>(functions.at(name))(std::move(args)...); - } - - string run(const string& line) { - return call("webfront.terminal.run", line); - } -}; - -vector bytes(string_view text) { - return {text.begin(), text.end()}; -} - -optional served(TestPackageFS& packages, const filesystem::path& path) { - auto file = packages.open(path); - if (!file) - return nullopt; - string content; - array buffer{}; - while (!file->eof()) - content.append(buffer.data(), file->read(buffer)); - return content; -} - -bool contains(const string& text, const string& part) { - return text.find(part) != string::npos; -} - -} // namespace - -SCENARIO("The tool manager installs tools through its bridge functions") { - GIVEN("a terminal with a tool manager on an application") { - TemporaryDirectory project; - TestProject::directory = project.path(); - RecordingApp app; - Terminal terminal{app}; - auto manager = make_unique>(app, terminal); - REQUIRE(manager->store().projectDir() == project.path()); - - WHEN("the page installs a tool in two chunks") { - app.call("webfront.pkg.begin", "@acme/plot", "1.2.0"); - app.call>("webfront.pkg.writeFile", - "@acme/plot", - "1.2.0", - "dist/index.html", - 0, - bytes("

pl")); - app.call>("webfront.pkg.writeFile", - "@acme/plot", - "1.2.0", - "dist/index.html", - 5, - bytes("ot

")); - app.call("webfront.pkg.commit", "@acme/plot", "1.2.0", "sha512-abc", "dist/index.html", "Live plot"); - - THEN("the page lists it with the URL of its entry") { - REQUIRE(app.call("webfront.pkg.list", 0) == "@acme/plot\t1.2.0\t/webfront/tools/@acme/plot/dist/index.html\tLive plot\n"); - } - THEN("wf list shows it") { - REQUIRE(app.run("wf list") == "@acme/plot@1.2.0 Live plot"); - } - THEN("PackageFS serves its files") { - TestPackageFS packages{"ignored"}; - REQUIRE(served(packages, "webfront/tools/@acme/plot/dist/index.html") == "

plot

"); - REQUIRE(served(packages, "/webfront/tools/@acme/plot/dist/index.html") == "

plot

"); - } - AND_WHEN("wf remove uninstalls it") { - REQUIRE(app.run("wf remove @acme/plot") == "Removed @acme/plot."); - THEN("it is no longer listed nor served") { - REQUIRE(app.run("wf list") == "No tool installed."); - REQUIRE(app.call("webfront.pkg.list", 0).empty()); - TestPackageFS packages{"ignored"}; - REQUIRE_FALSE(served(packages, "webfront/tools/@acme/plot/dist/index.html")); - } - } - AND_WHEN("the ToolManager object is destroyed") { - manager.reset(); - THEN("the registered functions still own the store") { - REQUIRE(contains(app.run("wf list"), "@acme/plot@1.2.0")); - } - } - } - } -} - -SCENARIO("Installed tools are listed with URLs the HTTP server resolves") { - GIVEN("a terminal with a tool manager on an application") { - TemporaryDirectory project; - TestProject::directory = project.path(); - RecordingApp app; - Terminal terminal{app}; - ToolManager manager{app, terminal}; - - WHEN("a tool whose entry needs escaping in a URL is installed") { - const string entry = "dist/a+b c%41\xc3\xa9#[].html"; - app.call("webfront.pkg.begin", "logs", "1.0.0"); - app.call>("webfront.pkg.writeFile", "logs", "1.0.0", entry, 0, bytes("

logs

")); - app.call("webfront.pkg.commit", "logs", "1.0.0", "", entry, "Logs"); - THEN("its listed URL is absolute, encoded, and leads the server to the file") { - const auto list = app.call("webfront.pkg.list", 0); - const auto url = list.substr(list.find("logs\t1.0.0\t") + 11); - REQUIRE(url.starts_with("/webfront/tools/logs/dist/a%2Bb%20c%2541%C3%A9%23%5B%5D.html\t")); - TestPackageFS packages{"ignored"}; - REQUIRE(served(packages, uri::decode(url.substr(0, url.find('\t')))) == "

logs

"); - http::RequestHandler handler{"."}; - http::Request request; - request.method = http::Request::Method::Get; - request.uri = url.substr(0, url.find('\t')); - REQUIRE(handler.handleRequest(request).statusCode == http::Response::ok); - } - } - } -} - -SCENARIO("The tool manager rejects malformed calls and commands") { - GIVEN("a terminal with a tool manager on an application") { - TemporaryDirectory project; - TestProject::directory = project.path(); - RecordingApp app; - Terminal terminal{app}; - ToolManager manager{app, terminal}; - - THEN("a negative, fractional or too large offset is rejected") { - app.call("webfront.pkg.begin", "plot", "1.0.0"); - for (const double offset : {-1.0, 0.5, 1e300, numeric_limits::infinity(), numeric_limits::quiet_NaN()}) - REQUIRE_THROWS_AS( - (app.call>("webfront.pkg.writeFile", "plot", "1.0.0", "a.js", offset, bytes("x"))), - invalid_argument); - } - THEN("wf documents itself and rejects malformed commands") { - REQUIRE(contains(app.run("help"), "Manage web tools: wf search | install | list | open | remove")); - for (const auto* command : {"wf search [term]", "wf install [@version]", "wf list", "wf open ", "wf remove "}) - REQUIRE(contains(app.run("wf"), command)); - REQUIRE(app.run("wf help") == app.run("wf")); - REQUIRE_THROWS_AS(app.run("wf frobnicate"), invalid_argument); - REQUIRE_THROWS_AS(app.run("wf remove"), invalid_argument); - REQUIRE_THROWS_AS(app.run("wf remove a b"), invalid_argument); - REQUIRE_THROWS_AS(app.run("wf list all"), invalid_argument); - REQUIRE_THROWS_AS(app.run("wf remove plot"), invalid_argument); - REQUIRE_THROWS_AS(app.run("wf remove ../x"), invalid_argument); - } - THEN("the commands of the page explain that it did not load its module when they reach C++") { - for (const auto* line : {"wf search", "wf install plot", "wf open plot"}) - REQUIRE_THROWS_WITH(app.run(line), Catch::Matchers::ContainsSubstring("webfront/components/tools/wf.mjs")); - } - THEN("the terminal page loads the browser module and reads the default registry") { - REQUIRE(app.call("webfront.terminal.extensions") == "/webfront/components/tools/wf.mjs"); - REQUIRE(app.call("webfront.pkg.registry") == "https://registry.npmjs.org/"); - } - } -} - -SCENARIO("The registry of the tool manager is configurable") { - GIVEN("a tool manager with a local registry") { - TemporaryDirectory project; - TestProject::directory = project.path(); - RecordingApp app; - Terminal terminal{app}; - ToolManager manager{app, terminal, {.registry = "/registry/"}}; - THEN("the page reads it") { - REQUIRE(app.call("webfront.pkg.registry") == "/registry/"); - } - } -} - -SCENARIO("The tool list is paged below the bridge's string limit") { - GIVEN("more tools with long titles than one bridge string can carry") { - TemporaryDirectory project; - TestProject::directory = project.path(); - RecordingApp app; - Terminal terminal{app}; - ToolManager manager{app, terminal}; - constexpr size_t toolCount = 70; - for (size_t index = 0; index < toolCount; ++index) { - const auto name = "tool" + to_string(index); - manager.store().begin(name, "1.0.0"); - manager.store().write(name, "1.0.0", {.path = "index.html", .offset = 0, .bytes = bytes("x")}); - manager.store().commit({.name = name, .version = "1.0.0", .entry = "index.html", .title = string(1024, 't')}); - } - - WHEN("the page reads the list from index 0 until an empty page") { - vector lines; - size_t pages = 0; - for (string page = app.call("webfront.pkg.list", 0); !page.empty(); - page = app.call("webfront.pkg.list", static_cast(lines.size()))) { - REQUIRE(page.size() <= tools::detail::maxListBytes); - REQUIRE(page.ends_with('\n')); - for (size_t start = 0, end = page.find('\n'); end != string::npos; start = end + 1, end = page.find('\n', start)) - lines.push_back(page.substr(0, page.find('\t', start)).substr(start)); - ++pages; - } - THEN("every tool is listed once, over several pages") { - REQUIRE(pages > 1); - REQUIRE(lines.size() == toolCount); - REQUIRE(set(lines.begin(), lines.end()).size() == toolCount); - } - } - THEN("an index past the end gives an empty page and an invalid index is rejected") { - REQUIRE(app.call("webfront.pkg.list", toolCount).empty()); - REQUIRE_THROWS_AS((app.call("webfront.pkg.list", -1)), invalid_argument); - } - } -} - -SCENARIO("PackageFS serves only the files of installed tools") { - GIVEN("a project with one installed tool and a file outside it") { - TemporaryDirectory project; - TestProject::directory = project.path(); - fs::ToolStore store{project.path()}; - store.begin("plot", "1.0.0"); - store.write("plot", "1.0.0", {.path = "index.html", .offset = 0, .bytes = bytes("

plot

")}); - store.write("plot", "1.0.0", {.path = "assets/app.js", .offset = 0, .bytes = bytes("go()")}); - store.commit({.name = "plot", .version = "1.0.0", .entry = "index.html"}); - ofstream(project.path() / "secret.txt") << "secret"; - TestPackageFS packages{"ignored"}; - - THEN("files of the installed version are served, also in subdirectories") { - REQUIRE(served(packages, "webfront/tools/plot/index.html") == "

plot

"); - REQUIRE(served(packages, "webfront/tools/plot/assets/app.js") == "go()"); - } - THEN("missing files, directories, unknown tools and other prefixes are not served") { - REQUIRE_FALSE(served(packages, "webfront/tools/plot/missing.js")); - REQUIRE_FALSE(served(packages, "webfront/tools/plot/assets")); - REQUIRE_FALSE(served(packages, "webfront/tools/other/index.html")); - REQUIRE_FALSE(served(packages, "webfront/tools/plot")); - REQUIRE_FALSE(served(packages, "webfront/tools/@scope")); - REQUIRE_FALSE(served(packages, "tools/plot/index.html")); - } - THEN("paths escaping the tool are not served") { - REQUIRE_FALSE(served(packages, "webfront/tools/plot/../../../secret.txt")); - REQUIRE_FALSE(served(packages, "webfront/tools/plot/./index.html")); - REQUIRE_FALSE(served(packages, "webfront/tools/../../secret.txt")); - } - WHEN("the lock file becomes malformed") { - ofstream(project.path() / "webfront-tools.lock.json") << "{"; - THEN("nothing is served") { - REQUIRE_FALSE(served(packages, "webfront/tools/plot/index.html")); - } - } - } -} - -SCENARIO("ToolsApp serves installed tools after the protected bridge script") { - GIVEN("the filesystem of ToolsApp") { - fs::DefaultFSWith files{""}; - THEN("the bridge script, the terminal, the tool manager module and the fallback page are served") { - REQUIRE(files.open("WebFront.js")); - REQUIRE(files.open(fs::TerminalFS::page)); - REQUIRE(files.open(fs::ToolManagerFS::module)); - REQUIRE_FALSE(files.open(string(fs::ToolManagerFS::prefix) + "other.mjs")); - REQUIRE(files.open("index.html")); - } - THEN("an unknown tool falls through to the next providers") { - REQUIRE_FALSE(files.open("webfront/tools/none/index.html")); - } - } -} diff --git a/test/unit/ToolStoreTests.cpp b/test/unit/ToolStoreTests.cpp deleted file mode 100644 index a4baf262..00000000 --- a/test/unit/ToolStoreTests.cpp +++ /dev/null @@ -1,532 +0,0 @@ -#include "TemporaryDirectory.hpp" -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace webfront; -using webfront::test::TemporaryDirectory; - -namespace { - -vector bytes(string_view text) { - return {text.begin(), text.end()}; -} - -string contentOf(const filesystem::path& file) { - ifstream stream(file, ios::binary); - ostringstream content; - content << stream.rdbuf(); - return content.str(); -} - -fs::ToolRecord plotRecord(string version = "1.2.0") { - return {.name = "@acme/plot", .version = std::move(version), .integrity = "sha512-abc", .entry = "dist/index.html", .title = "Live plot"}; -} - -void install(fs::ToolStore& store, const fs::ToolRecord& record, string_view page = "

plot

") { - store.begin(record.name, record.version); - store.write(record.name, record.version, {.path = record.entry, .offset = 0, .bytes = bytes(page)}); - store.commit(record); -} - -} // namespace - -SCENARIO("Package names, versions and paths from the browser are validated") { - GIVEN("valid npm names, versions and package paths") { - auto name = GENERATE("plot", "webfront-plot", "@acme/plot", "a.b_c~d"); - THEN("they are accepted") { - REQUIRE_NOTHROW(fs::tools::validatePackageName(name)); - REQUIRE_NOTHROW(fs::tools::validateVersion("1.2.0-beta.1+build.5")); - REQUIRE(fs::tools::safeRelativePath("dist/assets/app.js") == filesystem::path("dist") / "assets" / "app.js"); - } - } - GIVEN("names that could leave the tools directory or are not npm names") { - auto name = GENERATE("", - ".", - "..", - "../x", - "@acme", - "@acme/", - "@/plot", - "@acme/../x", - "@acme/a/b", - "Plot", - "_plot", - "a b", - "a\\b", - "a..b", - "@acme/a..b", - "@a..b/c"); - THEN("they are rejected") { - REQUIRE_THROWS_AS(fs::tools::validatePackageName(name), invalid_argument); - } - } - GIVEN("names and versions longer than npm accepts") { - THEN("they are rejected") { - REQUIRE_THROWS_AS(fs::tools::validatePackageName(string(215, 'a')), invalid_argument); - REQUIRE_THROWS_AS(fs::tools::validateVersion("1" + string(256, '0')), invalid_argument); - } - } - GIVEN("invalid versions") { - auto version = GENERATE("", "..", "v1.0.0", "1.0/0", "1.0 0", "1..0"); - THEN("they are rejected") { - REQUIRE_THROWS_AS(fs::tools::validateVersion(version), invalid_argument); - } - } - GIVEN("unsafe paths") { - auto path = GENERATE(as{}, - "", - "/etc/passwd", - "../x", - "a/../../x", - "a/./b", - "a//b", - "a/", - "..", - "C:/x", - "c:x", - "a\\..\\b", - "a?.js", - "a*.js", - "ab", - "a|b", - "a\"b", - "main..html", - "a/b..c/d", - string("a\0b", 3)); - THEN("they are rejected") { - REQUIRE_THROWS_AS(fs::tools::safeRelativePath(path), invalid_argument); - } - } -} - -SCENARIO("The lock file is read and written as JSON") { - GIVEN("two installed tools") { - fs::tools::LockedTools tools; - tools.emplace("@acme/plot", plotRecord()); - tools.emplace("logs", fs::ToolRecord{.name = "logs", .version = "0.1.0", .integrity = "", .entry = "index.html", .title = "Say \"hi\" \\o/"}); - - WHEN("they are formatted and parsed back") { - const auto json = fs::tools::formatLock(tools); - THEN("the same records are read, sorted by name") { - REQUIRE(json.starts_with("{\n \"lockfileVersion\": 1,\n \"tools\": {\n \"@acme/plot\": {")); - REQUIRE(fs::tools::parseLock(json) == tools); - } - } - } - GIVEN("no tool") { - THEN("an empty lock file round-trips") { - REQUIRE(fs::tools::parseLock(fs::tools::formatLock({})).empty()); - } - } - GIVEN("a lock file edited by hand, with unknown members and escapes") { - const auto json = R"({"other": [1, true, null, {"a": "b"}], "tools": {"plot": {"version": "1.0.0", "extra": 3, - "entry": "index.html", "title": "\u00e9\ud83d\ude00\/"}}})"; - THEN("the unknown members are skipped and the escapes decoded") { - const auto tools = fs::tools::parseLock(json); - REQUIRE(tools.at("plot").version == "1.0.0"); - REQUIRE(tools.at("plot").title == "\xc3\xa9\xf0\x9f\x98\x80/"); - } - } - GIVEN("empty arrays and objects among the unknown members") { - THEN("they are skipped") { - REQUIRE(fs::tools::parseLock(R"({"a": [], "b": {}, "c": [[]], "tools": {}})").empty()); - } - } - GIVEN("every escape of the JSON grammar") { - json::Reader reader{R"("\"\\\/\b\f\n\r\t\u20AC\u0041")"}; - THEN("each one is decoded") { - REQUIRE(reader.string() - == "\"\\/\b\f\n\r\t\xe2\x82\xac" - "A"); - } - } -} - -SCENARIO("The lock file reader is strict") { - GIVEN("malformed JSON") { - auto json = GENERATE("", - "{", - R"({"tools": {"plot": {"version": "1.0.0"}})", - R"({"tools": 1} x)", - R"({"tools": {"p": {"title": "\x"}}})", - R"({"tools": {"p": {"title": "\ud800"}}})", - R"({"tools": {"p": {"title": "\udc00"}}})", - R"({"tools": {"p": {"title": "\ud800\u0041"}}})", - R"({"tools": {"p": {"title": "\u12G4"}}})", - R"({"tools": {"p": {"title": "\u12"}}})", - R"({"other": [1, }})", - R"({"other": 1} x)", - R"({"other": "abc)", - R"({"tools": {"p": {"x": }}})", - R"({"tools": {}, "other": garbage})", - R"({"tools": {}, "lockfileVersion": 1e+})", - R"({"a": 01})", - R"({"a": -})", - R"({"a": 1.})", - R"({"a": .5})", - R"({"a": +1})", - R"({"a": 1e})", - R"({"a": tru})", - R"({"a": nulls})", - "{\"tools\": {\"p\": {\"title\": \"a\nb\"}}}"); - THEN("parsing throws") { - REQUIRE_THROWS(fs::tools::parseLock(json)); - } - } - GIVEN("numbers and literals of the JSON grammar among the unknown members") { - const auto json = R"({"a": -0.5e+10, "b": 1E5, "c": 0, "d": true, "e": false, "f": null, "g": 12.25, "h": -0, "i": 3e-2, "tools": {}})"; - THEN("they are skipped") { - REQUIRE(fs::tools::parseLock(json).empty()); - } - } - GIVEN("strings with control characters") { - THEN("quoting escapes them") { - REQUIRE(json::quote("a\nb\x01") == R"("a\u000ab\u0001")"); - } - } - GIVEN("a record pointing outside the tools directory or breaking the listing") { - auto json = GENERATE(R"({"tools": {"../x": {"version": "1.0.0", "entry": "index.html"}}})", - R"({"tools": {"plot": {"version": "../1", "entry": "index.html"}}})", - R"({"tools": {"plot": {"version": "1.0.0", "entry": "../../secret"}}})", - R"({"tools": {"plot": {"version": "1.0.0", "entry": "index.html", "title": "a\nb"}}})", - R"({"tools": {"plot": {"version": "1.0.0", "entry": "index.html", "integrity": "a\tb"}}})"); - THEN("parsing rejects it") { - REQUIRE_THROWS_AS(fs::tools::parseLock(json), invalid_argument); - } - } -} - -SCENARIO("A tool store installs tools in its project directory") { - GIVEN("an empty project") { - TemporaryDirectory project; - fs::ToolStore store{project.path()}; - REQUIRE(store.installed().empty()); - - WHEN("a tool is installed in several chunks") { - store.begin("@acme/plot", "1.2.0"); - store.write("@acme/plot", "1.2.0", {.path = "dist/index.html", .offset = 0, .bytes = bytes("

")}); - store.write("@acme/plot", "1.2.0", {.path = "dist/index.html", .offset = 3, .bytes = bytes("plot

")}); - store.write("@acme/plot", "1.2.0", {.path = "package.json", .offset = 0, .bytes = bytes("{}")}); - store.commit(plotRecord()); - - THEN("its files are in its version directory and the lock file records it") { - const auto directory = project.path() / ".webfront" / "tools" / "@acme" / "plot@1.2.0"; - REQUIRE(store.installDir("@acme/plot", "1.2.0") == directory); - REQUIRE(contentOf(directory / "dist" / "index.html") == "

plot

"); - REQUIRE(contentOf(directory / "package.json") == "{}"); - REQUIRE(store.find("@acme/plot") == plotRecord()); - REQUIRE(fs::ToolStore::readLock(project.path() / "webfront-tools.lock.json").size() == 1); - REQUIRE_FALSE(filesystem::exists(project.path() / "webfront-tools.lock.json.tmp")); - } - AND_WHEN("another version is installed") { - install(store, plotRecord("2.0.0"), "

v2

"); - THEN("it replaces the previous one") { - REQUIRE(store.find("@acme/plot")->version == "2.0.0"); - REQUIRE_FALSE(filesystem::exists(store.installDir("@acme/plot", "1.2.0"))); - REQUIRE(contentOf(store.installDir("@acme/plot", "2.0.0") / "dist" / "index.html") == "

v2

"); - } - } - AND_WHEN("the same version is installed again") { - install(store, plotRecord(), "

again

"); - THEN("its files are replaced") { - REQUIRE(contentOf(store.installDir("@acme/plot", "1.2.0") / "dist" / "index.html") == "

again

"); - } - } - AND_WHEN("it is removed") { - REQUIRE(store.remove("@acme/plot")); - THEN("its files and its lock entry are gone") { - REQUIRE_FALSE(filesystem::exists(store.installDir("@acme/plot", "1.2.0"))); - REQUIRE(store.installed().empty()); - REQUIRE_FALSE(store.remove("@acme/plot")); - } - } - } - } -} - -SCENARIO("A tool store rejects inconsistent installations") { - GIVEN("a project with an installation in progress") { - TemporaryDirectory project; - fs::ToolStore store{project.path()}; - store.begin("plot", "1.0.0"); - store.write("plot", "1.0.0", {.path = "index.html", .offset = 0, .bytes = bytes("abc")}); - - THEN("a chunk that does not follow the written bytes is rejected") { - REQUIRE_THROWS_AS(store.write("plot", "1.0.0", {.path = "index.html", .offset = 2, .bytes = bytes("x")}), invalid_argument); - REQUIRE_THROWS_AS(store.write("plot", "1.0.0", {.path = "missing.js", .offset = 1, .bytes = bytes("x")}), invalid_argument); - } - THEN("a file that cannot be written is reported") { - store.write("plot", "1.0.0", {.path = "dir/file.js", .offset = 0, .bytes = bytes("x")}); - REQUIRE_THROWS_AS(store.write("plot", "1.0.0", {.path = "dir", .offset = 0, .bytes = bytes("x")}), runtime_error); - } - THEN("an unsafe path is rejected") { - REQUIRE_THROWS_AS(store.write("plot", "1.0.0", {.path = "../escape.js", .offset = 0, .bytes = bytes("x")}), invalid_argument); - REQUIRE_FALSE(filesystem::exists(project.path() / ".webfront" / "tools" / ".staging" / "escape.js")); - } - THEN("writing or committing a version that was not begun is rejected") { - REQUIRE_THROWS_AS(store.write("plot", "2.0.0", {.path = "index.html", .offset = 0, .bytes = bytes("x")}), invalid_argument); - REQUIRE_THROWS_AS(store.commit({.name = "plot", .version = "2.0.0", .entry = "index.html"}), invalid_argument); - } - THEN("a lock file that cannot be written fails the commit") { - filesystem::create_directories(project.path() / "webfront-tools.lock.json.tmp"); - REQUIRE_THROWS_AS(store.commit({.name = "plot", .version = "1.0.0", .entry = "index.html"}), runtime_error); - } - THEN("a title or integrity longer than 1024 bytes is rejected") { - REQUIRE_THROWS_AS(store.commit({.name = "plot", .version = "1.0.0", .entry = "index.html", .title = string(1025, 't')}), invalid_argument); - REQUIRE_THROWS_AS(store.commit({.name = "plot", .version = "1.0.0", .integrity = string(1025, 'i'), .entry = "index.html"}), invalid_argument); - REQUIRE_NOTHROW(store.commit({.name = "plot", .version = "1.0.0", .entry = "index.html", .title = string(1024, 't')})); - } - THEN("a title or integrity with control characters is rejected") { - REQUIRE_THROWS_AS(store.commit({.name = "plot", .version = "1.0.0", .entry = "index.html", .title = "two\nlines"}), invalid_argument); - REQUIRE_THROWS_AS(store.commit({.name = "plot", .version = "1.0.0", .integrity = "a\tb", .entry = "index.html"}), invalid_argument); - REQUIRE(store.installed().empty()); - } - THEN("a commit whose entry page was not written is rejected") { - REQUIRE_THROWS_AS(store.commit({.name = "plot", .version = "1.0.0", .entry = "missing.html"}), invalid_argument); - REQUIRE(store.installed().empty()); - } - WHEN("the installation is committed") { - store.commit({.name = "plot", .version = "1.0.0", .entry = "index.html"}); - THEN("it cannot be committed or written again without a new begin") { - REQUIRE_THROWS_AS(store.commit({.name = "plot", .version = "1.0.0", .entry = "index.html"}), invalid_argument); - REQUIRE_THROWS_AS(store.write("plot", "1.0.0", {.path = "index.html", .offset = 0, .bytes = bytes("x")}), invalid_argument); - } - } - } -} - -SCENARIO("A tool store refuses lock files it cannot read") { - GIVEN("a lock file that exists but cannot be read") { - TemporaryDirectory project; - const auto lockFile = project.path() / "webfront-tools.lock.json"; - filesystem::create_directory(lockFile); - fs::ToolStore store{project.path()}; - THEN("reading the installed tools fails instead of reporting none") { - REQUIRE_THROWS_AS(store.installed(), runtime_error); - } - THEN("an installation fails without replacing the lock file") { - store.begin("plot", "1.0.0"); - store.write("plot", "1.0.0", {.path = "index.html", .offset = 0, .bytes = bytes("x")}); - REQUIRE_THROWS_AS(store.commit({.name = "plot", .version = "1.0.0", .entry = "index.html"}), runtime_error); - REQUIRE(filesystem::is_directory(lockFile)); - } - } - -#ifndef _WIN32 - GIVEN("a lock file without read permission") { - TemporaryDirectory project; - const auto lockFile = project.path() / "webfront-tools.lock.json"; - ofstream(lockFile) << R"({"tools": {"logs": {"version": "1.0.0", "entry": "index.html"}}})"; - filesystem::permissions(lockFile, filesystem::perms::none); - const bool readable = ifstream(lockFile).is_open(); // e.g. when the tests run as root - fs::ToolStore store{project.path()}; - THEN("an installation fails instead of dropping the recorded tools") { - store.begin("plot", "1.0.0"); - store.write("plot", "1.0.0", {.path = "index.html", .offset = 0, .bytes = bytes("x")}); - if (!readable) - REQUIRE_THROWS_AS(store.commit({.name = "plot", .version = "1.0.0", .entry = "index.html"}), runtime_error); - filesystem::permissions(lockFile, filesystem::perms::owner_read | filesystem::perms::owner_write); - REQUIRE(store.find("logs")); - } - } -#endif - GIVEN("a malformed lock file") { - TemporaryDirectory project; - ofstream(project.path() / "webfront-tools.lock.json") << "{ not json"; - fs::ToolStore store{project.path()}; - THEN("reading the installed tools reports it") { - REQUIRE_THROWS_AS(store.installed(), runtime_error); - } - } -} - -SCENARIO("A tool store keeps the installed version when a replacement does not complete") { - GIVEN("a project with an installed tool") { - TemporaryDirectory project; - fs::ToolStore store{project.path()}; - install(store, plotRecord()); - - WHEN("a version differing only by case is installed, as on a case-insensitive volume") { - install(store, plotRecord("1.2.0-alpha"), "

alpha

"); - install(store, plotRecord("1.2.0-Alpha"), "

Alpha

"); - THEN("the cleanup of the replaced version keeps the new files") { - REQUIRE(store.find("@acme/plot")->version == "1.2.0-Alpha"); - REQUIRE(contentOf(store.installDir("@acme/plot", "1.2.0-Alpha") / "dist" / "index.html") == "

Alpha

"); - } - } - WHEN("installing a version fails when the lock file is written") { - filesystem::create_directories(project.path() / "webfront-tools.lock.json.tmp"); - const auto failingInstall = [&](string version) { - REQUIRE_THROWS_AS(install(store, plotRecord(std::move(version)), "

failed

"), runtime_error); - }; - failingInstall("1.2.0"); - failingInstall("2.0.0"); - THEN("the installed version and its files are intact, and no other version is left") { - REQUIRE(store.find("@acme/plot") == plotRecord()); - REQUIRE(contentOf(store.installDir("@acme/plot", "1.2.0") / "dist" / "index.html") == "

plot

"); - REQUIRE_FALSE(filesystem::exists(store.installDir("@acme/plot", "2.0.0"))); - } - } - WHEN("a new installation is abandoned") { - store.begin("@acme/plot", "3.0.0"); - store.write("@acme/plot", "3.0.0", {.path = "dist/index.html", .offset = 0, .bytes = bytes("

v3

")}); - THEN("the installed version is untouched") { - REQUIRE(store.find("@acme/plot")->version == "1.2.0"); - REQUIRE(contentOf(store.installDir("@acme/plot", "1.2.0") / "dist" / "index.html") == "

plot

"); - } - } - } -} - -SCENARIO("Installations of versions differing only by case do not share their staged files") { - GIVEN("a project") { - TemporaryDirectory project; - fs::ToolStore store{project.path()}; - const auto stage = [&store](const fs::ToolRecord& record, string_view page) { - store.begin(record.name, record.version); - store.write(record.name, record.version, {.path = record.entry, .offset = 0, .bytes = bytes(page)}); - }; - - WHEN("the installations of 1.2.0-alpha and 1.2.0-Alpha are interleaved") { - stage(plotRecord("1.2.0-alpha"), "

alpha

"); - stage(plotRecord("1.2.0-Alpha"), "

Alpha

"); - THEN("each commit installs the files written for its own version") { - store.commit(plotRecord("1.2.0-alpha")); - REQUIRE(store.find("@acme/plot")->version == "1.2.0-alpha"); - REQUIRE(contentOf(store.installDir("@acme/plot", "1.2.0-alpha") / "dist" / "index.html") == "

alpha

"); - store.commit(plotRecord("1.2.0-Alpha")); - REQUIRE(store.find("@acme/plot")->version == "1.2.0-Alpha"); - REQUIRE(contentOf(store.installDir("@acme/plot", "1.2.0-Alpha") / "dist" / "index.html") == "

Alpha

"); - } - } - WHEN("an installation is restarted while another case variant is staged") { - stage(plotRecord("1.2.0-alpha"), "

alpha

"); - stage(plotRecord("1.2.0-Alpha"), "

Alpha

"); - store.begin("@acme/plot", "1.2.0-Alpha"); - THEN("only the restarted installation loses its staged files") { - REQUIRE_THROWS_AS(store.commit(plotRecord("1.2.0-Alpha")), invalid_argument); - store.commit(plotRecord("1.2.0-alpha")); - REQUIRE(contentOf(store.installDir("@acme/plot", "1.2.0-alpha") / "dist" / "index.html") == "

alpha

"); - } - } - } -} - -SCENARIO("Stores of the same project share their transactions") { - GIVEN("two stores of one project") { - TemporaryDirectory project; - fs::ToolStore first{project.path()}; - fs::ToolStore second{project.path() / "."}; - - THEN("an installation begun in one can be completed in the other") { - first.begin("plot", "1.0.0"); - second.write("plot", "1.0.0", {.path = "index.html", .offset = 0, .bytes = bytes("x")}); - second.commit({.name = "plot", .version = "1.0.0", .entry = "index.html"}); - REQUIRE(first.find("plot")); - } - WHEN("both install tools at the same time") { - constexpr int toolsPerStore = 25; - atomic failures{0}; - const auto installMany = [&failures](fs::ToolStore& store, const string& prefix) { - for (int index = 0; index < toolsPerStore; ++index) { - try { - install(store, {.name = prefix + to_string(index), .version = "1.0.0", .entry = "index.html"}); - } catch (const exception&) { - ++failures; - } - } - }; - { - jthread a{installMany, ref(first), "a"}; - jthread b{installMany, ref(second), "b"}; - } - THEN("every installation succeeds and is recorded with its files") { - REQUIRE(failures == 0); - const auto installed = first.installed(); - REQUIRE(installed.size() == 2 * toolsPerStore); - for (const auto& [name, record] : installed) - REQUIRE(filesystem::is_regular_file(first.installDir(name, record.version) / "index.html")); - } - } - } -} - -#ifndef _WIN32 -namespace { - -// Makes a directory read-only (its entries cannot be deleted) until destroyed. -class ReadOnlyDirectory { -public: - explicit ReadOnlyDirectory(filesystem::path path) : directory(std::move(path)) { - filesystem::permissions(directory, filesystem::perms::owner_read | filesystem::perms::owner_exec); - } - ReadOnlyDirectory(const ReadOnlyDirectory&) = delete; - ReadOnlyDirectory& operator=(const ReadOnlyDirectory&) = delete; - ~ReadOnlyDirectory() { - error_code ignored; - filesystem::permissions(directory, filesystem::perms::owner_all, ignored); - } - -private: - filesystem::path directory; -}; - -} // namespace - -SCENARIO("Directories that cannot be deleted do not fail completed operations") { - GIVEN("an installed version whose files cannot be deleted") { - TemporaryDirectory project; - fs::ToolStore store{project.path()}; - install(store, {.name = "plot", .version = "1.0.0", .entry = "index.html"}); - const auto installed = store.installDir("plot", "1.0.0"); - const auto backup = project.path() / ".webfront" / "tools" / "plot@1.0.0~backup"; - - WHEN("another version replaces it") { - const ReadOnlyDirectory readOnly{installed}; - REQUIRE_NOTHROW(install(store, {.name = "plot", .version = "2.0.0", .entry = "index.html"})); - THEN("the new version is installed") { - REQUIRE(store.find("plot")->version == "2.0.0"); - } - } - WHEN("the same version is reinstalled") { - const ReadOnlyDirectory readOnly{installed}; - REQUIRE_NOTHROW(install(store, {.name = "plot", .version = "1.0.0", .entry = "index.html"}, "

again

")); - THEN("the new files are installed") { - REQUIRE(contentOf(installed / "index.html") == "

again

"); - } - AND_WHEN("it is reinstalled again while the backup is still left behind") { - REQUIRE_NOTHROW(install(store, {.name = "plot", .version = "1.0.0", .entry = "index.html"}, "

third

")); - THEN("the newest files are installed") { - REQUIRE(contentOf(installed / "index.html") == "

third

"); - } - } - // The read-only directory was moved to the backup, which could not be deleted. - error_code ignored; - filesystem::permissions(backup, filesystem::perms::owner_all, ignored); - } - WHEN("it is removed") { - const ReadOnlyDirectory readOnly{installed}; - THEN("the removal succeeds") { - REQUIRE(store.remove("plot")); - REQUIRE(store.installed().empty()); - } - } - } -} -#endif diff --git a/test/web/JasmineTest.cpp b/test/web/JasmineTest.cpp index 836f3bb6..300b3f5d 100644 --- a/test/web/JasmineTest.cpp +++ b/test/web/JasmineTest.cpp @@ -1,14 +1,9 @@ -#include -#include #include #include #include #include #include -#include #include -#include -#include #include #include #include @@ -56,42 +51,6 @@ struct TestState { atomic passed{false}; }; -/// Project directory of the tools installed by test/web/js/tools-specs.mjs: a fresh temporary -/// directory, removed by main(), so the test never writes into the source tree. -struct TestToolsProject { - static filesystem::path get() { - static const filesystem::path directory = [] { - const auto unique = to_string(chrono::system_clock::now().time_since_epoch().count()); - auto path = filesystem::temp_directory_path() / ("webfront-webtest-tools-" + unique); - filesystem::create_directories(path); - return path; - }(); - return directory; - } -}; - -/// Search endpoint of the fake npm registry used by test/web/js/tools-specs.mjs; its packuments and -/// tarball are plain files under test/web/registry/ (see make_fixture.py), served by NativeDebugFS. -/// The server drops the query string before looking up files, so tools-specs.mjs checks the query -/// wf.mjs sends. -class FakeRegistrySearchFS { -public: - explicit FakeRegistrySearchFS(filesystem::path docRoot) : root(std::move(docRoot)) {} - - optional open(filesystem::path file) const { - const auto request = file.relative_path().generic_string(); - if (request != "registry/-/v1/search") - return {}; - ifstream stream(root / "registry" / "search.json", ios::binary); - if (!stream.is_open()) - return {}; - return fs::File{std::move(stream)}; - } - -private: - filesystem::path root; -}; - // Serve the actual example page so the React regression exercises the shipped UI. class ReactDemoFS { public: @@ -132,15 +91,11 @@ class EncodedRunnerFS { using TestFS = fs::Multi>; + fs::BabelFS>; // CMake chooses an embedded frontend; the same specs run under CEF/Xvfb and Windows WebView2. #ifndef WEBFRONT_TEST_FRONTEND #define WEBFRONT_TEST_FRONTEND webfront::frontend::CEFFrontend @@ -152,7 +107,6 @@ class BrowserIntegrationTest { explicit BrowserIntegrationTest(const filesystem::path& docRoot) : webFront("9002", docRoot) { registerCallbacks(); registerBitsetCallbacks(); - registerTerminalCommands(); } ~BrowserIntegrationTest() { @@ -402,19 +356,6 @@ class BrowserIntegrationTest { }); } - /// Commands driven by test/web/js/terminal-specs.mjs, and the tool manager driven by - /// test/web/js/tools-specs.mjs against the fake registry under test/web/registry/. - void registerTerminalCommands() { - Terminal terminal{webFront, {.prompt = "test> ", .banner = "webtest terminal"}}; - terminal.command("greet", "Greet someone", [](CommandArgs args) { - return "Hello, " + (args.empty() ? string{"world"} : args[0]) + "!"; - }); - terminal.command("fail", "Throw from C++", [](CommandArgs) -> string { - throw runtime_error("terminal command failed"); - }); - ToolManager tools{webFront, terminal, {.registry = "/registry/"}}; - } - /// The JS side echoes back the very arrays browserReady() sent it, so the cpp* members double as the /// expected values and there is a single place to edit when the fixtures change. template @@ -526,8 +467,6 @@ int main() { log::error("Browser integration test failed: {}", error.what()); cerr << error.what() << '\n'; } - error_code ignored; - filesystem::remove_all(TestToolsProject::get(), ignored); log::removeSinks(consoleSink); return result; } diff --git a/test/web/SpecRunner.html b/test/web/SpecRunner.html index e81a77fc..7cd93fc6 100644 --- a/test/web/SpecRunner.html +++ b/test/web/SpecRunner.html @@ -6,7 +6,6 @@ WebFront automated browser tests - diff --git a/test/web/js/terminal-specs.mjs b/test/web/js/terminal-specs.mjs deleted file mode 100644 index 99db7cc4..00000000 --- a/test/web/js/terminal-specs.mjs +++ /dev/null @@ -1,162 +0,0 @@ -// Drives the embedded terminal component (served by fs::TerminalFS) against the commands that -// test/web/JasmineTest.cpp registers through webfront::Terminal. Trailing spaces are trimmed when -// reading the screen, so a prompt line reads 'test>'. -import { mount, runLine, tokenize } from '/webfront/components/terminal/terminal.mjs'; - -describe('WebFront terminal component', () => { - let mounted; - let element; - - beforeAll(async () => { - element = document.createElement('div'); - element.style.width = '640px'; - element.style.height = '240px'; - document.body.appendChild(element); - mounted = await mount(element); - }); - - afterAll(() => { - mounted.terminal.dispose(); - element.remove(); - }); - - it('loads the compressed xterm CSS and Fit addon locally and resizes the terminal', async () => { - const initialColumns = mounted.terminal.cols; - expect(initialColumns).toBeGreaterThan(20); - element.style.width = '960px'; - try { - const deadline = Date.now() + 3000; - while (mounted.terminal.cols <= initialColumns && Date.now() < deadline) - await new Promise(resolve => setTimeout(resolve, 20)); - expect(mounted.terminal.cols).toBeGreaterThan(initialColumns); - const style = getComputedStyle(element.querySelector('.xterm')); - expect(style.position).toBe('relative'); - const resources = performance.getEntriesByType('resource') - .filter(entry => entry.name.includes('/webfront/components/terminal/')); - for (const name of ['xterm.mjs', 'xterm.css', 'addon-fit.mjs']) - expect(resources.some(entry => entry.name.endsWith('/' + name))).toBeTrue(); - expect(resources.every(entry => new URL(entry.name).origin === location.origin)).toBeTrue(); - } finally { - element.style.width = '640px'; - const deadline = Date.now() + 3000; - while (mounted.terminal.cols !== initialColumns && Date.now() < deadline) - await new Promise(resolve => setTimeout(resolve, 20)); - } - }); - - function screen() { - const buffer = mounted.terminal.buffer.active; - const lines = []; - for (let index = 0; index < buffer.length; ++index) - lines.push(buffer.getLine(index).translateToString(true)); - return lines.join('\n').trimEnd(); - } - - // Each chunk is delivered like one keyboard event, then the command or completion is awaited. - async function type(...chunks) { - for (const chunk of chunks) { - mounted.terminal.input(chunk); - await mounted.editor.whenIdle(); - } - await mounted.flush(); - return screen(); - } - - it('shows the banner and prompt read from C++', async () => { - await mounted.flush(); - expect(mounted.editor).not.toBeNull(); - expect(screen()).toContain('webtest terminal'); - expect(screen().split('\n').at(-1)).toBe('test>'); - }); - - it('runs a registered C++ command with its parsed arguments', async () => { - const text = await type('greet "Ada Lovelace"\r'); - expect(text).toContain('test> greet "Ada Lovelace"\nHello, Ada Lovelace!\ntest>'); - }); - - it('reports an unknown command without failing the session', async () => { - const text = await type('nope\r'); - expect(text).toContain("Unknown command 'nope'"); - expect(text.split('\n').at(-1)).toBe('test>'); - }); - - it('shows a C++ command exception as an error', async () => { - const text = await type('fail\r'); - expect(text).toContain('Error: terminal command failed'); - expect(text.split('\n').at(-1)).toBe('test>'); - }); - - it('reports an application without terminal functions instead of failing to mount', async () => { - const element = document.createElement('div'); - document.body.appendChild(element); - const missing = { - ready: Promise.resolve(), - cppFunction: (name) => () => Promise.reject(new Error(`C++ function '${name}' was not found`)), - }; - const failed = await mount(element, { bridge: missing }); - await failed.flush(); - expect(failed.editor).toBeNull(); - expect(failed.terminal.buffer.active.getLine(0).translateToString(true)) - .toContain("Terminal unavailable: C++ function 'webfront.terminal."); - failed.terminal.dispose(); - element.remove(); - }); - - it('splits lines into words like C++', () => { - expect(tokenize(`greet 'Ada L' "a\\"b" c\\ d`)).toEqual(['greet', 'Ada L', 'a"b', 'c d']); - expect(() => tokenize('"open')).toThrowError(SyntaxError, 'Unterminated quote'); - expect(() => tokenize('end\\')).toThrowError(SyntaxError, 'Trailing backslash'); - }); - - it('runs browser commands of extensions before C++, which gets the lines they decline', async () => { - const runInCpp = async (line) => `cpp:${line}`; - const progress = []; - const commands = new Map([['tool', async ([action], context) => { - if (action !== 'local') - return undefined; - context.write('step\n'); - return `browser:${context.line}\nsecond line`; - }]]); - const options = {commands, runInCpp, write: (text) => progress.push(text)}; - expect(await runLine('tool local', options)).toBe('browser:tool local\r\nsecond line'); - expect(progress).toEqual(['step\r\n']); - expect(await runLine('tool other', options)).toBe('cpp:tool other'); - expect(await runLine('greet', options)).toBe('cpp:greet'); - expect(await runLine('tool "open', options)).toBe('cpp:tool "open'); - }); - - it('reports an extension module that fails to load and keeps the terminal usable', async () => { - const element = document.createElement('div'); - element.style.width = '1000px'; - element.style.height = '120px'; - document.body.appendChild(element); - const bridge = { - ready: Promise.resolve(), - cppFunction: (name) => async (line) => ({ - 'webfront.terminal.prompt': '> ', - 'webfront.terminal.banner': '', - 'webfront.terminal.extensions': '/webfront/components/tools/missing.mjs', - 'webfront.terminal.run': `ran ${line}`, - })[name], - }; - const withExtension = await mount(element, { bridge }); - await withExtension.flush(); - const text = withExtension.terminal.buffer.active.getLine(0).translateToString(true); - expect(text).toContain('Terminal extension /webfront/components/tools/missing.mjs failed to load'); - expect(withExtension.editor).not.toBeNull(); - withExtension.terminal.dispose(); - element.remove(); - }); - - // Specs run in random order, so this one does not depend on the history left by the others. - it('completes a command name with Tab and recalls history', async () => { - await type('gre', '\t'); - expect(mounted.editor.line).toBe('greet '); - await type('Bob\r'); - expect(screen()).toContain('Hello, Bob!'); - await type('\x1b[A'); - expect(mounted.editor.line).toBe('greet Bob'); - await type('\x03'); - expect(mounted.editor.line).toBe(''); - }); -}); diff --git a/test/web/js/tools-specs.mjs b/test/web/js/tools-specs.mjs deleted file mode 100644 index a81192ff..00000000 --- a/test/web/js/tools-specs.mjs +++ /dev/null @@ -1,271 +0,0 @@ -// Drives the wf tool manager: the browser module served by fs::ToolManagerFS, loaded by the terminal -// as an extension, against the webfront::ToolManager that test/web/JasmineTest.cpp registers with the -// fake npm registry under test/web/registry/ (no public network). Installed tools go to a temporary -// project directory, served by fs::BasicPackageFS. -import { mount } from '/webfront/components/terminal/terminal.mjs'; -import { chunkSize, gunzip, installed, parseSpec, readTar, verifyIntegrity } from '/webfront/components/tools/wf.mjs'; - -const toolName = 'webfront-test-tool'; -const toolUrl = `/webfront/tools/${toolName}/`; -const longPath = 'dist/assets/' + 'nested-directory-with-a-long-name/'.repeat(3) + 'file.txt'; - -async function fetchBytes(url) { - const response = await fetch(url); - if (!response.ok) - throw new Error(`${url}: HTTP ${response.status}`); - return new Uint8Array(await response.arrayBuffer()); -} - -async function sha512(bytes) { - return 'sha512-' + btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest('SHA-512', bytes)))); -} - -// A tar archive of [{path, text}] regular files; a path over 100 bytes gets a GNU long-name entry. -function tar(entries) { - const encoder = new TextEncoder(); - const blocks = []; - const padded = (bytes) => { - const block = new Uint8Array(Math.ceil(bytes.length / 512) * 512); - block.set(bytes); - return block; - }; - const header = (name, size, type) => { - const block = new Uint8Array(512); - const put = (value, offset) => block.set(encoder.encode(value), offset); - put(name.slice(0, 100), 0); - put('0000644\0', 100); - put(size.toString(8).padStart(11, '0') + '\0', 124); - put('00000000000\0', 136); - block.fill(0x20, 148, 156); - put(type, 156); - put('ustar\x0000', 257); - put(block.reduce((sum, byte) => sum + byte, 0).toString(8).padStart(6, '0') + '\0 ', 148); - return block; - }; - for (const {path, text} of entries) { - const bytes = encoder.encode(text); - if (path.length > 100) { - const name = encoder.encode(path + '\0'); - blocks.push(header('././@LongLink', name.length, 'L'), padded(name)); - } - blocks.push(header(path, bytes.length, '0'), padded(bytes)); - } - blocks.push(new Uint8Array(1024)); - return new Uint8Array(blocks.flatMap((block) => [...block])); -} - -async function gzip(bytes) { - return new Uint8Array(await new Response(new Blob([bytes]).stream().pipeThrough(new CompressionStream('gzip'))).arrayBuffer()); -} - -async function fixtureTarball() { - const packument = await (await fetch(`/registry/${toolName}`)).json(); - const {tarball, integrity} = packument.versions['1.0.0'].dist; - return {bytes: await fetchBytes(`/registry/${tarball}`), integrity}; -} - -describe('WebFront wf tool manager', () => { - let mounted; - - beforeAll(async () => { - const element = document.createElement('div'); - element.style.width = '1200px'; - element.style.height = '320px'; - document.body.appendChild(element); - mounted = await mount(element); - }); - - afterAll(() => { - mounted.terminal.dispose(); - }); - - // Wrapped rows are joined, so long output lines read as one. - function screen() { - const buffer = mounted.terminal.buffer.active; - let text = ''; - for (let index = 0; index < buffer.length; ++index) { - const line = buffer.getLine(index); - text += (index > 0 && !line.isWrapped ? '\n' : '') + line.translateToString(true); - } - return text.trimEnd(); - } - - // Clears the screen, runs a line and returns what it printed, without the prompts. - async function run(line) { - for (const chunk of ['clear\r', line + '\r']) { - mounted.terminal.input(chunk); - await mounted.editor.whenIdle(); - } - await mounted.flush(); - const lines = screen().split('\n'); - expect(lines[0]).toBe(`test> ${line}`); - expect(lines.at(-1)).toBe('test>'); - return lines.slice(1, -1).join('\n'); - } - - async function isInstalled(name) { - return (await installed()).some((tool) => tool.name === name); - } - - it('splits package specs into a name and a version', () => { - expect(parseSpec('plot')).toEqual({name: 'plot', version: ''}); - expect(parseSpec('plot@1.2.0')).toEqual({name: 'plot', version: '1.2.0'}); - expect(parseSpec('@acme/plot')).toEqual({name: '@acme/plot', version: ''}); - expect(parseSpec('@acme/plot@next')).toEqual({name: '@acme/plot', version: 'next'}); - }); - - it('verifies the SHA-512 integrity of a tarball and reads its ustar, prefixed and pax paths', async () => { - const {bytes, integrity} = await fixtureTarball(); - expect(await verifyIntegrity(bytes, `sha1-ignored ${integrity}`)).toBe(integrity); - await expectAsync(verifyIntegrity(bytes, 'sha512-' + btoa('x'.repeat(64)))).toBeRejectedWithError(/Integrity check failed/); - await expectAsync(verifyIntegrity(bytes, 'sha1-only')).toBeRejectedWithError(/no SHA-512 integrity/); - - const files = readTar(await gunzip(bytes)); - expect(files.map((file) => file.path)).toEqual([ - 'package/package.json', - 'package/dist/index.html', - 'package/dist/data.bin', - `package/${longPath}`, - 'package/dist/café.txt', - ]); - expect(files[2].bytes.length).toBe(40000); - }); - - it('rejects a corrupt tar header', async () => { - const archive = readTar(new Uint8Array(1024)); // only end-of-archive blocks - expect(archive).toEqual([]); - const corrupt = new Uint8Array(1024); - corrupt.set(new TextEncoder().encode('name'), 0); - expect(() => readTar(corrupt)).toThrowError(/Corrupt tar header/); - }); - - it('lets C++ answer wf help', async () => { - const output = await run('wf help'); - expect(output).toContain('wf install [@version]'); - expect(output).toContain('wf remove '); - }); - - it('searches the registry for web tools', async () => { - const fetched = spyOn(window, 'fetch').and.callThrough(); - const output = await run('wf search test'); - const url = new URL(fetched.calls.mostRecent().args[0], location.href); - expect(url.pathname).toBe('/registry/-/v1/search'); - expect(url.searchParams.get('text')).toBe('keywords:webfront-tool test'); - expect(output).toContain(`${toolName}@1.0.0 Fixture of the WebFront browser integration test`); - }); - - it('installs a tool that is then listed, served, opened and removed', async () => { - const installOutput = await run(`wf install ${toolName}`); - expect(installOutput).toContain(`Downloading ${toolName}@1.0.0`); - expect(installOutput).toContain('Installing 5 files'); - expect(installOutput).toContain(`Installed ${toolName}@1.0.0: Test tool.`); - expect(await run('wf list')).toBe(`${toolName}@1.0.0 Test tool`); - - const page = new TextDecoder().decode(await fetchBytes(`${toolUrl}dist/index.html`)); - expect(page).toContain('webfront-test-tool page'); - const data = await fetchBytes(`${toolUrl}dist/data.bin`); - expect(data.length).toBe(40000); - expect(data.every((byte, index) => byte === index % 251)).toBeTrue(); - expect(new TextDecoder().decode(await fetchBytes(toolUrl + longPath))).toBe('long path\n'); - expect(new TextDecoder().decode(await fetchBytes(`${toolUrl}dist/${encodeURIComponent('café.txt')}`))).toBe('pax path\n'); - - const open = spyOn(window, 'open').and.returnValue({}); - expect(await run(`wf open ${toolName}`)).toBe(`Opened Test tool: ${toolUrl}dist/index.html`); - expect(open).toHaveBeenCalledOnceWith(`${toolUrl}dist/index.html`, '_blank'); - - expect(await run(`wf remove ${toolName}`)).toBe(`Removed ${toolName}.`); - expect((await fetch(`${toolUrl}dist/index.html`)).status).toBe(404); - }); - - it('refuses a tarball whose integrity does not match', async () => { - const output = await run('wf install webfront-test-corrupt'); - expect(output).toContain('Error: Integrity check failed'); - expect(await isInstalled('webfront-test-corrupt')).toBeFalse(); - }); - - it('reports an unknown version or package', async () => { - expect(await run(`wf install ${toolName}@9.9.9`)).toContain(`Error: ${toolName} has no version '9.9.9'`); - expect(await run('wf install webfront-missing-tool')).toMatch(/Error: .*\/registry\/webfront-missing-tool: HTTP 404/); - expect(await isInstalled(toolName)).toBeFalse(); - }); - - it('reports a tool that is not installed or malformed arguments', async () => { - expect(await run('wf open webfront-missing-tool')).toBe('Error: webfront-missing-tool is not installed'); - expect(await run('wf install')).toBe("Error: Wrong number of arguments. Type 'wf help'."); - }); - - it('refuses a tarball that unpacks to more than the limit', async () => { - const bytes = await gzip(new Uint8Array(4096)); - expect((await gunzip(bytes, 4096)).length).toBe(4096); - await expectAsync(gunzip(bytes, 4095)).toBeRejectedWithError(/unpacks to more than 4095 bytes/); - }); - - // Packages built in the page and served by a fetch stub under the fake registry's URL. - describe('with packages published in the page', () => { - const realFetch = window.fetch; - let routes; - - beforeEach(() => { - routes = new Map(); - spyOn(window, 'fetch').and.callFake((url, init) => { - const route = routes.get(new URL(url, location.href).pathname); - return route ? route(init) : realFetch(url, init); - }); - }); - - async function publish(name, entries) { - const tarball = await gzip(tar(entries)); - const packument = { - name, - 'dist-tags': {latest: '1.0.0'}, - versions: {'1.0.0': {name, version: '1.0.0', dist: {tarball: `/registry/tarballs/${name}.tgz`, integrity: await sha512(tarball)}}}, - }; - routes.set(`/registry/${name}`, async () => new Response(JSON.stringify(packument))); - routes.set(`/registry/tarballs/${name}.tgz`, async () => new Response(tarball)); - } - - const manifest = (name) => ({path: 'package/package.json', - text: JSON.stringify({name, version: '1.0.0', webfront: {kind: 'tool', entry: 'index.html', title: name}})}); - - it('installs files larger than a bridge chunk, which the browser sends in several WebSocket frames', async () => { - const big = '0123456789'.repeat(Math.ceil(1.2 * chunkSize / 10)); - await publish('webfront-test-big', [manifest('webfront-test-big'), - {path: 'package/index.html', text: '

big

'}, - {path: 'package/big.txt', text: big}, - {path: 'package/empty.txt', text: ''}, - {path: `package/${'n'.repeat(120)}.txt`, text: 'long name'}]); - expect(await run('wf install webfront-test-big')).toContain('Installed webfront-test-big@1.0.0'); - const tool = '/webfront/tools/webfront-test-big/'; - expect(new TextDecoder().decode(await fetchBytes(`${tool}big.txt`))).toBe(big); - expect((await fetchBytes(`${tool}empty.txt`)).length).toBe(0); - expect(new TextDecoder().decode(await fetchBytes(`${tool}${'n'.repeat(120)}.txt`))).toBe('long name'); - expect(await run('wf remove webfront-test-big')).toBe('Removed webfront-test-big.'); - }); - - it('lets C++ reject a path escaping the tool', async () => { - await publish('webfront-test-evil', [manifest('webfront-test-evil'), - {path: 'package/index.html', text: '

evil

'}, - {path: `package/${'x'.repeat(100)}/../../evil.txt`, text: 'escaped'}]); - expect(await run('wf install webfront-test-evil')).toContain("Error: Unsafe path 'x"); - expect(await isInstalled('webfront-test-evil')).toBeFalse(); - }); - - it('stops an installation with Ctrl+C', async () => { - let started; - const waiting = new Promise((resolve) => { started = resolve; }); - routes.set('/registry/webfront-test-slow', ({signal}) => new Promise((resolve, reject) => { - signal.addEventListener('abort', () => reject(signal.reason)); - started(); - })); - mounted.terminal.input('clear\r'); - await mounted.editor.whenIdle(); - mounted.terminal.input('wf install webfront-test-slow\r'); - await waiting; - mounted.terminal.input('\x03'); - await mounted.editor.whenIdle(); - await mounted.flush(); - expect(screen()).toBe('test> wf install webfront-test-slow\n^C\nError: Interrupted\ntest>'); - expect(await isInstalled('webfront-test-slow')).toBeFalse(); - }); - }); -}); diff --git a/test/web/js/webfront-specs.mjs b/test/web/js/webfront-specs.mjs index 7bf355c4..8e95b93f 100644 --- a/test/web/js/webfront-specs.mjs +++ b/test/web/js/webfront-specs.mjs @@ -1,7 +1,5 @@ import './content-policy-specs.mjs'; import { importedValue } from './module-fixture.mjs'; -import './terminal-specs.mjs'; -import './tools-specs.mjs'; import './react-demo-specs.mjs'; describe('Frontend page URL', () => { diff --git a/test/web/registry/make_fixture.py b/test/web/registry/make_fixture.py deleted file mode 100644 index 7f93df33..00000000 --- a/test/web/registry/make_fixture.py +++ /dev/null @@ -1,81 +0,0 @@ -"""Regenerates the fake npm registry served to test/web/js/tools-specs.mjs: the tarball of the -webfront-test-tool package and the packuments that point at it. Run from any directory: - - python3 test/web/registry/make_fixture.py - -The output is deterministic (no timestamps), so an unchanged script leaves the files unchanged. -""" - -import base64 -import gzip -import hashlib -import io -import json -import pathlib -import tarfile - -HERE = pathlib.Path(__file__).resolve().parent -NAME = "webfront-test-tool" -VERSION = "1.0.0" -TARBALL = f"tarballs/{NAME}-{VERSION}.tgz" - -package_json = { - "name": NAME, - "version": VERSION, - "description": "Fixture of the WebFront browser integration test", - "keywords": ["webfront-tool"], - "webfront": {"kind": "tool", "title": "Test tool", "entry": "dist/index.html"}, -} - -files = { - "package.json": json.dumps(package_json, indent=2).encode() + b"\n", - "dist/index.html": b'\nTest tool\n

webfront-test-tool page

\n', - # Larger than a writeFile chunk (16384 bytes), so it is sent in several chunks. - "dist/data.bin": bytes(index % 251 for index in range(40000)), - # Longer than the 100-byte ustar name field: split between the ustar prefix and name fields. - "dist/assets/" + "nested-directory-with-a-long-name/" * 3 + "file.txt": b"long path\n", - # Non-ASCII: stored in a pax extended header. - "dist/café.txt": b"pax path\n", -} - - -def tarball(): - archive = io.BytesIO() - with tarfile.open(fileobj=archive, mode="w", format=tarfile.PAX_FORMAT) as tar: - for path, data in files.items(): - info = tarfile.TarInfo("package/" + path) - info.size = len(data) - info.mode = 0o644 - info.mtime = 0 - # node-tar, which npm uses, also writes plain ustar headers when a path fits in them. - tar.format = tarfile.PAX_FORMAT if not path.isascii() else tarfile.USTAR_FORMAT - tar.addfile(info, io.BytesIO(data)) - compressed = io.BytesIO() - with gzip.GzipFile(fileobj=compressed, mode="wb", mtime=0) as stream: - stream.write(archive.getvalue()) - return compressed.getvalue() - - -def packument(name, integrity): - return { - "name": name, - "dist-tags": {"latest": VERSION}, - "versions": {VERSION: {"name": name, "version": VERSION, "dist": {"tarball": TARBALL, "integrity": integrity}}}, - } - - -def write_json(path, value): - (HERE / path).write_text(json.dumps(value, indent=2) + "\n", encoding="utf-8", newline="\n") - - -data = tarball() -(HERE / "tarballs").mkdir(exist_ok=True) -(HERE / TARBALL).write_bytes(data) -integrity = "sha512-" + base64.b64encode(hashlib.sha512(data).digest()).decode() -write_json(NAME, packument(NAME, integrity)) -# Same tarball, wrong hash: the installation must be refused. -write_json("webfront-test-corrupt", packument("webfront-test-corrupt", "sha512-" + base64.b64encode(bytes(64)).decode())) -write_json( - "search.json", - {"objects": [{"package": {"name": NAME, "version": VERSION, "description": package_json["description"]}}], "total": 1}, -) diff --git a/test/web/registry/search.json b/test/web/registry/search.json deleted file mode 100644 index 1a95dc83..00000000 --- a/test/web/registry/search.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "objects": [ - { - "package": { - "name": "webfront-test-tool", - "version": "1.0.0", - "description": "Fixture of the WebFront browser integration test" - } - } - ], - "total": 1 -} diff --git a/test/web/registry/tarballs/webfront-test-tool-1.0.0.tgz b/test/web/registry/tarballs/webfront-test-tool-1.0.0.tgz deleted file mode 100644 index 20df38995978228179982bd0224d99b997ddfb62..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1090 zcmdVM{ZrBh0Dy6~wdpdm%V}+*4C}P!$g+~H#XMgqRyN9}Ih~@Xq`8@*acZ7$ImuH~ z=0rqDnIe$^u>(_2M8r2tMNmOeQ*#C=IcO1wA$-|(w|`>K56^wT)ow2T_OA2Kxy+)a zXpjsmlx~S5PWxtG%m=wvt@|wA4fXx>@`a9kiKf@ILTYtEO-OQLcmt23v;bBX zJ{dK-4nerbL7H1m{XlrDd=-OAxDwDc4GCb9k&RjM-dZR#wg{+R?>v9*gL$_5yb$!& z!8TbZHQsod*oftoZHZx+XgP;p3ZJpb}N8aPRCG{># zy=Pyy8=M_SM)L*C&dA&z*x48c0lm!eE@VBj@MT`!7BC5>y6RLTvxj>s(~|;Wq-$le zmc8r?-ehA4gPdq|WACoQgq=IH2Nv=Sd3%Z%d30OCBqt(0=VKo^Y%q@-!->3Bz%^BA zvnpu z6LoEM?X<%KOGDhAX-vlx84L8^ftnT|vMuD+dkIq{|96;x9Vj9s{ZQM0Qk8bhhW69bm z{bs**Zt13EeM)5P*RSjt3D2b!{`d?XlLQBb>rrsWq)-8O4pxVV?c*H27#OAJiXBrT zlh`S(0GHaIvKghoNF%z`A@5!-bq9n1D)p1A zvQxez9}XTT?l`$88haUWW}Js`Uh;UvV*4eQtF`g#RGTbA?)@Cm_`!vylVyI*m(uVk zZ2=gri2%R`!YebH|BwK0icxL9MW0ki#{NRNLCW_<{x@?P@XqJ#Uvpf>TwMMJg&a&J diff --git a/test/web/registry/webfront-test-corrupt b/test/web/registry/webfront-test-corrupt deleted file mode 100644 index 928af8cf..00000000 --- a/test/web/registry/webfront-test-corrupt +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "webfront-test-corrupt", - "dist-tags": { - "latest": "1.0.0" - }, - "versions": { - "1.0.0": { - "name": "webfront-test-corrupt", - "version": "1.0.0", - "dist": { - "tarball": "tarballs/webfront-test-tool-1.0.0.tgz", - "integrity": "sha512-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==" - } - } - } -} diff --git a/test/web/registry/webfront-test-tool b/test/web/registry/webfront-test-tool deleted file mode 100644 index 5a08390c..00000000 --- a/test/web/registry/webfront-test-tool +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "webfront-test-tool", - "dist-tags": { - "latest": "1.0.0" - }, - "versions": { - "1.0.0": { - "name": "webfront-test-tool", - "version": "1.0.0", - "dist": { - "tarball": "tarballs/webfront-test-tool-1.0.0.tgz", - "integrity": "sha512-WA/PcGQdG7416UoBzMF+yoZyiE37RiTyqgw8Aj5AaJWkEU/rXHvfTYM4X/0BGRWHQCxRSJKlE7MKgsJvih/t2w==" - } - } - } -} diff --git a/third_party/xterm/LICENSE b/third_party/xterm/LICENSE deleted file mode 100644 index 4472336c..00000000 --- a/third_party/xterm/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) 2017-2019, The xterm.js authors (https://github.com/xtermjs/xterm.js) -Copyright (c) 2014-2016, SourceLair Private Company (https://www.sourcelair.com) -Copyright (c) 2012-2013, Christopher Jeffrey (https://github.com/chjj/) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/third_party/xterm/VERSION b/third_party/xterm/VERSION deleted file mode 100644 index 19a6fe9d..00000000 --- a/third_party/xterm/VERSION +++ /dev/null @@ -1,2 +0,0 @@ -@xterm/xterm 6.0.0 -@xterm/addon-fit 0.11.0 diff --git a/third_party/xterm/addon-fit-LICENSE b/third_party/xterm/addon-fit-LICENSE deleted file mode 100644 index 8f178925..00000000 --- a/third_party/xterm/addon-fit-LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2019, The xterm.js authors (https://github.com/xtermjs/xterm.js) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/third_party/xterm/addon-fit.mjs b/third_party/xterm/addon-fit.mjs deleted file mode 100644 index 24d4f618..00000000 --- a/third_party/xterm/addon-fit.mjs +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved. - * @license MIT - * - * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) - * @license MIT - * - * Originally forked from (with the author's permission): - * Fabrice Bellard's javascript vt100 for jslinux: - * http://bellard.org/jslinux/ - * Copyright (c) 2011 Fabrice Bellard - */ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -var h=2,_=1,o=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let s=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,r=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(r.getPropertyValue("height")),a=Math.max(0,parseInt(r.getPropertyValue("width"))),i=window.getComputedStyle(this._terminal.element),n={top:parseInt(i.getPropertyValue("padding-top")),bottom:parseInt(i.getPropertyValue("padding-bottom")),right:parseInt(i.getPropertyValue("padding-right")),left:parseInt(i.getPropertyValue("padding-left"))},m=n.top+n.bottom,d=n.right+n.left,c=l-m,p=a-d-s;return{cols:Math.max(h,Math.floor(p/t.css.cell.width)),rows:Math.max(_,Math.floor(c/t.css.cell.height))}}};export{o as FitAddon}; -//# sourceMappingURL=addon-fit.mjs.map diff --git a/third_party/xterm/xterm.css b/third_party/xterm/xterm.css deleted file mode 100644 index 819654e4..00000000 --- a/third_party/xterm/xterm.css +++ /dev/null @@ -1,285 +0,0 @@ -/** - * Copyright (c) 2014 The xterm.js authors. All rights reserved. - * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) - * https://github.com/chjj/term.js - * @license MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * Originally forked from (with the author's permission): - * Fabrice Bellard's javascript vt100 for jslinux: - * http://bellard.org/jslinux/ - * Copyright (c) 2011 Fabrice Bellard - * The original design remains. The terminal itself - * has been extended to include xterm CSI codes, among - * other features. - */ - -/** - * Default styles for xterm.js - */ - -.xterm { - cursor: text; - position: relative; - user-select: none; - -ms-user-select: none; - -webkit-user-select: none; -} - -.xterm.focus, -.xterm:focus { - outline: none; -} - -.xterm .xterm-helpers { - position: absolute; - top: 0; - /** - * The z-index of the helpers must be higher than the canvases in order for - * IMEs to appear on top. - */ - z-index: 5; -} - -.xterm .xterm-helper-textarea { - padding: 0; - border: 0; - margin: 0; - /* Move textarea out of the screen to the far left, so that the cursor is not visible */ - position: absolute; - opacity: 0; - left: -9999em; - top: 0; - width: 0; - height: 0; - z-index: -5; - /** Prevent wrapping so the IME appears against the textarea at the correct position */ - white-space: nowrap; - overflow: hidden; - resize: none; -} - -.xterm .composition-view { - /* TODO: Composition position got messed up somewhere */ - background: #000; - color: #FFF; - display: none; - position: absolute; - white-space: nowrap; - z-index: 1; -} - -.xterm .composition-view.active { - display: block; -} - -.xterm .xterm-viewport { - /* On OS X this is required in order for the scroll bar to appear fully opaque */ - background-color: #000; - overflow-y: scroll; - cursor: default; - position: absolute; - right: 0; - left: 0; - top: 0; - bottom: 0; -} - -.xterm .xterm-screen { - position: relative; -} - -.xterm .xterm-screen canvas { - position: absolute; - left: 0; - top: 0; -} - -.xterm-char-measure-element { - display: inline-block; - visibility: hidden; - position: absolute; - top: 0; - left: -9999em; - line-height: normal; -} - -.xterm.enable-mouse-events { - /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */ - cursor: default; -} - -.xterm.xterm-cursor-pointer, -.xterm .xterm-cursor-pointer { - cursor: pointer; -} - -.xterm.column-select.focus { - /* Column selection mode */ - cursor: crosshair; -} - -.xterm .xterm-accessibility:not(.debug), -.xterm .xterm-message { - position: absolute; - left: 0; - top: 0; - bottom: 0; - right: 0; - z-index: 10; - color: transparent; - pointer-events: none; -} - -.xterm .xterm-accessibility-tree:not(.debug) *::selection { - color: transparent; -} - -.xterm .xterm-accessibility-tree { - font-family: monospace; - user-select: text; - white-space: pre; -} - -.xterm .xterm-accessibility-tree > div { - transform-origin: left; - width: fit-content; -} - -.xterm .live-region { - position: absolute; - left: -9999px; - width: 1px; - height: 1px; - overflow: hidden; -} - -.xterm-dim { - /* Dim should not apply to background, so the opacity of the foreground color is applied - * explicitly in the generated class and reset to 1 here */ - opacity: 1 !important; -} - -.xterm-underline-1 { text-decoration: underline; } -.xterm-underline-2 { text-decoration: double underline; } -.xterm-underline-3 { text-decoration: wavy underline; } -.xterm-underline-4 { text-decoration: dotted underline; } -.xterm-underline-5 { text-decoration: dashed underline; } - -.xterm-overline { - text-decoration: overline; -} - -.xterm-overline.xterm-underline-1 { text-decoration: overline underline; } -.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; } -.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; } -.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; } -.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; } - -.xterm-strikethrough { - text-decoration: line-through; -} - -.xterm-screen .xterm-decoration-container .xterm-decoration { - z-index: 6; - position: absolute; -} - -.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer { - z-index: 7; -} - -.xterm-decoration-overview-ruler { - z-index: 8; - position: absolute; - top: 0; - right: 0; - pointer-events: none; -} - -.xterm-decoration-top { - z-index: 2; - position: relative; -} - - - -/* Derived from vs/base/browser/ui/scrollbar/media/scrollbar.css */ - -/* xterm.js customization: Override xterm's cursor style */ -.xterm .xterm-scrollable-element > .scrollbar { - cursor: default; -} - -/* Arrows */ -.xterm .xterm-scrollable-element > .scrollbar > .scra { - cursor: pointer; - font-size: 11px !important; -} - -.xterm .xterm-scrollable-element > .visible { - opacity: 1; - - /* Background rule added for IE9 - to allow clicks on dom node */ - background:rgba(0,0,0,0); - - transition: opacity 100ms linear; - /* In front of peek view */ - z-index: 11; -} -.xterm .xterm-scrollable-element > .invisible { - opacity: 0; - pointer-events: none; -} -.xterm .xterm-scrollable-element > .invisible.fade { - transition: opacity 800ms linear; -} - -/* Scrollable Content Inset Shadow */ -.xterm .xterm-scrollable-element > .shadow { - position: absolute; - display: none; -} -.xterm .xterm-scrollable-element > .shadow.top { - display: block; - top: 0; - left: 3px; - height: 3px; - width: 100%; - box-shadow: var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset; -} -.xterm .xterm-scrollable-element > .shadow.left { - display: block; - top: 3px; - left: 0; - height: 100%; - width: 3px; - box-shadow: var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset; -} -.xterm .xterm-scrollable-element > .shadow.top-left-corner { - display: block; - top: 0; - left: 0; - height: 3px; - width: 3px; -} -.xterm .xterm-scrollable-element > .shadow.top.left { - box-shadow: var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset; -} diff --git a/third_party/xterm/xterm.mjs b/third_party/xterm/xterm.mjs deleted file mode 100644 index d5402562..00000000 --- a/third_party/xterm/xterm.mjs +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved. - * @license MIT - * - * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) - * @license MIT - * - * Originally forked from (with the author's permission): - * Fabrice Bellard's javascript vt100 for jslinux: - * http://bellard.org/jslinux/ - * Copyright (c) 2011 Fabrice Bellard - */ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -var zs=Object.defineProperty;var Rl=Object.getOwnPropertyDescriptor;var Ll=(s,t)=>{for(var e in t)zs(s,e,{get:t[e],enumerable:!0})};var M=(s,t,e,i)=>{for(var r=i>1?void 0:i?Rl(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&zs(t,e,r),r},S=(s,t)=>(e,i)=>t(e,i,s);var Gs="Terminal input",mi={get:()=>Gs,set:s=>Gs=s},$s="Too much output to announce, navigate to rows manually to read",_i={get:()=>$s,set:s=>$s=s};function Al(s){return s.replace(/\r?\n/g,"\r")}function kl(s,t){return t?"\x1B[200~"+s+"\x1B[201~":s}function Vs(s,t){s.clipboardData&&s.clipboardData.setData("text/plain",t.selectionText),s.preventDefault()}function qs(s,t,e,i){if(s.stopPropagation(),s.clipboardData){let r=s.clipboardData.getData("text/plain");Cn(r,t,e,i)}}function Cn(s,t,e,i){s=Al(s),s=kl(s,e.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),e.triggerDataEvent(s,!0),t.value=""}function Mn(s,t,e){let i=e.getBoundingClientRect(),r=s.clientX-i.left-10,n=s.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function Pn(s,t,e,i,r){Mn(s,t,e),r&&i.rightClickSelect(s),t.value=i.selectionText,t.select()}function Ce(s){return s>65535?(s-=65536,String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):String.fromCharCode(s)}function It(s,t=0,e=s.length){let i="";for(let r=t;r65535?(n-=65536,i+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):i+=String.fromCharCode(n)}return i}var er=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let i=t.length;if(!i)return 0;let r=0,n=0;if(this._interim){let o=t.charCodeAt(n++);56320<=o&&o<=57343?e[r++]=(this._interim-55296)*1024+o-56320+65536:(e[r++]=this._interim,e[r++]=o),this._interim=0}for(let o=n;o=i)return this._interim=l,r;let a=t.charCodeAt(o);56320<=a&&a<=57343?e[r++]=(l-55296)*1024+a-56320+65536:(e[r++]=l,e[r++]=a);continue}l!==65279&&(e[r++]=l)}return r}},tr=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let i=t.length;if(!i)return 0;let r=0,n,o,l,a,u=0,h=0;if(this.interim[0]){let _=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let m=0,f;for(;(f=this.interim[++m]&63)&&m<4;)p<<=6,p|=f;let A=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,R=A-m;for(;h=i)return 0;if(f=t[h++],(f&192)!==128){h--,_=!0;break}else this.interim[m++]=f,p<<=6,p|=f&63}_||(A===2?p<128?h--:e[r++]=p:A===3?p<2048||p>=55296&&p<=57343||p===65279||(e[r++]=p):p<65536||p>1114111||(e[r++]=p)),this.interim.fill(0)}let c=i-4,d=h;for(;d=i)return this.interim[0]=n,r;if(o=t[d++],(o&192)!==128){d--;continue}if(u=(n&31)<<6|o&63,u<128){d--;continue}e[r++]=u}else if((n&240)===224){if(d>=i)return this.interim[0]=n,r;if(o=t[d++],(o&192)!==128){d--;continue}if(d>=i)return this.interim[0]=n,this.interim[1]=o,r;if(l=t[d++],(l&192)!==128){d--;continue}if(u=(n&15)<<12|(o&63)<<6|l&63,u<2048||u>=55296&&u<=57343||u===65279)continue;e[r++]=u}else if((n&248)===240){if(d>=i)return this.interim[0]=n,r;if(o=t[d++],(o&192)!==128){d--;continue}if(d>=i)return this.interim[0]=n,this.interim[1]=o,r;if(l=t[d++],(l&192)!==128){d--;continue}if(d>=i)return this.interim[0]=n,this.interim[1]=o,this.interim[2]=l,r;if(a=t[d++],(a&192)!==128){d--;continue}if(u=(n&7)<<18|(o&63)<<12|(l&63)<<6|a&63,u<65536||u>1114111)continue;e[r++]=u}}return r}};var ir="";var we=" ";var De=class s{constructor(){this.fg=0;this.bg=0;this.extended=new rt}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new s;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},rt=class s{constructor(t=0,e=0){this._ext=0;this._urlId=0;this._ext=t,this._urlId=e}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new s(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}};var q=class s extends De{constructor(){super(...arguments);this.content=0;this.fg=0;this.bg=0;this.extended=new rt;this.combinedData=""}static fromCharData(e){let i=new s;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ce(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let r=e[1].charCodeAt(0);if(55296<=r&&r<=56319){let n=e[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(r-55296)*1024+n-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};var js="di$target",Hn="di$dependencies",Fn=new Map;function Xs(s){return s[Hn]||[]}function ie(s){if(Fn.has(s))return Fn.get(s);let t=function(e,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Pl(t,e,r)};return t._id=s,Fn.set(s,t),t}function Pl(s,t,e){t[js]===t?t[Hn].push({id:s,index:e}):(t[Hn]=[{id:s,index:e}],t[js]=t)}var F=ie("BufferService"),rr=ie("CoreMouseService"),ge=ie("CoreService"),Zs=ie("CharsetService"),xt=ie("InstantiationService");var nr=ie("LogService"),H=ie("OptionsService"),sr=ie("OscLinkService"),Js=ie("UnicodeService"),Be=ie("DecorationService");var wt=class{constructor(t,e,i){this._bufferService=t;this._optionsService=e;this._oscLinkService=i}provideLinks(t,e){let i=this._bufferService.buffer.lines.get(t-1);if(!i){e(void 0);return}let r=[],n=this._optionsService.rawOptions.linkHandler,o=new q,l=i.getTrimmedLength(),a=-1,u=-1,h=!1;for(let c=0;cn?n.activate(m,f,_):Ol(m,f),hover:(m,f)=>n?.hover?.(m,f,_),leave:(m,f)=>n?.leave?.(m,f,_)})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=c,a=o.extended.urlId):(u=-1,a=-1)}}e(r)}};wt=M([S(0,F),S(1,H),S(2,sr)],wt);function Ol(s,t){if(confirm(`Do you want to navigate to ${t}? - -WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var nt=ie("CharSizeService"),ae=ie("CoreBrowserService"),Dt=ie("MouseService"),ce=ie("RenderService"),Qs=ie("SelectionService"),or=ie("CharacterJoinerService"),Re=ie("ThemeService"),lr=ie("LinkProviderService");var Wn=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?ar.isErrorNoTelemetry(t)?new ar(t.message+` - -`+t.stack):new Error(t.message+` - -`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},Bl=new Wn;function Lt(s){Nl(s)||Bl.onUnexpectedError(s)}var Un="Canceled";function Nl(s){return s instanceof bi?!0:s instanceof Error&&s.name===Un&&s.message===Un}var bi=class extends Error{constructor(){super(Un),this.name=this.message}};function eo(s){return s?new Error(`Illegal argument: ${s}`):new Error("Illegal argument")}var ar=class s extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof s)return t;let e=new s;return e.message=t.message,e.stack=t.stack,e}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Rt=class s extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,s.prototype)}};function Fl(s,t,e=0,i=s.length){let r=e,n=i;for(;r{function s(a){return a<0}l.isLessThan=s;function t(a){return a<=0}l.isLessThanOrEqual=t;function e(a){return a>0}l.isGreaterThan=e;function i(a){return a===0}l.isNeitherLessOrGreaterThan=i,l.greaterThan=1,l.lessThan=-1,l.neitherLessOrGreaterThan=0})(ro||={});function no(s,t){return(e,i)=>t(s(e),s(i))}var so=(s,t)=>s-t;var At=class At{constructor(t){this.iterate=t}forEach(t){this.iterate(e=>(t(e),!0))}toArray(){let t=[];return this.iterate(e=>(t.push(e),!0)),t}filter(t){return new At(e=>this.iterate(i=>t(i)?e(i):!0))}map(t){return new At(e=>this.iterate(i=>e(t(i))))}some(t){let e=!1;return this.iterate(i=>(e=t(i),!e)),e}findFirst(t){let e;return this.iterate(i=>t(i)?(e=i,!1):!0),e}findLast(t){let e;return this.iterate(i=>(t(i)&&(e=i),!0)),e}findLastMaxBy(t){let e,i=!0;return this.iterate(r=>((i||ro.isGreaterThan(t(r,e)))&&(i=!1,e=r),!0)),e}};At.empty=new At(t=>{});var io=At;function co(s,t){let e=Object.create(null);for(let i of s){let r=t(i),n=e[r];n||(n=e[r]=[]),n.push(i)}return e}var lo,ao,oo=class{constructor(t,e){this.toKey=e;this._map=new Map;this[lo]="SetWithKey";for(let i of t)this.add(i)}get size(){return this._map.size}add(t){let e=this.toKey(t);return this._map.set(e,t),this}delete(t){return this._map.delete(this.toKey(t))}has(t){return this._map.has(this.toKey(t))}*entries(){for(let t of this._map.values())yield[t,t]}keys(){return this.values()}*values(){for(let t of this._map.values())yield t}clear(){this._map.clear()}forEach(t,e){this._map.forEach(i=>t.call(e,i,i,this))}[(ao=Symbol.iterator,lo=Symbol.toStringTag,ao)](){return this.values()}};var ur=class{constructor(){this.map=new Map}add(t,e){let i=this.map.get(t);i||(i=new Set,this.map.set(t,i)),i.add(e)}delete(t,e){let i=this.map.get(t);i&&(i.delete(e),i.size===0&&this.map.delete(t))}forEach(t,e){let i=this.map.get(t);i&&i.forEach(e)}get(t){let e=this.map.get(t);return e||new Set}};function Kn(s,t){let e=this,i=!1,r;return function(){if(i)return r;if(i=!0,t)try{r=s.apply(e,arguments)}finally{t()}else r=s.apply(e,arguments);return r}}var zn;(O=>{function s(I){return I&&typeof I=="object"&&typeof I[Symbol.iterator]=="function"}O.is=s;let t=Object.freeze([]);function e(){return t}O.empty=e;function*i(I){yield I}O.single=i;function r(I){return s(I)?I:i(I)}O.wrap=r;function n(I){return I||t}O.from=n;function*o(I){for(let k=I.length-1;k>=0;k--)yield I[k]}O.reverse=o;function l(I){return!I||I[Symbol.iterator]().next().done===!0}O.isEmpty=l;function a(I){return I[Symbol.iterator]().next().value}O.first=a;function u(I,k){let P=0;for(let oe of I)if(k(oe,P++))return!0;return!1}O.some=u;function h(I,k){for(let P of I)if(k(P))return P}O.find=h;function*c(I,k){for(let P of I)k(P)&&(yield P)}O.filter=c;function*d(I,k){let P=0;for(let oe of I)yield k(oe,P++)}O.map=d;function*_(I,k){let P=0;for(let oe of I)yield*k(oe,P++)}O.flatMap=_;function*p(...I){for(let k of I)yield*k}O.concat=p;function m(I,k,P){let oe=P;for(let Me of I)oe=k(oe,Me);return oe}O.reduce=m;function*f(I,k,P=I.length){for(k<0&&(k+=I.length),P<0?P+=I.length:P>I.length&&(P=I.length);ki.source!==null&&!this.getRootParent(i,t).isSingleton).flatMap(([i])=>i)}computeLeakingDisposables(t=10,e){let i;if(e)i=e;else{let a=new Map,u=[...this.livingDisposables.values()].filter(c=>c.source!==null&&!this.getRootParent(c,a).isSingleton);if(u.length===0)return;let h=new Set(u.map(c=>c.value));if(i=u.filter(c=>!(c.parent&&h.has(c.parent))),i.length===0)throw new Error("There are cyclic diposable chains!")}if(!i)return;function r(a){function u(c,d){for(;c.length>0&&d.some(_=>typeof _=="string"?_===c[0]:c[0].match(_));)c.shift()}let h=a.source.split(` -`).map(c=>c.trim().replace("at ","")).filter(c=>c!=="");return u(h,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),h.reverse()}let n=new ur;for(let a of i){let u=r(a);for(let h=0;h<=u.length;h++)n.add(u.slice(0,h).join(` -`),a)}i.sort(no(a=>a.idx,so));let o="",l=0;for(let a of i.slice(0,t)){l++;let u=r(a),h=[];for(let c=0;cr(f)[c]),f=>f);delete m[u[c]];for(let[f,A]of Object.entries(m))h.unshift(` - stacktraces of ${A.length} other leaks continue with ${f}`);h.unshift(d)}o+=` - - -==================== Leaking disposable ${l}/${i.length}: ${a.value.constructor.name} ==================== -${h.join(` -`)} -============================================================ - -`}return i.length>t&&(o+=` - - -... and ${i.length-t} more leaking disposables - -`),{leaks:i,details:o}}};hr.idx=0;var uo=hr;function Ul(s){dt=s}if(Wl){let s="__is_disposable_tracked__";Ul(new class{trackDisposable(t){let e=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[s]||console.log(e)},3e3)}setParent(t,e){if(t&&t!==D.None)try{t[s]=!0}catch{}}markAsDisposed(t){if(t&&t!==D.None)try{t[s]=!0}catch{}}markAsSingleton(t){}})}function fr(s){return dt?.trackDisposable(s),s}function pr(s){dt?.markAsDisposed(s)}function vi(s,t){dt?.setParent(s,t)}function Kl(s,t){if(dt)for(let e of s)dt.setParent(e,t)}function Gn(s){return dt?.markAsSingleton(s),s}function Ne(s){if(zn.is(s)){let t=[];for(let e of s)if(e)try{e.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(s)?[]:s}else if(s)return s.dispose(),s}function ho(...s){let t=C(()=>Ne(s));return Kl(s,t),t}function C(s){let t=fr({dispose:Kn(()=>{pr(t),s()})});return t}var dr=class dr{constructor(){this._toDispose=new Set;this._isDisposed=!1;fr(this)}dispose(){this._isDisposed||(pr(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ne(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return vi(t,this),this._isDisposed?dr.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),vi(t,null))}};dr.DISABLE_DISPOSED_WARNING=!1;var Ee=dr,D=class{constructor(){this._store=new Ee;fr(this),vi(this._store,this)}dispose(){pr(this),this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};D.None=Object.freeze({dispose(){}});var ye=class{constructor(){this._isDisposed=!1;fr(this)}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),t&&vi(t,this),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,pr(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t&&vi(t,null),t}};var fe=typeof window=="object"?window:globalThis;var kt=class kt{constructor(t){this.element=t,this.next=kt.Undefined,this.prev=kt.Undefined}};kt.Undefined=new kt(void 0);var G=kt,Ct=class{constructor(){this._first=G.Undefined;this._last=G.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===G.Undefined}clear(){let t=this._first;for(;t!==G.Undefined;){let e=t.next;t.prev=G.Undefined,t.next=G.Undefined,t=e}this._first=G.Undefined,this._last=G.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,e){let i=new G(t);if(this._first===G.Undefined)this._first=i,this._last=i;else if(e){let n=this._last;this._last=i,i.prev=n,n.next=i}else{let n=this._first;this._first=i,i.next=n,n.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==G.Undefined){let t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==G.Undefined){let t=this._last.element;return this._remove(this._last),t}}_remove(t){if(t.prev!==G.Undefined&&t.next!==G.Undefined){let e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===G.Undefined&&t.next===G.Undefined?(this._first=G.Undefined,this._last=G.Undefined):t.next===G.Undefined?(this._last=this._last.prev,this._last.next=G.Undefined):t.prev===G.Undefined&&(this._first=this._first.next,this._first.prev=G.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==G.Undefined;)yield t.element,t=t.next}};var zl=globalThis.performance&&typeof globalThis.performance.now=="function",mr=class s{static create(t){return new s(t)}constructor(t){this._now=zl&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}};var Gl=!1,fo=!1,$l=!1,$;(Qe=>{Qe.None=()=>D.None;function t(y){if($l){let{onDidAddListener:T}=y,g=gi.create(),w=0;y.onDidAddListener=()=>{++w===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),g.print()),T?.()}}}function e(y,T){return d(y,()=>{},0,void 0,!0,void 0,T)}Qe.defer=e;function i(y){return(T,g=null,w)=>{let E=!1,x;return x=y(N=>{if(!E)return x?x.dispose():E=!0,T.call(g,N)},null,w),E&&x.dispose(),x}}Qe.once=i;function r(y,T,g){return h((w,E=null,x)=>y(N=>w.call(E,T(N)),null,x),g)}Qe.map=r;function n(y,T,g){return h((w,E=null,x)=>y(N=>{T(N),w.call(E,N)},null,x),g)}Qe.forEach=n;function o(y,T,g){return h((w,E=null,x)=>y(N=>T(N)&&w.call(E,N),null,x),g)}Qe.filter=o;function l(y){return y}Qe.signal=l;function a(...y){return(T,g=null,w)=>{let E=ho(...y.map(x=>x(N=>T.call(g,N))));return c(E,w)}}Qe.any=a;function u(y,T,g,w){let E=g;return r(y,x=>(E=T(E,x),E),w)}Qe.reduce=u;function h(y,T){let g,w={onWillAddFirstListener(){g=y(E.fire,E)},onDidRemoveLastListener(){g?.dispose()}};T||t(w);let E=new v(w);return T?.add(E),E.event}function c(y,T){return T instanceof Array?T.push(y):T&&T.add(y),y}function d(y,T,g=100,w=!1,E=!1,x,N){let Z,te,Oe,ze=0,le,et={leakWarningThreshold:x,onWillAddFirstListener(){Z=y(ht=>{ze++,te=T(te,ht),w&&!Oe&&(me.fire(te),te=void 0),le=()=>{let fi=te;te=void 0,Oe=void 0,(!w||ze>1)&&me.fire(fi),ze=0},typeof g=="number"?(clearTimeout(Oe),Oe=setTimeout(le,g)):Oe===void 0&&(Oe=0,queueMicrotask(le))})},onWillRemoveListener(){E&&ze>0&&le?.()},onDidRemoveLastListener(){le=void 0,Z.dispose()}};N||t(et);let me=new v(et);return N?.add(me),me.event}Qe.debounce=d;function _(y,T=0,g){return Qe.debounce(y,(w,E)=>w?(w.push(E),w):[E],T,void 0,!0,void 0,g)}Qe.accumulate=_;function p(y,T=(w,E)=>w===E,g){let w=!0,E;return o(y,x=>{let N=w||!T(x,E);return w=!1,E=x,N},g)}Qe.latch=p;function m(y,T,g){return[Qe.filter(y,T,g),Qe.filter(y,w=>!T(w),g)]}Qe.split=m;function f(y,T=!1,g=[],w){let E=g.slice(),x=y(te=>{E?E.push(te):Z.fire(te)});w&&w.add(x);let N=()=>{E?.forEach(te=>Z.fire(te)),E=null},Z=new v({onWillAddFirstListener(){x||(x=y(te=>Z.fire(te)),w&&w.add(x))},onDidAddFirstListener(){E&&(T?setTimeout(N):N())},onDidRemoveLastListener(){x&&x.dispose(),x=null}});return w&&w.add(Z),Z.event}Qe.buffer=f;function A(y,T){return(w,E,x)=>{let N=T(new O);return y(function(Z){let te=N.evaluate(Z);te!==R&&w.call(E,te)},void 0,x)}}Qe.chain=A;let R=Symbol("HaltChainable");class O{constructor(){this.steps=[]}map(T){return this.steps.push(T),this}forEach(T){return this.steps.push(g=>(T(g),g)),this}filter(T){return this.steps.push(g=>T(g)?g:R),this}reduce(T,g){let w=g;return this.steps.push(E=>(w=T(w,E),w)),this}latch(T=(g,w)=>g===w){let g=!0,w;return this.steps.push(E=>{let x=g||!T(E,w);return g=!1,w=E,x?E:R}),this}evaluate(T){for(let g of this.steps)if(T=g(T),T===R)break;return T}}function I(y,T,g=w=>w){let w=(...Z)=>N.fire(g(...Z)),E=()=>y.on(T,w),x=()=>y.removeListener(T,w),N=new v({onWillAddFirstListener:E,onDidRemoveLastListener:x});return N.event}Qe.fromNodeEventEmitter=I;function k(y,T,g=w=>w){let w=(...Z)=>N.fire(g(...Z)),E=()=>y.addEventListener(T,w),x=()=>y.removeEventListener(T,w),N=new v({onWillAddFirstListener:E,onDidRemoveLastListener:x});return N.event}Qe.fromDOMEventEmitter=k;function P(y){return new Promise(T=>i(y)(T))}Qe.toPromise=P;function oe(y){let T=new v;return y.then(g=>{T.fire(g)},()=>{T.fire(void 0)}).finally(()=>{T.dispose()}),T.event}Qe.fromPromise=oe;function Me(y,T){return y(g=>T.fire(g))}Qe.forward=Me;function Pe(y,T,g){return T(g),y(w=>T(w))}Qe.runAndSubscribe=Pe;class Ke{constructor(T,g){this._observable=T;this._counter=0;this._hasChanged=!1;let w={onWillAddFirstListener:()=>{T.addObserver(this)},onDidRemoveLastListener:()=>{T.removeObserver(this)}};g||t(w),this.emitter=new v(w),g&&g.add(this.emitter)}beginUpdate(T){this._counter++}handlePossibleChange(T){}handleChange(T,g){this._hasChanged=!0}endUpdate(T){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function di(y,T){return new Ke(y,T).emitter.event}Qe.fromObservable=di;function V(y){return(T,g,w)=>{let E=0,x=!1,N={beginUpdate(){E++},endUpdate(){E--,E===0&&(y.reportChanges(),x&&(x=!1,T.call(g)))},handlePossibleChange(){},handleChange(){x=!0}};y.addObserver(N),y.reportChanges();let Z={dispose(){y.removeObserver(N)}};return w instanceof Ee?w.add(Z):Array.isArray(w)&&w.push(Z),Z}}Qe.fromObservableLight=V})($||={});var Mt=class Mt{constructor(t){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=`${t}_${Mt._idPool++}`,Mt.all.add(this)}start(t){this._stopWatch=new mr,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Mt.all=new Set,Mt._idPool=0;var $n=Mt,po=-1;var br=class br{constructor(t,e,i=(br._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t;this.threshold=e;this.name=i;this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,e){let i=this.threshold;if(i<=0||e{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,e=0;for(let[i,r]of this._stacks)(!t||e{if(s instanceof Pt)t(s);else for(let e=0;e{s.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(s.join(` -`)),s.length=0)},3e3),_r=new FinalizationRegistry(t=>{typeof t=="string"&&s.push(t)})}var v=class{constructor(t){this._size=0;this._options=t,this._leakageMon=po>0||this._options?.leakWarningThreshold?new Vn(t?.onListenerError??Lt,this._options?.leakWarningThreshold??po):void 0,this._perfMon=this._options?._profName?new $n(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(fo){let t=this._listeners;queueMicrotask(()=>{Yl(t,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(t,e,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],h=new Yn(`${a}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(this._options?.onListenerError||Lt)(h),D.None}if(this._disposed)return D.None;e&&(t=t.bind(e));let r=new Pt(t),n,o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=gi.create(),n=this._leakageMon.check(r.stack,this._size+1)),fo&&(r.stack=o??gi.create()),this._listeners?this._listeners instanceof Pt?(this._deliveryQueue??=new jn,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let l=C(()=>{_r?.unregister(l),n?.(),this._removeListener(r)});if(i instanceof Ee?i.add(l):Array.isArray(i)&&i.push(l),_r){let a=new Error().stack.split(` -`).slice(2,3).join(` -`).trim(),u=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);_r.register(l,u?.[2]??a,l)}return l},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let e=this._listeners,i=e.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*ql<=e.length){let n=0;for(let o=0;o0}};var jn=class{constructor(){this.i=-1;this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var gr=class gr{constructor(){this.mapWindowIdToZoomLevel=new Map;this._onDidChangeZoomLevel=new v;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event;this.mapWindowIdToZoomFactor=new Map;this._onDidChangeFullscreen=new v;this.onDidChangeFullscreen=this._onDidChangeFullscreen.event;this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,e){if(this.getZoomLevel(e)===t)return;let i=this.getWindowId(e);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,e){this.mapWindowIdToZoomFactor.set(this.getWindowId(e),t)}setFullscreen(t,e){if(this.isFullscreen(e)===t)return;let i=this.getWindowId(e);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};gr.INSTANCE=new gr;var Si=gr;function Xl(s,t,e){typeof t=="string"&&(t=s.matchMedia(t)),t.addEventListener("change",e)}var Eu=Si.INSTANCE.onDidChangeZoomLevel;function mo(s){return Si.INSTANCE.getZoomFactor(s)}var Tu=Si.INSTANCE.onDidChangeFullscreen,Ot=typeof navigator=="object"?navigator.userAgent:"",Ei=Ot.indexOf("Firefox")>=0,Bt=Ot.indexOf("AppleWebKit")>=0,Ti=Ot.indexOf("Chrome")>=0,Sr=!Ti&&Ot.indexOf("Safari")>=0;var Iu=Ot.indexOf("Electron/")>=0,yu=Ot.indexOf("Android")>=0,vr=!1;if(typeof fe.matchMedia=="function"){let s=fe.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=fe.matchMedia("(display-mode: fullscreen)");vr=s.matches,Xl(fe,s,({matches:e})=>{vr&&t.matches||(vr=e)})}function _o(){return vr}var Nt="en",yr=!1,xr=!1,Ii=!1,Zl=!1,vo=!1,go=!1,Jl=!1,Ql=!1,ea=!1,ta=!1,Tr,Ir=Nt,bo=Nt,ia,$e,Ve=globalThis,xe;typeof Ve.vscode<"u"&&typeof Ve.vscode.process<"u"?xe=Ve.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(xe=process);var So=typeof xe?.versions?.electron=="string",ra=So&&xe?.type==="renderer";if(typeof xe=="object"){yr=xe.platform==="win32",xr=xe.platform==="darwin",Ii=xe.platform==="linux",Zl=Ii&&!!xe.env.SNAP&&!!xe.env.SNAP_REVISION,Jl=So,ea=!!xe.env.CI||!!xe.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Tr=Nt,Ir=Nt;let s=xe.env.VSCODE_NLS_CONFIG;if(s)try{let t=JSON.parse(s);Tr=t.userLocale,bo=t.osLocale,Ir=t.resolvedLanguage||Nt,ia=t.languagePack?.translationsConfigFile}catch{}vo=!0}else typeof navigator=="object"&&!ra?($e=navigator.userAgent,yr=$e.indexOf("Windows")>=0,xr=$e.indexOf("Macintosh")>=0,Ql=($e.indexOf("Macintosh")>=0||$e.indexOf("iPad")>=0||$e.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ii=$e.indexOf("Linux")>=0,ta=$e?.indexOf("Mobi")>=0,go=!0,Ir=globalThis._VSCODE_NLS_LANGUAGE||Nt,Tr=navigator.language.toLowerCase(),bo=Tr):console.error("Unable to resolve platform.");var Xn=0;xr?Xn=1:yr?Xn=3:Ii&&(Xn=2);var wr=yr,Te=xr,Zn=Ii;var Dr=vo;var na=go&&typeof Ve.importScripts=="function",xu=na?Ve.origin:void 0;var Fe=$e,st=Ir,sa;(i=>{function s(){return st}i.value=s;function t(){return st.length===2?st==="en":st.length>=3?st[0]==="e"&&st[1]==="n"&&st[2]==="-":!1}i.isDefaultVariant=t;function e(){return st==="en"}i.isDefault=e})(sa||={});var oa=typeof Ve.postMessage=="function"&&!Ve.importScripts,Eo=(()=>{if(oa){let s=[];Ve.addEventListener("message",e=>{if(e.data&&e.data.vscodeScheduleAsyncWork)for(let i=0,r=s.length;i{let i=++t;s.push({id:i,callback:e}),Ve.postMessage({vscodeScheduleAsyncWork:i},"*")}}return s=>setTimeout(s)})();var la=!!(Fe&&Fe.indexOf("Chrome")>=0),wu=!!(Fe&&Fe.indexOf("Firefox")>=0),Du=!!(!la&&Fe&&Fe.indexOf("Safari")>=0),Ru=!!(Fe&&Fe.indexOf("Edg/")>=0),Lu=!!(Fe&&Fe.indexOf("Android")>=0);var ot=typeof navigator=="object"?navigator:{},aa={clipboard:{writeText:Dr||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(ot&&ot.clipboard&&ot.clipboard.writeText),readText:Dr||!!(ot&&ot.clipboard&&ot.clipboard.readText)},keyboard:Dr||_o()?0:ot.keyboard||Sr?1:2,touch:"ontouchstart"in fe||ot.maxTouchPoints>0,pointerEvents:fe.PointerEvent&&("ontouchstart"in fe||navigator.maxTouchPoints>0)};var yi=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},Jn=new yi,To=new yi,Io=new yi,yo=new Array(230);var Qn;(o=>{function s(l){return Jn.keyCodeToStr(l)}o.toString=s;function t(l){return Jn.strToKeyCode(l)}o.fromString=t;function e(l){return To.keyCodeToStr(l)}o.toUserSettingsUS=e;function i(l){return Io.keyCodeToStr(l)}o.toUserSettingsGeneral=i;function r(l){return To.strToKeyCode(l)||Io.strToKeyCode(l)}o.fromUserSettings=r;function n(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Jn.keyCodeToStr(l)}o.toElectronAccelerator=n})(Qn||={});var Rr=class s{constructor(t,e,i,r,n){this.ctrlKey=t;this.shiftKey=e;this.altKey=i;this.metaKey=r;this.keyCode=n}equals(t){return t instanceof s&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",e=this.shiftKey?"1":"0",i=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${e}${i}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new es([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}};var es=class{constructor(t){if(t.length===0)throw eo("chords");this.chords=t}getHashCode(){let t="";for(let e=0,i=this.chords.length;e{function s(r){return r===i.None||r===i.Cancelled||r instanceof ts?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}i.isCancellationToken=s,i.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:$.None}),i.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Do})})(ma||={});var ts=class{constructor(){this._isCancelled=!1;this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Do:(this._emitter||(this._emitter=new v),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var _a=Symbol("MicrotaskDelay");var Ye=class{constructor(t,e){this._isDisposed=!1;this._token=-1,typeof t=="function"&&typeof e=="number"&&this.setIfNotSet(t,e)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,e){if(this._isDisposed)throw new Rt("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},e)}setIfNotSet(t,e){if(this._isDisposed)throw new Rt("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},e))}},kr=class{constructor(){this.disposable=void 0;this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(t,e,i=globalThis){if(this.isDisposed)throw new Rt("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{t()},e);this.disposable=C(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};var ba,Ar;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Ar=(s,t)=>{Eo(()=>{if(e)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let e=!1;return{dispose(){e||(e=!0)}}}:Ar=(s,t,e)=>{let i=s.requestIdleCallback(t,typeof e=="number"?{timeout:e}:void 0),r=!1;return{dispose(){r||(r=!0,s.cancelIdleCallback(i))}}},ba=s=>Ar(globalThis,s)})();var va;(e=>{async function s(i){let r,n=await Promise.all(i.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}e.settled=s;function t(i){return new Promise(async(r,n)=>{try{await i(r,n)}catch(o){n(o)}})}e.withAsyncBody=t})(va||={});var _e=class _e{static fromArray(t){return new _e(e=>{e.emitMany(t)})}static fromPromise(t){return new _e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new _e(async e=>{await Promise.all(t.map(async i=>e.emitOne(await i)))})}static merge(t){return new _e(async e=>{await Promise.all(t.map(async i=>{for await(let r of i)e.emitOne(r)}))})}constructor(t,e){this._state=0,this._results=[],this._error=null,this._onReturn=e,this._onStateChanged=new v,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,e){return new _e(async i=>{for await(let r of t)i.emitOne(e(r))})}map(t){return _e.map(this,t)}static filter(t,e){return new _e(async i=>{for await(let r of t)e(r)&&i.emitOne(r)})}filter(t){return _e.filter(this,t)}static coalesce(t){return _e.filter(t,e=>!!e)}coalesce(){return _e.coalesce(this)}static async toPromise(t){let e=[];for await(let i of t)e.push(i);return e}toPromise(){return _e.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};_e.EMPTY=_e.fromArray([]);var Ro=_e;function Lo(s){return 55296<=s&&s<=56319}function is(s){return 56320<=s&&s<=57343}function Ao(s,t){return(s-55296<<10)+(t-56320)+65536}function Mo(s){return ns(s,0)}function ns(s,t){switch(typeof s){case"object":return s===null?je(349,t):Array.isArray(s)?Ea(s,t):Ta(s,t);case"string":return Po(s,t);case"boolean":return Sa(s,t);case"number":return je(s,t);case"undefined":return je(937,t);default:return je(617,t)}}function je(s,t){return(t<<5)-t+s|0}function Sa(s,t){return je(s?433:863,t)}function Po(s,t){t=je(149417,t);for(let e=0,i=s.length;ens(i,e),t)}function Ta(s,t){return t=je(181387,t),Object.keys(s).sort().reduce((e,i)=>(e=Po(i,e),ns(s[i],e)),t)}function rs(s,t,e=32){let i=e-t,r=~((1<>>i)>>>0}function ko(s,t=0,e=s.byteLength,i=0){for(let r=0;re.toString(16).padStart(2,"0")).join(""):Ia((s>>>0).toString(16),t/4)}var Cr=class Cr{constructor(){this._h0=1732584193;this._h1=4023233417;this._h2=2562383102;this._h3=271733878;this._h4=3285377520;this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let e=t.length;if(e===0)return;let i=this._buff,r=this._buffLen,n=this._leftoverHighSurrogate,o,l;for(n!==0?(o=n,l=-1,n=0):(o=t.charCodeAt(0),l=0);;){let a=o;if(Lo(o))if(l+1>>6,t[e++]=128|(i&63)>>>0):i<65536?(t[e++]=224|(i&61440)>>>12,t[e++]=128|(i&4032)>>>6,t[e++]=128|(i&63)>>>0):(t[e++]=240|(i&1835008)>>>18,t[e++]=128|(i&258048)>>>12,t[e++]=128|(i&4032)>>>6,t[e++]=128|(i&63)>>>0),e>=64&&(this._step(),e-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),e}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),wi(this._h0)+wi(this._h1)+wi(this._h2)+wi(this._h3)+wi(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,ko(this._buff,this._buffLen),this._buffLen>56&&(this._step(),ko(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=Cr._bigBlock32,e=this._buffDV;for(let c=0;c<64;c+=4)t.setUint32(c,e.getUint32(c,!1),!1);for(let c=64;c<320;c+=4)t.setUint32(c,rs(t.getUint32(c-12,!1)^t.getUint32(c-32,!1)^t.getUint32(c-56,!1)^t.getUint32(c-64,!1),1),!1);let i=this._h0,r=this._h1,n=this._h2,o=this._h3,l=this._h4,a,u,h;for(let c=0;c<80;c++)c<20?(a=r&n|~r&o,u=1518500249):c<40?(a=r^n^o,u=1859775393):c<60?(a=r&n|r&o|n&o,u=2400959708):(a=r^n^o,u=3395469782),h=rs(i,5)+a+l+u+t.getUint32(c*4,!1)&4294967295,l=o,o=n,n=rs(r,30),r=i,i=h;this._h0=this._h0+i&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+n&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+l&4294967295}};Cr._bigBlock32=new DataView(new ArrayBuffer(320));var Co=Cr;var{registerWindow:Bh,getWindow:be,getDocument:Nh,getWindows:Fh,getWindowsCount:Hh,getWindowId:Oo,getWindowById:Wh,hasWindow:Uh,onDidRegisterWindow:No,onWillUnregisterWindow:Kh,onDidUnregisterWindow:zh}=function(){let s=new Map;fe;let t={window:fe,disposables:new Ee};s.set(fe.vscodeWindowId,t);let e=new v,i=new v,r=new v;function n(o,l){return(typeof o=="number"?s.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:e.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(o){if(s.has(o.vscodeWindowId))return D.None;let l=new Ee,a={window:o,disposables:l.add(new Ee)};return s.set(o.vscodeWindowId,a),l.add(C(()=>{s.delete(o.vscodeWindowId),i.fire(o)})),l.add(L(o,Y.BEFORE_UNLOAD,()=>{r.fire(o)})),e.fire(a),l},getWindows(){return s.values()},getWindowsCount(){return s.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return s.has(o)},getWindowById:n,getWindow(o){let l=o;if(l?.ownerDocument?.defaultView)return l.ownerDocument.defaultView.window;let a=o;return a?.view?a.view.window:fe},getDocument(o){return be(o).document}}}();var ss=class{constructor(t,e,i,r){this._node=t,this._type=e,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function L(s,t,e,i){return new ss(s,t,e,i)}function ya(s,t){return function(e){return t(new qe(s,e))}}function xa(s){return function(t){return s(new ft(t))}}var os=function(t,e,i,r){let n=i;return e==="click"||e==="mousedown"||e==="contextmenu"?n=ya(be(t),i):(e==="keydown"||e==="keypress"||e==="keyup")&&(n=xa(i)),L(t,e,n,r)};var wa,mt;var Mr=class extends kr{constructor(t){super(),this.defaultTarget=t&&be(t)}cancelAndSet(t,e,i){return super.cancelAndSet(t,e,i??this.defaultTarget)}},Di=class{constructor(t,e=0){this._runner=t,this.priority=e,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(t){Lt(t)}}static sort(t,e){return e.priority-t.priority}};(function(){let s=new Map,t=new Map,e=new Map,i=new Map,r=n=>{e.set(n,!1);let o=s.get(n)??[];for(t.set(n,o),s.set(n,[]),i.set(n,!0);o.length>0;)o.sort(Di.sort),o.shift().execute();i.set(n,!1)};mt=(n,o,l=0)=>{let a=Oo(n),u=new Di(o,l),h=s.get(a);return h||(h=[],s.set(a,h)),h.push(u),e.get(a)||(e.set(a,!0),n.requestAnimationFrame(()=>r(a))),u},wa=(n,o,l)=>{let a=Oo(n);if(i.get(a)){let u=new Di(o,l),h=t.get(a);return h||(h=[],t.set(a,h)),h.push(u),u}else return mt(n,o,l)}})();var pt=class pt{constructor(t,e){this.width=t;this.height=e}with(t=this.width,e=this.height){return t!==this.width||e!==this.height?new pt(t,e):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof pt?t:new pt(t.width,t.height)}static equals(t,e){return t===e?!0:!t||!e?!1:t.width===e.width&&t.height===e.height}};pt.None=new pt(0,0);var Bo=pt;function Fo(s){let t=s.getBoundingClientRect(),e=be(s);return{left:t.left+e.scrollX,top:t.top+e.scrollY,width:t.width,height:t.height}}var Gh=new class{constructor(){this.mutationObservers=new Map}observe(s,t,e){let i=this.mutationObservers.get(s);i||(i=new Map,this.mutationObservers.set(s,i));let r=Mo(e),n=i.get(r);if(n)n.users+=1;else{let o=new v,l=new MutationObserver(u=>o.fire(u));l.observe(s,e);let a=n={users:1,observer:l,onDidMutate:o.event};t.add(C(()=>{a.users-=1,a.users===0&&(o.dispose(),l.disconnect(),i?.delete(r),i?.size===0&&this.mutationObservers.delete(s))})),i.set(r,n)}return n.onDidMutate}};var Y={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:Bt?"webkitAnimationStart":"animationstart",ANIMATION_END:Bt?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Bt?"webkitAnimationIteration":"animationiteration"};var Da=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Ho(s,t,e,...i){let r=Da.exec(t);if(!r)throw new Error("Bad use of emmet");let n=r[1]||"div",o;return s!=="http://www.w3.org/1999/xhtml"?o=document.createElementNS(s,n):o=document.createElement(n),r[3]&&(o.id=r[3]),r[4]&&(o.className=r[4].replace(/\./g," ").trim()),e&&Object.entries(e).forEach(([l,a])=>{typeof a>"u"||(/^on\w+$/.test(l)?o[l]=a:l==="selected"?a&&o.setAttribute(l,"true"):o.setAttribute(l,a))}),o.append(...i),o}function Ra(s,t,...e){return Ho("http://www.w3.org/1999/xhtml",s,t,...e)}Ra.SVG=function(s,t,...e){return Ho("http://www.w3.org/2000/svg",s,t,...e)};var ls=class{constructor(t){this.domNode=t;this._maxWidth="";this._width="";this._height="";this._top="";this._left="";this._bottom="";this._right="";this._paddingTop="";this._paddingLeft="";this._paddingBottom="";this._paddingRight="";this._fontFamily="";this._fontWeight="";this._fontSize="";this._fontStyle="";this._fontFeatureSettings="";this._fontVariationSettings="";this._textDecoration="";this._lineHeight="";this._letterSpacing="";this._className="";this._display="";this._position="";this._visibility="";this._color="";this._backgroundColor="";this._layerHint=!1;this._contain="none";this._boxShadow=""}setMaxWidth(t){let e=Ie(t);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let e=Ie(t);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(t){let e=Ie(t);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(t){let e=Ie(t);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(t){let e=Ie(t);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(t){let e=Ie(t);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(t){let e=Ie(t);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(t){let e=Ie(t);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let e=Ie(t);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let e=Ie(t);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let e=Ie(t);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let e=Ie(t);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let e=Ie(t);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let e=Ie(t);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,e){this.domNode.classList.toggle(t,e),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,e){this.domNode.setAttribute(t,e)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function Ie(s){return typeof s=="number"?`${s}px`:s}function _t(s){return new ls(s)}var Wt=class{constructor(){this._hooks=new Ee;this._pointerMoveCallback=null;this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(t,e){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,t&&i&&i(e)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(t,e,i,r,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=n;let o=t;try{t.setPointerCapture(e),this._hooks.add(C(()=>{try{t.releasePointerCapture(e)}catch{}}))}catch{o=be(t)}this._hooks.add(L(o,Y.POINTER_MOVE,l=>{if(l.buttons!==i){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(L(o,Y.POINTER_UP,l=>this.stopMonitoring(!0)))}};function Wo(s,t,e){let i=null,r=null;if(typeof e.value=="function"?(i="value",r=e.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof e.get=="function"&&(i="get",r=e.get),!r)throw new Error("not supported");let n=`$memoize$${t}`;e[i]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[n]}}var He;(n=>(n.Tap="-xterm-gesturetap",n.Change="-xterm-gesturechange",n.Start="-xterm-gesturestart",n.End="-xterm-gesturesend",n.Contextmenu="-xterm-gesturecontextmenu"))(He||={});var Q=class Q extends D{constructor(){super();this.dispatched=!1;this.targets=new Ct;this.ignoreTargets=new Ct;this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register($.runAndSubscribe(No,({window:e,disposables:i})=>{i.add(L(e.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add(L(e.document,"touchend",r=>this.onTouchEnd(e,r))),i.add(L(e.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:fe,disposables:this._store}))}static addTarget(e){if(!Q.isTouchDevice())return D.None;Q.INSTANCE||(Q.INSTANCE=Gn(new Q));let i=Q.INSTANCE.targets.push(e);return C(i)}static ignoreTarget(e){if(!Q.isTouchDevice())return D.None;Q.INSTANCE||(Q.INSTANCE=Gn(new Q));let i=Q.INSTANCE.ignoreTargets.push(e);return C(i)}static isTouchDevice(){return"ontouchstart"in fe||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,n=e.targetTouches.length;r=Q.HOLD_DELAY&&Math.abs(u.initialPageX-Se(u.rollingPageX))<30&&Math.abs(u.initialPageY-Se(u.rollingPageY))<30){let c=this.newGestureEvent(He.Contextmenu,u.initialTarget);c.pageX=Se(u.rollingPageX),c.pageY=Se(u.rollingPageY),this.dispatchEvent(c)}else if(n===1){let c=Se(u.rollingPageX),d=Se(u.rollingPageY),_=Se(u.rollingTimestamps)-u.rollingTimestamps[0],p=c-u.rollingPageX[0],m=d-u.rollingPageY[0],f=[...this.targets].filter(A=>u.initialTarget instanceof Node&&A.contains(u.initialTarget));this.inertia(e,f,r,Math.abs(p)/_,p>0?1:-1,c,Math.abs(m)/_,m>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(He.End,u.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let r=document.createEvent("CustomEvent");return r.initEvent(e,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(e){if(e.type===He.Tap){let i=new Date().getTime(),r=0;i-this._lastSetTapCountTime>Q.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=i,e.tapCount=r}else(e.type===He.Change||e.type===He.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(e.initialTarget))return;let i=[];for(let r of this.targets)if(r.contains(e.initialTarget)){let n=0,o=e.initialTarget;for(;o&&o!==r;)n++,o=o.parentElement;i.push([n,r])}i.sort((r,n)=>r[0]-n[0]);for(let[r,n]of i)n.dispatchEvent(e),this.dispatched=!0}}inertia(e,i,r,n,o,l,a,u,h){this.handle=mt(e,()=>{let c=Date.now(),d=c-r,_=0,p=0,m=!0;n+=Q.SCROLL_FRICTION*d,a+=Q.SCROLL_FRICTION*d,n>0&&(m=!1,_=o*n*d),a>0&&(m=!1,p=u*a*d);let f=this.newGestureEvent(He.Change);f.translationX=_,f.translationY=p,i.forEach(A=>A.dispatchEvent(f)),m||this.inertia(e,i,c,n,o,l+_,a,u,h+p)})}onTouchMove(e){let i=Date.now();for(let r=0,n=e.changedTouches.length;r3&&(l.rollingPageX.shift(),l.rollingPageY.shift(),l.rollingTimestamps.shift()),l.rollingPageX.push(o.pageX),l.rollingPageY.push(o.pageY),l.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};Q.SCROLL_FRICTION=-.005,Q.HOLD_DELAY=700,Q.CLEAR_TAP_COUNT_TIME=400,M([Wo],Q,"isTouchDevice",1);var Pr=Q;var lt=class extends D{onclick(t,e){this._register(L(t,Y.CLICK,i=>e(new qe(be(t),i))))}onmousedown(t,e){this._register(L(t,Y.MOUSE_DOWN,i=>e(new qe(be(t),i))))}onmouseover(t,e){this._register(L(t,Y.MOUSE_OVER,i=>e(new qe(be(t),i))))}onmouseleave(t,e){this._register(L(t,Y.MOUSE_LEAVE,i=>e(new qe(be(t),i))))}onkeydown(t,e){this._register(L(t,Y.KEY_DOWN,i=>e(new ft(i))))}onkeyup(t,e){this._register(L(t,Y.KEY_UP,i=>e(new ft(i))))}oninput(t,e){this._register(L(t,Y.INPUT,e))}onblur(t,e){this._register(L(t,Y.BLUR,e))}onfocus(t,e){this._register(L(t,Y.FOCUS,e))}onchange(t,e){this._register(L(t,Y.CHANGE,e))}ignoreGesture(t){return Pr.ignoreTarget(t)}};var Uo=11,Or=class extends lt{constructor(t){super(),this._onActivate=t.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=t.bgWidth+"px",this.bgDomNode.style.height=t.bgHeight+"px",typeof t.top<"u"&&(this.bgDomNode.style.top="0px"),typeof t.left<"u"&&(this.bgDomNode.style.left="0px"),typeof t.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof t.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=t.className,this.domNode.style.position="absolute",this.domNode.style.width=Uo+"px",this.domNode.style.height=Uo+"px",typeof t.top<"u"&&(this.domNode.style.top=t.top+"px"),typeof t.left<"u"&&(this.domNode.style.left=t.left+"px"),typeof t.bottom<"u"&&(this.domNode.style.bottom=t.bottom+"px"),typeof t.right<"u"&&(this.domNode.style.right=t.right+"px"),this._pointerMoveMonitor=this._register(new Wt),this._register(os(this.bgDomNode,Y.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(os(this.domNode,Y.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new Mr),this._pointerdownScheduleRepeatTimer=this._register(new Ye)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,be(t))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),t.preventDefault()}};var cs=class s{constructor(t,e,i,r,n,o,l){this._forceIntegerValues=t;this._scrollStateBrand=void 0;this._forceIntegerValues&&(e=e|0,i=i|0,r=r|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=r,this.rawScrollTop=l,e<0&&(e=0),r+e>i&&(r=i-e),r<0&&(r=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=e,this.scrollWidth=i,this.scrollLeft=r,this.height=n,this.scrollHeight=o,this.scrollTop=l}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,e){return new s(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,e?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,e?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new s(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,e){let i=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,n=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,a=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:e,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:a}}},Ri=class extends D{constructor(e){super();this._scrollableBrand=void 0;this._onScroll=this._register(new v);this.onScroll=this._onScroll.event;this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new cs(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,i){let r=this._state.withScrollDimensions(e,i);this._setState(r,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let i=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(i,!1)}setScrollPositionSmooth(e,i){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let n;i?n=new Nr(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=Nr.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),i=this._state.withScrollPosition(e);if(this._setState(i,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,i){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,i)))}},Br=class{constructor(t,e,i){this.scrollLeft=t,this.scrollTop=e,this.isDone=i}};function as(s,t){let e=t-s;return function(i){return s+e*ka(i)}}function La(s,t,e){return function(i){return i2.5*i){let n,o;return t{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(t){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(t?" fade":"")))}};var Ca=140,Ut=class extends lt{constructor(t){super(),this._lazyRender=t.lazyRender,this._host=t.host,this._scrollable=t.scrollable,this._scrollByPage=t.scrollByPage,this._scrollbarState=t.scrollbarState,this._visibilityController=this._register(new Fr(t.visibility,"visible scrollbar "+t.extraScrollbarClassName,"invisible scrollbar "+t.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Wt),this._shouldRender=!0,this.domNode=_t(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(L(this.domNode.domNode,Y.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(t){let e=this._register(new Or(t));this.domNode.domNode.appendChild(e.bgDomNode),this.domNode.domNode.appendChild(e.domNode)}_createSlider(t,e,i,r){this.slider=_t(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(t),this.slider.setLeft(e),typeof i=="number"&&this.slider.setWidth(i),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(L(this.slider.domNode,Y.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.stopPropagation()})}_onElementSize(t){return this._scrollbarState.setVisibleSize(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(t){return this._scrollbarState.setScrollSize(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(t){return this._scrollbarState.setScrollPosition(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(t){t.target===this.domNode.domNode&&this._onPointerDown(t)}delegatePointerDown(t){let e=this.domNode.domNode.getClientRects()[0].top,i=e+this._scrollbarState.getSliderPosition(),r=e+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(t);i<=n&&n<=r?t.button===0&&(t.preventDefault(),this._sliderPointerDown(t)):this._onPointerDown(t)}_onPointerDown(t){let e,i;if(t.target===this.domNode.domNode&&typeof t.offsetX=="number"&&typeof t.offsetY=="number")e=t.offsetX,i=t.offsetY;else{let n=Fo(this.domNode.domNode);e=t.pageX-n.left,i=t.pageY-n.top}let r=this._pointerDownRelativePosition(e,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),t.button===0&&(t.preventDefault(),this._sliderPointerDown(t))}_sliderPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=this._sliderPointerPosition(t),i=this._sliderOrthogonalPointerPosition(t),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,n=>{let o=this._sliderOrthogonalPointerPosition(n),l=Math.abs(o-i);if(wr&&l>Ca){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let u=this._sliderPointerPosition(n)-e;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(u))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(t){let e={};this.writeScrollPosition(e,t),this._scrollable.setScrollPositionNow(e)}updateScrollbarSize(t){this._updateScrollbarSize(t),this._scrollbarState.setScrollbarSize(t),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}};var Kt=class s{constructor(t,e,i,r,n,o){this._scrollbarSize=Math.round(e),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new s(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let e=Math.round(t);return this._visibleSize!==e?(this._visibleSize=e,this._refreshComputedValues(),!0):!1}setScrollSize(t){let e=Math.round(t);return this._scrollSize!==e?(this._scrollSize=e,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let e=Math.round(t);return this._scrollPosition!==e?(this._scrollPosition=e,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,e,i,r,n){let o=Math.max(0,i-t),l=Math.max(0,o-2*e),a=r>0&&r>i;if(!a)return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let u=Math.round(Math.max(20,Math.floor(i*l/r))),h=(l-u)/(r-i),c=n*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(u),computedSliderRatio:h,computedSliderPosition:Math.round(c)}}_refreshComputedValues(){let t=s._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let e=t-this._arrowSize-this._computedSliderSize/2;return Math.round(e/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let e=t-this._arrowSize,i=this._scrollPosition;return e0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),e){let r=Math.abs(t.deltaX),n=Math.abs(t.deltaY),o=Math.abs(e.deltaX),l=Math.abs(e.deltaY),a=Math.max(Math.min(r,o),1),u=Math.max(Math.min(n,l),1),h=Math.max(r,o),c=Math.max(n,l);h%a===0&&c%u===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};zr.INSTANCE=new zr;var hs=zr,ds=class extends lt{constructor(e,i,r){super();this._onScroll=this._register(new v);this.onScroll=this._onScroll.event;this._onWillScroll=this._register(new v);this.onWillScroll=this._onWillScroll.event;this._options=Pa(i),this._scrollable=r,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let n={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Ur(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new Wr(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=_t(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=_t(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=_t(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,o=>this._onMouseOver(o)),this.onmouseleave(this._listenOnDomNode,o=>this._onMouseLeave(o)),this._hideTimeout=this._register(new Ye),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ne(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Te&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new xi(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Ne(this._mouseWheelToDispose),e)){let r=n=>{this._onMouseWheel(new xi(n))};this._mouseWheelToDispose.push(L(this._listenOnDomNode,Y.MOUSE_WHEEL,r,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let i=hs.INSTANCE;zo&&i.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,l=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&l+o===0?l=o=0:Math.abs(o)>=Math.abs(l)?l=0:o=0),this._options.flipAxes&&([o,l]=[l,o]);let a=!Te&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!l&&(l=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let u=this._scrollable.getFutureScrollPosition(),h={};if(o){let c=Ko*o,d=u.scrollTop-(c<0?Math.floor(c):Math.ceil(c));this._verticalScrollbar.writeScrollPosition(h,d)}if(l){let c=Ko*l,d=u.scrollLeft-(c<0?Math.floor(c):Math.ceil(c));this._horizontalScrollbar.writeScrollPosition(h,d)}h=this._scrollable.validateScrollPosition(h),(u.scrollLeft!==h.scrollLeft||u.scrollTop!==h.scrollTop)&&(zo&&this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),r=!0)}let n=r;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),i=e.scrollTop>0,r=e.scrollLeft>0,n=r?" left":"",o=i?" top":"",l=r||i?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${o}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Ma)}};var Kr=class extends ds{constructor(t,e,i){super(t,e,i)}setScrollPosition(t){t.reuseAnimation?this._scrollable.setScrollPositionSmooth(t,t.reuseAnimation):this._scrollable.setScrollPositionNow(t)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Pa(s){let t={lazyRender:typeof s.lazyRender<"u"?s.lazyRender:!1,className:typeof s.className<"u"?s.className:"",useShadows:typeof s.useShadows<"u"?s.useShadows:!0,handleMouseWheel:typeof s.handleMouseWheel<"u"?s.handleMouseWheel:!0,flipAxes:typeof s.flipAxes<"u"?s.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof s.consumeMouseWheelIfScrollbarIsNeeded<"u"?s.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof s.alwaysConsumeMouseWheel<"u"?s.alwaysConsumeMouseWheel:!1,scrollYToX:typeof s.scrollYToX<"u"?s.scrollYToX:!1,mouseWheelScrollSensitivity:typeof s.mouseWheelScrollSensitivity<"u"?s.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof s.fastScrollSensitivity<"u"?s.fastScrollSensitivity:5,scrollPredominantAxis:typeof s.scrollPredominantAxis<"u"?s.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof s.mouseWheelSmoothScroll<"u"?s.mouseWheelSmoothScroll:!0,arrowSize:typeof s.arrowSize<"u"?s.arrowSize:11,listenOnDomNode:typeof s.listenOnDomNode<"u"?s.listenOnDomNode:null,horizontal:typeof s.horizontal<"u"?s.horizontal:1,horizontalScrollbarSize:typeof s.horizontalScrollbarSize<"u"?s.horizontalScrollbarSize:10,horizontalSliderSize:typeof s.horizontalSliderSize<"u"?s.horizontalSliderSize:0,horizontalHasArrows:typeof s.horizontalHasArrows<"u"?s.horizontalHasArrows:!1,vertical:typeof s.vertical<"u"?s.vertical:1,verticalScrollbarSize:typeof s.verticalScrollbarSize<"u"?s.verticalScrollbarSize:10,verticalHasArrows:typeof s.verticalHasArrows<"u"?s.verticalHasArrows:!1,verticalSliderSize:typeof s.verticalSliderSize<"u"?s.verticalSliderSize:0,scrollByPage:typeof s.scrollByPage<"u"?s.scrollByPage:!1};return t.horizontalSliderSize=typeof s.horizontalSliderSize<"u"?s.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof s.verticalSliderSize<"u"?s.verticalSliderSize:t.verticalScrollbarSize,Te&&(t.className+=" mac"),t}var zt=class extends D{constructor(e,i,r,n,o,l,a,u){super();this._bufferService=r;this._optionsService=a;this._renderService=u;this._onRequestScrollLines=this._register(new v);this.onRequestScrollLines=this._onRequestScrollLines.event;this._isSyncing=!1;this._isHandlingScroll=!1;this._suppressOnScrollHandler=!1;let h=this._register(new Ri({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>mt(n.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Kr(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register($.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(C(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(C(()=>this._styleElement.remove())),this._register($.runAndSubscribe(l.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${l.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${l.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${l.colors.scrollbarSliderActiveBackground.css};`,"}"].join(` -`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=i-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=i,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};zt=M([S(2,F),S(3,ae),S(4,rr),S(5,Re),S(6,H),S(7,ce)],zt);var Gt=class extends D{constructor(e,i,r,n,o){super();this._screenElement=e;this._bufferService=i;this._coreBrowserService=r;this._decorationService=n;this._renderService=o;this._decorationElements=new Map;this._altBufferIsActive=!1;this._dimensionsChanged=!1;this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(l=>this._removeDecoration(l))),this._register(C(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,i=e.element){if(!i)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?i.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Gt=M([S(1,F),S(2,ae),S(3,Be),S(4,ce)],Gt);var Gr=class{constructor(){this._zones=[];this._zonePool=[];this._zonePoolIndex=0;this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(t){if(t.options.overviewRulerOptions){for(let e of this._zones)if(e.color===t.options.overviewRulerOptions.color&&e.position===t.options.overviewRulerOptions.position){if(this._lineIntersectsZone(e,t.marker.line))return;if(this._lineAdjacentToZone(e,t.marker.line,t.options.overviewRulerOptions.position)){this._addLineToZone(e,t.marker.line);return}}if(this._zonePoolIndex=t.startBufferLine&&e<=t.endBufferLine}_lineAdjacentToZone(t,e,i){return e>=t.startBufferLine-this._linePadding[i||"full"]&&e<=t.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(t,e){t.startBufferLine=Math.min(t.startBufferLine,e),t.endBufferLine=Math.max(t.endBufferLine,e)}};var We={full:0,left:0,center:0,right:0},at={full:0,left:0,center:0,right:0},Li={full:0,left:0,center:0,right:0},bt=class extends D{constructor(e,i,r,n,o,l,a,u){super();this._viewportElement=e;this._screenElement=i;this._bufferService=r;this._decorationService=n;this._renderService=o;this._optionsService=l;this._themeService=a;this._coreBrowserService=u;this._colorZoneStore=new Gr;this._shouldUpdateDimensions=!0;this._shouldUpdateAnchor=!0;this._lastKnownBufferLength=0;this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(C(()=>this._canvas?.remove()));let h=this._canvas.getContext("2d");if(h)this._ctx=h;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);at.full=this._canvas.width,at.left=e,at.center=i,at.right=e,this._refreshDrawHeightConstants(),Li.full=1,Li.left=1,Li.center=1+at.left,Li.right=1+at.left+at.center}_refreshDrawHeightConstants(){We.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,i=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);We.left=i,We.center=i,We.right=i}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*We.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*We.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*We.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*We.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let i of this._decorationService.decorations)this._colorZoneStore.addDecoration(i);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)i.position!=="full"&&this._renderColorZone(i);for(let i of e)i.position==="full"&&this._renderColorZone(i);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Li[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-We[e.position||"full"]/2),at[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+We[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};bt=M([S(2,F),S(3,Be),S(4,ce),S(5,H),S(6,Re),S(7,ae)],bt);var b;(E=>(E.NUL="\0",E.SOH="",E.STX="",E.ETX="",E.EOT="",E.ENQ="",E.ACK="",E.BEL="\x07",E.BS="\b",E.HT=" ",E.LF=` -`,E.VT="\v",E.FF="\f",E.CR="\r",E.SO="",E.SI="",E.DLE="",E.DC1="",E.DC2="",E.DC3="",E.DC4="",E.NAK="",E.SYN="",E.ETB="",E.CAN="",E.EM="",E.SUB="",E.ESC="\x1B",E.FS="",E.GS="",E.RS="",E.US="",E.SP=" ",E.DEL="\x7F"))(b||={});var Ai;(g=>(g.PAD="\x80",g.HOP="\x81",g.BPH="\x82",g.NBH="\x83",g.IND="\x84",g.NEL="\x85",g.SSA="\x86",g.ESA="\x87",g.HTS="\x88",g.HTJ="\x89",g.VTS="\x8A",g.PLD="\x8B",g.PLU="\x8C",g.RI="\x8D",g.SS2="\x8E",g.SS3="\x8F",g.DCS="\x90",g.PU1="\x91",g.PU2="\x92",g.STS="\x93",g.CCH="\x94",g.MW="\x95",g.SPA="\x96",g.EPA="\x97",g.SOS="\x98",g.SGCI="\x99",g.SCI="\x9A",g.CSI="\x9B",g.ST="\x9C",g.OSC="\x9D",g.PM="\x9E",g.APC="\x9F"))(Ai||={});var fs;(t=>t.ST=`${b.ESC}\\`)(fs||={});var $t=class{constructor(t,e,i,r,n,o){this._textarea=t;this._compositionView=e;this._bufferService=i;this._optionsService=r;this._coreService=n;this._renderService=o;this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(t){this._compositionView.textContent=t.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(t){if(this._isComposing||this._isSendingComposition){if(t.keyCode===20||t.keyCode===229||t.keyCode===16||t.keyCode===17||t.keyCode===18)return!1;this._finalizeComposition(!1)}return t.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(t){if(this._compositionView.classList.remove("active"),this._isComposing=!1,t){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;e.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(e.start,this._compositionPosition.start):i=this._textarea.value.substring(e.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let t=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let e=this._textarea.value,i=e.replace(t,"");this._dataAlreadySent=i,e.length>t.length?this._coreService.triggerDataEvent(i,!0):e.lengththis.updateCompositionElements(!0),0)}}};$t=M([S(2,F),S(3,H),S(4,ge),S(5,ce)],$t);var ue=0,he=0,de=0,J=0,ps={css:"#00000000",rgba:0},j;(i=>{function s(r,n,o,l){return l!==void 0?`#${vt(r)}${vt(n)}${vt(o)}${vt(l)}`:`#${vt(r)}${vt(n)}${vt(o)}`}i.toCss=s;function t(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}i.toRgba=t;function e(r,n,o,l){return{css:i.toCss(r,n,o,l),rgba:i.toRgba(r,n,o,l)}}i.toColor=e})(j||={});var U;(l=>{function s(a,u){if(J=(u.rgba&255)/255,J===1)return{css:u.css,rgba:u.rgba};let h=u.rgba>>24&255,c=u.rgba>>16&255,d=u.rgba>>8&255,_=a.rgba>>24&255,p=a.rgba>>16&255,m=a.rgba>>8&255;ue=_+Math.round((h-_)*J),he=p+Math.round((c-p)*J),de=m+Math.round((d-m)*J);let f=j.toCss(ue,he,de),A=j.toRgba(ue,he,de);return{css:f,rgba:A}}l.blend=s;function t(a){return(a.rgba&255)===255}l.isOpaque=t;function e(a,u,h){let c=$r.ensureContrastRatio(a.rgba,u.rgba,h);if(c)return j.toColor(c>>24&255,c>>16&255,c>>8&255)}l.ensureContrastRatio=e;function i(a){let u=(a.rgba|255)>>>0;return[ue,he,de]=$r.toChannels(u),{css:j.toCss(ue,he,de),rgba:u}}l.opaque=i;function r(a,u){return J=Math.round(u*255),[ue,he,de]=$r.toChannels(a.rgba),{css:j.toCss(ue,he,de,J),rgba:j.toRgba(ue,he,de,J)}}l.opacity=r;function n(a,u){return J=a.rgba&255,r(a,J*u/255)}l.multiplyOpacity=n;function o(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}l.toColorRGB=o})(U||={});var z;(i=>{let s,t;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(s=n,s.globalCompositeOperation="copy",t=s.createLinearGradient(0,0,1,1))}catch{}function e(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return ue=parseInt(r.slice(1,2).repeat(2),16),he=parseInt(r.slice(2,3).repeat(2),16),de=parseInt(r.slice(3,4).repeat(2),16),j.toColor(ue,he,de);case 5:return ue=parseInt(r.slice(1,2).repeat(2),16),he=parseInt(r.slice(2,3).repeat(2),16),de=parseInt(r.slice(3,4).repeat(2),16),J=parseInt(r.slice(4,5).repeat(2),16),j.toColor(ue,he,de,J);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return ue=parseInt(n[1]),he=parseInt(n[2]),de=parseInt(n[3]),J=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),j.toColor(ue,he,de,J);if(!s||!t)throw new Error("css.toColor: Unsupported css format");if(s.fillStyle=t,s.fillStyle=r,typeof s.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(s.fillRect(0,0,1,1),[ue,he,de,J]=s.getImageData(0,0,1,1).data,J!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:j.toRgba(ue,he,de,J),css:r}}i.toColor=e})(z||={});var ve;(e=>{function s(i){return t(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=s;function t(i,r,n){let o=i/255,l=r/255,a=n/255,u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),h=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4);return u*.2126+h*.7152+c*.0722}e.relativeLuminance2=t})(ve||={});var $r;(n=>{function s(o,l){if(J=(l&255)/255,J===1)return l;let a=l>>24&255,u=l>>16&255,h=l>>8&255,c=o>>24&255,d=o>>16&255,_=o>>8&255;return ue=c+Math.round((a-c)*J),he=d+Math.round((u-d)*J),de=_+Math.round((h-_)*J),j.toRgba(ue,he,de)}n.blend=s;function t(o,l,a){let u=ve.relativeLuminance(o>>8),h=ve.relativeLuminance(l>>8);if(Xe(u,h)>8));if(m>8));return m>A?p:f}return p}let d=i(o,l,a),_=Xe(u,ve.relativeLuminance(d>>8));if(_>8));return _>m?d:p}return d}}n.ensureContrastRatio=t;function e(o,l,a){let u=o>>24&255,h=o>>16&255,c=o>>8&255,d=l>>24&255,_=l>>16&255,p=l>>8&255,m=Xe(ve.relativeLuminance2(d,_,p),ve.relativeLuminance2(u,h,c));for(;m0||_>0||p>0);)d-=Math.max(0,Math.ceil(d*.1)),_-=Math.max(0,Math.ceil(_*.1)),p-=Math.max(0,Math.ceil(p*.1)),m=Xe(ve.relativeLuminance2(d,_,p),ve.relativeLuminance2(u,h,c));return(d<<24|_<<16|p<<8|255)>>>0}n.reduceLuminance=e;function i(o,l,a){let u=o>>24&255,h=o>>16&255,c=o>>8&255,d=l>>24&255,_=l>>16&255,p=l>>8&255,m=Xe(ve.relativeLuminance2(d,_,p),ve.relativeLuminance2(u,h,c));for(;m>>0}n.increaseLuminance=i;function r(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}n.toChannels=r})($r||={});function vt(s){let t=s.toString(16);return t.length<2?"0"+t:t}function Xe(s,t){return s1){let c=this._getJoinedRanges(r,l,o,e,n);for(let d=0;d1){let h=this._getJoinedRanges(r,l,o,e,n);for(let c=0;c=di,E=y,x=this._workCell;if(_.length>0&&y===_[0][0]&&w){let W=_.shift(),An=this._isCellInSelection(W[0],e);for(O=W[0]+1;O=W[1],w?(g=!0,x=new Vr(this._workCell,t.translateToString(!0,W[0],W[1]),W[1]-W[0]),E=W[1]-1,T=x.getWidth()):di=W[1]}let N=this._isCellInSelection(y,e),Z=i&&y===o,te=Qe&&y>=h&&y<=c,Oe=!1;this._decorationService.forEachDecorationAtCell(y,e,void 0,W=>{Oe=!0});let ze=x.getChars()||we;if(ze===" "&&(x.isUnderline()||x.isOverline())&&(ze="\xA0"),Ke=T*a-u.get(ze,x.isBold(),x.isItalic()),!f)f=this._document.createElement("span");else if(A&&(N&&Pe||!N&&!Pe&&x.bg===I)&&(N&&Pe&&p.selectionForeground||x.fg===k)&&x.extended.ext===P&&te===oe&&Ke===Me&&!Z&&!g&&!Oe&&w){x.isInvisible()?R+=we:R+=ze,A++;continue}else A&&(f.textContent=R),f=this._document.createElement("span"),A=0,R="";if(I=x.bg,k=x.fg,P=x.extended.ext,oe=te,Me=Ke,Pe=N,g&&o>=y&&o<=E&&(o=y),!this._coreService.isCursorHidden&&Z&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&V.push("xterm-cursor-blink"),V.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline");break;default:break}}if(x.isBold()&&V.push("xterm-bold"),x.isItalic()&&V.push("xterm-italic"),x.isDim()&&V.push("xterm-dim"),x.isInvisible()?R=we:R=x.getChars()||we,x.isUnderline()&&(V.push(`xterm-underline-${x.extended.underlineStyle}`),R===" "&&(R="\xA0"),!x.isUnderlineColorDefault()))if(x.isUnderlineColorRGB())f.style.textDecorationColor=`rgb(${De.toColorRGB(x.getUnderlineColor()).join(",")})`;else{let W=x.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&x.isBold()&&W<8&&(W+=8),f.style.textDecorationColor=p.ansi[W].css}x.isOverline()&&(V.push("xterm-overline"),R===" "&&(R="\xA0")),x.isStrikethrough()&&V.push("xterm-strikethrough"),te&&(f.style.textDecoration="underline");let le=x.getFgColor(),et=x.getFgColorMode(),me=x.getBgColor(),ht=x.getBgColorMode(),fi=!!x.isInverse();if(fi){let W=le;le=me,me=W;let An=et;et=ht,ht=An}let tt,Qi,pi=!1;this._decorationService.forEachDecorationAtCell(y,e,void 0,W=>{W.options.layer!=="top"&&pi||(W.backgroundColorRGB&&(ht=50331648,me=W.backgroundColorRGB.rgba>>8&16777215,tt=W.backgroundColorRGB),W.foregroundColorRGB&&(et=50331648,le=W.foregroundColorRGB.rgba>>8&16777215,Qi=W.foregroundColorRGB),pi=W.options.layer==="top")}),!pi&&N&&(tt=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,me=tt.rgba>>8&16777215,ht=50331648,pi=!0,p.selectionForeground&&(et=50331648,le=p.selectionForeground.rgba>>8&16777215,Qi=p.selectionForeground)),pi&&V.push("xterm-decoration-top");let it;switch(ht){case 16777216:case 33554432:it=p.ansi[me],V.push(`xterm-bg-${me}`);break;case 50331648:it=j.toColor(me>>16,me>>8&255,me&255),this._addStyle(f,`background-color:#${qo((me>>>0).toString(16),"0",6)}`);break;case 0:default:fi?(it=p.foreground,V.push(`xterm-bg-${257}`)):it=p.background}switch(tt||x.isDim()&&(tt=U.multiplyOpacity(it,.5)),et){case 16777216:case 33554432:x.isBold()&&le<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(le+=8),this._applyMinimumContrast(f,it,p.ansi[le],x,tt,void 0)||V.push(`xterm-fg-${le}`);break;case 50331648:let W=j.toColor(le>>16&255,le>>8&255,le&255);this._applyMinimumContrast(f,it,W,x,tt,Qi)||this._addStyle(f,`color:#${qo(le.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(f,it,p.foreground,x,tt,Qi)||fi&&V.push(`xterm-fg-${257}`)}V.length&&(f.className=V.join(" "),V.length=0),!Z&&!g&&!Oe&&w?A++:f.textContent=R,Ke!==this.defaultSpacing&&(f.style.letterSpacing=`${Ke}px`),d.push(f),y=E}return f&&A&&(f.textContent=R),d}_applyMinimumContrast(t,e,i,r,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||$o(r.getCode()))return!1;let l=this._getContrastCache(r),a;if(!n&&!o&&(a=l.getColor(e.rgba,i.rgba)),a===void 0){let u=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);a=U.ensureContrastRatio(n||e,o||i,u),l.setColor((n||e).rgba,(o||i).rgba,a??null)}return a?(this._addStyle(t,`color:${a.css}`),!0):!1}_getContrastCache(t){return t.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(t,e){t.setAttribute("style",`${t.getAttribute("style")||""}${e};`)}_isCellInSelection(t,e){let i=this._selectionStart,r=this._selectionEnd;return!i||!r?!1:this._columnSelectMode?i[0]<=r[0]?t>=i[0]&&e>=i[1]&&t=i[1]&&t>=r[0]&&e<=r[1]:e>i[1]&&e=i[0]&&t=i[0]}};Vt=M([S(1,or),S(2,H),S(3,ae),S(4,ge),S(5,Be),S(6,Re)],Vt);function qo(s,t,e){for(;s.length0&&(this._flat[r]=l),l}let n=t;e&&(n+="B"),i&&(n+="I");let o=this._holey.get(n);if(o===void 0){let l=0;e&&(l|=1),i&&(l|=2),o=this._measure(t,l),o>0&&this._holey.set(n,o)}return o}_measure(t,e){let i=this._measureElements[e];return i.textContent=t.repeat(32),i.offsetWidth/32}};var ms=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,e,i,r=!1){if(this.selectionStart=e,this.selectionEnd=i,!e||!i||e[0]===i[0]&&e[1]===i[1]){this.clear();return}let n=t.buffers.active.ydisp,o=e[1]-n,l=i[1]-n,a=Math.max(o,0),u=Math.min(l,t.rows-1);if(a>=t.rows||u<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=l,this.viewportCappedStartRow=a,this.viewportCappedEndRow=u,this.startCol=e[0],this.endCol=i[0]}isCellSelected(t,e,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&i>=this.viewportCappedStartRow&&e=this.viewportCappedStartRow&&e>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i=this.startCol&&e=this.startCol):!1}};function Yo(){return new ms}var _s="xterm-dom-renderer-owner-",Le="xterm-rows",jr="xterm-fg-",jo="xterm-bg-",ki="xterm-focus",Xr="xterm-selection",Na=1,Yt=class extends D{constructor(e,i,r,n,o,l,a,u,h,c,d,_,p,m){super();this._terminal=e;this._document=i;this._element=r;this._screenElement=n;this._viewportElement=o;this._helperContainer=l;this._linkifier2=a;this._charSizeService=h;this._optionsService=c;this._bufferService=d;this._coreService=_;this._coreBrowserService=p;this._themeService=m;this._terminalClass=Na++;this._rowElements=[];this._selectionRenderModel=Yo();this.onRequestRedraw=this._register(new v).event;this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Le),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(Xr),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Vo(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(f=>this._injectCss(f))),this._injectCss(this._themeService.colors),this._rowFactory=u.createInstance(Vt,document),this._element.classList.add(_s+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(f=>this._handleLinkHover(f))),this._register(this._linkifier2.onHideLinkUnderline(f=>this._handleLinkLeave(f))),this._register(C(()=>{this._element.classList.remove(_s+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Yr(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${Le} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let i=`${this._terminalSelector} .${Le} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;i+=`${this._terminalSelector} .${Le} .xterm-dim { color: ${U.multiplyOpacity(e.foreground,.5).css};}`,i+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;i+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${n} { 50% { box-shadow: none; }}`,i+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${Le}.${ki} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Le}.${ki} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Le}.${ki} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${Le} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Le} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Le} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Le} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Le} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${Xr} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Xr} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Xr} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,a]of e.ansi.entries())i+=`${this._terminalSelector} .${jr}${l} { color: ${a.css}; }${this._terminalSelector} .${jr}${l}.xterm-dim { color: ${U.multiplyOpacity(a,.5).css}; }${this._terminalSelector} .${jo}${l} { background-color: ${a.css}; }`;i+=`${this._terminalSelector} .${jr}${257} { color: ${U.opaque(e.background).css}; }${this._terminalSelector} .${jr}${257}.xterm-dim { color: ${U.multiplyOpacity(U.opaque(e.background),.5).css}; }${this._terminalSelector} .${jo}${257} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let r=this._rowElements.length;r<=i;r++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(ki),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ki),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,r),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,r),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,l=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,u=this._document.createDocumentFragment();if(r){let h=e[0]>i[0];u.appendChild(this._createSelectionElement(l,h?i[0]:e[0],h?e[0]:i[0],a-l+1))}else{let h=n===l?e[0]:0,c=l===o?i[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(l,h,c));let d=a-l-1;if(u.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,d)),l!==a){let _=o===a?i[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(a,0,_))}}this._selectionContainer.appendChild(u)}_createSelectionElement(e,i,r,n=1){let o=this._document.createElement("div"),l=i*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(r-i);return l+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-l),o.style.height=`${n*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${l}px`,o.style.width=`${a}px`,o}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,i){let r=this._bufferService.buffer,n=r.ybase+r.y,o=Math.min(r.x,this._bufferService.cols-1),l=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,a=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=i;h++){let c=h+r.ydisp,d=this._rowElements[h],_=r.lines.get(c);if(!d||!_)break;d.replaceChildren(...this._rowFactory.createRow(_,c,c===n,a,u,o,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${_s}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,r,n,o,l){r<0&&(e=0),n<0&&(i=0);let a=this._bufferService.rows-1;r=Math.max(Math.min(r,a),0),n=Math.max(Math.min(n,a),0),o=Math.min(o,this._bufferService.cols);let u=this._bufferService.buffer,h=u.ybase+u.y,c=Math.min(u.x,o-1),d=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=r;m<=n;++m){let f=m+u.ydisp,A=this._rowElements[m],R=u.lines.get(f);if(!A||!R)break;A.replaceChildren(...this._rowFactory.createRow(R,f,f===h,_,p,c,d,this.dimensions.css.cell.width,this._widthCache,l?m===r?e:0:-1,l?(m===n?i:o)-1:-1))}}};Yt=M([S(7,xt),S(8,nt),S(9,H),S(10,F),S(11,ge),S(12,ae),S(13,Re)],Yt);var jt=class extends D{constructor(e,i,r){super();this._optionsService=r;this.width=0;this.height=0;this._onCharSizeChange=this._register(new v);this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new vs(this._optionsService))}catch{this._measureStrategy=this._register(new bs(e,i,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};jt=M([S(2,H)],jt);var Zr=class extends D{constructor(){super(...arguments);this._result={width:0,height:0}}_validateAndSet(e,i){e!==void 0&&e>0&&i!==void 0&&i>0&&(this._result.width=e,this._result.height=i)}},bs=class extends Zr{constructor(e,i,r){super();this._document=e;this._parentElement=i;this._optionsService=r;this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},vs=class extends Zr{constructor(e){super();this._optionsService=e;this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}};var Jr=class extends D{constructor(e,i,r){super();this._textarea=e;this._window=i;this.mainDocument=r;this._isFocused=!1;this._cachedIsFocused=void 0;this._screenDprMonitor=this._register(new gs(this._window));this._onDprChange=this._register(new v);this.onDprChange=this._onDprChange.event;this._onWindowChange=this._register(new v);this.onWindowChange=this._onWindowChange.event;this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register($.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(L(this._textarea,"focus",()=>this._isFocused=!0)),this._register(L(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},gs=class extends D{constructor(e){super();this._parentWindow=e;this._windowResizeListener=this._register(new ye);this._onDprChange=this._register(new v);this.onDprChange=this._onDprChange.event;this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(C(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=L(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}};var Qr=class extends D{constructor(){super();this.linkProviders=[];this._register(C(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let i=this.linkProviders.indexOf(e);i!==-1&&this.linkProviders.splice(i,1)}}}};function Ci(s,t,e){let i=e.getBoundingClientRect(),r=s.getComputedStyle(e),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-i.left-n,t.clientY-i.top-o]}function Xo(s,t,e,i,r,n,o,l,a){if(!n)return;let u=Ci(s,t,e);if(u)return u[0]=Math.ceil((u[0]+(a?o/2:0))/o),u[1]=Math.ceil(u[1]/l),u[0]=Math.min(Math.max(u[0],1),i+(a?1:0)),u[1]=Math.min(Math.max(u[1],1),r),u}var Xt=class{constructor(t,e){this._renderService=t;this._charSizeService=e}getCoords(t,e,i,r,n){return Xo(window,t,e,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(t,e){let i=Ci(window,t,e);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};Xt=M([S(0,ce),S(1,nt)],Xt);var en=class{constructor(t,e){this._renderCallback=t;this._coreBrowserService=e;this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(t){return this._refreshCallbacks.push(t),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(t,e,i){this._rowCount=i,t=t!==void 0?t:0,e=e!==void 0?e:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,e):e,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let t of this._refreshCallbacks)t(0);this._refreshCallbacks=[]}};var tn={};Ll(tn,{getSafariVersion:()=>Ha,isChromeOS:()=>Ts,isFirefox:()=>Ss,isIpad:()=>Wa,isIphone:()=>Ua,isLegacyEdge:()=>Fa,isLinux:()=>Bi,isMac:()=>Zt,isNode:()=>Mi,isSafari:()=>Zo,isWindows:()=>Es});var Mi=typeof process<"u"&&"title"in process,Pi=Mi?"node":navigator.userAgent,Oi=Mi?"node":navigator.platform,Ss=Pi.includes("Firefox"),Fa=Pi.includes("Edge"),Zo=/^((?!chrome|android).)*safari/i.test(Pi);function Ha(){if(!Zo)return 0;let s=Pi.match(/Version\/(\d+)/);return s===null||s.length<2?0:parseInt(s[1])}var Zt=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Oi),Wa=Oi==="iPad",Ua=Oi==="iPhone",Es=["Windows","Win16","Win32","WinCE"].includes(Oi),Bi=Oi.indexOf("Linux")>=0,Ts=/\bCrOS\b/.test(Pi);var rn=class{constructor(){this._tasks=[];this._i=0}enqueue(t){this._tasks.push(t),this._start()}flush(){for(;this._in){r-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-e))}ms`),this._start();return}r=n}this.clear()}},Is=class extends rn{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},ys=class extends rn{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Jt=!Mi&&"requestIdleCallback"in window?ys:Is,nn=class{constructor(){this._queue=new Jt}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}};var Qt=class extends D{constructor(e,i,r,n,o,l,a,u,h){super();this._rowCount=e;this._optionsService=r;this._charSizeService=n;this._coreService=o;this._coreBrowserService=u;this._renderer=this._register(new ye);this._pausedResizeTask=new nn;this._observerDisposable=this._register(new ye);this._isPaused=!1;this._needsFullRefresh=!1;this._isNextRenderRedrawOnly=!0;this._needsSelectionRefresh=!1;this._canvasWidth=0;this._canvasHeight=0;this._selectionState={start:void 0,end:void 0,columnSelectMode:!1};this._onDimensionsChange=this._register(new v);this.onDimensionsChange=this._onDimensionsChange.event;this._onRenderedViewportChange=this._register(new v);this.onRenderedViewportChange=this._onRenderedViewportChange.event;this._onRender=this._register(new v);this.onRender=this._onRender.event;this._onRefreshRequest=this._register(new v);this.onRefreshRequest=this._onRefreshRequest.event;this._renderDebouncer=new en((c,d)=>this._renderRows(c,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new xs(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(C(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(l.onDecorationRegistered(()=>this._fullRefresh())),this._register(l.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,!0))),this._register(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});r.observe(i),this._observerDisposable.value=C(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,i,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),i=Math.max(i,n.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(i=>this.refreshRows(i.start,i.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,r){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=r,this._renderer.value?.handleSelectionChanged(e,i,r)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Qt=M([S(2,H),S(3,nt),S(4,ge),S(5,Be),S(6,F),S(7,ae),S(8,Re)],Qt);var xs=class{constructor(t,e,i){this._coreBrowserService=t;this._coreService=e;this._onTimeout=i;this._start=0;this._end=0;this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Jo(s,t,e,i){let r=e.buffer.x,n=e.buffer.y;if(!e.buffer.hasScrollback)return Ga(r,n,s,t,e,i)+sn(n,t,e,i)+$a(r,n,s,t,e,i);let o;if(n===t)return o=r>s?"D":"C",Fi(Math.abs(r-s),Ni(o,i));o=n>t?"D":"C";let l=Math.abs(n-t),a=za(n>t?s:r,e)+(l-1)*e.cols+1+Ka(n>t?r:s,e);return Fi(a,Ni(o,i))}function Ka(s,t){return s-1}function za(s,t){return t.cols-s}function Ga(s,t,e,i,r,n){return sn(t,i,r,n).length===0?"":Fi(el(s,t,s,t-gt(t,r),!1,r).length,Ni("D",n))}function sn(s,t,e,i){let r=s-gt(s,e),n=t-gt(t,e),o=Math.abs(r-n)-Va(s,t,e);return Fi(o,Ni(Qo(s,t),i))}function $a(s,t,e,i,r,n){let o;sn(t,i,r,n).length>0?o=i-gt(i,r):o=t;let l=i,a=qa(s,t,e,i,r,n);return Fi(el(s,o,e,l,a==="C",r).length,Ni(a,n))}function Va(s,t,e){let i=0,r=s-gt(s,e),n=t-gt(t,e);for(let o=0;o=0&&s0?o=i-gt(i,r):o=t,s=e&&ot?"A":"B"}function el(s,t,e,i,r,n){let o=s,l=t,a="";for(;(o!==e||l!==i)&&l>=0&&ln.cols-1?(a+=n.buffer.translateBufferLineToString(l,!1,s,o),o=0,s=0,l++):!r&&o<0&&(a+=n.buffer.translateBufferLineToString(l,!1,0,s+1),o=n.cols-1,s=o,l--);return a+n.buffer.translateBufferLineToString(l,!1,s,o)}function Ni(s,t){let e=t?"O":"[";return b.ESC+e+s}function Fi(s,t){s=Math.floor(s);let e="";for(let i=0;ithis._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function ws(s,t){if(s.start.y>s.end.y)throw new Error(`Buffer range end (${s.end.x}, ${s.end.y}) cannot be before start (${s.start.x}, ${s.start.y})`);return t*(s.end.y-s.start.y)+(s.end.x-s.start.x+1)}var Ds=50,Ya=15,ja=50,Xa=500,Za="\xA0",Ja=new RegExp(Za,"g");var ei=class extends D{constructor(e,i,r,n,o,l,a,u,h){super();this._element=e;this._screenElement=i;this._linkifier=r;this._bufferService=n;this._coreService=o;this._mouseService=l;this._optionsService=a;this._renderService=u;this._coreBrowserService=h;this._dragScrollAmount=0;this._enabled=!0;this._workCell=new q;this._mouseDownTimeStamp=0;this._oldHasSelection=!1;this._oldSelectionStart=void 0;this._oldSelectionEnd=void 0;this._onLinuxMouseSelection=this._register(new v);this.onLinuxMouseSelection=this._onLinuxMouseSelection.event;this._onRedrawRequest=this._register(new v);this.onRequestRedraw=this._onRedrawRequest.event;this._onSelectionChange=this._register(new v);this.onSelectionChange=this._onSelectionChange.event;this._onRequestScrollLines=this._register(new v);this.onRequestScrollLines=this._onRequestScrollLines.event;this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new on(this._bufferService),this._activeSelectionMode=0,this._register(C(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!e||!i?!1:e[0]!==i[0]||e[1]!==i[1]}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let r=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let l=e[0]l.replace(Ja," ")).join(Es?`\r -`:` -`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Bi&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let i=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n||!i?!1:this._areCoordsInSelection(i,r,n)}isCellInSelection(e,i){let r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n?!1:this._areCoordsInSelection([e,i],r,n)}_areCoordsInSelection(e,i,r){return e[1]>i[1]&&e[1]=i[0]&&e[0]=i[0]}_selectWordAtCursor(e,i){let r=this._linkifier.currentLink?.link?.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=ws(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,i),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=Ci(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=r?0:(i>r&&(i-=r),i=Math.min(Math.max(i,-Ds),Ds),i/=Ds,i/Math.abs(i)+Math.round(i*(Ya-1)))}shouldForceSelection(e){return Zt?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),ja)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&i.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(Zt&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&ithis._handleTrim(i))}_convertViewportColToCharacterIndex(e,i){let r=i;for(let n=0;i>=n;n++){let o=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:o>1&&i!==n&&(r+=o-1)}return r}setSelection(e,i,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,l=o.lines.get(e[1]);if(!l)return;let a=o.translateBufferLineToString(e[1],!1),u=this._convertViewportColToCharacterIndex(l,e[0]),h=u,c=e[0]-u,d=0,_=0,p=0,m=0;if(a.charAt(u)===" "){for(;u>0&&a.charAt(u-1)===" ";)u--;for(;h1&&(m+=I-1,h+=I-1);R>0&&u>0&&!this._isCharWordSeparator(l.loadCell(R-1,this._workCell));){l.loadCell(R-1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,R--):k>1&&(p+=k-1,u-=k-1),u--,R--}for(;O1&&(m+=k-1,h+=k-1),h++,O++}}h++;let f=u+c-d+p,A=Math.min(this._bufferService.cols,h-u+d+_-p-m);if(!(!i&&a.slice(u,h).trim()==="")){if(r&&f===0&&l.getCodePoint(0)!==32){let R=o.lines.get(e[1]-1);if(R&&l.isWrapped&&R.getCodePoint(this._bufferService.cols-1)!==32){let O=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(O){let I=this._bufferService.cols-O.start;f-=I,A+=I}}}if(n&&f+A===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let R=o.lines.get(e[1]+1);if(R?.isWrapped&&R.getCodePoint(0)!==32){let O=this._getWordAt([0,e[1]+1],!1,!1,!0);O&&(A+=O.length)}}return{start:f,length:A}}}_selectWordAt(e,i){let r=this._getWordAt(e,i);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let r=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=ws(r,this._bufferService.cols)}};ei=M([S(3,F),S(4,ge),S(5,Dt),S(6,H),S(7,ce),S(8,ae)],ei);var Hi=class{constructor(){this._data={}}set(t,e,i){this._data[t]||(this._data[t]={}),this._data[t][e]=i}get(t,e){return this._data[t]?this._data[t][e]:void 0}clear(){this._data={}}};var Wi=class{constructor(){this._color=new Hi;this._css=new Hi}setCss(t,e,i){this._css.set(t,e,i)}getCss(t,e){return this._css.get(t,e)}setColor(t,e,i){this._color.set(t,e,i)}getColor(t,e){return this._color.get(t,e)}clear(){this._color.clear(),this._css.clear()}};var re=Object.freeze((()=>{let s=[z.toColor("#2e3436"),z.toColor("#cc0000"),z.toColor("#4e9a06"),z.toColor("#c4a000"),z.toColor("#3465a4"),z.toColor("#75507b"),z.toColor("#06989a"),z.toColor("#d3d7cf"),z.toColor("#555753"),z.toColor("#ef2929"),z.toColor("#8ae234"),z.toColor("#fce94f"),z.toColor("#729fcf"),z.toColor("#ad7fa8"),z.toColor("#34e2e2"),z.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let e=0;e<216;e++){let i=t[e/36%6|0],r=t[e/6%6|0],n=t[e%6];s.push({css:j.toCss(i,r,n),rgba:j.toRgba(i,r,n)})}for(let e=0;e<24;e++){let i=8+e*10;s.push({css:j.toCss(i,i,i),rgba:j.toRgba(i,i,i)})}return s})());var St=z.toColor("#ffffff"),Ki=z.toColor("#000000"),tl=z.toColor("#ffffff"),il=Ki,Ui={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Qa=St,ti=class extends D{constructor(e){super();this._optionsService=e;this._contrastCache=new Wi;this._halfContrastCache=new Wi;this._onChangeColors=this._register(new v);this.onChangeColors=this._onChangeColors.event;this._colors={foreground:St,background:Ki,cursor:tl,cursorAccent:il,selectionForeground:void 0,selectionBackgroundTransparent:Ui,selectionBackgroundOpaque:U.blend(Ki,Ui),selectionInactiveBackgroundTransparent:Ui,selectionInactiveBackgroundOpaque:U.blend(Ki,Ui),scrollbarSliderBackground:U.opacity(St,.2),scrollbarSliderHoverBackground:U.opacity(St,.4),scrollbarSliderActiveBackground:U.opacity(St,.5),overviewRulerBorder:St,ansi:re.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let i=this._colors;if(i.foreground=K(e.foreground,St),i.background=K(e.background,Ki),i.cursor=U.blend(i.background,K(e.cursor,tl)),i.cursorAccent=U.blend(i.background,K(e.cursorAccent,il)),i.selectionBackgroundTransparent=K(e.selectionBackground,Ui),i.selectionBackgroundOpaque=U.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=K(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=U.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?K(e.selectionForeground,ps):void 0,i.selectionForeground===ps&&(i.selectionForeground=void 0),U.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=U.opacity(i.selectionBackgroundTransparent,.3)),U.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=U.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=K(e.scrollbarSliderBackground,U.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=K(e.scrollbarSliderHoverBackground,U.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=K(e.scrollbarSliderActiveBackground,U.opacity(i.foreground,.5)),i.overviewRulerBorder=K(e.overviewRulerBorder,Qa),i.ansi=re.slice(),i.ansi[0]=K(e.black,re[0]),i.ansi[1]=K(e.red,re[1]),i.ansi[2]=K(e.green,re[2]),i.ansi[3]=K(e.yellow,re[3]),i.ansi[4]=K(e.blue,re[4]),i.ansi[5]=K(e.magenta,re[5]),i.ansi[6]=K(e.cyan,re[6]),i.ansi[7]=K(e.white,re[7]),i.ansi[8]=K(e.brightBlack,re[8]),i.ansi[9]=K(e.brightRed,re[9]),i.ansi[10]=K(e.brightGreen,re[10]),i.ansi[11]=K(e.brightYellow,re[11]),i.ansi[12]=K(e.brightBlue,re[12]),i.ansi[13]=K(e.brightMagenta,re[13]),i.ansi[14]=K(e.brightCyan,re[14]),i.ansi[15]=K(e.brightWhite,re[15]),e.extendedAnsi){let r=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let n=0;no.index-l.index),r=[];for(let o of i){let l=this._services.get(o.id);if(!l)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${o.id._id}.`);r.push(l)}let n=i.length>0?i[0].index:e.length;if(e.length!==n)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${n+1} conflicts with ${e.length} static arguments`);return new t(...e,...r)}};var ec={trace:0,debug:1,info:2,warn:3,error:4,off:5},tc="xterm.js: ",ii=class extends D{constructor(e){super();this._optionsService=e;this._logLevel=5;this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),ic=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=ec[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;ithis._length)for(let i=this._length;i=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;nthis._maxLength){let n=this._length+r.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,r){if(!(i<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let o=i-1;o>=0;o--)this.set(e+o+r,this.get(e+o));let n=e+i+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n>22,e&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,e){this._data[t*B+1]=e[0],e[1].length>1?(this._combined[t]=e[1],this._data[t*B+0]=t|2097152|e[2]<<22):this._data[t*B+0]=e[1].charCodeAt(0)|e[2]<<22}getWidth(t){return this._data[t*B+0]>>22}hasWidth(t){return this._data[t*B+0]&12582912}getFg(t){return this._data[t*B+1]}getBg(t){return this._data[t*B+2]}hasContent(t){return this._data[t*B+0]&4194303}getCodePoint(t){let e=this._data[t*B+0];return e&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):e&2097151}isCombined(t){return this._data[t*B+0]&2097152}getString(t){let e=this._data[t*B+0];return e&2097152?this._combined[t]:e&2097151?Ce(e&2097151):""}isProtected(t){return this._data[t*B+2]&536870912}loadCell(t,e){return an=t*B,e.content=this._data[an+0],e.fg=this._data[an+1],e.bg=this._data[an+2],e.content&2097152&&(e.combinedData=this._combined[t]),e.bg&268435456&&(e.extended=this._extendedAttrs[t]),e}setCell(t,e){e.content&2097152&&(this._combined[t]=e.combinedData),e.bg&268435456&&(this._extendedAttrs[t]=e.extended),this._data[t*B+0]=e.content,this._data[t*B+1]=e.fg,this._data[t*B+2]=e.bg}setCellFromCodepoint(t,e,i,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*B+0]=e|i<<22,this._data[t*B+1]=r.fg,this._data[t*B+2]=r.bg}addCodepointToCell(t,e,i){let r=this._data[t*B+0];r&2097152?this._combined[t]+=Ce(e):r&2097151?(this._combined[t]=Ce(r&2097151)+Ce(e),r&=-2097152,r|=2097152):r=e|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[t*B+0]=r}insertCells(t,e,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),e=0;--n)this.setCell(t+e+n,this.loadCell(t+n,r));for(let n=0;nthis.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r=t&&delete this._combined[l]}let n=Object.keys(this._extendedAttrs);for(let o=0;o=t&&delete this._extendedAttrs[l]}}return this.length=t,i*4*Ls=0;--t)if(this._data[t*B+0]&4194303)return t+(this._data[t*B+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*B+0]&4194303||this._data[t*B+2]&50331648)return t+(this._data[t*B+0]>>22);return 0}copyCellsFrom(t,e,i,r,n){let o=t._data;if(n)for(let a=r-1;a>=0;a--){for(let u=0;u=e&&(this._combined[u-e+i]=t._combined[u])}}translateToString(t,e,i,r){e=e??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;e>22||1}return r&&r.push(e),n}};function sl(s,t,e,i,r,n){let o=[];for(let l=0;l=l&&i0&&(f>c||h[f].getTrimmedLength()===0);f--)m++;m>0&&(o.push(l+h.length-m),o.push(m)),l+=h.length-1}return o}function ol(s,t){let e=[],i=0,r=t[i],n=0;for(let o=0;ori(s,u,t)).reduce((a,u)=>a+u),n=0,o=0,l=0;for(;la&&(n-=a,o++);let u=s[o].getWidth(n-1)===2;u&&n--;let h=u?e-1:e;i.push(h),l+=h}return i}function ri(s,t,e){if(t===s.length-1)return s[t].getTrimmedLength();let i=!s[t].hasContent(e-1)&&s[t].getWidth(e-1)===1,r=s[t+1].getWidth(0)===2;return i&&r?e-1:e}var un=class un{constructor(t){this.line=t;this.isDisposed=!1;this._disposables=[];this._id=un._nextId++;this._onDispose=this.register(new v);this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ne(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};un._nextId=1;var cn=un;var ne={},Je=ne.B;ne[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"};ne.A={"#":"\xA3"};ne.B=void 0;ne[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"};ne.C=ne[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"};ne.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"};ne.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"};ne.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"};ne.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"};ne.E=ne[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"};ne.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"};ne.H=ne[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"};ne["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"};var cl=4294967295,$i=class{constructor(t,e,i){this._hasScrollback=t;this._optionsService=e;this._bufferService=i;this.ydisp=0;this.ybase=0;this.y=0;this.x=0;this.tabs={};this.savedY=0;this.savedX=0;this.savedCurAttrData=X.clone();this.savedCharset=Je;this.markers=[];this._nullCell=q.fromCharData([0,ir,1,0]);this._whitespaceCell=q.fromCharData([0,we,1,32]);this._isClearing=!1;this._memoryCleanupQueue=new Jt;this._memoryCleanupPosition=0;this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new zi(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new rt),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new rt),this._whitespaceCell}getBlankLine(t,e){return new Ze(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&ecl?cl:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=X);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new zi(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell(X),r=0,n=this._getCorrectBufferLength(e);if(n>this.lines.maxLength&&(this.lines.maxLength=n),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new Ze(t,i)));else for(let l=this._rows;l>e;l--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(n0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=n}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let o=0;o.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,r=sl(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(X),i);if(r.length>0){let n=ol(this.lines,r);ll(this.lines,n.layout),this._reflowLargerAdjustViewport(t,e,n.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let r=this.getNullCell(X),n=i;for(;n-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;l--){let a=this.lines.get(l);if(!a||!a.isWrapped&&a.getTrimmedLength()<=t)continue;let u=[a];for(;a.isWrapped&&l>0;)a=this.lines.get(--l),u.unshift(a);if(!i){let I=this.ybase+this.y;if(I>=l&&I0&&(n.push({start:l+u.length+o,newLines:p}),o+=p.length),u.push(...p);let m=c.length-1,f=c[m];f===0&&(m--,f=c[m]);let A=u.length-d-1,R=h;for(;A>=0;){let I=Math.min(R,f);if(u[m]===void 0)break;if(u[m].copyCellsFrom(u[A],R-I,f-I,I,!0),f-=I,f===0&&(m--,f=c[m]),R-=I,R===0){A--;let k=Math.max(A,0);R=ri(u,k,this._cols)}}for(let I=0;I0;)this.ybase===0?this.y0){let l=[],a=[];for(let f=0;f=0;f--)if(d&&d.start>h+_){for(let A=d.newLines.length-1;A>=0;A--)this.lines.set(f--,d.newLines[A]);f++,l.push({index:h+1,amount:d.newLines.length}),_+=d.newLines.length,d=n[++c]}else this.lines.set(f,a[h--]);let p=0;for(let f=l.length-1;f>=0;f--)l[f].index+=p,this.lines.onInsertEmitter.fire(l[f]),p+=l[f].amount;let m=Math.max(0,u+o-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(t,e,i=0,r){let n=this.lines.get(t);return n?n.translateToString(e,i,r):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+10;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.linei.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}};var hn=class extends D{constructor(e,i){super();this._optionsService=e;this._bufferService=i;this._onBufferActivate=this._register(new v);this.onBufferActivate=this._onBufferActivate.event;this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new $i(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new $i(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}};var ks=2,Cs=1,ni=class extends D{constructor(e){super();this.isUserScrolling=!1;this._onResize=this._register(new v);this.onResize=this._onResize.event;this._onScroll=this._register(new v);this.onScroll=this._onScroll.event;this.cols=Math.max(e.rawOptions.cols||0,ks),this.rows=Math.max(e.rawOptions.rows||0,Cs),this.buffers=this._register(new hn(e,this)),this._register(this.buffers.onBufferActivate(i=>{this._onScroll.fire(i.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,i){let r=this.cols!==e,n=this.rows!==i;this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i,colsChanged:r,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){let r=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=r.getBlankLine(e,i),this._cachedBlankLine=n),n.isWrapped=i;let o=r.ybase+r.scrollTop,l=r.ybase+r.scrollBottom;if(r.scrollTop===0){let a=r.lines.isFull;l===r.lines.length-1?a?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(l+1,0,n.clone()),a?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let a=l-o+1;r.lines.shiftElements(o+1,a-1,-1),r.lines.set(l,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,i){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let n=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),n!==r.ydisp&&(i||this._onScroll.fire(r.ydisp))}};ni=M([S(0,H)],ni);var si={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Zt,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},nc=["normal","bold","100","200","300","400","500","600","700","800","900"],dn=class extends D{constructor(e){super();this._onOptionChange=this._register(new v);this.onOptionChange=this._onOptionChange.event;let i={...si};for(let r in e)if(r in i)try{let n=e[r];i[r]=this._sanitizeAndValidateOption(r,n)}catch(n){console.error(n)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(C(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(r=>{r===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&i()})}_setupOptions(){let e=r=>{if(!(r in si))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},i=(r,n)=>{if(!(r in si))throw new Error(`No option with key "${r}"`);n=this._sanitizeAndValidateOption(r,n),this.rawOptions[r]!==n&&(this.rawOptions[r]=n,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let n={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this.options,r,n)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=si[e]),!sc(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=si[e]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=nc.includes(i)?i:si[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(i*10)/10));break;case"scrollback":if(i=Math.min(i,4294967295),i<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{};break}return i}};function sc(s){return s==="block"||s==="underline"||s==="bar"}function oi(s,t=5){if(typeof s!="object")return s;let e=Array.isArray(s)?[]:{};for(let i in s)e[i]=t<=1?s[i]:s[i]&&oi(s[i],t-1);return e}var ul=Object.freeze({insertMode:!1}),hl=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),li=class extends D{constructor(e,i,r){super();this._bufferService=e;this._logService=i;this._optionsService=r;this.isCursorInitialized=!1;this.isCursorHidden=!1;this._onData=this._register(new v);this.onData=this._onData.event;this._onUserInput=this._register(new v);this.onUserInput=this._onUserInput.event;this._onBinary=this._register(new v);this.onBinary=this._onBinary.event;this._onRequestScrollToBottom=this._register(new v);this.onRequestScrollToBottom=this._onRequestScrollToBottom.event;this.modes=oi(ul),this.decPrivateModes=oi(hl)}reset(){this.modes=oi(ul),this.decPrivateModes=oi(hl)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};li=M([S(0,F),S(1,nr),S(2,H)],li);var dl={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:s=>s.button===4||s.action!==1?!1:(s.ctrl=!1,s.alt=!1,s.shift=!1,!0)},VT200:{events:19,restrict:s=>s.action!==32},DRAG:{events:23,restrict:s=>!(s.action===32&&s.button===3)},ANY:{events:31,restrict:s=>!0}};function Ms(s,t){let e=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(e|=64,e|=s.action):(e|=s.button&3,s.button&4&&(e|=64),s.button&8&&(e|=128),s.action===32?e|=32:s.action===0&&!t&&(e|=3)),e}var Ps=String.fromCharCode,fl={DEFAULT:s=>{let t=[Ms(s,!1)+32,s.col+32,s.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Ps(t[0])}${Ps(t[1])}${Ps(t[2])}`},SGR:s=>{let t=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${Ms(s,!0)};${s.col};${s.row}${t}`},SGR_PIXELS:s=>{let t=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${Ms(s,!0)};${s.x};${s.y}${t}`}},ai=class extends D{constructor(e,i,r){super();this._bufferService=e;this._coreService=i;this._optionsService=r;this._protocols={};this._encodings={};this._activeProtocol="";this._activeEncoding="";this._lastEvent=null;this._wheelPartialScroll=0;this._onProtocolChange=this._register(new v);this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(dl))this.addProtocol(n,dl[n]);for(let n of Object.keys(fl))this.addEncoding(n,fl[n]);this.reset()}addProtocol(e,i){this._protocols[e]=i}addEncoding(e,i){this._encodings[e]=i}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,i,r){if(e.deltaY===0||e.shiftKey||i===void 0||r===void 0)return 0;let n=i/r,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=n+0,Math.abs(e.deltaY)<50&&(o*=.3),this._wheelPartialScroll+=o,o=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_applyScrollModifier(e,i){return i.altKey||i.ctrlKey||i.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let i=this._encodings[this._activeEncoding](e);return i&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(i):this._coreService.triggerDataEvent(i,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,i,r){if(r){if(e.x!==i.x||e.y!==i.y)return!1}else if(e.col!==i.col||e.row!==i.row)return!1;return!(e.button!==i.button||e.action!==i.action||e.ctrl!==i.ctrl||e.alt!==i.alt||e.shift!==i.shift)}};ai=M([S(0,F),S(1,ge),S(2,H)],ai);var Os=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],ac=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],se;function cc(s,t){let e=0,i=t.length-1,r;if(st[i][1])return!1;for(;i>=e;)if(r=e+i>>1,s>t[r][1])e=r+1;else if(s=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,e){let i=this.wcwidth(t),r=i===0&&e!==0;if(r){let n=Ae.extractWidth(e);n===0?r=!1:n>i&&(i=n)}return Ae.createPropertyValue(0,i,r)}};var Ae=class s{constructor(){this._providers=Object.create(null);this._active="";this._onChange=new v;this.onChange=this._onChange.event;let t=new fn;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,e,i=!1){return(t&16777215)<<3|(e&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let e=0,i=0,r=t.length;for(let n=0;n=r)return e+this.wcwidth(o);let u=t.charCodeAt(n);56320<=u&&u<=57343?o=(o-55296)*1024+u-56320+65536:e+=this.wcwidth(u)}let l=this.charProperties(o,i),a=s.extractWidth(l);s.extractShouldJoin(l)&&(a-=s.extractWidth(i)),e+=a,i=l}return e}charProperties(t,e){return this._activeProvider.charProperties(t,e)}};var pn=class{constructor(){this.glevel=0;this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(t){this.glevel=t,this.charset=this._charsets[t]}setgCharset(t,e){this._charsets[t]=e,this.glevel===t&&(this.charset=e)}};function Bs(s){let e=s.buffer.lines.get(s.buffer.ybase+s.buffer.y-1)?.get(s.cols-1),i=s.buffer.lines.get(s.buffer.ybase+s.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var Vi=2147483647,uc=256,ci=class s{constructor(t=32,e=32){this.maxLength=t;this.maxSubParamsLength=e;if(e>uc)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(e),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let e=new s;if(!t.length)return e;for(let i=Array.isArray(t[0])?1:0;i>8,r=this._subParamsIdx[e]&255;r-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Vi?Vi:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Vi?Vi:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let e=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-e>0?this._subParams.subarray(e,i):null}getSubParamsAll(){let t={};for(let e=0;e>8,r=this._subParamsIdx[e]&255;r-i>0&&(t[e]=this._subParams.slice(i,r))}return t}addDigit(t){let e;if(this._rejectDigits||!(e=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,r=i[e-1];i[e-1]=~r?Math.min(r*10+t,Vi):t}};var qi=[],mn=class{constructor(){this._state=0;this._active=qi;this._id=-1;this._handlers=Object.create(null);this._handlerFb=()=>{};this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(t,e){this._handlers[t]===void 0&&(this._handlers[t]=[]);let i=this._handlers[t];return i.push(e),{dispose:()=>{let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=qi}reset(){if(this._state===2)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].end(!1);this._stack.paused=!1,this._active=qi,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||qi,!this._active.length)this._handlerFb(this._id,"START");else for(let t=this._active.length-1;t>=0;t--)this._active[t].start()}_put(t,e,i){if(!this._active.length)this._handlerFb(this._id,"PUT",It(t,e,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(t,e,i)}start(){this.reset(),this._state=1}put(t,e,i){if(this._state!==3){if(this._state===1)for(;e0&&this._put(t,e,i)}}end(t,e=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",t);else{let i=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=e,n=this._stack.fallThrough,this._stack.paused=!1),!n&&i===!1){for(;r>=0&&(i=this._active[r].end(t),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=qi,this._id=-1,this._state=0}}},pe=class{constructor(t){this._handler=t;this._data="";this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=It(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data),e instanceof Promise))return e.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,e}};var Yi=[],_n=class{constructor(){this._handlers=Object.create(null);this._active=Yi;this._ident=0;this._handlerFb=()=>{};this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Yi}registerHandler(t,e){this._handlers[t]===void 0&&(this._handlers[t]=[]);let i=this._handlers[t];return i.push(e),{dispose:()=>{let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}reset(){if(this._active.length)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].unhook(!1);this._stack.paused=!1,this._active=Yi,this._ident=0}hook(t,e){if(this.reset(),this._ident=t,this._active=this._handlers[t]||Yi,!this._active.length)this._handlerFb(this._ident,"HOOK",e);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(e)}put(t,e,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",It(t,e,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(t,e,i)}unhook(t,e=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",t);else{let i=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=e,n=this._stack.fallThrough,this._stack.paused=!1),!n&&i===!1){for(;r>=0&&(i=this._active[r].unhook(t),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=Yi,this._ident=0}},ji=new ci;ji.addParam(0);var Xi=class{constructor(t){this._handler=t;this._data="";this._params=ji;this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():ji,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=It(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=ji,this._data="",this._hitLimit=!1,i));return this._params=ji,this._data="",this._hitLimit=!1,e}};var Fs=class{constructor(t){this.table=new Uint8Array(t)}setDefault(t,e){this.table.fill(t<<4|e)}add(t,e,i,r){this.table[e<<8|t]=i<<4|r}addMany(t,e,i,r){for(let n=0;nu),i=(a,u)=>e.slice(a,u),r=i(32,127),n=i(0,24);n.push(25),n.push.apply(n,i(28,32));let o=i(0,14),l;s.setDefault(1,0),s.addMany(r,0,2,0);for(l in o)s.addMany([24,26,153,154],l,3,0),s.addMany(i(128,144),l,3,0),s.addMany(i(144,152),l,3,0),s.add(156,l,0,0),s.add(27,l,11,1),s.add(157,l,4,8),s.addMany([152,158,159],l,0,7),s.add(155,l,11,3),s.add(144,l,11,9);return s.addMany(n,0,3,0),s.addMany(n,1,3,1),s.add(127,1,0,1),s.addMany(n,8,0,8),s.addMany(n,3,3,3),s.add(127,3,0,3),s.addMany(n,4,3,4),s.add(127,4,0,4),s.addMany(n,6,3,6),s.addMany(n,5,3,5),s.add(127,5,0,5),s.addMany(n,2,3,2),s.add(127,2,0,2),s.add(93,1,4,8),s.addMany(r,8,5,8),s.add(127,8,5,8),s.addMany([156,27,24,26,7],8,6,0),s.addMany(i(28,32),8,0,8),s.addMany([88,94,95],1,0,7),s.addMany(r,7,0,7),s.addMany(n,7,0,7),s.add(156,7,0,0),s.add(127,7,0,7),s.add(91,1,11,3),s.addMany(i(64,127),3,7,0),s.addMany(i(48,60),3,8,4),s.addMany([60,61,62,63],3,9,4),s.addMany(i(48,60),4,8,4),s.addMany(i(64,127),4,7,0),s.addMany([60,61,62,63],4,0,6),s.addMany(i(32,64),6,0,6),s.add(127,6,0,6),s.addMany(i(64,127),6,0,0),s.addMany(i(32,48),3,9,5),s.addMany(i(32,48),5,9,5),s.addMany(i(48,64),5,0,6),s.addMany(i(64,127),5,7,0),s.addMany(i(32,48),4,9,5),s.addMany(i(32,48),1,9,2),s.addMany(i(32,48),2,9,2),s.addMany(i(48,127),2,10,0),s.addMany(i(48,80),1,10,0),s.addMany(i(81,88),1,10,0),s.addMany([89,90,92],1,10,0),s.addMany(i(96,127),1,10,0),s.add(80,1,11,9),s.addMany(n,9,0,9),s.add(127,9,0,9),s.addMany(i(28,32),9,0,9),s.addMany(i(32,48),9,9,12),s.addMany(i(48,60),9,8,10),s.addMany([60,61,62,63],9,9,10),s.addMany(n,11,0,11),s.addMany(i(32,128),11,0,11),s.addMany(i(28,32),11,0,11),s.addMany(n,10,0,10),s.add(127,10,0,10),s.addMany(i(28,32),10,0,10),s.addMany(i(48,60),10,8,10),s.addMany([60,61,62,63],10,0,11),s.addMany(i(32,48),10,9,12),s.addMany(n,12,0,12),s.add(127,12,0,12),s.addMany(i(28,32),12,0,12),s.addMany(i(32,48),12,9,12),s.addMany(i(48,64),12,0,11),s.addMany(i(64,127),12,12,13),s.addMany(i(64,127),10,12,13),s.addMany(i(64,127),9,12,13),s.addMany(n,13,13,13),s.addMany(r,13,13,13),s.add(127,13,0,13),s.addMany([27,156,24,26],13,14,0),s.add(ke,0,2,0),s.add(ke,8,5,8),s.add(ke,6,0,6),s.add(ke,11,0,11),s.add(ke,13,13,13),s}(),bn=class extends D{constructor(e=hc){super();this._transitions=e;this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0};this.initialState=0,this.currentState=this.initialState,this._params=new ci,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,r,n)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,r)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(C(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new mn),this._dcsParser=this._register(new _n),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let o=0;ol||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(i[0]>n||n>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return r<<=8,r|=n,r}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(e&255)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let n=this._escHandlers[r];return n.push(i),{dispose:()=>{let o=n.indexOf(i);o!==-1&&n.splice(o,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let n=this._csiHandlers[r];return n.push(i),{dispose:()=>{let o=n.indexOf(i);o!==-1&&n.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,i,r,n,o){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=o}parse(e,i,r){let n=0,o=0,l=0,a;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let u=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&h>-1){for(;h>=0&&(a=u[h](this._params),a!==!0);h--)if(a instanceof Promise)return this._parseStack.handlerPos=h,a}this._parseStack.handlers=[];break;case 4:if(r===!1&&h>-1){for(;h>=0&&(a=u[h](),a!==!0);h--)if(a instanceof Promise)return this._parseStack.handlerPos=h,a}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],a=this._dcsParser.unhook(n!==24&&n!==26,r),a)return a;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],a=this._oscParser.end(n!==24&&n!==26,r),a)return a;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let u=l;u>4){case 2:for(let m=u+1;;++m){if(m>=i||(n=e[m])<32||n>126&&n=i||(n=e[m])<32||n>126&&n=i||(n=e[m])<32||n>126&&n=i||(n=e[m])<32||n>126&&n=0&&(a=c[d](this._params),a!==!0);d--)if(a instanceof Promise)return this._preserveStack(3,c,d,o,u),a;d<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++u47&&n<60);u--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let _=this._escHandlers[this._collect<<8|n],p=_?_.length-1:-1;for(;p>=0&&(a=_[p](),a!==!0);p--)if(a instanceof Promise)return this._preserveStack(4,_,p,o,u),a;p<0&&this._escHandlerFb(this._collect<<8|n),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|n,this._params);break;case 13:for(let m=u+1;;++m)if(m>=i||(n=e[m])===24||n===26||n===27||n>127&&n=i||(n=e[m])<32||n>127&&n>4:n>>8}return i}}function Hs(s,t){let e=s.toString(16),i=e.length<2?"0"+e:e;switch(t){case 4:return e[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function ml(s,t=16){let[e,i,r]=s;return`rgb:${Hs(e,t)}/${Hs(i,t)}/${Hs(r,t)}`}var mc={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ut=131072,_l=10;function bl(s,t){if(s>24)return t.setWinLines||!1;switch(s){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var vl=5e3,gl=0,vn=class extends D{constructor(e,i,r,n,o,l,a,u,h=new bn){super();this._bufferService=e;this._charsetService=i;this._coreService=r;this._logService=n;this._optionsService=o;this._oscLinkService=l;this._coreMouseService=a;this._unicodeService=u;this._parser=h;this._parseBuffer=new Uint32Array(4096);this._stringDecoder=new er;this._utf8Decoder=new tr;this._windowTitle="";this._iconName="";this._windowTitleStack=[];this._iconNameStack=[];this._curAttrData=X.clone();this._eraseAttrDataInternal=X.clone();this._onRequestBell=this._register(new v);this.onRequestBell=this._onRequestBell.event;this._onRequestRefreshRows=this._register(new v);this.onRequestRefreshRows=this._onRequestRefreshRows.event;this._onRequestReset=this._register(new v);this.onRequestReset=this._onRequestReset.event;this._onRequestSendFocus=this._register(new v);this.onRequestSendFocus=this._onRequestSendFocus.event;this._onRequestSyncScrollBar=this._register(new v);this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event;this._onRequestWindowsOptionsReport=this._register(new v);this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event;this._onA11yChar=this._register(new v);this.onA11yChar=this._onA11yChar.event;this._onA11yTab=this._register(new v);this.onA11yTab=this._onA11yTab.event;this._onCursorMove=this._register(new v);this.onCursorMove=this._onCursorMove.event;this._onLineFeed=this._register(new v);this.onLineFeed=this._onLineFeed.event;this._onScroll=this._register(new v);this.onScroll=this._onScroll.event;this._onTitleChange=this._register(new v);this.onTitleChange=this._onTitleChange.event;this._onColor=this._register(new v);this.onColor=this._onColor.event;this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0};this._specialColors=[256,257,258];this._register(this._parser),this._dirtyRowTracker=new Zi(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:d.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,d,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:d,data:_})}),this._parser.setDcsHandlerFallback((c,d,_)=>{d==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:d,payload:_})}),this._parser.setPrintHandler((c,d,_)=>this.print(c,d,_)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(b.BEL,()=>this.bell()),this._parser.setExecuteHandler(b.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(b.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(b.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(b.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(b.BS,()=>this.backspace()),this._parser.setExecuteHandler(b.HT,()=>this.tab()),this._parser.setExecuteHandler(b.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(b.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Ai.IND,()=>this.index()),this._parser.setExecuteHandler(Ai.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Ai.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new pe(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new pe(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new pe(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new pe(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new pe(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new pe(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new pe(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new pe(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new pe(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new pe(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new pe(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new pe(c=>this.restoreCursorColor(c))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let c in ne)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Xi((c,d)=>this.requestStatusString(c,d)))}getAttrData(){return this._curAttrData}_preserveStack(e,i,r,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=i,this._parseStack.decodedLength=r,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((i,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),vl))]).catch(i=>{if(i!=="#SLOW_TIMEOUT")throw i;console.warn(`async parser handler taking longer than ${vl} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,i){let r,n=this._activeBuffer.x,o=this._activeBuffer.y,l=0,a=this._parseStack.paused;if(a){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,i))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ut&&(l=this._parseStack.position+ut)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.lengthut)for(let c=l;c0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let p=this._parser.precedingJoinState;for(let m=i;mu){if(h){let O=_,I=this._activeBuffer.x-R;for(this._activeBuffer.x=R,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),R>0&&_ instanceof Ze&&_.copyCellsFrom(O,I,0,R,!1);I=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(c&&(_.insertCells(this._activeBuffer.x,o-R,this._activeBuffer.getNullCell(d)),_.getWidth(u-1)===2&&_.setCellFromCodepoint(u-1,0,1,d)),_.setCellFromCodepoint(this._activeBuffer.x++,n,o,d),o>0)for(;--o;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=p,this._activeBuffer.x0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,i){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>bl(r.params[0],this._optionsService.rawOptions.windowOptions)?i(r):!0):this._parser.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._parser.registerDcsHandler(e,new Xi(i))}registerEscHandler(e,i){return this._parser.registerEscHandler(e,i)}registerOscHandler(e,i){return this._parser.registerOscHandler(e,new pe(i))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,i){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+i):(this._activeBuffer.x=e,this._activeBuffer.y=i),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,i){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+i)}cursorUp(e){let i=this._activeBuffer.y-this._activeBuffer.scrollTop;return i>=0?this._moveCursor(0,-Math.min(i,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let i=this._activeBuffer.scrollBottom-this._activeBuffer.y;return i>=0?this._moveCursor(0,Math.min(i,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let i=e.params[0];return i===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:i===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let i=e.params[0];return i===1&&(this._curAttrData.bg|=536870912),(i===2||i===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,i,r,n=!1,o=!1){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);l.replaceCells(i,r,this._activeBuffer.getNullCell(this._eraseAttrData()),o),n&&(l.isWrapped=!1)}_resetBufferLine(e,i=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),i),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,i=!1){this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,i);r=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+r)?.getTrimmedLength(););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,i=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,i);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,i);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,i);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let c=h;for(let d=1;d0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(b.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(b.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(b.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(b.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(b.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let i=0;i(P[P.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",P[P.SET=1]="SET",P[P.RESET=2]="RESET",P[P.PERMANENTLY_SET=3]="PERMANENTLY_SET",P[P.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(r||={});let n=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:l}=this._coreMouseService,a=this._coreService,{buffers:u,cols:h}=this._bufferService,{active:c,alt:d}=u,_=this._optionsService.rawOptions,p=(A,R)=>(a.triggerDataEvent(`${b.ESC}[${i?"":"?"}${A};${R}$y`),!0),m=A=>A?1:2,f=e.params[0];return i?f===2?p(f,4):f===4?p(f,m(a.modes.insertMode)):f===12?p(f,3):f===20?p(f,m(_.convertEol)):p(f,0):f===1?p(f,m(n.applicationCursorKeys)):f===3?p(f,_.windowOptions.setWinLines?h===80?2:h===132?1:0:0):f===6?p(f,m(n.origin)):f===7?p(f,m(n.wraparound)):f===8?p(f,3):f===9?p(f,m(o==="X10")):f===12?p(f,m(_.cursorBlink)):f===25?p(f,m(!a.isCursorHidden)):f===45?p(f,m(n.reverseWraparound)):f===66?p(f,m(n.applicationKeypad)):f===67?p(f,4):f===1e3?p(f,m(o==="VT200")):f===1002?p(f,m(o==="DRAG")):f===1003?p(f,m(o==="ANY")):f===1004?p(f,m(n.sendFocus)):f===1005?p(f,4):f===1006?p(f,m(l==="SGR")):f===1015?p(f,4):f===1016?p(f,m(l==="SGR_PIXELS")):f===1048?p(f,1):f===47||f===1047||f===1049?p(f,m(c===d)):f===2004?p(f,m(n.bracketedPasteMode)):f===2026?p(f,m(n.synchronizedOutput)):p(f,0)}_updateAttrColor(e,i,r,n,o){return i===2?(e|=50331648,e&=-16777216,e|=De.fromColorRGB([r,n,o])):i===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,i,r){let n=[0,0,-1,0,0,0],o=0,l=0;do{if(n[l+o]=e.params[i+l],e.hasSubParams(i+l)){let a=e.getSubParams(i+l),u=0;do n[1]===5&&(o=1),n[l+u+1+o]=a[u];while(++u=2||n[1]===2&&l+o>=5)break;n[1]&&(o=1)}while(++l+i5)&&(e=1),i.extended.underlineStyle=e,i.fg|=268435456,e===0&&(i.fg&=-268435457),i.updateExtended()}_processSGR0(e){e.fg=X.fg,e.bg=X.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let i=e.length,r,n=this._curAttrData;for(let o=0;o=30&&r<=37?(n.fg&=-50331904,n.fg|=16777216|r-30):r>=40&&r<=47?(n.bg&=-50331904,n.bg|=16777216|r-40):r>=90&&r<=97?(n.fg&=-50331904,n.fg|=16777216|r-90|8):r>=100&&r<=107?(n.bg&=-50331904,n.bg|=16777216|r-100|8):r===0?this._processSGR0(n):r===1?n.fg|=134217728:r===3?n.bg|=67108864:r===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,n)):r===5?n.fg|=536870912:r===7?n.fg|=67108864:r===8?n.fg|=1073741824:r===9?n.fg|=2147483648:r===2?n.bg|=134217728:r===21?this._processUnderline(2,n):r===22?(n.fg&=-134217729,n.bg&=-134217729):r===23?n.bg&=-67108865:r===24?(n.fg&=-268435457,this._processUnderline(0,n)):r===25?n.fg&=-536870913:r===27?n.fg&=-67108865:r===28?n.fg&=-1073741825:r===29?n.fg&=2147483647:r===39?(n.fg&=-67108864,n.fg|=X.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=X.bg&16777215):r===38||r===48||r===58?o+=this._extractColor(e,o,n):r===53?n.bg|=1073741824:r===55?n.bg&=-1073741825:r===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):r===100?(n.fg&=-67108864,n.fg|=X.fg&16777215,n.bg&=-67108864,n.bg|=X.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${b.ESC}[0n`);break;case 6:let i=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${b.ESC}[${i};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let i=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${b.ESC}[?${i};${r}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=X.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let i=e.length===0?1:e.params[0];if(i===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(i){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=i%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let i=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!bl(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let i=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:i!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${b.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(i===0||i===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>_l&&this._windowTitleStack.shift()),(i===0||i===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>_l&&this._iconNameStack.shift());break;case 23:(i===0||i===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(i===0||i===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let i=[],r=e.split(";");for(;r.length>1;){let n=r.shift(),o=r.shift();if(/^\d+$/.exec(n)){let l=parseInt(n);if(Sl(l))if(o==="?")i.push({type:0,index:l});else{let a=Ws(o);a&&i.push({type:1,index:l,color:a})}}}return i.length&&this._onColor.fire(i),!0}setHyperlink(e){let i=e.indexOf(";");if(i===-1)return!0;let r=e.slice(0,i).trim(),n=e.slice(i+1);return n?this._createHyperlink(r,n):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,i){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),n,o=r.findIndex(l=>l.startsWith("id="));return o!==-1&&(n=r[o].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:i}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,i){let r=e.split(";");for(let n=0;n=this._specialColors.length);++n,++i)if(r[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[i]}]);else{let o=Ws(r[n]);o&&this._onColor.fire([{type:1,index:this._specialColors[i],color:o}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let i=[],r=e.split(";");for(let n=0;n=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=X.clone(),this._eraseAttrDataInternal=X.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new q;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let i=0;i(this._coreService.triggerDataEvent(`${b.ESC}${a}${b.ESC}\\`),!0),n=this._bufferService.buffer,o=this._optionsService.rawOptions,l={block:2,underline:4,bar:6};return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${l[o.cursorStyle]-(o.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,i){this._dirtyRowTracker.markRangeDirty(e,i)}},Zi=class{constructor(t){this._bufferService=t;this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){tthis.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(gl=t,t=e,e=gl),tthis.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Zi=M([S(0,F)],Zi);function Sl(s){return 0<=s&&s<256}var _c=5e7,El=12,bc=50,gn=class extends D{constructor(e){super();this._action=e;this._writeBuffer=[];this._callbacks=[];this._pendingData=0;this._bufferOffset=0;this._isSyncWriting=!1;this._syncCalls=0;this._didUserInput=!1;this._onWriteParsed=this._register(new v);this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){if(i!==void 0&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,i){if(this._pendingData>_c)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],o=this._action(n,i);if(o){let a=u=>performance.now()-r>=El?setTimeout(()=>this._innerWrite(0,u)):this._innerWrite(r,u);o.catch(u=>(queueMicrotask(()=>{throw u}),Promise.resolve(!1))).then(a);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-r>=El)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>bc&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}};var ui=class{constructor(t){this._bufferService=t;this._nextId=1;this._entriesWithId=new Map;this._dataByLinkId=new Map}registerLink(t){let e=this._bufferService.buffer;if(t.id===void 0){let a=e.addMarker(e.ybase+e.y),u={data:t,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(u,a)),this._dataByLinkId.set(u.id,u),u.id}let i=t,r=this._getEntryIdKey(i),n=this._entriesWithId.get(r);if(n)return this.addLineToLink(n.id,e.ybase+e.y),n.id;let o=e.addMarker(e.ybase+e.y),l={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(t,e){let i=this._dataByLinkId.get(t);if(i&&i.lines.every(r=>r.line!==e)){let r=this._bufferService.buffer.addMarker(e);i.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(i,r))}}getLinkData(t){return this._dataByLinkId.get(t)?.data}_getEntryIdKey(t){return`${t.id};;${t.uri}`}_removeMarkerFromLink(t,e){let i=t.lines.indexOf(e);i!==-1&&(t.lines.splice(i,1),t.lines.length===0&&(t.data.id!==void 0&&this._entriesWithId.delete(t.key),this._dataByLinkId.delete(t.id)))}};ui=M([S(0,F)],ui);var Tl=!1,Sn=class extends D{constructor(e){super();this._windowsWrappingHeuristics=this._register(new ye);this._onBinary=this._register(new v);this.onBinary=this._onBinary.event;this._onData=this._register(new v);this.onData=this._onData.event;this._onLineFeed=this._register(new v);this.onLineFeed=this._onLineFeed.event;this._onResize=this._register(new v);this.onResize=this._onResize.event;this._onWriteParsed=this._register(new v);this.onWriteParsed=this._onWriteParsed.event;this._onScroll=this._register(new v);this._instantiationService=new ln,this.optionsService=this._register(new dn(e)),this._instantiationService.setService(H,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(ni)),this._instantiationService.setService(F,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(ii)),this._instantiationService.setService(nr,this._logService),this.coreService=this._register(this._instantiationService.createInstance(li)),this._instantiationService.setService(ge,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(ai)),this._instantiationService.setService(rr,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ae)),this._instantiationService.setService(Js,this.unicodeService),this._charsetService=this._instantiationService.createInstance(pn),this._instantiationService.setService(Zs,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(ui),this._instantiationService.setService(sr,this._oscLinkService),this._inputHandler=this._register(new vn(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register($.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register($.forward(this._bufferService.onResize,this._onResize)),this._register($.forward(this.coreService.onData,this._onData)),this._register($.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new gn((i,r)=>this._inputHandler.parse(i,r))),this._register($.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new v),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!Tl&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Tl=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,ks),i=Math.max(i,Cs),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&i.buildNumber!==void 0&&i.buildNumber!==void 0?e=i.backend==="conpty"&&i.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Bs.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Bs(this._bufferService),!1))),this._windowsWrappingHeuristics.value=C(()=>{for(let i of e)i.dispose()})}}};var gc={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function Il(s,t,e,i){let r={type:0,cancel:!1,key:void 0},n=(s.shiftKey?1:0)|(s.altKey?2:0)|(s.ctrlKey?4:0)|(s.metaKey?8:0);switch(s.keyCode){case 0:s.key==="UIKeyInputUpArrow"?t?r.key=b.ESC+"OA":r.key=b.ESC+"[A":s.key==="UIKeyInputLeftArrow"?t?r.key=b.ESC+"OD":r.key=b.ESC+"[D":s.key==="UIKeyInputRightArrow"?t?r.key=b.ESC+"OC":r.key=b.ESC+"[C":s.key==="UIKeyInputDownArrow"&&(t?r.key=b.ESC+"OB":r.key=b.ESC+"[B");break;case 8:r.key=s.ctrlKey?"\b":b.DEL,s.altKey&&(r.key=b.ESC+r.key);break;case 9:if(s.shiftKey){r.key=b.ESC+"[Z";break}r.key=b.HT,r.cancel=!0;break;case 13:r.key=s.altKey?b.ESC+b.CR:b.CR,r.cancel=!0;break;case 27:r.key=b.ESC,s.altKey&&(r.key=b.ESC+b.ESC),r.cancel=!0;break;case 37:if(s.metaKey)break;n?r.key=b.ESC+"[1;"+(n+1)+"D":t?r.key=b.ESC+"OD":r.key=b.ESC+"[D";break;case 39:if(s.metaKey)break;n?r.key=b.ESC+"[1;"+(n+1)+"C":t?r.key=b.ESC+"OC":r.key=b.ESC+"[C";break;case 38:if(s.metaKey)break;n?r.key=b.ESC+"[1;"+(n+1)+"A":t?r.key=b.ESC+"OA":r.key=b.ESC+"[A";break;case 40:if(s.metaKey)break;n?r.key=b.ESC+"[1;"+(n+1)+"B":t?r.key=b.ESC+"OB":r.key=b.ESC+"[B";break;case 45:!s.shiftKey&&!s.ctrlKey&&(r.key=b.ESC+"[2~");break;case 46:n?r.key=b.ESC+"[3;"+(n+1)+"~":r.key=b.ESC+"[3~";break;case 36:n?r.key=b.ESC+"[1;"+(n+1)+"H":t?r.key=b.ESC+"OH":r.key=b.ESC+"[H";break;case 35:n?r.key=b.ESC+"[1;"+(n+1)+"F":t?r.key=b.ESC+"OF":r.key=b.ESC+"[F";break;case 33:s.shiftKey?r.type=2:s.ctrlKey?r.key=b.ESC+"[5;"+(n+1)+"~":r.key=b.ESC+"[5~";break;case 34:s.shiftKey?r.type=3:s.ctrlKey?r.key=b.ESC+"[6;"+(n+1)+"~":r.key=b.ESC+"[6~";break;case 112:n?r.key=b.ESC+"[1;"+(n+1)+"P":r.key=b.ESC+"OP";break;case 113:n?r.key=b.ESC+"[1;"+(n+1)+"Q":r.key=b.ESC+"OQ";break;case 114:n?r.key=b.ESC+"[1;"+(n+1)+"R":r.key=b.ESC+"OR";break;case 115:n?r.key=b.ESC+"[1;"+(n+1)+"S":r.key=b.ESC+"OS";break;case 116:n?r.key=b.ESC+"[15;"+(n+1)+"~":r.key=b.ESC+"[15~";break;case 117:n?r.key=b.ESC+"[17;"+(n+1)+"~":r.key=b.ESC+"[17~";break;case 118:n?r.key=b.ESC+"[18;"+(n+1)+"~":r.key=b.ESC+"[18~";break;case 119:n?r.key=b.ESC+"[19;"+(n+1)+"~":r.key=b.ESC+"[19~";break;case 120:n?r.key=b.ESC+"[20;"+(n+1)+"~":r.key=b.ESC+"[20~";break;case 121:n?r.key=b.ESC+"[21;"+(n+1)+"~":r.key=b.ESC+"[21~";break;case 122:n?r.key=b.ESC+"[23;"+(n+1)+"~":r.key=b.ESC+"[23~";break;case 123:n?r.key=b.ESC+"[24;"+(n+1)+"~":r.key=b.ESC+"[24~";break;default:if(s.ctrlKey&&!s.shiftKey&&!s.altKey&&!s.metaKey)s.keyCode>=65&&s.keyCode<=90?r.key=String.fromCharCode(s.keyCode-64):s.keyCode===32?r.key=b.NUL:s.keyCode>=51&&s.keyCode<=55?r.key=String.fromCharCode(s.keyCode-51+27):s.keyCode===56?r.key=b.DEL:s.keyCode===219?r.key=b.ESC:s.keyCode===220?r.key=b.FS:s.keyCode===221&&(r.key=b.GS);else if((!e||i)&&s.altKey&&!s.metaKey){let l=gc[s.keyCode]?.[s.shiftKey?1:0];if(l)r.key=b.ESC+l;else if(s.keyCode>=65&&s.keyCode<=90){let a=s.ctrlKey?s.keyCode-64:s.keyCode+32,u=String.fromCharCode(a);s.shiftKey&&(u=u.toUpperCase()),r.key=b.ESC+u}else if(s.keyCode===32)r.key=b.ESC+(s.ctrlKey?b.NUL:" ");else if(s.key==="Dead"&&s.code.startsWith("Key")){let a=s.code.slice(3,4);s.shiftKey||(a=a.toLowerCase()),r.key=b.ESC+a,r.cancel=!0}}else e&&!s.altKey&&!s.ctrlKey&&!s.shiftKey&&s.metaKey?s.keyCode===65&&(r.type=1):s.key&&!s.ctrlKey&&!s.altKey&&!s.metaKey&&s.keyCode>=48&&s.key.length===1?r.key=s.key:s.key&&s.ctrlKey&&(s.key==="_"&&(r.key=b.US),s.key==="@"&&(r.key=b.NUL));break}return r}var ee=0,En=class{constructor(t){this._getKey=t;this._array=[];this._insertedValues=[];this._flushInsertedTask=new Jt;this._isFlushingInserted=!1;this._deletedIndices=[];this._flushDeletedTask=new Jt;this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(t){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(t)}_flushInserted(){let t=this._insertedValues.sort((n,o)=>this._getKey(n)-this._getKey(o)),e=0,i=0,r=new Array(this._array.length+this._insertedValues.length);for(let n=0;n=this._array.length||this._getKey(t[e])<=this._getKey(this._array[i])?(r[n]=t[e],e++):r[n]=this._array[i++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(t){if(this._flushCleanupInserted(),this._array.length===0)return!1;let e=this._getKey(t);if(e===void 0||(ee=this._search(e),ee===-1)||this._getKey(this._array[ee])!==e)return!1;do if(this._array[ee]===t)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(ee),!0;while(++een-o),e=0,i=new Array(this._array.length-t.length),r=0;for(let n=0;n0&&this._flushDeletedTask.flush()}*getKeyIterator(t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ee=this._search(t),!(ee<0||ee>=this._array.length)&&this._getKey(this._array[ee])===t))do yield this._array[ee];while(++ee=this._array.length)&&this._getKey(this._array[ee])===t))do e(this._array[ee]);while(++ee=e;){let r=e+i>>1,n=this._getKey(this._array[r]);if(n>t)i=r-1;else if(n0&&this._getKey(this._array[r-1])===t;)r--;return r}}return e}};var Us=0,yl=0,Tn=class extends D{constructor(){super();this._decorations=new En(e=>e?.marker.line);this._onDecorationRegistered=this._register(new v);this.onDecorationRegistered=this._onDecorationRegistered.event;this._onDecorationRemoved=this._register(new v);this.onDecorationRemoved=this._onDecorationRemoved.event;this._register(C(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let i=new Ks(e);if(i){let r=i.marker.onDispose(()=>i.dispose()),n=i.onDispose(()=>{n.dispose(),i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),r.dispose())});this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,r){let n=0,o=0;for(let l of this._decorations.getKeyIterator(i))n=l.options.x??0,o=n+(l.options.width??1),e>=n&&e{Us=o.options.x??0,yl=Us+(o.options.width??1),e>=Us&&e=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=r-this._lastRefreshMs,o=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e)}};var xl=20;var wl=!1,Tt=class extends D{constructor(e,i,r,n){super();this._terminal=e;this._coreBrowserService=r;this._renderService=n;this._rowColumns=new WeakMap;this._liveRegionLineCount=0;this._charsToConsume=[];this._charsToAnnounce="";let o=this._coreBrowserService.mainDocument;this._accessibilityContainer=o.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=o.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;lthis._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=o.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new In(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");wl?(this._accessibilityContainer.classList.add("debug"),this._rowContainer.classList.add("debug"),this._debugRootContainer=o.createElement("div"),this._debugRootContainer.classList.add("xterm"),this._debugRootContainer.appendChild(o.createTextNode("------start a11y------")),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(o.createTextNode("------end a11y------")),this._terminal.element.insertAdjacentElement("afterend",this._debugRootContainer)):this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(l=>this._handleResize(l.rows))),this._register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(l=>this._handleChar(l))),this._register(this._terminal.onLineFeed(()=>this._handleChar(` -`))),this._register(this._terminal.onA11yTab(l=>this._handleTab(l))),this._register(this._terminal.onKey(l=>this._handleKey(l.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(L(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(C(()=>{wl?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let i=0;i0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` -`&&(this._liveRegionLineCount++,this._liveRegionLineCount===xl+1&&(this._liveRegion.textContent+=_i.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){let r=this._terminal.buffer,n=r.lines.length.toString();for(let o=e;o<=i;o++){let l=r.lines.get(r.ydisp+o),a=[],u=l?.translateToString(!0,void 0,void 0,a)||"",h=(r.ydisp+o+1).toString(),c=this._rowElements[o];c&&(u.length===0?(c.textContent="\xA0",this._rowColumns.set(c,[0,1])):(c.textContent=u,this._rowColumns.set(c,a)),c.setAttribute("aria-posinset",h),c.setAttribute("aria-setsize",n),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let r=e.target,n=this._rowElements[i===0?1:this._rowElements.length-2],o=r.getAttribute("aria-posinset"),l=i===0?"1":`${this._terminal.buffer.lines.length}`;if(o===l||e.relatedTarget!==n)return;let a,u;if(i===0?(a=r,u=this._rowElements.pop(),this._rowContainer.removeChild(u)):(a=this._rowElements.shift(),u=r,this._rowContainer.removeChild(a)),a.removeEventListener("focus",this._topBoundaryFocusListener),u.removeEventListener("focus",this._bottomBoundaryFocusListener),i===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(i===0?-1:1),this._rowElements[i===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let i={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===r.node&&i.offset>r.offset)&&([i,r]=[r,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let n=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:n,offset:n.textContent?.length??0}),!this._rowContainer.contains(r.node))return;let o=({node:u,offset:h})=>{let c=u instanceof Text?u.parentNode:u,d=parseInt(c?.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(c);if(!_)return console.warn("columns is null. Race condition?"),null;let p=h<_.length?_[h]:_.slice(-1)[0]+1;return p>=this._terminal.cols&&(++d,p=0),{row:d,column:p}},l=o(i),a=o(r);if(!(!l||!a)){if(l.row>a.row||l.row===a.row&&l.column>=a.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(a.row-l.row)*this._terminal.cols-l.column+a.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let i=this._rowContainer.children.length;ie;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e{Ne(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(L(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(L(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(L(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(L(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;let r=e.composedPath();for(let n=0;n{n?.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())i?this._activeProviderReplies?.get(n)&&(r=this._checkLinkProviderResult(n,e,r)):o.provideLinks(e.y,l=>{if(this._isMouseOut)return;let a=l?.map(u=>({link:u}));this._activeProviderReplies?.set(n,a),r=this._checkLinkProviderResult(n,e,r),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,i){let r=new Set;for(let n=0;ne?this._bufferService.cols:a.link.range.end.x;for(let c=u;c<=h;c++){if(r.has(c)){o.splice(l--,1);break}r.add(c)}}}}_checkLinkProviderResult(e,i,r){if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),o=!1;for(let l=0;lthis._linkAtPosition(a.link,i));l&&(r=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let l=0;lthis._linkAtPosition(u.link,i));if(a){r=!0,this._handleNewLink(a);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);i&&this._mouseDownLink&&Ec(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,i){!this._currentLink||!this._lastMouseEvent||(!e||!i||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Ne(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:r=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:r=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let n=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(n,o),this._lastMouseEvent)){let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}})))}_linkHover(e,i,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(r,i.text)}_fireUnderlineEvent(e,i){let r=e.range,n=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-n-1,r.end.x,r.end.y-n-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,i,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(r,i.text)}_linkAtPosition(e,i){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,o=i.y*this._bufferService.cols+i.x;return r<=o&&o<=n}_positionFromMouseEvent(e,i,r){let n=r.getCoords(e,i,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,i,r,n,o){return{x1:e,y1:i,x2:r,y2:n,cols:this._bufferService.cols,fg:o}}};hi=M([S(1,Dt),S(2,ce),S(3,F),S(4,lr)],hi);function Ec(s,t){return s.text===t.text&&s.range.start.x===t.range.start.x&&s.range.start.y===t.range.start.y&&s.range.end.x===t.range.end.x&&s.range.end.y===t.range.end.y}var yn=class extends Sn{constructor(e={}){super(e);this._linkifier=this._register(new ye);this.browser=tn;this._keyDownHandled=!1;this._keyDownSeen=!1;this._keyPressHandled=!1;this._unprocessedDeadKey=!1;this._accessibilityManager=this._register(new ye);this._onCursorMove=this._register(new v);this.onCursorMove=this._onCursorMove.event;this._onKey=this._register(new v);this.onKey=this._onKey.event;this._onRender=this._register(new v);this.onRender=this._onRender.event;this._onSelectionChange=this._register(new v);this.onSelectionChange=this._onSelectionChange.event;this._onTitleChange=this._register(new v);this.onTitleChange=this._onTitleChange.event;this._onBell=this._register(new v);this.onBell=this._onBell.event;this._onFocus=this._register(new v);this._onBlur=this._register(new v);this._onA11yCharEmitter=this._register(new v);this._onA11yTabEmitter=this._register(new v);this._onWillOpen=this._register(new v);this._setup(),this._decorationService=this._instantiationService.createInstance(Tn),this._instantiationService.setService(Be,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Qr),this._instantiationService.setService(lr,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(wt)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(i=>this.refresh(i?.start??0,i?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(i=>this._reportWindowsOptions(i))),this._register(this._inputHandler.onColor(i=>this._handleColorEvent(i))),this._register($.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register($.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register($.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register($.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(i=>this._afterResize(i.cols,i.rows))),this._register(C(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let i of e){let r,n="";switch(i.index){case 256:r="foreground",n="10";break;case 257:r="background",n="11";break;case 258:r="cursor",n="12";break;default:r="ansi",n="4;"+i.index}switch(i.type){case 0:let o=U.toColorRGB(r==="ansi"?this._themeService.colors.ansi[i.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${b.ESC}]${n};${ml(o)}${fs.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(l=>l.ansi[i.index]=j.toColor(...i.color));else{let l=r;this._themeService.modifyColors(a=>a[l]=j.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Tt,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(b.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(b.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,o=i.getWidth(r),l=this._renderService.dimensions.css.cell.width*o,a=this.buffer.y*this._renderService.dimensions.css.cell.height,u=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=u+"px",this.textarea.style.top=a+"px",this.textarea.style.width=l+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(L(this.element,"copy",i=>{this.hasSelection()&&Vs(i,this._selectionService)}));let e=i=>qs(i,this.textarea,this.coreService,this.optionsService);this._register(L(this.textarea,"paste",e)),this._register(L(this.element,"paste",e)),Ss?this._register(L(this.element,"mousedown",i=>{i.button===2&&Pn(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(L(this.element,"contextmenu",i=>{Pn(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Bi&&this._register(L(this.element,"auxclick",i=>{i.button===1&&Mn(i,this.textarea,this.screenElement)}))}_bindKeys(){this._register(L(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(L(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(L(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(L(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(L(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(L(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(L(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(L(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",mi.get()),Ts||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Jr,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ae,this._coreBrowserService),this._register(L(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(L(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(jt,this._document,this._helperContainer),this._instantiationService.setService(nt,this._charSizeService),this._themeService=this._instantiationService.createInstance(ti),this._instantiationService.setService(Re,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ct),this._instantiationService.setService(or,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Qt,this.rows,this.screenElement)),this._instantiationService.setService(ce,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance($t,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Xt),this._instantiationService.setService(Dt,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(hi,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(zt,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ei,this.element,this.screenElement,n)),this._instantiationService.setService(Qs,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register($.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Gt,this.screenElement)),this._register(L(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Tt,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(bt,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(bt,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Yt,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function r(l){let a=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!a)return!1;let u,h;switch(l.overrideType||l.type){case"mousemove":h=32,l.buttons===void 0?(u=3,l.button!==void 0&&(u=l.button<3?l.button:3)):u=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":h=0,u=l.button<3?l.button:3;break;case"mousedown":h=1,u=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let c=l.deltaY;if(c===0||e.coreMouseService.consumeWheelEvent(l,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;h=c<0?0:1,u=4;break;default:return!1}return h===void 0||u===void 0||u>4?!1:e.coreMouseService.triggerMouseEvent({col:a.col,row:a.row,x:a.x,y:a.y,button:u,action:h,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:l=>(r(l),l.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(l)),wheel:l=>(r(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&r(l)},mousemove:l=>{l.buttons||r(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),l&8?n.mousemove||(i.addEventListener("mousemove",o.mousemove),n.mousemove=o.mousemove):(i.removeEventListener("mousemove",n.mousemove),n.mousemove=null),l&16?n.wheel||(i.addEventListener("wheel",o.wheel,{passive:!1}),n.wheel=o.wheel):(i.removeEventListener("wheel",n.wheel),n.wheel=null),l&2?n.mouseup||(n.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),l&4?n.mousedrag||(n.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(L(i,"mousedown",l=>{if(l.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(l)))return r(l),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(l)})),this._register(L(i,"wheel",l=>{if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(l)===!1)return!1;if(!this.buffer.hasScrollback){if(l.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(l,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(l,!0);let h=b.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!0),this.cancel(l,!0)}}},{passive:!1}))}refresh(e,i){this._renderService?.refreshRows(e,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}paste(e){Cn(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,i,r){this._selectionService.setSelection(e,i,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,i){this._selectionService?.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!i&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=Il(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let n=this.rows-1;return this.scrollLines(r.type===2?-n:n),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===b.ETX||r.key===b.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,i){let r=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return i.type==="keypress"?r:r&&(!i.keyCode||i.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Tc(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(e.which===null||e.which===void 0)i=e.keyCode;else if(e.which!==0&&e.charCode!==0)i=e.which;else return!1;return!i||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e=0;t--)this._addons[t].instance.dispose()}loadAddon(t,e){let i={instance:e,dispose:e.dispose,isDisposed:!1};this._addons.push(i),e.dispose=()=>this._wrappedAddonDispose(i),e.activate(t)}_wrappedAddonDispose(t){if(t.isDisposed)return;let e=-1;for(let i=0;i=this._line.length))return e?(this._line.loadCell(t,e),e):this._line.loadCell(t,new q)}translateToString(t,e,i){return this._line.translateToString(t,e,i)}};var Ji=class{constructor(t,e){this._buffer=t;this.type=e}init(t){return this._buffer=t,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(t){let e=this._buffer.lines.get(t);if(e)return new wn(e)}getNullCell(){return new q}};var Dn=class extends D{constructor(e){super();this._core=e;this._onBufferChange=this._register(new v);this.onBufferChange=this._onBufferChange.event;this._normal=new Ji(this._core.buffers.normal,"normal"),this._alternate=new Ji(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}};var Rn=class{constructor(t){this._core=t}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,i=>e(i.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(i,r)=>e(i,r.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}};var Ln=class{constructor(t){this._core=t}register(t){this._core.unicodeService.register(t)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(t){this._core.unicodeService.activeVersion=t}};var Ic=["cols","rows"],Ue=0,Dl=class extends D{constructor(t){super(),this._core=this._register(new yn(t)),this._addonManager=this._register(new xn),this._publicOptions={...this._core.options};let e=r=>this._core.options[r],i=(r,n)=>{this._checkReadonlyOptions(r),this._core.options[r]=n};for(let r in this._core.options){let n={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,n)}}_checkReadonlyOptions(t){if(Ic.includes(t))throw new Error(`Option "${t}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new Rn(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Ln(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new Dn(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,i){this._verifyIntegers(t,e,i),this._core.select(t,e,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r -`,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return mi.get()},set promptLabel(t){mi.set(t)},get tooMuchOutput(){return _i.get()},set tooMuchOutput(t){_i.set(t)}}}_verifyIntegers(...t){for(Ue of t)if(Ue===1/0||isNaN(Ue)||Ue%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(Ue of t)if(Ue&&(Ue===1/0||isNaN(Ue)||Ue%1!==0||Ue<0))throw new Error("This API only accepts positive integers")}};export{Dl as Terminal}; -//# sourceMappingURL=xterm.mjs.map From 6a96a62e3127bb17abf8936c29e9cea95a9f18ee Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 08:53:49 +0200 Subject: [PATCH 048/134] Let a print task outlive its context and pin the terminal's reserved names [#308] Context::print read its command through this once the lazy task started: a task awaited after its Context was gone printed for whatever then lived there. It now takes the command at the call. The names the terminal handles before C++ commands are declared once in commands.mjs; a Node test compares them with commands::reservedNames and the browser test with the terminal's built-ins. --- include/webfront/Commands.hpp | 20 +++++++++++++------- js/developer/environment/bundles.json | 4 ++-- js/developer/environment/commands.mjs | 3 +++ js/developer/environment/runtime.mjs | 7 +++++-- js/developer/tools/check.mjs | 7 +++++++ test/unit/CommandsTests.cpp | 24 ++++++++++++++++++++++++ test/web/developer-specs.mjs | 2 ++ 7 files changed, 56 insertions(+), 11 deletions(-) diff --git a/include/webfront/Commands.hpp b/include/webfront/Commands.hpp index 9ea1e11a..f7583af6 100644 --- a/include/webfront/Commands.hpp +++ b/include/webfront/Commands.hpp @@ -140,14 +140,10 @@ class Context { /// Writes like write(), one piece at a time: after each piece, the command is suspended while more than /// maxPendingOutput frames wait for a browser that reads slower than the command writes. Each wait is a point where - /// Ctrl+C stops the command. Prefer it to write() for large or unbounded output. + /// Ctrl+C stops the command. Prefer it to write() for large or unbounded output. The returned task does not need + /// this Context: it may be awaited after it is gone. [[nodiscard]] Task print(std::string text) const { - const auto command = run; - for (const auto piece : detail::chunks(text)) { - if (command->stop.stop_requested() || !command->send("webfront.commands.output", piece)) - co_return; - co_await command->ui.writesAtMost(maxPendingOutput); // at once if the queue is short, else woken as it drains - } + return printPieces(run, std::move(text)); } /// Sets the exit code reported when the command returns; 0 by default. An exception reports 1. @@ -168,6 +164,16 @@ class Context { private: std::shared_ptr> run; + + // A static coroutine: a task starts when awaited, so it takes the command by value at the call instead of reading + // it through `this` once started. + static Task printPieces(std::shared_ptr> command, std::string text) { + for (const auto piece : detail::chunks(text)) { + if (command->stop.stop_requested() || !command->send("webfront.commands.output", piece)) + co_return; + co_await command->ui.writesAtMost(maxPendingOutput); // at once if the queue is short, else woken as it drains + } + } }; namespace detail { diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 43c65e23..5d25d705 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -16,10 +16,10 @@ "js/developer/environment/packages.mjs": "6636219f3fef20ea1d274dc9298d8af451ef257b86fe6c1ed0de9a7c797b11d8", "js/developer/environment/starter.mjs": "f38e290e03aebe146623c2ca9b590d645fb91a51acdf7a98101bb00b5b88096c", "js/developer/environment/paths.mjs": "3b6114df78eb193161c5c84499dda084cb7ff91c56a4496371c30295d00880e3", - "js/developer/environment/runtime.mjs": "962ecee55408dbe504791fa64b326fa59a6bfd0f0f1dc50f5b863c497cef3088", + "js/developer/environment/runtime.mjs": "6325ee38cafa803b72932b4b2f2263014cbffae47d2191848940145f85e17d08", "js/developer/environment/terminal.mjs": "7ffcf7ac6ef63c35cdf5ef70284b384525b13ba18422af069289e53b6c4f6be1", "js/developer/environment/tarball.mjs": "1c1e1aea067910e1fec74e85b4bf9fbefed9b38187a04d8d2764f0b9a96fca39", - "js/developer/environment/commands.mjs": "964770e4ca02c1044319b17ed76b7f6006427ac6751bd4c789ae58cbb850b071", + "js/developer/environment/commands.mjs": "8a663925f610f7bd55d17be4b9b9eafb09a4ce278e6f84ba9f7bb9b7f036e0b2", "js/developer/environment/compiler.mjs": "cc6fbe8cabbd94750045cebfdf942234247519099a192ef9cdda6ccbdbfbb6a4", "js/developer/environment/bundler.mjs": "c2f55056a4702d57207203a29226f98a95a31ae615596bf21338b7dfabe83ed9", "js/developer/environment/entry.mjs": "b2b942443e3c74ae2c008392ba244d9b7e91db70ba1b4ebbe1357c455ebf51bb", diff --git a/js/developer/environment/commands.mjs b/js/developer/environment/commands.mjs index da60c9cb..39b4bf1f 100644 --- a/js/developer/environment/commands.mjs +++ b/js/developer/environment/commands.mjs @@ -1,6 +1,9 @@ // The application's C++ commands (webfront::Commands): discovered through the bridge and run in this browser's session. // Their output streams in through fire-and-forget calls; Ctrl+C cancels them in C++ without waiting for them to end. +/** Names the terminal itself handles; webfront::commands::reservedNames refuses them to C++ commands. */ +export const reservedNames = ['wf', 'clear', 'exit', 'help', 'history']; + const running = new Map(); // command number -> {write, exit} let lastId = 0; diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index 8ea9aea9..bf95f886 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -2,8 +2,8 @@ import {Terminal} from '@xterm/xterm'; import {FitAddon} from '@xterm/addon-fit'; import {LineEditor, tokenize, wordAtEnd, unicodeProvider, clearScreen, historyLimit} from './terminal.mjs'; import {manifestPath} from './manifest.mjs'; -import {discoverCommands, runCommand} from './commands.mjs'; -export {discoverCommands}; +import {discoverCommands, runCommand, reservedNames} from './commands.mjs'; +export {discoverCommands, reservedNames}; import {validateLock} from './packages.mjs'; import {call, readProject, publish, writeChunks} from './io.mjs'; import {isUnsafe} from './paths.mjs'; @@ -306,6 +306,9 @@ const builtins = { }, }; +/** The commands the terminal handles before the application's: wf and the built-ins, which must be reservedNames. */ +export const builtinNames = ['wf', ...Object.keys(builtins)]; + /** * Runs a terminal line: a built-in command, a wf command or one of the application's C++ commands (context.cppCommands, * from discoverCommands). Resolves with the output for the terminal, "\r\n"-terminated lines; context.write receives diff --git a/js/developer/tools/check.mjs b/js/developer/tools/check.mjs index 422b9c0e..5a9c5e91 100644 --- a/js/developer/tools/check.mjs +++ b/js/developer/tools/check.mjs @@ -220,3 +220,10 @@ test('npm tarballs: package specs, integrity, bounded gunzip and tar entries', a assert.throws(() => readTar(corrupt), /Corrupt tar header/); }); +test('the terminal and webfront::Commands reserve the same command names', async () => { + const {reservedNames} = await import('../environment/commands.mjs'); + const header = await readFile(new URL('../../../include/webfront/Commands.hpp', import.meta.url), 'utf8'); + const declared = header.match(/reservedNames\{([^}]*)\}/); + assert.ok(declared, 'Commands.hpp must declare commands::reservedNames'); + assert.deepEqual([...declared[1].matchAll(/"([^"]*)"/g)].map(match => match[1]).sort(), [...reservedNames].sort()); +}); diff --git a/test/unit/CommandsTests.cpp b/test/unit/CommandsTests.cpp index 8870c6c3..c528b3a8 100644 --- a/test/unit/CommandsTests.cpp +++ b/test/unit/CommandsTests.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -343,6 +344,29 @@ SCENARIO("Printing a long text waits between its pieces") { } } +SCENARIO("A print task may be awaited after its context is gone") { + GIVEN("a command that creates a print task from a context, then reuses its storage for another") { + FakeApp app; + Commands commands{app}; + commands.add("print", "", [&app](Context context) -> Task { + optional temporary{context}; + auto printing = temporary->print("mine\n"); + temporary.reset(); + temporary.emplace(make_shared>(app.ui(1), 99, vector{})); + co_await std::move(printing); + }); + WHEN("it awaits the task") { + app.start(app.ui(1), 1, "print", "[]"); + THEN("the text is printed by the command that created the task") { + const auto calls = app.callsOf(1); + REQUIRE(calls.size() == 2); + CHECK(calls[0].id == 1); + CHECK(calls[0].values == vector{"mine\n"}); + } + } + } +} + SCENARIO("Ctrl+C stops a running command and the next one runs at once") { GIVEN("a command waiting in a browser") { Fixture fixture; diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index 77da461c..c55f0f73 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -336,6 +336,8 @@ try { assert(JSON.parse(await listing('.webfront/developer/staging')).length === 0, 'A check must leave no staged files'); assert(/typescript@6\.0\.3/.test(await runtime.execute(['list'], context)), 'The terminal must stay usable after a stopped check'); // The terminal: the application's C++ commands, run in this browser's session. + assert(JSON.stringify([...runtime.builtinNames].sort()) === JSON.stringify([...runtime.reservedNames].sort()), + `The terminal's own commands must be the names reserved to it: ${runtime.builtinNames}`); const cppCommands = await runtime.discoverCommands(webFront); assert(['echo', 'fail', 'linger', 'status', 'stream', 'wait'].every(name => cppCommands.has(name)) && cppCommands.get('echo') === 'Write its arguments', `The C++ commands must be discovered with their help: ${[...cppCommands.keys()]}`); From 0b9ba2499a2f55e65fb2506f3544884522d99e3b Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 09:12:43 +0200 Subject: [PATCH 049/134] End a terminal command whose connection closes [#308] Once webfront.commands.start was acknowledged, runCommand waited only for the exit report or Ctrl+C: after a disconnection the report could not arrive, the Promise stayed pending and the editor stayed busy. Each command now listens to the bridge's WebSocket close event, rejects with exit code 1, and removes its listener however it ends. Node tests drive the real WebFront.js over a simulated WebSocket; the browser test closes the second session's connection during its command. --- docs/DEVELOPER_ENVIRONMENT.md | 2 + js/developer/environment/bundles.json | 2 +- js/developer/environment/commands.mjs | 12 +++- js/developer/tools/check.mjs | 80 +++++++++++++++++++++++++++ test/web/developer-specs.mjs | 8 ++- 5 files changed, 100 insertions(+), 4 deletions(-) diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index e952d8f3..39f1c36a 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -390,6 +390,8 @@ of its browser with `webfront.commands.start`. In C++, the command is spawned li not wait for the command to end: the prompt returns at once and the next command runs, while the first one unwinds. Its late output and exit report are ignored. - The browser's disconnection stops its commands, and the application's shutdown drains them with its other tasks. + In the terminal, a command whose connection closes ends at once with an error (exit code 1): its exit report can + no longer arrive. - An exception thrown by a command is printed as an error, with exit code 1. - Each connected browser has its own session: a command in one browser neither delays nor is stopped by another. - A command must not block the server thread, which serves every browser: a handler that does not return diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 5d25d705..fbc29bef 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -19,7 +19,7 @@ "js/developer/environment/runtime.mjs": "6325ee38cafa803b72932b4b2f2263014cbffae47d2191848940145f85e17d08", "js/developer/environment/terminal.mjs": "7ffcf7ac6ef63c35cdf5ef70284b384525b13ba18422af069289e53b6c4f6be1", "js/developer/environment/tarball.mjs": "1c1e1aea067910e1fec74e85b4bf9fbefed9b38187a04d8d2764f0b9a96fca39", - "js/developer/environment/commands.mjs": "8a663925f610f7bd55d17be4b9b9eafb09a4ce278e6f84ba9f7bb9b7f036e0b2", + "js/developer/environment/commands.mjs": "8de20c01f02f33c0566f204fcf1ee2382a23344d2103581fe2914469ec570531", "js/developer/environment/compiler.mjs": "cc6fbe8cabbd94750045cebfdf942234247519099a192ef9cdda6ccbdbfbb6a4", "js/developer/environment/bundler.mjs": "c2f55056a4702d57207203a29226f98a95a31ae615596bf21338b7dfabe83ed9", "js/developer/environment/entry.mjs": "b2b942443e3c74ae2c008392ba244d9b7e91db70ba1b4ebbe1357c455ebf51bb", diff --git a/js/developer/environment/commands.mjs b/js/developer/environment/commands.mjs index 39b4bf1f..7e0c618e 100644 --- a/js/developer/environment/commands.mjs +++ b/js/developer/environment/commands.mjs @@ -34,22 +34,31 @@ const failure = (message, exitCode) => Object.assign(new Error(message), {exitCo /** * Runs a C++ command and resolves once it returns. It rejects with the command's exception (exit code 1), with its * non-zero exit code, or at once with exit code 130 when `signal` aborts: the command is then asked to stop, and its - * late output and exit are ignored. `write` receives the output as it comes, with "\n" line endings. + * late output and exit are ignored. It also rejects when the bridge's connection closes, since its exit can no longer + * arrive (C++ stops the commands of a disconnected browser). `write` receives the output as it comes, with "\n" line + * endings. */ export function runCommand(bridge, name, args, {signal, write = () => {}} = {}) { installReceivers(); lastId = lastId % 0xffffffff + 1; const id = lastId; + // The bridge's WebSocket: its close event is the only notice of a disconnection once the start is acknowledged. + const socket = bridge.socket; return new Promise((resolve, reject) => { const finish = () => { running.delete(id); signal?.removeEventListener('abort', interrupt); + socket?.removeEventListener?.('close', disconnected); }; const interrupt = () => { finish(); bridge.cppFunction('webfront.commands.cancel')(id).catch(() => {}); reject(failure('Interrupted', 130)); }; + const disconnected = () => { + finish(); + reject(failure('The connection to the application closed', 1)); + }; if (signal?.aborted) return reject(failure('Interrupted', 130)); running.set(id, {write, exit: (code, error) => { finish(); @@ -57,6 +66,7 @@ export function runCommand(bridge, name, args, {signal, write = () => {}} = {}) else reject(failure(error || `Command ${name} exited with code ${code}`, code)); }}); signal?.addEventListener('abort', interrupt, {once: true}); + socket?.addEventListener?.('close', disconnected, {once: true}); const failed = error => { if (!running.has(id)) return; finish(); diff --git a/js/developer/tools/check.mjs b/js/developer/tools/check.mjs index 5a9c5e91..cc2aa0e0 100644 --- a/js/developer/tools/check.mjs +++ b/js/developer/tools/check.mjs @@ -3,6 +3,7 @@ import assert from 'node:assert/strict'; import {gunzipSync} from 'node:zlib'; import {createHash} from 'node:crypto'; import {readFile} from 'node:fs/promises'; +import vm from 'node:vm'; import {resolvePackages, downloadPackage, validateLock} from '../environment/packages.bundle.mjs'; import {packageEntry, normalize, virtualPlugin} from '../environment/bundler.mjs'; import {generateProvider, compress} from '../environment/embed.mjs'; @@ -227,3 +228,82 @@ test('the terminal and webfront::Commands reserve the same command names', async assert.ok(declared, 'Commands.hpp must declare commands::reservedNames'); assert.deepEqual([...declared[1].matchAll(/"([^"]*)"/g)].map(match => match[1]).sort(), [...reservedNames].sort()); }); + +// A WebSocket the real bridge (js/core/WebFront.js) talks to: it records the frames sent, fires the on* handlers like a +// browser, and counts the listeners added with addEventListener. +class FakeWebSocket extends EventTarget { + static last = null; + constructor() { + super(); + this.sent = []; + this.listeners = 0; + FakeWebSocket.last = this; + } + send(data) { this.sent.push(new Uint8Array(data.buffer ?? data).slice()); } + addEventListener(...args) { ++this.listeners; super.addEventListener(...args); } + removeEventListener(...args) { --this.listeners; super.removeEventListener(...args); } + fire(type, init = {}) { + const event = Object.assign(new Event(type), init); + this[`on${type}`]?.(event); + this.dispatchEvent(event); + } +} + +// A bridge linked to the fake WebSocket, little-endian, and a helper answering a C++ call with a void return. +async function linkedBridge() { + const source = await readFile(new URL('../../core/WebFront.js', import.meta.url), 'utf8'); + const sandbox = {WebSocket: FakeWebSocket, location: {host: 'localhost'}, TextEncoder, TextDecoder, console}; + vm.runInNewContext(source, sandbox); + const bridge = sandbox.webFront, socket = FakeWebSocket.last; + socket.fire('open'); + socket.fire('message', {data: new Uint8Array([1, 0]).buffer}); // acknowledgement: little-endian + await bridge.ready; + const acknowledge = frame => socket.fire('message', {data: new Uint8Array([4, 0, frame[2], frame[3], 0, 0, 0, 0]).buffer}); + return {bridge, socket, acknowledge}; +} + +// The command number of a webfront.commands.start frame: the number after the function name. +const commandNumber = frame => { + const view = new DataView(frame.buffer); + return view.getFloat64(8 + 2 + view.getUint8(9) + 1, true); +}; + +const settled = promise => Promise.race([promise.then(() => 'resolved', () => 'rejected'), new Promise(resolve => setTimeout(() => resolve('pending'), 20))]); + +test('a C++ command whose start was acknowledged rejects when the connection closes, and unsubscribes', async () => { + const {runCommand} = await import('../environment/commands.mjs'); + const {bridge, socket, acknowledge} = await linkedBridge(); + const listenersBefore = socket.listeners; + const command = runCommand(bridge, 'wait', []); + command.catch(() => {}); + const start = socket.sent.at(-1); + acknowledge(start); + assert.equal(await settled(command), 'pending'); + assert.equal(socket.listeners, listenersBefore + 1); + socket.fire('close', {wasClean: false}); + await assert.rejects(command, error => error.exitCode === 1 && /connection to the application closed/.test(error.message)); + assert.equal(socket.listeners, listenersBefore); + // The exit report of the stopped command can no longer reach it; a late one is ignored. + globalThis.webfront.commands.exit(commandNumber(start), 130, ''); + await assert.rejects(runCommand(bridge, 'wait', []), /not connected/); + assert.equal(socket.listeners, listenersBefore); +}); + +test('a C++ command that exits, or is interrupted, removes its close listener', async () => { + const {runCommand} = await import('../environment/commands.mjs'); + const {bridge, socket, acknowledge} = await linkedBridge(); + const listenersBefore = socket.listeners; + const finished = runCommand(bridge, 'echo', ['x']); + const start = socket.sent.at(-1); + acknowledge(start); + globalThis.webfront.commands.exit(commandNumber(start), 0, ''); + assert.equal(await finished, ''); + assert.equal(socket.listeners, listenersBefore); + const controller = new AbortController(); + const interrupted = runCommand(bridge, 'wait', [], {signal: controller.signal}); + acknowledge(socket.sent.at(-1)); + controller.abort(); + await assert.rejects(interrupted, error => error.exitCode === 130); + assert.equal(socket.listeners, listenersBefore); + socket.fire('close', {wasClean: true, code: 1000, reason: ''}); +}); diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index c55f0f73..15e4ce03 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -395,12 +395,16 @@ try { await waitState('here', 'cancelled'); assert(await commandState('second') === 'running', 'Ctrl+C in one browser must not stop the command of another'); const browsers = await webFront.cppFunction('test.browsers')(); - sessionFrame.remove(); + // Its connection closes while its acknowledged command runs: the terminal stops waiting for an exit that cannot come. + second.bridge.socket.close(); + const lost = await secondWait; + assert(lost?.exitCode === 1 && /connection to the application closed/.test(lost.message), + `A command of a closed connection must reject: ${lost?.message}`); await waitState('second', 'cancelled'); for (let attempt = 0; await webFront.cppFunction('test.browsers')() !== browsers - 1; ++attempt) if (attempt === 200) throw new Error('The connection of a closed browser must be released'); else await delay(25); - void secondWait; + sessionFrame.remove(); // The terminal itself, mounted in this page with a real xterm.js. const host = document.createElement('div'); host.style.cssText = 'width:640px;height:240px'; From 2495371c6a7551c2b5162092db4efa088cdc4c6c Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 09:33:59 +0200 Subject: [PATCH 050/134] Pin developer distribution 0.5.0 [#303] DeveloperReleaseData.hpp now pins the 0.5.0 environment (project manifest, wf restore, wf run/exec, wf check and the complete terminal), built reproducibly from these sources; the bootstrap bundles are unchanged. The developer-v0.5.0 tag on this commit publishes it. --- docs/CHANGELOG.md | 4 ++-- docs/DEVELOPER_ENVIRONMENT.md | 4 ++-- docs/PROJECT_STATUS.md | 4 ++-- include/webfront/system/DeveloperReleaseData.hpp | 6 +++--- js/developer/environment/bundles.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index ab5b192d..7e8ed45d 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,8 +6,8 @@ - Project manifest `webfront.project.json` (format 1: `name`, `version`, `dependencies`, `registry`, `scripts`, `entries`, `providers`, `test`, `permissions`), strictly validated; `wf init`, `wf install [--update]` and - manifest-driven `wf preview`/`wf embed` in developer distribution 0.5.0 (not published yet; the pin in - `DeveloperReleaseData.hpp` stays on 0.4.1 until 0.5.0 is published and verified). The lock records the digest of + manifest-driven `wf preview`/`wf embed` in developer distribution 0.5.0, which `DeveloperReleaseData.hpp` pins + (published as `developer-v0.5.0`). The lock records the digest of the manifest dependencies and reports a desynchronized state. `developer::Store::commitGroup` publishes manifest and lock through a synced intent journal with crash recovery and a concurrent-install precondition. New bridge callbacks `webfront.developer.state` and `webfront.developer.commitGroup`. Starters ship a manifest; diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 39f1c36a..1d51b6e8 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -48,7 +48,7 @@ native tests from empty working directories, with developer callbacks absent. Pa HTTP 200, CORS `*` and the pinned archive bytes. These checks supplement offline CTest fixtures. The default configuration is generated in `include/webfront/system/DeveloperReleaseData.hpp` and targets -`https://ambroise-leclerc.github.io/WebFront/developer/0.4.1/environment.tgz`. This version, published and archived as `developer-v0.4.1`, generates providers that include ``. Published 0.4.0 stays immutable but targets the former include layout. The sources are ahead of that pin: `distribution.json` names 0.5.0 (the project manifest), which is not pinned until it has been published and verified (see `js/developer/tools/PUBLISHING.md`). The configuration pins one version and +`https://ambroise-leclerc.github.io/WebFront/developer/0.5.0/environment.tgz`. This version (project manifest, `wf restore`, `wf run`, `wf check` and the complete terminal) is published by the `developer-v0.5.0` tag (see `js/developer/tools/PUBLISHING.md`). Published 0.4.1 and 0.4.0 stay immutable; 0.4.0 targets the former include layout. The configuration pins one version and its SHA-512 rather than resolving a mutable `latest` channel. An explicit `DeveloperBootstrapOptions{.environment = url, .integrity = trustedHash}` still selects a different HTTPS/CORS repository or a same-origin test fixture. Users install neither npm nor Node.js. @@ -142,7 +142,7 @@ examples are limited to Hello World and Life. Existing embedded React/Babel prov ## Project manifest (`webfront.project.json`) -Available from developer distribution 0.5.0, which is not published yet: the default configuration still pins 0.4.1, whose environment predates the manifest. +Available from developer distribution 0.5.0, which the default configuration pins; the 0.4.1 environment predates the manifest. A project has one manifest, the equivalent of `package.json`, which every `wf` command reads: ```json diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index 4f456561..0ddbfdd9 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -9,8 +9,8 @@ removed without redirect headers (see `docs/CHANGELOG.md`). Browser sources live (bridge, fallback, bootstrap loader and embedding modules) and `js/developer/` (environment, terminal components, build tools, vendoring tools); tests live in `test/{unit,web,fuzz,fixtures,cmake}`. The CTest case `RepositoryLayout` enforces the root. The generated-provider include changed, so the developer -distribution is bumped to 0.4.1, published and archived as `developer-v0.4.1`. Version 0.5.0 (project manifest, #305) is -built from the sources but not pinned: `DeveloperReleaseData.hpp` moves to it only after `developer-v0.5.0` is published and verified. +distribution is bumped to 0.4.1, published and archived as `developer-v0.4.1`. Version 0.5.0 (project manifest, `wf restore`, +`wf run`/`wf exec`, `wf check`, the complete terminal) is pinned by `DeveloperReleaseData.hpp` and published by the `developer-v0.5.0` tag. ## CI test duration (#298, 2026-10-21) diff --git a/include/webfront/system/DeveloperReleaseData.hpp b/include/webfront/system/DeveloperReleaseData.hpp index eed7156a..32c7ae3b 100644 --- a/include/webfront/system/DeveloperReleaseData.hpp +++ b/include/webfront/system/DeveloperReleaseData.hpp @@ -4,7 +4,7 @@ #include namespace webfront::developer::release { -inline constexpr std::string_view version{"0.4.1"}; -inline constexpr std::string_view environment{"https://ambroise-leclerc.github.io/WebFront/developer/0.4.1/environment.tgz"}; -inline constexpr std::string_view integrity{"sha512-GFvk1FWIVWBWAXLzJUEmaKo1CIMS82FZdhZyd/q8qE3/FA8CcxFN7G/u4gpQJNMJ9R1PKKLV0UXd2uuk08y0AA=="}; +inline constexpr std::string_view version{"0.5.0"}; +inline constexpr std::string_view environment{"https://ambroise-leclerc.github.io/WebFront/developer/0.5.0/environment.tgz"}; +inline constexpr std::string_view integrity{"sha512-TV6S61kUhnCJc99/Ow890Pro47mfZ0fBqki17lx0xnpCNmcfcqZPpO1SG09Su50WIEtRDopMxt3yvanFwbLEdQ=="}; } // namespace webfront::developer::release diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index fbc29bef..65c40f2b 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -44,5 +44,5 @@ "js/developer/vendor/package-lock.json": "f6aefe8b4cb0b15f866f41eae425f6654d2c6c2d96438fd0da878c5651585616", "js/core/bootstrap/bootstrap.bundle.mjs": "1069b307799ed2b0de53914748521731bc9796414a416d56340bbda983ef2443", "js/developer/environment/packages.bundle.mjs": "7c5b721c9252e81a4228bbef0441576fdb77af983e40675dbeab5976da582529", - "include/webfront/system/DeveloperReleaseData.hpp": "c97a8c3b21df3306c179f7b46d945159b5854f9d2810f135a4ab224c768c75d7" + "include/webfront/system/DeveloperReleaseData.hpp": "d5aaddb2ba839e4c8df46b7d37e2861163233a9018b0f2fb35a6f79831e16569" } From c1bae78753cfef10e7d3846bdad08930227bbccd Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 09:39:06 +0200 Subject: [PATCH 051/134] Record the published developer distribution 0.5.0 and end the public smoke test after its public checks [#303] developer-v0.5.0 is deployed: Pages serves byte-identical archives with CORS *. The --public mode of the developer test now reports success after the checks it can run against the public distribution (Pages, npm, previews, providers): the later sections need the application's local registry, which that mode does not configure. --- docs/DEVELOPER_ENVIRONMENT.md | 2 +- docs/PROJECT_STATUS.md | 4 +++- test/web/DeveloperTest.cpp | 3 ++- test/web/developer-specs.mjs | 11 +++++++++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 1d51b6e8..cffd9d5c 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -48,7 +48,7 @@ native tests from empty working directories, with developer callbacks absent. Pa HTTP 200, CORS `*` and the pinned archive bytes. These checks supplement offline CTest fixtures. The default configuration is generated in `include/webfront/system/DeveloperReleaseData.hpp` and targets -`https://ambroise-leclerc.github.io/WebFront/developer/0.5.0/environment.tgz`. This version (project manifest, `wf restore`, `wf run`, `wf check` and the complete terminal) is published by the `developer-v0.5.0` tag (see `js/developer/tools/PUBLISHING.md`). Published 0.4.1 and 0.4.0 stay immutable; 0.4.0 targets the former include layout. The configuration pins one version and +`https://ambroise-leclerc.github.io/WebFront/developer/0.5.0/environment.tgz`. This version (project manifest, `wf restore`, `wf run`, `wf check` and the complete terminal) is published and archived as `developer-v0.5.0`. Published 0.4.1 and 0.4.0 stay immutable; 0.4.0 targets the former include layout. The configuration pins one version and its SHA-512 rather than resolving a mutable `latest` channel. An explicit `DeveloperBootstrapOptions{.environment = url, .integrity = trustedHash}` still selects a different HTTPS/CORS repository or a same-origin test fixture. Users install neither npm nor Node.js. diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index 0ddbfdd9..49217549 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -10,7 +10,9 @@ removed without redirect headers (see `docs/CHANGELOG.md`). Browser sources live components, build tools, vendoring tools); tests live in `test/{unit,web,fuzz,fixtures,cmake}`. The CTest case `RepositoryLayout` enforces the root. The generated-provider include changed, so the developer distribution is bumped to 0.4.1, published and archived as `developer-v0.4.1`. Version 0.5.0 (project manifest, `wf restore`, -`wf run`/`wf exec`, `wf check`, the complete terminal) is pinned by `DeveloperReleaseData.hpp` and published by the `developer-v0.5.0` tag. +`wf run`/`wf exec`, `wf check`, the complete terminal) is pinned by `DeveloperReleaseData.hpp`, published and archived as `developer-v0.5.0`. On 2026-10-23 Pages returned HTTP 200, +CORS `*` and archives byte-identical to a reproducible local build; the live `--public` test (CEF, Linux) downloaded them, +fetched React from npm, ran the PI and Life previews and generated both providers. ## CI test duration (#298, 2026-10-21) diff --git a/test/web/DeveloperTest.cpp b/test/web/DeveloperTest.cpp index a5157f2d..4b8a62d1 100644 --- a/test/web/DeveloperTest.cpp +++ b/test/web/DeveloperTest.cpp @@ -224,7 +224,8 @@ int main(int argc, char** argv) { app.shutdown(); if (!passed.load()) return 1; - if (states->get("final") != "cancelled") { + const bool publicMode = argc == 4; // ends before the terminal checks, which need the local registry + if (!publicMode && states->get("final") != "cancelled") { std::cerr << "The command running at shutdown was not drained: " << states->get("final") << '\n'; return 1; } diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index 15e4ce03..066c72d8 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -16,6 +16,8 @@ async function writeFile(path, text) { await call('write', id, 'output', 0, new TextEncoder().encode(text)); await call('commit', id); } +// Ends the --public smoke test, which has no local registry for the checks that follow the generated headers. +class PublicSmokeDone extends Error {} try { await webFront.ready; for (let attempt = 0; attempt < 300; ++attempt) { @@ -144,6 +146,7 @@ try { const lifeHeader = await webFront.cppFunction('test.header')('LifeUI'); await runtime.execute(['embed', 'life-ui/main.tsx', '--output', 'generated/LifeUI.hpp'], context); assert(await webFront.cppFunction('test.header')('LifeUI') === lifeHeader, 'Life header must be deterministic'); + if (!config.registryExplicit) throw new PublicSmokeDone(); // A dependency added by hand desynchronizes the lock: commands say so and nothing is resolved implicitly. manifest.dependencies.scheduler = '*'; await writeFile('webfront.project.json', JSON.stringify(manifest, null, 2)); @@ -638,8 +641,12 @@ try { await waitState('final', 'running'); await webFront.cppFunction('test.report')(true, 'WASM + npm + TSX + PI + Life animation + deterministic headers + scripts + type check + terminal passed'); } catch (error) { - console.error(error); - await webFront.cppFunction('test.report')(false, String(error.stack ?? error)); + if (error instanceof PublicSmokeDone) + await webFront.cppFunction('test.report')(true, 'Public distribution: WASM + npm + TSX + PI + Life animation + deterministic headers passed'); + else { + console.error(error); + await webFront.cppFunction('test.report')(false, String(error.stack ?? error)); + } } finally { setTimeout(() => globalThis.close(), 0); } From 89ba79e8ccf4a16661f963351dab5d2300a67792 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 10:03:12 +0200 Subject: [PATCH 052/134] Add browser builds and incremental development previews [#309] --- .github/workflows/DeveloperDistribution.yml | 2 +- docs/CHANGELOG.md | 7 + docs/DEVELOPER_ENVIRONMENT.md | 40 +++- docs/PROJECT_STATUS.md | 2 +- js/developer/environment/bundler.mjs | 21 +- js/developer/environment/bundles.json | 11 +- js/developer/environment/compiler.mjs | 17 +- js/developer/environment/development.mjs | 248 ++++++++++++++++++++ js/developer/environment/runtime.mjs | 7 +- js/developer/tools/RELEASE_NOTES.md | 2 + js/developer/tools/build.mjs | 2 +- js/developer/tools/development-check.mjs | 152 ++++++++++++ js/developer/tools/distribution.json | 2 +- test/web/developer-specs.mjs | 61 +++++ 14 files changed, 552 insertions(+), 22 deletions(-) create mode 100644 js/developer/environment/development.mjs create mode 100644 js/developer/tools/development-check.mjs diff --git a/.github/workflows/DeveloperDistribution.yml b/.github/workflows/DeveloperDistribution.yml index 46c039e6..149678e2 100644 --- a/.github/workflows/DeveloperDistribution.yml +++ b/.github/workflows/DeveloperDistribution.yml @@ -67,7 +67,7 @@ jobs: echo "::notice::Sources build $building; DeveloperReleaseData.hpp still pins the published $pinned." node js/developer/tools/pin-check.mjs fi - node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs js/developer/tools/manifest-check.mjs js/developer/tools/restore-check.mjs js/developer/tools/scripts-check.mjs + node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs js/developer/tools/manifest-check.mjs js/developer/tools/restore-check.mjs js/developer/tools/scripts-check.mjs js/developer/tools/development-check.mjs - name: Check the dedicated release tag if: startsWith(github.ref, 'refs/tags/developer-v') env: diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 7e8ed45d..c294cb9a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -4,6 +4,13 @@ ### Added +- `wf build [entry]` / `wf dev [entry]` (#309, environment sources; release pin unchanged): build all manifest + entries to `.webfront/developer/build/` without opening the preview, or continuously rebuild one preview + with a persistent esbuild/WASM context. Sequential 750 ms polling watches read inputs and missing imports + (1,024 paths, 32 MiB per pass). Build/publication errors preserve the last good preview; diagnostics with + file/line/column stream to the terminal and overlay the preview. Corrections resume rebuilding; Ctrl+C + terminates the Worker, stops polling and aborts staged output. + - Project manifest `webfront.project.json` (format 1: `name`, `version`, `dependencies`, `registry`, `scripts`, `entries`, `providers`, `test`, `permissions`), strictly validated; `wf init`, `wf install [--update]` and manifest-driven `wf preview`/`wf embed` in developer distribution 0.5.0, which `DeveloperReleaseData.hpp` pins diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index cffd9d5c..ad55dee4 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -99,7 +99,7 @@ wf embed ui/main.tsx --output generated/LifeUI.hpp The starter contains editable TSX/CSS and an exact-version `webfront.project.json` recipe. `wf create life another-directory` selects a different new destination; existing directories are never replaced. React DOM pulls scheduler transitively and checks its React peer. -Edit the local files in your normal editor, then run `wf preview` again. Ctrl+C interrupts +Edit the local files in your normal editor and use `wf dev` for automatic rebuilds, or run `wf preview` again. Ctrl+C interrupts commands, including downloads and builds. The interface draws an isometric field with raised living cells, soft lighting and translucent @@ -351,7 +351,7 @@ open, Enter starts a new session. No system shell is exposed. - **Typing ahead and paste:** keys typed or pasted while a command runs are applied after it, line by line; a last line without a line break waits on the prompt. Ctrl+C drops the keys still waiting. - **Completion (Tab):** command names, `wf` subcommands, the manifest's scripts after `wf run`, its entries and - providers after `wf preview` and `wf embed`, and project paths, also when the word is escaped (`my\ dir/`) or + entries/providers after `wf build`, `wf dev`, `wf preview` and `wf embed`, and project paths, also when the word is escaped (`my\ dir/`) or quoted (`"my dir/`); the completion is written the same way and closes the quote. Several candidates are completed to their common prefix, or listed. - **Exit codes:** a failed command prints `Error: `, with `(exit code N)` when N is not 1. Ctrl+C gives 130. @@ -404,6 +404,40 @@ browser is gone. The names `wf`, `clear`, `exit`, writing large output with it, faster than the browser reads, grows the connection's write queue; use `context.print` for such output. +## Build and continuous development + +`wf build [entry.tsx|name]` compiles without opening or navigating the preview and publishes the whole +result to `.webfront/developer/build/`. With no argument it builds every manifest entry: a single entry +uses that directory directly; multiple entries each get a named subdirectory with their own `index.html`, +`app.js`, optional CSS and assets. Directory names percent-escape punctuation and Windows device names. An explicit path or manifest entry name selects one entry at the root. +Publication replaces the directory only after every entry succeeds. Build output is available as local +files; the developer HTTP provider serves only the environment and preview directories. + +`wf dev [entry.tsx|name]` selects `entries.main` or the sole entry when omitted, builds, opens the preview +and keeps running until Ctrl+C. It reuses one compiler Worker and esbuild context across rebuilds. +Changing the selected entry or locked graph recreates the context. It uses the installed lock, without +resolving packages or downloading dependencies; `wf install`/`wf restore` remain explicit actions. + +Detection uses portable, sequential polling rather than a platform-specific C++ filesystem watcher. +After each build it waits 750 ms, then compares SHA-256 digests of the inputs actually read during that +build, including missing resolution candidates, the manifest, the lock and used cached package files. +Creating a missing import, deleting an input, editing CSS, or changing entries/the lock triggers a rebuild. +Unrelated files and generated outputs are not scanned. A pass is limited to 1,024 paths and 32 MiB of +input, read in 256 KiB chunks; each compilation has a 120 s deadline. Polling never overlaps a build or +another poll. Large projects can hit these explicit limits. An edit made during a build is detected by +the next poll; polling can miss a change that is reverted completely between reads. + +Only a successful build and publication reload the preview, replacing its session history entry. A build +error leaves its last successful files and running document intact. Diagnostics (`file:line:column`, with +one-based line and column numbers) stream to the terminal and appear as a text overlay in the preview. +Fixing the source resumes rebuilding and clears the overlay. Ctrl+C ends with exit code 130, terminates +the Worker, cancels polling and aborts staged publication; a publication already committed finishes and reloads +the preview before stopping. +The last successful preview stays available. Browser disconnection also stops the loop. + +These commands are in the 0.6.0 environment sources (not published); the release pin stays on published 0.5.0. To try +them before the next release, provision an archive rebuilt from these sources as described below. + ## Dependencies, storage and limitations - `wf install` accepts exact versions, registry tags and semver ranges, resolves ordinary @@ -491,7 +525,7 @@ WKWebView and all 14 Linux CEF/Xvfb cases with both GCC and Clang in The packed 0.3.0 version passes WKWebView and all 14 GCC CEF/Xvfb cases in [run 39490581423](https://github.com/ambroise-leclerc/WebFront/actions/runs/39490581423). For Linux, select CEF and Xvfb instead; the same developer tests use the selected test frontend. -`DeveloperBrowserIntegration` exercises the real WASM compiler, local registry, PI and Life previews, C++ generation/animation and +`DeveloperBrowserIntegration` exercises the real WASM compiler, local registry, build without navigation, incremental dev reload/error/recovery/Ctrl+C, PI and Life previews, C++ generation/animation and repeatable header generation. Its CTest fixtures then build that **browser-generated** header and run `DeveloperEmbeddedIntegration` and `LifeEmbeddedIntegration` from empty working directories with no developer callbacks. diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index 49217549..b7aa1cb3 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -132,7 +132,7 @@ Status snapshot: 2026-07-19. Optional mddlog integration note: 2026-10-02. Newco manifest permissions, which frame the `context` API only and are not a sandbox. Peers require explicit compatible roots/direct dependencies. The environment's terminal (#308) runs `wf`, built-in and C++ commands (`webfront::Commands`: per-browser coroutine sessions, streamed output, Ctrl+C cancellation without waiting, drained at shutdown) with - multi-row editing, CJK/emoji widths, persistent history and completion. Automatic rebuild/watch is future work. `wf restore [--offline]` (0.5.0, #306) rebuilds or checks + multi-row editing, CJK/emoji widths, persistent history and completion. `wf build` / `wf dev` (#309, environment sources) publish manifest entries and rebuild the preview automatically with a reused esbuild context, bounded input polling, error overlays and Ctrl+C cancellation; the release pin is unchanged. `wf restore [--offline]` (0.5.0, #306) rebuilds or checks the cache from the lock, from the application's registry option, else the manifest's, else npmjs. See [DEVELOPER_ENVIRONMENT](DEVELOPER_ENVIRONMENT.md) for exact commands and limits. diff --git a/js/developer/environment/bundler.mjs b/js/developer/environment/bundler.mjs index d2d23189..9416df4b 100644 --- a/js/developer/environment/bundler.mjs +++ b/js/developer/environment/bundler.mjs @@ -57,19 +57,32 @@ function virtualPluginWith(lock, packages, readProject, loaded) { return {contents: loader ? decoder.decode(bytes) : bytes, loader: loader ?? 'file'}; }; return {name: 'webfront-project', setup(build) { + // Resolution caches belong to one rebuild: source bytes must never survive into the next one. + build.onStart?.(() => loaded.clear()); build.onResolve({filter: /.*/}, args => resolveImport(args, lock, find)); build.onLoad({filter: /.*/, namespace: 'empty'}, () => ({contents: '', loader: 'js'})); for (const namespace of ['project', 'npm']) build.onLoad({filter: /.*/, namespace}, load(namespace)); }}; } -export async function bundle(esbuild, {entry, lock, packages, readProject}) { - const result = await esbuild.build({entryPoints: [entry], bundle: true, write: false, +function applicationOptions({entry, lock, packages, readProject}) { + return {entryPoints: [entry], bundle: true, write: false, outdir: '/output', entryNames: 'app', assetNames: 'assets/[name]-[hash]', format: 'esm', platform: 'browser', target: 'es2020', jsx: 'automatic', minify: true, define: {'process.env.NODE_ENV': '"production"'}, legalComments: 'inline', - plugins: [virtualPlugin(lock, packages, readProject)]}); - return new Map(result.outputFiles.map(file => [file.path.replace(/^\/output\//, ''), file.contents])); + plugins: [virtualPlugin(lock, packages, readProject)]}; +} + +const outputFiles = result => new Map(result.outputFiles.map(file => [file.path.replace(/^\/output\//, ''), file.contents])); + +export async function bundle(esbuild, options) { + return outputFiles(await esbuild.build(applicationOptions(options))); +} + +/** One esbuild context for repeated builds; the virtual filesystem is read again on every rebuild. */ +export async function bundleContext(esbuild, options) { + const context = await esbuild.context(applicationOptions(options)); + return {rebuild: async () => outputFiles(await context.rebuild()), dispose: () => context.dispose()}; } // Node.js built-in modules: a script importing one fails while it is loaded, unless a locked package of that name diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 65c40f2b..559a146d 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -16,12 +16,13 @@ "js/developer/environment/packages.mjs": "6636219f3fef20ea1d274dc9298d8af451ef257b86fe6c1ed0de9a7c797b11d8", "js/developer/environment/starter.mjs": "f38e290e03aebe146623c2ca9b590d645fb91a51acdf7a98101bb00b5b88096c", "js/developer/environment/paths.mjs": "3b6114df78eb193161c5c84499dda084cb7ff91c56a4496371c30295d00880e3", - "js/developer/environment/runtime.mjs": "6325ee38cafa803b72932b4b2f2263014cbffae47d2191848940145f85e17d08", + "js/developer/environment/runtime.mjs": "391403965c1661c23359d49fd25e2ddb3f7b026225d32256c578f977dd8a7c8a", + "js/developer/environment/development.mjs": "dd07bc64e12c3392223f0e7aab0ae2f5223e093930bee8abe78a0cd3e2940d85", "js/developer/environment/terminal.mjs": "7ffcf7ac6ef63c35cdf5ef70284b384525b13ba18422af069289e53b6c4f6be1", "js/developer/environment/tarball.mjs": "1c1e1aea067910e1fec74e85b4bf9fbefed9b38187a04d8d2764f0b9a96fca39", "js/developer/environment/commands.mjs": "8de20c01f02f33c0566f204fcf1ee2382a23344d2103581fe2914469ec570531", - "js/developer/environment/compiler.mjs": "cc6fbe8cabbd94750045cebfdf942234247519099a192ef9cdda6ccbdbfbb6a4", - "js/developer/environment/bundler.mjs": "c2f55056a4702d57207203a29226f98a95a31ae615596bf21338b7dfabe83ed9", + "js/developer/environment/compiler.mjs": "64bf490cd09e1324ff95b88f1b1579c8ca186b953cc96862ab49262fe1a85cca", + "js/developer/environment/bundler.mjs": "8ad11d122478a4c6be2025580c28adfeb801f629ffd8b0ed5f05f8d1520b5a2f", "js/developer/environment/entry.mjs": "b2b942443e3c74ae2c008392ba244d9b7e91db70ba1b4ebbe1357c455ebf51bb", "js/developer/environment/conditions.mjs": "7f0ecba239480831e38985ccffd4c82309949924f4eb9d938e4ad1b09f5f36ed", "js/developer/environment/io.mjs": "21af39f07c7eb863908c1df768e3c31de1c6eb8ff757c2a287c4a47c76855db6", @@ -37,8 +38,8 @@ "js/developer/tools/starters/pi/style.css": "360e2c7ae6d3699b00e18cbf67efbae7a8d8863d88926b31139e102cf38e5abd", "examples/life/ui/main.tsx": "ed11a82aad1639eb6997af8b0fca4d5c5ed4c36422c22a74ac49ae73078d0a91", "examples/life/ui/style.css": "9bb55eb0f0a3287e5b7dc78af9d69608b87ff42c4d9c8a653bc83a52fe293c44", - "js/developer/tools/distribution.json": "12b40657d1bc34c4093cd5f793d772bf3fa6fd8615ab7b766ad1756092438f83", - "js/developer/tools/build.mjs": "1516d8f0be60c0dc3d6f3ae66a92558699d62b4d15714325580eb2c0d35dac7f", + "js/developer/tools/distribution.json": "4c8703b10e0bfca70e47e1c2b9f5afe7bbe4b4b87cd8be99e15082cfd2915373", + "js/developer/tools/build.mjs": "ac26574972e1b0ebfb58c8d39ea52a9cf24d2a686370c893308b24c9350183f5", "js/developer/tools/site.mjs": "1827d3fd7e1e470336aab25ea8686c912c2b674a10f7be496f2f0077fbc45292", "js/developer/tools/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b", "js/developer/vendor/package-lock.json": "f6aefe8b4cb0b15f866f41eae425f6654d2c6c2d96438fd0da878c5651585616", diff --git a/js/developer/environment/compiler.mjs b/js/developer/environment/compiler.mjs index f7e3ed23..23abadf6 100644 --- a/js/developer/environment/compiler.mjs +++ b/js/developer/environment/compiler.mjs @@ -1,5 +1,5 @@ import * as esbuild from 'esbuild-wasm'; -import {bundle, bundleScript} from './bundler.mjs'; +import {bundle, bundleScript, bundleContext} from './bundler.mjs'; const pending = new Map(); let nextId = 0; @@ -9,6 +9,7 @@ const readProject = path => new Promise((resolve, reject) => { self.postMessage({type: 'read', id, path}); }); const initialized = esbuild.initialize({wasmURL: new URL('./esbuild.wasm', import.meta.url).href, worker: false}); +let context, contextKey; self.onmessage = async ({data}) => { if (data.type === 'read-result') { const request = pending.get(data.id); @@ -21,9 +22,19 @@ self.onmessage = async ({data}) => { if (data.type !== 'build' && data.type !== 'script') return; try { await initialized; - const files = await (data.type === 'script' ? bundleScript : bundle)(esbuild, {...data, readProject}); + let files; + if (data.incremental) { + const key = JSON.stringify([data.entry, data.lock]); + if (key !== contextKey) { + await context?.dispose(); + contextKey = undefined; + context = await bundleContext(esbuild, {...data, readProject}); + contextKey = key; + } + files = await context.rebuild(); + } else files = await (data.type === 'script' ? bundleScript : bundle)(esbuild, {...data, readProject}); self.postMessage({type: 'result', files}); } catch (error) { - self.postMessage({type: 'error', error: error.message}); + self.postMessage({type: 'error', error: error.message, diagnostics: error.errors?.map(({text, location}) => ({text, location}))}); } }; diff --git a/js/developer/environment/development.mjs b/js/developer/environment/development.mjs new file mode 100644 index 00000000..cc33f3a7 --- /dev/null +++ b/js/developer/environment/development.mjs @@ -0,0 +1,248 @@ +// Browser builds and development loop. Only project-relative bridge reads; no platform watcher or shell. +import {call, publish} from './io.mjs'; +import {loadProject, resolveEntry, syncNotice, noManifest} from './project.mjs'; +import {manifestPath, lockPath} from './manifest.mjs'; +import {applicationPage} from './embed.mjs'; + +export const watchBounds = {paths: 1024, bytes: 32 * 1024 * 1024, interval: 750}; +const stopped = () => Object.assign(new Error('Interrupted'), {exitCode: 130}); +const digest = async bytes => Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256', bytes)), b => b.toString(16).padStart(2, '0')).join(''); + +// Bound both each read and the whole pass, including resolution probes for files that do not exist yet. +export async function observedRead(bridge, path, observed, budget, signal) { + signal?.throwIfAborted(); + if (!observed.has(path) && observed.size >= watchBounds.paths) throw new Error('Build/watch exceeds 1024 input paths'); + observed.set(path, null); + const chunks = []; + let offset = 0; + try { + for (;;) { + signal?.throwIfAborted(); + const chunk = await call(bridge, 'read', path, offset); + budget.bytes += chunk.length; + if (budget.bytes > watchBounds.bytes) throw new Error('Build/watch exceeds 32 MiB of input per pass'); + chunks.push(chunk); + offset += chunk.length; + if (chunk.length < 256 * 1024) break; + } + } catch (error) { + // Other read failures must be retried/reported, rather than mistaken for a missing import. + observed.set(path, error.message.includes('Cannot read project file:') ? 'missing' : `error:${error.message}`); + throw error; + } + const bytes = new Uint8Array(await new Blob(chunks).arrayBuffer()); + observed.set(path, await digest(bytes)); + return bytes; +} + +/** A persistent compiler Worker. At most one rebuild at a time; stop/timeout terminate it and reject pending work. */ +export function compilerSession(bridge, signal, createWorker = () => new Worker(new URL('./compiler.mjs', import.meta.url), {type: 'module'})) { + const worker = createWorker(); + let pending, closed = false, observed = new Map(), budget; + const finish = (error, files) => { + if (!pending) return; + const {resolve, reject, timer} = pending; + pending = null; + clearTimeout(timer); + error ? reject(error) : resolve(files); + }; + const close = (error = stopped()) => { + if (closed) return; + closed = true; + worker.terminate(); + signal?.removeEventListener('abort', abort); + finish(error); + }; + const abort = () => close(stopped()); + signal?.addEventListener('abort', abort, {once: true}); + worker.onerror = event => close(new Error(event.message || 'Compiler worker failed')); + worker.onmessage = async ({data}) => { + if (closed || !pending) return; + if (data.type === 'read') { + let response; + try { response = {bytes: await observedRead(bridge, data.path, observed, budget, signal)}; } + catch (error) { + if (/Build\/watch exceeds/.test(error.message)) return close(error); + response = {error: error.message}; + } + if (!closed && pending) worker.postMessage({type: 'read-result', id: data.id, ...response}); + } else if (data.type === 'result') finish(null, data.files); + else if (data.type === 'error') finish(Object.assign(new Error(data.error), {diagnostics: data.diagnostics})); + }; + if (signal?.aborted) abort(); + return { + get closed() { return closed; }, + get observed() { return observed; }, + rebuild(message) { + if (closed) return Promise.reject(stopped()); + if (pending) return Promise.reject(new Error('A browser build is already running')); + observed = new Map(); + budget = {bytes: 0}; + return new Promise((resolve, reject) => { + pending = {resolve, reject, timer: setTimeout(() => close(new Error('Browser build timed out')), 120000)}; + worker.postMessage({type: 'build', incremental: true, ...message}); + }); + }, + close, + }; +} + +export function diagnosticsText(error) { + if (!error.diagnostics?.length) return error.message; + return error.diagnostics.map(({text, location}) => location ? + `${location.file.replace(/^project:/, '')}:${location.line}:${location.column + 1}: ${text}\n${location.lineText ?? ''}` : text).join('\n'); +} + +// textContent keeps a diagnostic containing source text inert in the application's document. +export function previewDiagnostics(frame, text) { + if (text && frame) frame.hidden = false; + const document = frame?.contentDocument; + if (!document?.body) return; + document.getElementById('webfront-build-diagnostics')?.remove(); + if (!text) return; + const overlay = document.createElement('pre'); + overlay.id = 'webfront-build-diagnostics'; + overlay.setAttribute('role', 'alert'); + overlay.style.cssText = 'position:fixed;inset:0;z-index:2147483647;margin:0;padding:24px;overflow:auto;white-space:pre-wrap;background:#211821ed;color:#ffd8d8;font:14px/1.5 monospace'; + overlay.textContent = text; + document.body.append(overlay); +} + +let revision = 0; +export function showPreview(frame, directory = 'preview') { + if (!frame) throw new Error('No preview frame is available'); + frame.hidden = false; + frame.contentWindow.location.replace(`/webfront/developer/${directory}/index.html?build=${Date.now()}-${++revision}`); +} + +// Manifest labels allow punctuation that project paths forbid. Escape it without collisions; also avoid +// Windows device directory names, so the same manifest builds on every supported platform. +function entryDirectory(name) { + const escaped = encodeURIComponent(name).replaceAll('.', '%2E'); + return /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i.test(escaped) ? + `%${escaped.charCodeAt(0).toString(16).toUpperCase()}${escaped.slice(1)}` : escaped; +} + +export function buildEntries(manifest, argument) { + if (argument !== undefined) return [['', resolveEntry(manifest, argument)]]; + const entries = Object.entries(manifest?.entries ?? {}); + if (!entries.length) throw new Error('Usage: wf build (or declare entries in webfront.project.json)'); + return entries.map(([name, entry]) => [entries.length === 1 ? '' : entryDirectory(name), entry]); +} + +export async function build(args, {bridge, signal}) { + if (args.length > 1) throw new Error('Usage: wf build [entry.tsx|name]'); + signal?.throwIfAborted(); + const project = await loadProject(bridge); + const session = compilerSession(bridge, signal); + try { + const files = new Map(); + for (const [name, entry] of buildEntries(project.manifest, args[0])) { + const output = await session.rebuild({entry, lock: project.lock ?? {format: 1, roots: {}, packages: {}}}); + output.set('index.html', applicationPage(output)); + for (const [path, bytes] of output) files.set(name ? `${name}/${path}` : path, bytes); + } + await publish(bridge, '.webfront/developer/build', files, {signal}); + return syncNotice(project) + 'Build ready: .webfront/developer/build/'; + } catch (error) { + if (signal?.aborted) throw stopped(); + throw Object.assign(error, {message: diagnosticsText(error)}); + } finally { session.close(); } +} + +export function waitForPoll(signal, milliseconds = watchBounds.interval) { + return new Promise((resolve, reject) => { + const abort = () => { clearTimeout(timer); signal?.removeEventListener('abort', abort); reject(stopped()); }; + const timer = setTimeout(() => { signal?.removeEventListener('abort', abort); resolve(); }, milliseconds); + signal?.addEventListener('abort', abort, {once: true}); + if (signal?.aborted) abort(); + }); +} + +// Compare to the bytes actually read by the build, not a snapshot taken after it: edits made during compilation +// are still noticed. Missing candidates are watched too, so creating an unresolved import recovers a failed build. +export async function inputsChanged(bridge, observed, signal) { + const current = new Map(), budget = {bytes: 0}; + for (const [path, before] of observed) { + try { await observedRead(bridge, path, current, budget, signal); } + catch (error) { + if (signal?.aborted) throw stopped(); + if (current.get(path) !== 'missing') throw error; + } + if (current.get(path) !== before) return true; + } + return false; +} + +export async function dev(args, {bridge, signal, preview: frame, write = () => {}}) { + if (args.length > 1) throw new Error('Usage: wf dev [entry.tsx|name]'); + const controller = new AbortController(); + const abort = () => controller.abort(); + let connectionClosed = false; + const disconnected = () => { connectionClosed = true; controller.abort(); }; + signal?.addEventListener('abort', abort, {once: true}); + bridge.socket?.addEventListener('close', disconnected, {once: true}); + if (signal?.aborted) abort(); + const active = controller.signal; + let session, observed = new Map(); + let diagnostic = ''; + const loaded = () => previewDiagnostics(frame, diagnostic); + frame?.addEventListener('load', loaded); + try { + for (;;) { + active.throwIfAborted(); + const configReads = new Map(), budget = {bytes: 0}; + try { + // Record the configuration before loading it. A concurrent edit triggers another iteration. + for (const path of [manifestPath, lockPath]) { + try { await observedRead(bridge, path, configReads, budget, active); } + catch (error) { if (configReads.get(path) !== 'missing') throw error; } + } + const project = await loadProject(bridge); + if (!project.manifest && args[0] === undefined) throw new Error(noManifest); + const entry = resolveEntry(project.manifest, args[0], 'wf dev '); + if (!session || session.closed) session = compilerSession(bridge, active); + const files = await session.rebuild({entry, lock: project.lock ?? {format: 1, roots: {}, packages: {}}}); + files.set('index.html', applicationPage(files)); + await publish(bridge, '.webfront/developer/preview', files, {signal: active}); + // Once commit succeeds, display its publication even if Ctrl+C arrived while awaiting it. + diagnostic = ''; + previewDiagnostics(frame, ''); + showPreview(frame); + // A successful build can drop dependencies that are no longer imported. + observed = new Map(session.observed); + write(syncNotice(project) + 'Preview ready. Watching inputs (Ctrl+C to stop).\n'); + } catch (error) { + if (active.aborted) throw stopped(); + diagnostic = diagnosticsText(error); + write(diagnostic + '\n'); + previewDiagnostics(frame, diagnostic); + if (session?.observed.size) observed = new Map(session.observed); + } + observed = new Map([...configReads, ...[...observed].filter(([path]) => !configReads.has(path))]); + if (observed.size > watchBounds.paths) throw new Error('Build/watch exceeds 1024 input paths'); + for (;;) { + await waitForPoll(active); + try { if (await inputsChanged(bridge, observed, active)) break; } + catch (error) { + if (active.aborted) throw stopped(); + // A temporarily unreadable file or a bound violation cannot publish or reload anything. + const text = diagnosticsText(error); + if (diagnostic !== text) { diagnostic = text; write(text + '\n'); previewDiagnostics(frame, text); } + } + } + } + } catch (error) { + if (controller.signal.aborted) { + if (connectionClosed) throw new Error('The connection to the application closed'); + throw stopped(); + } + throw error; + } finally { + session?.close(); + signal?.removeEventListener('abort', abort); + bridge.socket?.removeEventListener('close', disconnected); + frame?.removeEventListener('load', loaded); + previewDiagnostics(frame, ''); + } +} diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index bf95f886..77d4cffc 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -12,6 +12,7 @@ import {install, initProject} from './installer.mjs'; import {restore, describeRegistry} from './restore.mjs'; import {loadProject, syncNotice, resolveEntry, embedTarget, lockPath, packageRoot, noManifest} from './project.mjs'; import {parseRunOptions, scriptCommand, execTarget, scriptHost, runWorker, runResult, runDeadline, secondsLeft} from './scripts.mjs'; +import {build, dev} from './development.mjs'; import {generateProvider, applicationPage} from './embed.mjs'; import {typescriptPackage, parseCheckOptions, checkHost} from './typecheck.mjs'; @@ -202,8 +203,8 @@ async function list(_args, {bridge}) { return syncNotice(project) + (names || 'No installed packages.'); } -const help = () => 'wf init [name]\nwf create [directory]\nwf install [--update] [[@range] ...]\nwf restore [--offline]\nwf run [--timeout ] ' + + '\n'; + return new Map([['index.html', encoder.encode(page)], ['runner.js', encoder.encode(runnerSource)], + ['jasmine.js', jasmine], ['specs.js', specs]]); +} + +const emptyReport = (status, exitCode, extra = {}) => ({status, exitCode, jasmine: '', pattern: '', incomplete: '', total: 0, passed: 0, + failed: 0, pending: 0, excluded: 0, durationMs: 0, failures: [], pendingSpecs: [], global: [], ...extra}); +const finite = value => Number.isFinite(value) && value >= 0 ? Math.round(value) : 0; +const text = (value, limit) => typeof value === 'string' ? value.slice(0, limit) : ''; +const problems = list => Array.isArray(list) ? list.slice(0, reportLimits.messages).map(item => + ({message: text(item?.message, reportLimits.text), stack: text(item?.stack, reportLimits.text)})) : []; + +/** + * The report of a finished run, from what the frame posted. Counts are exact; the lists of failures and of pending + * specs are cut at their limits. + * status: passed | failed | incomplete (no spec, or fit/fdescribe) | error (the specs did not load); + * exitCode: 0 only for passed. + */ +export function buildReport(data, {pattern = ''} = {}) { + if (data.type === 'error') return emptyReport('error', 1, {pattern, error: text(data.message, reportLimits.text)}); + const specs = Array.isArray(data.specs) ? data.specs : []; + const count = status => specs.filter(spec => spec.status === status).length; + const failedSpecs = specs.filter(spec => spec.status === 'failed'); + const executed = specs.filter(spec => spec.status !== 'excluded').length; + const global = problems(data.global); + let status = ['passed', 'failed', 'incomplete'].includes(data.overall) ? data.overall : 'failed'; + let incomplete = text(data.incomplete, 1024); + if (status === 'passed' && (failedSpecs.length || global.length)) status = 'failed'; + if (status === 'passed' && !executed) { status = 'incomplete'; incomplete = pattern ? `No spec matches "${pattern}"` : 'No specs found'; } + return {status, exitCode: status === 'passed' ? 0 : 1, jasmine: text(data.version, 32), pattern, incomplete, + total: executed, passed: count('passed'), failed: failedSpecs.length, pending: count('pending'), excluded: count('excluded'), + durationMs: finite(data.durationMs), + failures: failedSpecs.slice(0, reportLimits.failures).map(({name, failures}) => ({name: text(name, 1024), messages: problems(failures)})), + pendingSpecs: specs.filter(spec => spec.status === 'pending').slice(0, reportLimits.pending).map(({name, reason}) => ({name: text(name, 1024), reason: text(reason, 1024)})), + global}; +} + +const plural = (count, word) => `${count} ${word}${count === 1 ? '' : 's'}`; +const trace = stack => stack.split('\n').filter(line => /(^|\s|@)\S+:\d+(:\d+)?\)?$/.test(line.trim())).slice(0, 3).map(line => ` ${line.trim()}`); +const problemLines = ({message, stack}) => [` ${message.split('\n').join('\n ')}`, ...trace(stack)]; + +/** The terminal's text for a report: a summary line, then each failure, global failure and pending spec. */ +export function formatReport(report) { + if (report.status === 'error') return `The specs did not load: ${report.error}`; + const summary = [plural(report.total, 'spec'), plural(report.failed, 'failure'), `${report.pending} pending`]; + if (report.excluded) summary.push(`${report.excluded} filtered out`); + const lines = [`${report.status === 'passed' ? 'PASSED' : 'FAILED'}: ${summary.join(', ')} (${report.durationMs} ms, jasmine-core ${report.jasmine})`]; + if (report.incomplete) lines.push(report.incomplete); + for (const {name, messages} of report.failures) lines.push(`FAIL ${name}`, ...messages.flatMap(problemLines)); + if (report.global.length) lines.push('Failures outside the specs:', ...report.global.flatMap(problemLines)); + for (const {name, reason} of report.pendingSpecs) lines.push(`PENDING ${name}${reason ? `: ${reason}` : ''}`); + return lines.join('\n'); +} + +const progress = {passed: '.', failed: 'F', pending: '*'}; +const stopped = (reason, pattern) => { + const [message, exitCode] = reason === 'timeout' ? ['Tests stopped at their time limit', 124] : ['Tests stopped by Ctrl+C', 130]; + return Object.assign(new ScriptExit(message, exitCode), {report: emptyReport(reason, exitCode, {pattern, error: message})}); +}; + +// Out of sight but laid out like a page: specs that measure the DOM need a real viewport. +function defaultFrame() { + const frame = document.createElement('iframe'); + frame.title = 'WebFront tests'; + frame.setAttribute('aria-hidden', 'true'); + frame.style.cssText = 'position:fixed;left:-10000px;top:0;width:1024px;height:768px;border:0'; + return frame; +} + +/** + * Runs the published runner in a frame of its own and resolves with its report. It rejects with a ScriptExit when + * `signal` aborts (130) or after `timeout` seconds (124); the frame is removed in every case. `createFrame` makes the + * frame element. + */ +export function runInFrame({pattern, timeout, signal, write = () => {}, createFrame = defaultFrame}) { + return new Promise((resolve, reject) => { + const frame = createFrame(); + let timer; + const finish = (error, report) => { + clearTimeout(timer); + removeEventListener('message', receive); + signal?.removeEventListener('abort', interrupt); + frame.remove(); + error ? reject(error) : resolve(report); + }; + const receive = ({source, origin, data}) => { + if (source !== frame.contentWindow || origin !== location.origin) return; + const message = data?.webfrontTest; + if (message?.type === 'spec') write(progress[message.status] ?? ''); + else if (message?.type === 'done' || message?.type === 'error') finish(null, buildReport(message, {pattern})); + }; + const interrupt = () => finish(stopped('interrupted', pattern)); + addEventListener('message', receive); + signal?.addEventListener('abort', interrupt, {once: true}); + timer = setTimeout(() => finish(stopped('timeout', pattern)), timeout * 1000); + if (signal?.aborted) return interrupt(); + frame.src = `/webfront/developer/test/index.html?pattern=${encodeURIComponent(pattern)}&run=${Date.now()}`; + document.body.append(frame); + }); +} + +/** The terminal's result of a report: its text on success, a ScriptExit carrying the report otherwise. */ +export function reportResult(report) { + const output = formatReport(report); + if (report.exitCode === 0) return output; + throw Object.assign(new ScriptExit(output, report.exitCode), {report}); +} diff --git a/js/developer/tools/RELEASE_NOTES.md b/js/developer/tools/RELEASE_NOTES.md index a3ed4f2f..bb9be579 100644 --- a/js/developer/tools/RELEASE_NOTES.md +++ b/js/developer/tools/RELEASE_NOTES.md @@ -10,4 +10,4 @@ Version 0.4.0 updates the Life starter text for a developer audience. The simula Version 0.5.0 introduces the project manifest `webfront.project.json`: `wf init`, manifest-driven `wf install` (with `--update`), `wf preview` and `wf embed`, and a lock that records the digest of the manifest dependencies. `wf install` now requires a manifest. The starters ship their own manifest. -Version 0.6.0 (in development, not published) adds `wf build` and incremental `wf dev`, with bounded input polling, diagnostics in the preview and Ctrl+C cancellation. A publication whose commit has completed is displayed before cancellation ends the command. The default pin remains on published 0.5.0. +Version 0.6.0 (in development, not published) adds `wf test` (the project's Jasmine, obtained by `wf install jasmine-core`, runs the specs of `test.specs` in the browser, with a structured report and a non-interactive entry), `wf build` and incremental `wf dev`, with bounded input polling, diagnostics in the preview and Ctrl+C cancellation. A publication whose commit has completed is displayed before cancellation ends the command. The default pin remains on published 0.5.0. diff --git a/js/developer/tools/build.mjs b/js/developer/tools/build.mjs index ab2fbeff..a766ed60 100644 --- a/js/developer/tools/build.mjs +++ b/js/developer/tools/build.mjs @@ -78,7 +78,7 @@ if (refresh) { await copyFile(resolve(root, 'js/developer/vendor/node_modules/semver/LICENSE'), resolve(root, 'js/developer/environment/PACKAGES-LICENSE.txt')); await writeFile(resolve(root, 'include/webfront/system/DeveloperReleaseData.hpp'), header); const inputs = {}; - for (const path of ['js/developer/environment/manifest.mjs', 'js/developer/environment/project.mjs', 'js/developer/environment/installer.mjs', 'js/developer/environment/restore.mjs', 'js/developer/environment/cache.mjs', 'js/developer/environment/scripts.mjs', 'js/developer/environment/script-worker.mjs', 'js/developer/environment/permissions.mjs', 'js/developer/environment/typecheck.mjs', 'js/developer/environment/typecheck-snapshot.mjs', 'js/developer/environment/typecheck-worker.mjs', 'js/developer/environment/packages-entry.mjs', 'js/developer/environment/bootstrap.mjs', 'js/developer/environment/bootstrap-entry.mjs', 'js/developer/environment/packages.mjs', 'js/developer/environment/starter.mjs', 'js/developer/environment/paths.mjs', 'js/developer/environment/runtime.mjs', 'js/developer/environment/development.mjs', 'js/developer/environment/terminal.mjs', 'js/developer/environment/tarball.mjs', 'js/developer/environment/commands.mjs', 'js/developer/environment/compiler.mjs', 'js/developer/environment/bundler.mjs', 'js/developer/environment/entry.mjs', 'js/developer/environment/conditions.mjs', 'js/developer/environment/io.mjs', 'js/developer/environment/recipe.mjs', 'js/developer/environment/registry.mjs', 'js/developer/environment/archive.mjs', 'js/developer/environment/lock.mjs', 'js/developer/environment/pins.mjs', 'js/developer/environment/peers.mjs', 'js/developer/environment/resolve.mjs', 'js/developer/environment/embed.mjs', 'js/developer/tools/starters/pi/main.tsx', 'js/developer/tools/starters/pi/style.css', 'examples/life/ui/main.tsx', 'examples/life/ui/style.css', 'js/developer/tools/distribution.json', 'js/developer/tools/build.mjs', 'js/developer/tools/site.mjs', 'js/developer/tools/archive.mjs', 'js/developer/vendor/package-lock.json', 'js/core/bootstrap/bootstrap.bundle.mjs', 'js/developer/environment/packages.bundle.mjs', 'include/webfront/system/DeveloperReleaseData.hpp']) + for (const path of ['js/developer/environment/manifest.mjs', 'js/developer/environment/project.mjs', 'js/developer/environment/installer.mjs', 'js/developer/environment/restore.mjs', 'js/developer/environment/cache.mjs', 'js/developer/environment/scripts.mjs', 'js/developer/environment/script-worker.mjs', 'js/developer/environment/permissions.mjs', 'js/developer/environment/typecheck.mjs', 'js/developer/environment/typecheck-snapshot.mjs', 'js/developer/environment/typecheck-worker.mjs', 'js/developer/environment/packages-entry.mjs', 'js/developer/environment/bootstrap.mjs', 'js/developer/environment/bootstrap-entry.mjs', 'js/developer/environment/packages.mjs', 'js/developer/environment/starter.mjs', 'js/developer/environment/paths.mjs', 'js/developer/environment/runtime.mjs', 'js/developer/environment/development.mjs', 'js/developer/environment/testing.mjs', 'js/developer/environment/terminal.mjs', 'js/developer/environment/tarball.mjs', 'js/developer/environment/commands.mjs', 'js/developer/environment/compiler.mjs', 'js/developer/environment/bundler.mjs', 'js/developer/environment/entry.mjs', 'js/developer/environment/conditions.mjs', 'js/developer/environment/io.mjs', 'js/developer/environment/recipe.mjs', 'js/developer/environment/registry.mjs', 'js/developer/environment/archive.mjs', 'js/developer/environment/lock.mjs', 'js/developer/environment/pins.mjs', 'js/developer/environment/peers.mjs', 'js/developer/environment/resolve.mjs', 'js/developer/environment/embed.mjs', 'js/developer/tools/starters/pi/main.tsx', 'js/developer/tools/starters/pi/style.css', 'examples/life/ui/main.tsx', 'examples/life/ui/style.css', 'js/developer/tools/distribution.json', 'js/developer/tools/build.mjs', 'js/developer/tools/site.mjs', 'js/developer/tools/archive.mjs', 'js/developer/vendor/package-lock.json', 'js/core/bootstrap/bootstrap.bundle.mjs', 'js/developer/environment/packages.bundle.mjs', 'include/webfront/system/DeveloperReleaseData.hpp']) inputs[path] = createHash('sha256').update(await readFile(resolve(root, path))).digest('hex'); await writeFile(resolve(root, 'js/developer/environment/bundles.json'), JSON.stringify(inputs, null, 2) + '\n'); for (const [source, name] of [['js/core/bootstrap/index.html', 'DeveloperIndexHtmlData'], ['js/core/bootstrap/bootstrap.bundle.mjs', 'DeveloperBootstrapData']]) diff --git a/js/developer/tools/testing-check.mjs b/js/developer/tools/testing-check.mjs new file mode 100644 index 00000000..58f8b814 --- /dev/null +++ b/js/developer/tools/testing-check.mjs @@ -0,0 +1,130 @@ +// Host tests supplement the real-browser regression of wf test in test/web/developer-specs.mjs. +import {test} from 'node:test'; +import assert from 'node:assert/strict'; +import {mkdtemp, writeFile, rm} from 'node:fs/promises'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; +import {pathToFileURL} from 'node:url'; +import {build as bundle} from '../vendor/node_modules/esbuild/lib/main.js'; +import * as esbuild from '../vendor/node_modules/esbuild/lib/main.js'; + +// Resolve the browser modules using the same locked dependencies as the environment archive. +async function load(entry) { + const compiled = await bundle({entryPoints: [entry], bundle: true, write: false, format: 'esm', platform: 'browser', + nodePaths: ['js/developer/vendor/node_modules']}); + const temporary = await mkdtemp(join(tmpdir(), 'webfront-testing-test-')); + try { + const path = join(temporary, 'module.mjs'); + await writeFile(path, compiled.outputFiles[0].contents); + return await import(pathToFileURL(path)); + } finally { await rm(temporary, {recursive: true, force: true}); } +} +const {parseTestOptions, specFiles, jasmineCore, buildReport, formatReport, reportResult, runnerFiles} = await load('js/developer/environment/testing.mjs'); +const {bundleTests} = await load('js/developer/environment/bundler.mjs'); +const encode = text => new TextEncoder().encode(text); +const decode = bytes => new TextDecoder().decode(bytes); + +test('options: a time limit in whole seconds and one pattern', () => { + assert.deepEqual(parseTestOptions([]), {timeout: 60, pattern: ''}); + assert.deepEqual(parseTestOptions(['--timeout', '5', 'suite name']), {timeout: 5, pattern: 'suite name'}); + for (const args of [['--timeout'], ['--timeout', '0'], ['--timeout', '1.5'], ['--timeout', '3601']]) assert.throws(() => parseTestOptions(args), /--timeout expects whole seconds from 1 to 3600/); + for (const args of [['a', 'b'], ['--filter'], ['--timeout', '5', 'a', 'b']]) assert.throws(() => parseTestOptions(args), /Usage: wf test/); +}); + +test('specs come from the manifest and jasmine-core from the lock, at the version the project chose', () => { + assert.throws(() => specFiles({}), /No specs/); + assert.throws(() => specFiles({test: {specs: []}}), /No specs/); + assert.deepEqual(specFiles({test: {specs: ['a.spec.ts', 'b.spec.js']}}), ['a.spec.ts', 'b.spec.js']); + const node = (name, version, files) => ({name, version, files, key: `${name}-${version}`, manifest: {}}); + const lock = {format: 1, roots: {'jasmine-core': {id: 'jasmine-core@6.0.0'}}, packages: { + 'jasmine-core@6.0.0': node('jasmine-core', '6.0.0', ['lib/jasmine-core/jasmine.js']), + 'jasmine-core@5.0.0': node('jasmine-core', '5.0.0', ['lib/jasmine-core/jasmine.js'])}}; + assert.equal(jasmineCore(lock).id, 'jasmine-core@6.0.0'); + assert.throws(() => jasmineCore({format: 1, roots: {}, packages: {}}), /run wf install jasmine-core/); + assert.throws(() => jasmineCore({format: 1, roots: {a: {id: 'jasmine-core@1.0.0'}}, packages: {'jasmine-core@1.0.0': node('jasmine-core', '1.0.0', ['lib/jasmine-core.js'])}}), /no lib\/jasmine-core\/jasmine\.js/); +}); + +const spec = (name, status, extra = {}) => ({name, status, reason: '', failures: [], ...extra}); +const failure = (message, stack = '') => ({message, stack}); + +test('a report counts exactly, names the failures and fails for anything but a pass', () => { + const passed = buildReport({type: 'done', version: '7.0.2', overall: 'passed', durationMs: 12.4, global: [], specs: [ + spec('a b', 'passed'), spec('a c', 'pending', {reason: 'later'}), spec('d', 'excluded')]}); + assert.deepEqual([passed.status, passed.exitCode, passed.total, passed.passed, passed.pending, passed.excluded, passed.durationMs], ['passed', 0, 2, 1, 1, 1, 12]); + assert.deepEqual(passed.pendingSpecs, [{name: 'a c', reason: 'later'}]); + const failed = buildReport({type: 'done', overall: 'failed', durationMs: 3, global: [], specs: [ + spec('x y', 'failed', {failures: [failure('Expected 1 to be 2.', 'Error: Expected 1 to be 2.\n at \n at UserContext. (http://127.0.0.1/specs.js:3:9)')]})]}); + assert.equal(failed.exitCode, 1); + assert.deepEqual(failed.failures.map(item => item.name), ['x y']); + // A reporter that says "passed" cannot hide a failed spec or a global failure. + assert.equal(buildReport({type: 'done', overall: 'passed', global: [], specs: [spec('x', 'failed')]}).status, 'failed'); + assert.equal(buildReport({type: 'done', overall: 'passed', global: [failure('afterAll failed')], specs: [spec('x', 'passed')]}).status, 'failed'); + assert.equal(buildReport({type: 'done', overall: 'bogus', global: [], specs: []}).status, 'failed'); + // Nothing executed is not a pass, with or without a pattern. + const none = buildReport({type: 'done', overall: 'passed', global: [], specs: [spec('x', 'excluded')]}, {pattern: 'zzz'}); + assert.deepEqual([none.status, none.exitCode, none.incomplete], ['incomplete', 1, 'No spec matches "zzz"']); + assert.equal(buildReport({type: 'done', overall: 'passed', global: [], specs: []}).incomplete, 'No specs found'); + assert.deepEqual([buildReport({type: 'done', overall: 'incomplete', incomplete: 'fit() or fdescribe() was found', global: [], specs: [spec('x', 'passed')]}).exitCode], [1]); + const broken = buildReport({type: 'error', message: 'Error: boom'}); + assert.deepEqual([broken.status, broken.exitCode, broken.error], ['error', 1, 'Error: boom']); +}); + +test('a report is bounded: what the specs post is cut, not trusted', () => { + const many = Array.from({length: 300}, (_, index) => spec(`s${index}`, 'failed', {failures: Array.from({length: 20}, () => failure('m'.repeat(50000)))})); + const report = buildReport({type: 'done', overall: 'failed', specs: many, global: [], durationMs: Infinity, version: 'v'.repeat(100)}); + assert.equal(report.failed, 300); + assert.equal(report.failures.length, 100); + assert.equal(report.failures[0].messages.length, 8); + assert.equal(report.failures[0].messages[0].message.length, 16 * 1024); + assert.equal(report.durationMs, 0); + assert.equal(report.jasmine.length, 32); + assert.equal(buildReport({type: 'done', overall: 'failed', specs: 'not a list', global: 7}).total, 0); +}); + +test('the terminal text gives the summary, each failure with its frames, then the pending specs', () => { + const report = buildReport({type: 'done', version: '7.0.2', overall: 'failed', durationMs: 5, global: [failure('afterAll boom')], specs: [ + spec('one', 'passed'), spec('two', 'pending', {reason: 'later'}), spec('three', 'excluded'), + spec('suite fails', 'failed', {failures: [failure('Expected 1 to be 2.', 'Error: Expected 1 to be 2.\n at \n at UserContext. (http://127.0.0.1/specs.js:3:9)\n foo@http://127.0.0.1/specs.js:4:5')]})]}); + const lines = formatReport(report).split('\n'); + assert.equal(lines[0], 'FAILED: 3 specs, 1 failure, 1 pending, 1 filtered out (5 ms, jasmine-core 7.0.2)'); + assert.deepEqual(lines.slice(1), ['FAIL suite fails', ' Expected 1 to be 2.', ' at UserContext. (http://127.0.0.1/specs.js:3:9)', + ' foo@http://127.0.0.1/specs.js:4:5', 'Failures outside the specs:', ' afterAll boom', 'PENDING two: later']); + assert.match(formatReport(buildReport({type: 'done', version: '7.0.2', overall: 'passed', durationMs: 1, global: [], specs: [spec('a', 'passed')]})), /^PASSED: 1 spec, 0 failures, 0 pending \(1 ms/); + assert.equal(formatReport(broken()), 'The specs did not load: Error: boom'); + function broken() { return buildReport({type: 'error', message: 'Error: boom'}); } +}); + +test('a result is the text on success and an error with the exit code and the report otherwise', () => { + const ok = buildReport({type: 'done', version: '7.0.2', overall: 'passed', durationMs: 1, global: [], specs: [spec('a', 'passed')]}); + assert.match(reportResult(ok), /^PASSED/); + const bad = buildReport({type: 'done', version: '7.0.2', overall: 'failed', durationMs: 1, global: [], specs: [spec('a', 'failed')]}); + assert.throws(() => reportResult(bad), error => error.exitCode === 1 && error.report === bad && /^FAILED/.test(error.message)); +}); + +test('the runner page loads the locked jasmine before the specs and the specs as a module', () => { + const files = runnerFiles(encode('specs'), encode('jasmine')); + assert.deepEqual([...files.keys()].sort(), ['index.html', 'jasmine.js', 'runner.js', 'specs.js']); + const page = decode(files.get('index.html')); + assert.ok(page.indexOf('./jasmine.js') > page.indexOf('/WebFront.js') && page.indexOf('./jasmine.js') < page.indexOf('./runner.js')); + assert.match(decode(files.get('runner.js')), /specFilter: spec => spec\.getFullName\(\)\.includes\(pattern\)/); +}); + +test('specs bundle in the manifest order with their imports, TypeScript and locked packages', async () => { + const files = new Map([['a.spec.ts', "import {value} from './value'; (globalThis as any).order = [...((globalThis as any).order ?? []), 'a' + value];"], + ['value.ts', "export const value: number = 1;"], ['b.spec.js', "import dep from 'dep'; globalThis.order = [...(globalThis.order ?? []), 'b' + dep];"], + ['npm/dep-1/index.js', 'export default 2;']]); + const lock = {format: 1, roots: {dep: {id: 'dep@1.0.0'}}, packages: {'dep@1.0.0': {name: 'dep', version: '1.0.0', key: 'dep-1', files: ['index.js'], manifest: {name: 'dep', version: '1.0.0', main: 'index.js'}, dependencies: {}}}}; + const readProject = async path => { + const bytes = files.get(path.startsWith('.webfront/developer/packages/') ? `npm/${path.split('/').slice(3).join('/')}` : path); + if (!bytes) throw new Error(`Cannot read project file: ${path}`); + return encode(bytes); + }; + const output = await bundleTests(esbuild, {specs: ['a.spec.ts', 'b.spec.js'], lock, readProject}); + assert.deepEqual([...output.keys()], ['specs.js']); + const code = decode(output.get('specs.js')); + const evaluated = new Function('globalThis', code.replace(/^export .*$/gm, '')); + const sandbox = {}; + evaluated(sandbox); + assert.deepEqual(sandbox.order, ['a1', 'b2'], 'the specs run in the manifest order'); + await assert.rejects(bundleTests(esbuild, {specs: ['absent.spec.js'], lock, readProject}), /absent\.spec\.js/); +}); diff --git a/test/unit/DeveloperTests.cpp b/test/unit/DeveloperTests.cpp index 1e04873e..39d1856d 100644 --- a/test/unit/DeveloperTests.cpp +++ b/test/unit/DeveloperTests.cpp @@ -106,12 +106,17 @@ SCENARIO("Developer filesystem serves only published resources and protects the TemporaryDirectory project; developer::Store store{project.path()}; fs::DeveloperFS filesystem{project.path()}; - GIVEN("published preview assets and private project files") { + GIVEN("published preview and test runner assets and private project files") { const auto id = store.begin(".webfront/developer/preview", true); store.write(id, "index.html", 0, bytes("preview")); store.commit(id); + const auto runner = store.begin(".webfront/developer/test", true); + store.write(runner, "index.html", 0, bytes("runner")); + store.commit(runner); THEN("the preview and bootstrap are served but project sources are not") { REQUIRE(filesystem.open("/webfront/developer/preview/index.html")); + REQUIRE(filesystem.open("/webfront/developer/test/index.html")); + REQUIRE_FALSE(filesystem.open("/webfront/developer/build/app.js")); REQUIRE(filesystem.open("/webfront-bootstrap.html")); REQUIRE(filesystem.open("/webfront-bootstrap.mjs")); REQUIRE(filesystem.open("/WebFront.js")); diff --git a/test/web/DeveloperTest.cpp b/test/web/DeveloperTest.cpp index 4b8a62d1..2ac19b52 100644 --- a/test/web/DeveloperTest.cpp +++ b/test/web/DeveloperTest.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -66,6 +67,20 @@ void registerCallbacks(App& app, const std::filesystem::path& project, std::atom // The generated header is larger than a bridge string: return a stable small digest. return std::to_string(std::hash{}(header)); }); + // The result a page sends after a non-interactive wf command (runNonInteractive), kept for the test to read back. + struct Result { + std::mutex mutex; + std::string json; + }; + auto result = std::make_shared(); + app.cppFunction("test.result", [result](std::string json) { + std::scoped_lock lock{result->mutex}; + result->json = std::move(json); + }); + app.cppFunction("test.lastResult", [result] { + std::scoped_lock lock{result->mutex}; + return result->json; + }); app.cppFunction("test.report", [&passed](bool success, std::string message) { std::cout << message << std::endl; passed.store(success); diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index b1387189..f0c536ac 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -399,6 +399,100 @@ try { assert(JSON.stringify([await listing(''), await listing('check')]) === JSON.stringify(before), 'A check must not write any project file'); assert(JSON.parse(await listing('.webfront/developer/staging')).length === 0, 'A check must leave no staged files'); assert(/typescript@6\.0\.3/.test(await runtime.execute(['list'], context)), 'The terminal must stay usable after a stopped check'); + // wf test: the specs of the manifest under the locked jasmine-core, in a frame of this page. + const testOutput = []; + const tested = async (args = [], extra = {}) => { + testOutput.length = 0; + let report = null; + const result = await runtime.execute(['test', ...args], {...runContext(), write: text => testOutput.push(text), onReport: value => { report = value; }, ...extra}) + .then(text => ({text}), error => ({error})); + return {...result, report, output: testOutput.join('')}; + }; + const readManifest = async () => JSON.parse(new TextDecoder().decode(await readFile('webfront.project.json'))); + const specsOf = async specs => writeFile('webfront.project.json', JSON.stringify({...await readManifest(), test: {specs}}, null, 2)); + assert(/No specs: declare "test"/.test((await tested()).error?.message), 'wf test must ask for declared specs'); + await writeFile('tests/pass.spec.js', "describe('passing', () => {\n it('adds', () => expect(1 + 1).toBe(2));\n it('is pending', () => pending('not yet'));\n" + + " it('awaits', async () => { await Promise.resolve(); expect(true).toBeTrue(); });\n});\n"); + await specsOf(['tests/pass.spec.js']); + assert(/jasmine-core is not installed: run wf install jasmine-core/.test((await tested()).error?.message), 'wf test must ask for jasmine-core'); + const testRequests = []; + globalThis.fetch = (input, init) => { + testRequests.push(new URL(input instanceof Request ? input.url : input, location.href).href); + return pageFetch(input, init); + }; + try { await runtime.execute(['install', 'jasmine-core'], context); } finally { globalThis.fetch = pageFetch; } + assert(testRequests.length > 0 && testRequests.every(url => url.startsWith(`${location.origin}/fixtures/registry/`)), `jasmine-core must come from the local registry: ${testRequests}`); + const testLock = await runtime.readLock(webFront); + const jasmineVersion = testLock.packages[testLock.roots['jasmine-core'].id].version; + const passing = await tested(); + assert(passing.text && passing.report?.status === 'passed' && passing.report.exitCode === 0 && passing.report.total === 3 && passing.report.passed === 2 && + passing.report.pending === 1 && passing.report.failed === 0 && passing.report.jasmine === jasmineVersion, + `Passing specs must be reported exactly: ${passing.error}\n${JSON.stringify(passing.report)}`); + assert(passing.output.startsWith('.*.') && passing.text.startsWith('PASSED: 3 specs, 0 failures, 1 pending') && /PENDING passing is pending: not yet/.test(passing.text) && + passing.text.includes(`jasmine-core ${jasmineVersion}`), `The terminal must show the progress and the summary: ${passing.output}\n${passing.text}`); + assert(!document.querySelector('iframe[title="WebFront tests"]'), 'The runner frame must be removed after a run'); + // A failing spec and the asynchronous failures: a late exception, an unhandled rejection, a spec reaching the bridge. + await writeFile('tests/fail.spec.ts', "describe('failing', () => {\n it('fails with a message', () => { const expected: number = 1; expect(expected).toBe(2); });\n});\n"); + await writeFile('tests/async.spec.js', "describe('asynchronous', () => {\n it('throws later', done => { setTimeout(() => { throw new Error('late boom'); }, 0); setTimeout(done, 80); });\n" + + " it('rejects unhandled', async () => { Promise.reject(new Error('unhandled boom')); await new Promise(resolve => setTimeout(resolve, 80)); });\n" + + " it('reaches the bridge', async () => expect(await webFront.cppFunction('test.browsers')()).toBeGreaterThan(0));\n});\n"); + await specsOf(['tests/pass.spec.js', 'tests/fail.spec.ts', 'tests/async.spec.js']); + const failing = await tested(); + const failedNames = failing.report?.failures.map(failure => failure.name); + assert(failing.error?.exitCode === 1 && failing.report?.status === 'failed' && failing.report.exitCode === 1 && failing.report.total === 7 && failing.report.passed === 3 && + failing.report.failed === 3 && failing.report.pending === 1, `A failing run must report exact counts and exit 1: ${failing.error}\n${JSON.stringify(failing.report)}`); + assert(JSON.stringify(failedNames) === JSON.stringify(['failing fails with a message', 'asynchronous throws later', 'asynchronous rejects unhandled']), `The failed specs must be named in order: ${failedNames}`); + const messageOf = name => failing.report.failures.find(failure => failure.name.endsWith(name)).messages.map(message => message.message).join('\n'); + assert(/Expected 1 to be 2\./.test(messageOf('fails with a message')) && /late boom/.test(messageOf('throws later')) && /unhandled boom/.test(messageOf('rejects unhandled')), + `Failure messages must be exact: ${JSON.stringify(failing.report.failures)}`); + assert(failing.error.message.startsWith('FAILED: 7 specs, 3 failures, 1 pending') && failing.error.message.includes('FAIL failing fails with a message\n Expected 1 to be 2.') && + failing.output.startsWith('.*.F'), `The terminal must show the failures: ${failing.output}\n${failing.error.message}`); + // A pattern keeps the specs whose full name contains it; one that matches nothing is not a pass. + const filtered = await tested(['passing']); + assert(filtered.report?.status === 'passed' && filtered.report.total === 3 && filtered.report.excluded === 4 && /4 filtered out/.test(filtered.text), `A pattern must filter the specs: ${filtered.error}\n${JSON.stringify(filtered.report)}`); + const unmatched = await tested(['no such spec']); + assert(unmatched.error?.exitCode === 1 && unmatched.report?.status === 'incomplete' && /No spec matches "no such spec"/.test(unmatched.error.message), `A pattern matching nothing must fail: ${unmatched.error}`); + // A spec that does not load fails the run: it is a build error for one that does not compile, a report for one that throws. + await writeFile('tests/missing.spec.js', "import './absent';\n"); + await specsOf(['tests/pass.spec.js', 'tests/missing.spec.js']); + const unbuilt = await tested(); + assert((unbuilt.error?.exitCode ?? 1) === 1 && /absent/.test(unbuilt.error.message) && !unbuilt.report, `An unresolved import must fail the build: ${unbuilt.error}`); + await writeFile('tests/throws.spec.js', "throw new Error('loading boom');\n"); + await specsOf(['tests/throws.spec.js']); + const unloaded = await tested(); + assert(unloaded.error?.exitCode === 1 && unloaded.report?.status !== 'passed' && /loading boom/.test(unloaded.error.message), `A spec that throws while loading must fail: ${unloaded.error}\n${JSON.stringify(unloaded.report)}`); + // A time limit and Ctrl+C end a run that does not return, remove the frame and report it. + await writeFile('tests/hang.spec.js', "describe('hanging', () => {\n it('never ends', () => new Promise(() => {}), 600000);\n});\n"); + await specsOf(['tests/hang.spec.js']); + const hung = await tested(['--timeout', '2']); + assert(hung.error?.exitCode === 124 && hung.report?.status === 'timeout' && /time limit/.test(hung.error.message), `A hanging run must stop at its time limit: ${hung.error}`); + assert(!document.querySelector('iframe[title="WebFront tests"]'), 'A timed out run must remove its frame'); + const stopTests = new AbortController(); + const interrupted = tested([], {signal: stopTests.signal}); + for (let attempt = 0; !document.querySelector('iframe[title="WebFront tests"]'); ++attempt) { + if (attempt === 300) throw new Error('The runner frame did not appear'); + await delay(30); + } + await delay(300); + stopTests.abort(new Error('Interrupted')); + const interruptedRun = await interrupted; + assert(interruptedRun.error?.exitCode === 130 && interruptedRun.report?.status === 'interrupted' && !document.querySelector('iframe[title="WebFront tests"]'), `Ctrl+C must stop a run: ${interruptedRun.error}`); + assert(/--timeout expects whole seconds/.test((await tested(['--timeout', '0'])).error?.message) && /Usage: wf test/.test((await tested(['a', 'b'])).error?.message), 'wf test must check its options'); + // Without a terminal: the result reaches C++ through the bridge and the session ends with the command's status. + await specsOf(['tests/pass.spec.js', 'tests/fail.spec.ts']); + const exits = []; + const sent = await runtime.runNonInteractive(['test'], {...runContext(), reporter: json => webFront.cppFunction('test.result')(json), onExit: code => exits.push(code)}); + const received = JSON.parse(await webFront.cppFunction('test.lastResult')()); + assert(sent.exitCode === 1 && exits.length === 1 && exits[0] === 1 && received.exitCode === 1 && received.report?.failed === 1 && received.report.total === 4 && + received.report.failures[0].name === 'failing fails with a message' && received.output.includes('FAILED: 4 specs, 1 failure'), `A non-interactive failure must reach C++ and end the session with 1: ${JSON.stringify(received)}`); + await specsOf(['tests/pass.spec.js']); + await runtime.runNonInteractive(['test'], {...runContext(), reporter: json => webFront.cppFunction('test.result')(json), onExit: code => exits.push(code)}); + const success = JSON.parse(await webFront.cppFunction('test.lastResult')()); + assert(exits[1] === 0 && success.exitCode === 0 && success.report.status === 'passed', `A non-interactive success must end the session with 0: ${JSON.stringify(success)}`); + await runtime.runNonInteractive(['test', '--timeout', 'x'], {...runContext(), reporter: () => { throw new Error('bridge down'); }, onExit: code => exits.push(code)}); + assert(exits[2] === 1, 'A command that fails and a result that cannot be sent must both end non-zero'); + await runtime.runNonInteractive(['list'], {...runContext(), reporter: () => { throw new Error('bridge down'); }, onExit: code => exits.push(code)}); + assert(exits[3] === 1, 'A result that cannot be sent must not end the session with 0'); // The terminal: the application's C++ commands, run in this browser's session. assert(JSON.stringify([...runtime.builtinNames].sort()) === JSON.stringify([...runtime.reservedNames].sort()), `The terminal's own commands must be the names reserved to it: ${runtime.builtinNames}`); From 0523d5aaf58a9dd050149555917bccbf815f8fe3 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 13:37:08 +0200 Subject: [PATCH 054/134] Bound the wf test result, start older Jasmine, report suite failures and CSS, share one deadline and isolate runs [#310] --- docs/DEVELOPER_ENVIRONMENT.md | 16 ++-- js/developer/environment/bundler.mjs | 2 +- js/developer/environment/bundles.json | 8 +- js/developer/environment/packages.bundle.mjs | 14 ++-- js/developer/environment/runtime.mjs | 54 +++++++++----- js/developer/environment/testing.mjs | 77 ++++++++++++++++---- js/developer/tools/testing-check.mjs | 45 +++++++++++- test/web/developer-specs.mjs | 29 ++++++++ 8 files changed, 192 insertions(+), 53 deletions(-) diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 6e0607fe..8a2009ce 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -453,26 +453,30 @@ and integrity. Nothing else is needed: no Node.js, no npm and no public network - `test.specs` lists project paths, run in that order (JS, JSX, TS and TSX are built by esbuild-wasm in the Worker of `wf build`, with the locked dependencies). Specs use the Jasmine globals (`describe`, `it`, `expect`, `jasmine`); - they do not import `jasmine-core`. Without specs, or without `jasmine-core` in the lock, the command says what to + they do not import `jasmine-core`. A spec may import a stylesheet, which the runner page loads. Both the Jasmine 7 and the earlier `jasmine.js`, which only exposes `jasmineRequire`, are started. Without specs, or without `jasmine-core` in the lock, the command says what to declare or install. - The specs run in a hidden frame of the environment's page (1024 × 768, same origin, with the bridge loaded, so a - spec can call `webFront.cppFunction`). The runner page is published to `.webfront/developer/test/` and served by - the developer HTTP provider; each run replaces it, and the frame is removed at the end, on a time limit and on Ctrl+C. + spec can call `webFront.cppFunction`). The runner page, Jasmine and everything the specs built (JS, CSS imported by a spec, assets) are published to a + directory of the run's own, `.webfront/developer/test//`, and served by the developer HTTP provider; two + sessions on a project never run each other's specs. The files are removed when the run ends (an empty directory + remains) and the frame is removed at the end, on a time limit and on Ctrl+C. - `pattern` keeps the specs whose full name (suites and spec names) contains it; the others count as filtered out. The order is fixed: no random shuffling. - The terminal shows `.`, `F` and `*` (passed, failed, pending) as specs end, then a summary line (`PASSED: 3 specs, 0 failures, 1 pending (12 ms, jasmine-core 7.0.2)`), each failure with its message and first stack frames, failures - outside any spec (an `afterAll`, a load error) and the pending specs with their reason. + outside any spec (a load error) and those of a suite (an `afterAll` that throws, shown as `FAIL (suite)`) and the pending specs with their reason. - Exit codes: 0 when every executed spec passed; 1 for a failed spec, a failure outside the specs, an unhandled asynchronous exception or rejection (Jasmine reports both as failures), a spec file that does not build or load, `fit`/`fdescribe`, and a run that executed nothing (no specs, or a pattern matching none); 124 at the time limit - (`--timeout`, default 60 s, 1 to 3600); 130 on Ctrl+C. Jasmine's own per-spec timeout (5 s by default) still ends a + (`--timeout`, default 60 s, 1 to 3600, covering the build and the publication as well as the run); 130 on Ctrl+C. Jasmine's own per-spec timeout (5 s by default) still ends a spec that never completes, which fails. - A synchronous infinite loop in a spec blocks the page that hosts the frame, as it would in any same-origin frame: the time limit cannot fire. Use asynchronous waits, which the time limit and Ctrl+C do stop. +The result sent to C++ is cut to 60,000 bytes when it is larger (a bridge string holds 65,535): the output first, then stack frames, messages and the lists, never the counts or the status; `truncated` is then `true`. + The report is structured: `{status, exitCode, total, passed, failed, pending, excluded, durationMs, jasmine, failures: -[{name, messages: [{message, stack}]}], pendingSpecs, global, incomplete}`, bounded (100 failures, 8 messages of 16 KiB +[{name, messages: [{message, stack}]}], pendingSpecs, suites, global, incomplete}`, bounded (100 failures, 8 messages of 16 KiB each per spec). `status` is `passed`, `failed`, `incomplete`, `error` (the specs did not load), `timeout` or `interrupted`. ### Without a terminal diff --git a/js/developer/environment/bundler.mjs b/js/developer/environment/bundler.mjs index 415cd231..a5ff5c5f 100644 --- a/js/developer/environment/bundler.mjs +++ b/js/developer/environment/bundler.mjs @@ -142,7 +142,7 @@ export async function bundleTests(esbuild, {specs, lock, packages, readProject}) build.onResolve({filter: /^webfront-spec:/}, args => find('project', normalize(args.path.slice('webfront-spec:'.length)))); }}; const result = await esbuild.build({entryPoints: ['webfront-test-entry'], bundle: true, write: false, - outfile: '/output/specs.js', format: 'esm', platform: 'browser', target: 'es2022', jsx: 'automatic', + outdir: '/output', entryNames: 'specs', assetNames: 'assets/[name]-[hash]', format: 'esm', platform: 'browser', target: 'es2022', jsx: 'automatic', define: {'process.env.NODE_ENV': '"test"'}, legalComments: 'inline', plugins: [entry, virtualPluginWith(lock, packages, readProject, loaded)]}); return new Map(result.outputFiles.map(file => [file.path.replace(/^\/output\//, ''), file.contents])); diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 12edc91b..e4770a53 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -16,14 +16,14 @@ "js/developer/environment/packages.mjs": "6636219f3fef20ea1d274dc9298d8af451ef257b86fe6c1ed0de9a7c797b11d8", "js/developer/environment/starter.mjs": "f38e290e03aebe146623c2ca9b590d645fb91a51acdf7a98101bb00b5b88096c", "js/developer/environment/paths.mjs": "3b6114df78eb193161c5c84499dda084cb7ff91c56a4496371c30295d00880e3", - "js/developer/environment/runtime.mjs": "1e9963a23b06bea2147b9de68d66e318de16c947589d3afb1668d243f4cf10b8", + "js/developer/environment/runtime.mjs": "cd9e942bc0db8fe0d61a1ac219320221c0e7b9eb06dc1b738731fc6746bfab99", "js/developer/environment/development.mjs": "dd07bc64e12c3392223f0e7aab0ae2f5223e093930bee8abe78a0cd3e2940d85", - "js/developer/environment/testing.mjs": "5d94b7702a65aca0e265cecae7ff82848d794ac0ffdbae127b3c576c480baed6", + "js/developer/environment/testing.mjs": "a450c27236ed23d9a1cb4b34fec3f22f3a16412c673a5cb6ce83db12fdd345c2", "js/developer/environment/terminal.mjs": "7ffcf7ac6ef63c35cdf5ef70284b384525b13ba18422af069289e53b6c4f6be1", "js/developer/environment/tarball.mjs": "1c1e1aea067910e1fec74e85b4bf9fbefed9b38187a04d8d2764f0b9a96fca39", "js/developer/environment/commands.mjs": "8de20c01f02f33c0566f204fcf1ee2382a23344d2103581fe2914469ec570531", "js/developer/environment/compiler.mjs": "0158931132aa9b43b7bbbd01de6fa4fc34fce8c65515d593dd494930f7a1910f", - "js/developer/environment/bundler.mjs": "a9b4d76ad2db1ddefe20319e98240a4124ff3595c61078f3f39fc76cf0ee0ac6", + "js/developer/environment/bundler.mjs": "48658151aae4fa5ad54c9fa3386ef4095b793de0f3ad242f95e8e5de0cd0ce4d", "js/developer/environment/entry.mjs": "b2b942443e3c74ae2c008392ba244d9b7e91db70ba1b4ebbe1357c455ebf51bb", "js/developer/environment/conditions.mjs": "7f0ecba239480831e38985ccffd4c82309949924f4eb9d938e4ad1b09f5f36ed", "js/developer/environment/io.mjs": "21af39f07c7eb863908c1df768e3c31de1c6eb8ff757c2a287c4a47c76855db6", @@ -45,6 +45,6 @@ "js/developer/tools/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b", "js/developer/vendor/package-lock.json": "f6aefe8b4cb0b15f866f41eae425f6654d2c6c2d96438fd0da878c5651585616", "js/core/bootstrap/bootstrap.bundle.mjs": "1069b307799ed2b0de53914748521731bc9796414a416d56340bbda983ef2443", - "js/developer/environment/packages.bundle.mjs": "671cc3fb82b1015e9c9c551f1aaaae788b0df0cd51bccbc01d0a3a3242ebde84", + "js/developer/environment/packages.bundle.mjs": "e36d1052285a313f7db67c1f58f8332da9e97446b1e2085422ebdae379288045", "include/webfront/system/DeveloperReleaseData.hpp": "d5aaddb2ba839e4c8df46b7d37e2861163233a9018b0f2fb35a6f79831e16569" } diff --git a/js/developer/environment/packages.bundle.mjs b/js/developer/environment/packages.bundle.mjs index 4f1af4f7..150dfb3d 100644 --- a/js/developer/environment/packages.bundle.mjs +++ b/js/developer/environment/packages.bundle.mjs @@ -1,16 +1,16 @@ -var Gn=Object.create;var mt=Object.defineProperty;var Mn=Object.getOwnPropertyDescriptor;var Wn=Object.getOwnPropertyNames;var _n=Object.getPrototypeOf,Vn=Object.prototype.hasOwnProperty;var w=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var Xn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Wn(t))!Vn.call(e,s)&&s!==r&&mt(e,s,{get:()=>t[s],enumerable:!(n=Mn(t,s))||n.enumerable});return e};var z=(e,t,r)=>(r=e!=null?Gn(_n(e)):{},Xn(t||!e||!e.__esModule?mt(r,"default",{value:e,enumerable:!0}):r,e));var V=w((Ea,xt)=>{"use strict";var Kn="2.0.0",Qn=Number.MAX_SAFE_INTEGER||9007199254740991,es=16,ts=250,rs=["major","premajor","minor","preminor","patch","prepatch","prerelease"];xt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:es,MAX_SAFE_BUILD_LENGTH:ts,MAX_SAFE_INTEGER:Qn,RELEASE_TYPES:rs,SEMVER_SPEC_VERSION:Kn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var X=w((ga,Rt)=>{"use strict";var ns=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Rt.exports=ns});var F=w((T,bt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:je,MAX_SAFE_BUILD_LENGTH:ss,MAX_LENGTH:os}=V(),is=X();T=bt.exports={};var cs=T.re=[],as=T.safeRe=[],p=T.src=[],ls=T.safeSrc=[],h=T.t={},us=0,Te="[a-zA-Z0-9-]",fs=[["\\s",1],["\\d",os],[Te,ss]],ps=e=>{for(let[t,r]of fs)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},E=(e,t,r)=>{let n=ps(t),s=us++;is(e,s,t),h[e]=s,p[s]=t,ls[s]=n,cs[s]=new RegExp(t,r?"g":void 0),as[s]=new RegExp(n,r?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Te}*`);E("MAINVERSION",`(${p[h.NUMERICIDENTIFIER]})\\.(${p[h.NUMERICIDENTIFIER]})\\.(${p[h.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${p[h.NUMERICIDENTIFIERLOOSE]})\\.(${p[h.NUMERICIDENTIFIERLOOSE]})\\.(${p[h.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${p[h.NONNUMERICIDENTIFIER]}|${p[h.NUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${p[h.NONNUMERICIDENTIFIER]}|${p[h.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASE",`(?:-(${p[h.PRERELEASEIDENTIFIER]}(?:\\.${p[h.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${p[h.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${p[h.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${Te}+`);E("BUILD",`(?:\\+(${p[h.BUILDIDENTIFIER]}(?:\\.${p[h.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${p[h.MAINVERSION]}${p[h.PRERELEASE]}?${p[h.BUILD]}?`);E("FULL",`^${p[h.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${p[h.MAINVERSIONLOOSE]}${p[h.PRERELEASELOOSE]}?${p[h.BUILD]}?`);E("LOOSE",`^${p[h.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${p[h.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${p[h.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${p[h.XRANGEIDENTIFIER]})(?:\\.(${p[h.XRANGEIDENTIFIER]})(?:\\.(${p[h.XRANGEIDENTIFIER]})(?:${p[h.PRERELEASE]})?${p[h.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${p[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${p[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${p[h.XRANGEIDENTIFIERLOOSE]})(?:${p[h.PRERELEASELOOSE]})?${p[h.BUILD]}?)?)?`);E("XRANGE",`^${p[h.GTLT]}\\s*${p[h.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${p[h.GTLT]}\\s*${p[h.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${je}})(?:\\.(\\d{1,${je}}))?(?:\\.(\\d{1,${je}}))?`);E("COERCE",`${p[h.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",p[h.COERCEPLAIN]+`(?:${p[h.PRERELEASE]})?(?:${p[h.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",p[h.COERCE],!0);E("COERCERTLFULL",p[h.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${p[h.LONETILDE]}\\s+`,!0);T.tildeTrimReplace="$1~";E("TILDE",`^${p[h.LONETILDE]}${p[h.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${p[h.LONETILDE]}${p[h.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${p[h.LONECARET]}\\s+`,!0);T.caretTrimReplace="$1^";E("CARET",`^${p[h.LONECARET]}${p[h.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${p[h.LONECARET]}${p[h.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${p[h.GTLT]}\\s*(${p[h.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${p[h.GTLT]}\\s*(${p[h.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${p[h.GTLT]}\\s*(${p[h.LOOSEPLAIN]}|${p[h.XRANGEPLAIN]})`,!0);T.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${p[h.XRANGEPLAIN]})\\s+-\\s+(${p[h.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${p[h.XRANGEPLAINLOOSE]})\\s+-\\s+(${p[h.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ce=w(($a,Ot)=>{"use strict";var hs=Object.freeze({loose:!0}),ds=Object.freeze({}),ms=e=>e?typeof e!="object"?hs:e:ds;Ot.exports=ms});var Pe=w((ya,Nt)=>{"use strict";var vt=/^[0-9]+$/,It=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:eIt(t,e);Nt.exports={compareIdentifiers:It,rcompareIdentifiers:ws}});var b=w((xa,kt)=>{"use strict";var ae=X(),{MAX_LENGTH:St,MAX_SAFE_INTEGER:le}=V(),{safeRe:ue,t:fe}=F(),Es=ce(),{compareIdentifiers:qe}=Pe(),Ce=class e{constructor(t,r){if(r=Es(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>St)throw new TypeError(`version is longer than ${St} characters`);ae("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?ue[fe.LOOSE]:ue[fe.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>le||this.major<0)throw new TypeError("Invalid major version");if(this.minor>le||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>le||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let o=+s;if(o>=0&&ot.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(ae("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return qe(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(ae("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return qe(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?ue[fe.PRERELEASELOOSE]:ue[fe.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let o=[r,s];n===!1&&(o=[r]),qe(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};kt.exports=Ce});var q=w((Ra,At)=>{"use strict";var Lt=b(),gs=(e,t,r=!1)=>{if(e instanceof Lt)return e;try{return new Lt(e,t)}catch(n){if(!r)return null;throw n}};At.exports=gs});var Tt=w((ba,jt)=>{"use strict";var $s=q(),ys=(e,t)=>{let r=$s(e,t);return r?r.version:null};jt.exports=ys});var qt=w((Oa,Pt)=>{"use strict";var xs=q(),Rs=(e,t)=>{let r=xs(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};Pt.exports=Rs});var Ut=w((va,Dt)=>{"use strict";var Ct=b(),bs=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new Ct(e instanceof Ct?e.version:e,r).inc(t,n,s).version}catch{return null}};Dt.exports=bs});var Gt=w((Ia,Ft)=>{"use strict";var zt=q(),Os=(e,t)=>{let r=zt(e,null,!0),n=zt(t,null,!0),s=r.compare(n);if(s===0)return null;let o=s>0,i=o?r:n,a=o?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0)return a.minor&&!a.patch?"minor":"patch"}let u=c?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};Ft.exports=Os});var Wt=w((Na,Mt)=>{"use strict";var vs=b(),Is=(e,t)=>new vs(e,t).major;Mt.exports=Is});var Vt=w((Sa,_t)=>{"use strict";var Ns=b(),Ss=(e,t)=>new Ns(e,t).minor;_t.exports=Ss});var Bt=w((ka,Xt)=>{"use strict";var ks=b(),Ls=(e,t)=>new ks(e,t).patch;Xt.exports=Ls});var Yt=w((La,Ht)=>{"use strict";var As=q(),js=(e,t)=>{let r=As(e,t);return r&&r.prerelease.length?r.prerelease:null};Ht.exports=js});var k=w((Aa,Zt)=>{"use strict";var Jt=b(),Ts=(e,t,r)=>new Jt(e,r).compare(new Jt(t,r));Zt.exports=Ts});var Qt=w((ja,Kt)=>{"use strict";var Ps=k(),qs=(e,t,r)=>Ps(t,e,r);Kt.exports=qs});var tr=w((Ta,er)=>{"use strict";var Cs=k(),Ds=(e,t)=>Cs(e,t,!0);er.exports=Ds});var pe=w((Pa,nr)=>{"use strict";var rr=b(),Us=(e,t,r)=>{let n=new rr(e,r),s=new rr(t,r);return n.compare(s)||n.compareBuild(s)};nr.exports=Us});var or=w((qa,sr)=>{"use strict";var zs=pe(),Fs=(e,t)=>e.sort((r,n)=>zs(r,n,t));sr.exports=Fs});var cr=w((Ca,ir)=>{"use strict";var Gs=pe(),Ms=(e,t)=>e.sort((r,n)=>Gs(n,r,t));ir.exports=Ms});var B=w((Da,ar)=>{"use strict";var Ws=k(),_s=(e,t,r)=>Ws(e,t,r)>0;ar.exports=_s});var he=w((Ua,lr)=>{"use strict";var Vs=k(),Xs=(e,t,r)=>Vs(e,t,r)<0;lr.exports=Xs});var De=w((za,ur)=>{"use strict";var Bs=k(),Hs=(e,t,r)=>Bs(e,t,r)===0;ur.exports=Hs});var Ue=w((Fa,fr)=>{"use strict";var Ys=k(),Js=(e,t,r)=>Ys(e,t,r)!==0;fr.exports=Js});var de=w((Ga,pr)=>{"use strict";var Zs=k(),Ks=(e,t,r)=>Zs(e,t,r)>=0;pr.exports=Ks});var me=w((Ma,hr)=>{"use strict";var Qs=k(),eo=(e,t,r)=>Qs(e,t,r)<=0;hr.exports=eo});var ze=w((Wa,dr)=>{"use strict";var to=De(),ro=Ue(),no=B(),so=de(),oo=he(),io=me(),co=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return to(e,r,n);case"!=":return ro(e,r,n);case">":return no(e,r,n);case">=":return so(e,r,n);case"<":return oo(e,r,n);case"<=":return io(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};dr.exports=co});var wr=w((_a,mr)=>{"use strict";var ao=b(),lo=q(),{safeRe:we,t:Ee}=F(),uo=(e,t)=>{if(e instanceof ao)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?we[Ee.COERCEFULL]:we[Ee.COERCE]);else{let c=t.includePrerelease?we[Ee.COERCERTLFULL]:we[Ee.COERCERTL],l;for(;(l=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||l.index+l[0].length!==r.index+r[0].length)&&(r=l),c.lastIndex=l.index+l[1].length+l[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",o=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return lo(`${n}.${s}.${o}${i}${a}`,t)};mr.exports=uo});var gr=w((Va,Er)=>{"use strict";var Fe=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};Er.exports=Fe});var L=w((Xa,Rr)=>{"use strict";var fo=/\s+/g,Ge=class e{constructor(t,r){if(r=ho(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Me)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(fo," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!yr(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&xo(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&$o)|(this.options.loose&&yo))+":"+t,s=$r.get(n);if(s)return s;let o=this.options.loose,i=o?v[O.HYPHENRANGELOOSE]:v[O.HYPHENRANGE];t=t.replace(i,Ao(this.options.includePrerelease)),g("hyphen replace",t),t=t.replace(v[O.COMPARATORTRIM],wo),g("comparator trim",t),t=t.replace(v[O.TILDETRIM],Eo),g("tilde trim",t),t=t.replace(v[O.CARETTRIM],go),g("caret trim",t);let a=t.split(" ").map(f=>Ro(f,this.options)).join(" ").split(/\s+/).map(f=>Lo(f,this.options));o&&(a=a.filter(f=>(g("loose invalid filter",f,this.options),!!f.match(v[O.COMPARATORLOOSE])))),g("range list",a);let c=new Map,l=a.map(f=>new Me(f,this.options));for(let f of l){if(yr(f))return[f];c.set(f.value,f)}c.size>1&&c.has("")&&c.delete("");let u=[...c.values()];return $r.set(n,u),u}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>xr(n,r)&&t.set.some(s=>xr(s,r)&&n.every(o=>s.every(i=>o.intersects(i,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new mo(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",xo=e=>e.value==="",xr=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(o=>s.intersects(o,t)),s=n.pop();return r},Ro=(e,t)=>(e=e.replace(v[O.BUILD],""),g("comp",e,t),e=vo(e,t),g("caret",e),e=bo(e,t),g("tildes",e),e=No(e,t),g("xrange",e),e=ko(e,t),g("stars",e),e),I=e=>!e||e.toLowerCase()==="x"||e==="*",bo=(e,t)=>e.trim().split(/\s+/).map(r=>Oo(r,t)).join(" "),Oo=(e,t)=>{let r=t.loose?v[O.TILDELOOSE]:v[O.TILDE];return e.replace(r,(n,s,o,i,a)=>{g("tilde",e,n,s,o,i,a);let c;return I(s)?c="":I(o)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:I(i)?c=`>=${s}.${o}.0 <${s}.${+o+1}.0-0`:a?(g("replaceTilde pr",a),c=`>=${s}.${o}.${i}-${a} <${s}.${+o+1}.0-0`):c=`>=${s}.${o}.${i} <${s}.${+o+1}.0-0`,g("tilde return",c),c})},vo=(e,t)=>e.trim().split(/\s+/).map(r=>Io(r,t)).join(" "),Io=(e,t)=>{g("caret",e,t);let r=t.loose?v[O.CARETLOOSE]:v[O.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,o,i,a,c)=>{g("caret",e,s,o,i,a,c);let l;return I(o)?l="":I(i)?l=`>=${o}.0.0${n} <${+o+1}.0.0-0`:I(a)?o==="0"?l=`>=${o}.${i}.0${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.0${n} <${+o+1}.0.0-0`:c?(g("replaceCaret pr",c),o==="0"?i==="0"?l=`>=${o}.${i}.${a}-${c} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}-${c} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a}-${c} <${+o+1}.0.0-0`):(g("no pr"),o==="0"?i==="0"?l=`>=${o}.${i}.${a}${n} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a} <${+o+1}.0.0-0`),g("caret return",l),l})},No=(e,t)=>(g("replaceXRanges",e,t),e.split(/\s+/).map(r=>So(r,t)).join(" ")),So=(e,t)=>{e=e.trim();let r=t.loose?v[O.XRANGELOOSE]:v[O.XRANGE];return e.replace(r,(n,s,o,i,a,c)=>{g("xRange",e,n,s,o,i,a,c);let l=I(o),u=l||I(i),f=u||I(a),m=f;return s==="="&&m&&(s=""),c=t.includePrerelease?"-0":"",l?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&m?(u&&(i=0),a=0,s===">"?(s=">=",u?(o=+o+1,i=0,a=0):(i=+i+1,a=0)):s==="<="&&(s="<",u?o=+o+1:i=+i+1),s==="<"&&(c="-0"),n=`${s+o}.${i}.${a}${c}`):u?n=`>=${o}.0.0${c} <${+o+1}.0.0-0`:f&&(n=`>=${o}.${i}.0${c} <${o}.${+i+1}.0-0`),g("xRange return",n),n})},ko=(e,t)=>(g("replaceStars",e,t),e.trim().replace(v[O.STAR],"")),Lo=(e,t)=>(g("replaceGTE0",e,t),e.trim().replace(v[t.includePrerelease?O.GTE0PRE:O.GTE0],"")),Ao=e=>(t,r,n,s,o,i,a,c,l,u,f,m)=>(I(n)?r="":I(s)?r=`>=${n}.0.0${e?"-0":""}`:I(o)?r=`>=${n}.${s}.0${e?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,I(l)?c="":I(u)?c=`<${+l+1}.0.0-0`:I(f)?c=`<${l}.${+u+1}.0-0`:m?c=`<=${l}.${u}.${f}-${m}`:e?c=`<${l}.${u}.${+f+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),jo=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var H=w((Ba,Sr)=>{"use strict";var Y=Symbol("SemVer ANY"),Ve=class e{static get ANY(){return Y}constructor(t,r){if(r=br(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),_e("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===Y?this.value="":this.value=this.operator+this.semver.version,_e("comp",this)}parse(t){let r=this.options.loose?Or[vr.COMPARATORLOOSE]:Or[vr.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new Ir(n[2],this.options.loose):this.semver=Y}toString(){return this.value}test(t){if(_e("Comparator.test",t,this.options.loose),this.semver===Y||t===Y)return!0;if(typeof t=="string")try{t=new Ir(t,this.options)}catch{return!1}return We(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Nr(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new Nr(this.value,r).test(t.semver):(r=br(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||We(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||We(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Sr.exports=Ve;var br=ce(),{safeRe:Or,t:vr}=F(),We=ze(),_e=X(),Ir=b(),Nr=L()});var J=w((Ha,kr)=>{"use strict";var To=L(),Po=(e,t,r)=>{try{t=new To(t,r)}catch{return!1}return t.test(e)};kr.exports=Po});var Ar=w((Ya,Lr)=>{"use strict";var qo=L(),Co=(e,t)=>new qo(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Lr.exports=Co});var Tr=w((Ja,jr)=>{"use strict";var Do=b(),Uo=L(),zo=(e,t,r)=>{let n=null,s=null,o=null;try{o=new Uo(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===-1)&&(n=i,s=new Do(n,r))}),n};jr.exports=zo});var qr=w((Za,Pr)=>{"use strict";var Fo=b(),Go=L(),Mo=(e,t,r)=>{let n=null,s=null,o=null;try{o=new Go(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===1)&&(n=i,s=new Fo(n,r))}),n};Pr.exports=Mo});var Ur=w((Ka,Dr)=>{"use strict";var Xe=b(),Wo=L(),Cr=B(),_o=(e,t)=>{e=new Wo(e,t);let r=new Xe("0.0.0");if(e.test(r)||(r=new Xe("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let a=new Xe(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||Cr(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||Cr(r,o))&&(r=o)}return r&&e.test(r)?r:null};Dr.exports=_o});var Fr=w((Qa,zr)=>{"use strict";var Vo=L(),Xo=(e,t)=>{try{return new Vo(e,t).range||"*"}catch{return null}};zr.exports=Xo});var ge=w((el,_r)=>{"use strict";var Bo=b(),Wr=H(),{ANY:Ho}=Wr,Yo=L(),Jo=J(),Gr=B(),Mr=he(),Zo=me(),Ko=de(),Qo=(e,t,r,n)=>{e=new Bo(e,n),t=new Yo(t,n);let s,o,i,a,c;switch(r){case">":s=Gr,o=Zo,i=Mr,a=">",c=">=";break;case"<":s=Mr,o=Ko,i=Gr,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Jo(e,t,n))return!1;for(let l=0;l{d.semver===Ho&&(d=new Wr(">=0.0.0")),f=f||d,m=m||d,s(d.semver,f.semver,n)?f=d:i(d.semver,m.semver,n)&&(m=d)}),f.operator===a||f.operator===c||(!m.operator||m.operator===a)&&o(e,m.semver))return!1;if(m.operator===c&&i(e,m.semver))return!1}return!0};_r.exports=Qo});var Xr=w((tl,Vr)=>{"use strict";var ei=ge(),ti=(e,t,r)=>ei(e,t,">",r);Vr.exports=ti});var Hr=w((rl,Br)=>{"use strict";var ri=ge(),ni=(e,t,r)=>ri(e,t,"<",r);Br.exports=ni});var Zr=w((nl,Jr)=>{"use strict";var Yr=L(),si=(e,t,r)=>(e=new Yr(e,r),t=new Yr(t,r),e.intersects(t,r));Jr.exports=si});var Qr=w((sl,Kr)=>{"use strict";var oi=J(),ii=k();Kr.exports=(e,t,r)=>{let n=[],s=null,o=null,i=e.sort((u,f)=>ii(u,f,r));for(let u of i)oi(u,t,r)?(o=u,s||(s=u)):(o&&n.push([s,o]),o=null,s=null);s&&n.push([s,null]);let a=[];for(let[u,f]of n)u===f?a.push(u):!f&&u===i[0]?a.push("*"):f?u===i[0]?a.push(`<=${f}`):a.push(`${u} - ${f}`):a.push(`>=${u}`);let c=a.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return c.length{"use strict";var en=L(),He=H(),{ANY:Be}=He,Z=J(),Ye=k(),ci=(e,t,r={})=>{if(e===t)return!0;e=new en(e,r),t=new en(t,r);let n=!1;e:for(let s of e.set){for(let o of t.set){let i=li(s,o,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},ai=[new He(">=0.0.0-0")],tn=[new He(">=0.0.0")],li=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Be){if(t.length===1&&t[0].semver===Be)return!0;r.includePrerelease?e=ai:e=tn}if(t.length===1&&t[0].semver===Be){if(r.includePrerelease)return!0;t=tn}let n=new Set,s,o;for(let d of e)d.operator===">"||d.operator===">="?s=rn(s,d,r):d.operator==="<"||d.operator==="<="?o=nn(o,d,r):n.add(d.semver);if(n.size>1)return null;let i;if(s&&o){if(i=Ye(s.semver,o.semver,r),i>0)return null;if(i===0&&(s.operator!==">="||o.operator!=="<="))return null}for(let d of n){if(s&&!Z(d,String(s),r)||o&&!Z(d,String(o),r))return null;for(let j of t)if(!Z(d,String(j),r))return!1;return!0}let a,c,l,u,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,m=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;f&&f.prerelease.length===1&&o.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(let d of t){if(u=u||d.operator===">"||d.operator===">=",l=l||d.operator==="<"||d.operator==="<=",s){if(m&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===m.major&&d.semver.minor===m.minor&&d.semver.patch===m.patch&&(m=!1),d.operator===">"||d.operator===">="){if(a=rn(s,d,r),a===d&&a!==s)return!1}else if(s.operator===">="&&!Z(s.semver,String(d),r))return!1}if(o){if(f&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===f.major&&d.semver.minor===f.minor&&d.semver.patch===f.patch&&(f=!1),d.operator==="<"||d.operator==="<="){if(c=nn(o,d,r),c===d&&c!==o)return!1}else if(o.operator==="<="&&!Z(o.semver,String(d),r))return!1}if(!d.operator&&(o||s)&&i!==0)return!1}return!(s&&l&&!o&&i!==0||o&&u&&!s&&i!==0||m||f)},rn=(e,t,r)=>{if(!e)return t;let n=Ye(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},nn=(e,t,r)=>{if(!e)return t;let n=Ye(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};sn.exports=ci});var C=w((il,ln)=>{"use strict";var Je=F(),cn=V(),ui=b(),an=Pe(),fi=q(),pi=Tt(),hi=qt(),di=Ut(),mi=Gt(),wi=Wt(),Ei=Vt(),gi=Bt(),$i=Yt(),yi=k(),xi=Qt(),Ri=tr(),bi=pe(),Oi=or(),vi=cr(),Ii=B(),Ni=he(),Si=De(),ki=Ue(),Li=de(),Ai=me(),ji=ze(),Ti=wr(),Pi=H(),qi=L(),Ci=J(),Di=Ar(),Ui=Tr(),zi=qr(),Fi=Ur(),Gi=Fr(),Mi=ge(),Wi=Xr(),_i=Hr(),Vi=Zr(),Xi=Qr(),Bi=on();ln.exports={parse:fi,valid:pi,clean:hi,inc:di,diff:mi,major:wi,minor:Ei,patch:gi,prerelease:$i,compare:yi,rcompare:xi,compareLoose:Ri,compareBuild:bi,sort:Oi,rsort:vi,gt:Ii,lt:Ni,eq:Si,neq:ki,gte:Li,lte:Ai,cmp:ji,coerce:Ti,Comparator:Pi,Range:qi,satisfies:Ci,toComparators:Di,maxSatisfying:Ui,minSatisfying:zi,minVersion:Fi,validRange:Gi,outside:Mi,gtr:Wi,ltr:_i,intersects:Vi,simplifyRange:Xi,subset:Bi,SemVer:ui,re:Je.re,src:Je.src,tokens:Je.t,SEMVER_SPEC_VERSION:cn.SEMVER_SPEC_VERSION,RELEASE_TYPES:cn.RELEASE_TYPES,compareIdentifiers:an.compareIdentifiers,rcompareIdentifiers:an.rcompareIdentifiers}});var Ae=new TextDecoder;function ie(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function Et(e,t){let r=String(t??"").split(/\s+/).filter(o=>o.startsWith("sha512-")).map(o=>o.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,o=>String.fromCharCode(o)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function gt(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let o=await r.read();!o.done;o=await r.read()){if(s+=o.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(o.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function _(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return Ae.decode(s<0?n:n.subarray(0,s))}function $t(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,o)=>s*256+o,e[t]&127);let n=_(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function Bn(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if($t(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function Hn(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let o=Ae.decode(e.subarray(n+1,r+s-1)),i=o.indexOf("=");t[o.slice(0,i)]=o.slice(i+1),r+=s}return t}function Yn(e,t){let r=e.subarray(t,t+512);Bn(r);let n=$t(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function Jn(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function Zn(e){let t=_(e,0,100),r=_(e,257,5)==="ustar"?_(e,345,155):"";return r?`${r}/${t}`:t}var wt={x:(e,t)=>({...e,pax:Hn(t).path}),L:(e,t)=>({...e,long:_(t,0,t.length)}),g:e=>e};function yt(e){let t=[],r={};for(let n=0;!Jn(e,n);){let{header:s,type:o,data:i,next:a}=Yn(e,n);if(n=a,Object.hasOwn(wt,o)){r=wt[o](r,i);continue}(o==="0"||o==="7")&&t.push({path:r.pax??r.long??Zn(s),bytes:i}),r={}}return t}var xe=z(C(),1);var x=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function G(e,t){let r=[],n=0;for(;;){let s=await x(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function K(e,{id:t,path:r,bytes:n},s){for(let o=0;o{}),a}}async function Hi(e,t){let r=[],n=0;for(;;){let{done:s,value:o}=await e.read();if(s)return r;if(n+=o.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(o)}}async function Yi(e,t){try{return await Hi(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function un(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await Yi(e.body.getReader(),t)).arrayBuffer())}var M=".webfront/developer/packages",Ji=/[\\\0:*?"<>|]/,Zi=e=>e.split("/").some(t=>!t||t==="."||t==="..");function Ki(e){return typeof e!="string"||!e||Ji.test(e)?!0:Zi(e)}function A(e){if(Ki(e))throw new Error(`Unsafe package path: ${e}`);return e}var Qi=new TextDecoder,ec=["preinstall","install","postinstall"];async function fn(e){let t=new Map;for(let r of yt(await gt(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=A(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var tc=e=>ec.some(t=>e.scripts?.[t]),rc=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function nc(e,t){return tc(e)||e.gypfile?!0:rc(t)}function pn(e,t,r){let n=JSON.parse(Qi.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(nc(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}function W(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var R="webfront.project.json",S="webfront-packages.lock.json",ee=1,Ze=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,sc=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,oc=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,hn=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,Ke=/^[A-Za-z_][A-Za-z0-9_]*$/,dn=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],ic=["files","publish","fetch"],$=e=>{throw new Error(`${R}: ${e}`)};function P(e,t){return W(e)||$(`${t} must be an object`),e}function Qe(e,t,r){for(let n of Object.keys(e))t.includes(n)||$(`unknown key "${n}" in ${r}`)}function $e(e,t){typeof e!="string"&&$(`${t} must be a project path`);try{return A(e)}catch{return $(`${t} is not a safe project-relative path: ${e}`)}}function mn(e,t){return(!Array.isArray(e)||e.length>256)&&$(`${t} must be an array of at most 256 paths`),e.map((r,n)=>$e(r,`${t}[${n}]`))}function cc(e){let t=P(e,"dependencies");for(let[r,n]of Object.entries(t))Ze.test(r)||$(`invalid npm package name "${r}"`),(typeof n!="string"||!oc.test(n)||n!==n.trim())&&$(`invalid version range for "${r}"`);return t}var et=e=>e.startsWith("/")&&!e.startsWith("//")&&!e.includes("\\");function ac(e){if(typeof e!="string"&&$("registry must be a URL"),et(e))return e;let t;try{t=new URL(e)}catch{return $("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&$("registry must use https"),e}function lc(e){let t=P(e,"scripts");for(let[r,n]of Object.entries(t))(!hn.test(r)||typeof n!="string"||!n||n.length>1024)&&$(`invalid script "${r}"`);return t}function uc(e){let t=P(e,"entries");for(let[r,n]of Object.entries(t))hn.test(r)||$(`invalid entry name "${r}"`),$e(n,`entries.${r}`);return t}function fc(e,t){let r=P(e,"providers");for(let[n,s]of Object.entries(r))Ke.test(n)||$(`invalid provider name "${n}"`),P(s,`providers.${n}`),Qe(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&$(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||$e(s.entry,`providers.${n}.entry`),$e(s.output,`providers.${n}.output`).endsWith(".hpp")||$(`providers.${n}.output must be a .hpp file`);return r}function pc(e){let t=P(e,"test");return Qe(t,["specs"],"test"),t.specs!==void 0&&mn(t.specs,"test.specs"),t}function hc(e,t){let r;try{r=new URL(e)}catch{return $(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&$(`${t} must be an https origin without a path`),e}function dc(e){let t=P(e,"permissions");for(let r of Object.keys(t))ic.includes(r)||$(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&mn(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&$("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>hc(r,`permissions.fetch[${n}]`))),t}function mc(e){(typeof e.name!="string"||!Ze.test(e.name))&&$("name must be a lower-case npm package name"),(typeof e.version!="string"||!sc.test(e.version))&&$("version must be a semantic version")}function wc(e){e.format!==ee&&(Number.isInteger(e.format)&&e.format>ee&&$(`format ${e.format} is not supported by this environment (it reads format ${ee}); update the environment`),$(`format must be ${ee}`))}function te(e){P(e,"the manifest"),wc(e),Qe(e,dn,"the manifest"),mc(e);let t=e.entries===void 0?{}:uc(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:cc(e.dependencies),entries:t,providers:e.providers===void 0?{}:fc(e.providers,t),...e.registry===void 0?{}:{registry:ac(e.registry)},...e.scripts===void 0?{}:{scripts:lc(e.scripts)},...e.test===void 0?{}:{test:pc(e.test)},...e.permissions===void 0?{}:{permissions:dc(e.permissions)}}}function tt(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return $("not valid JSON")}return{source:t,manifest:te(t)}}function gl(e){return tt(e).manifest}function rt(e){let t={};for(let r of dn)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` -`}function wn(e){return{format:ee,name:e,version:"0.1.0",dependencies:{}}}function En(e){let r=(String(e??"").split("/").filter(Boolean).pop()??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"");return Ze.test(r)?r:"webfront-app"}async function ye(e){let t=JSON.stringify(Object.entries(e).sort(([n],[s])=>ns?1:0)),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(r)].map(n=>n.toString(16).padStart(2,"0")).join("")}var nt=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),Re=(e,t)=>`${e.replace("/","+")}@${t}`,st=(e,t,r)=>`${Re(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function Ec(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function gc(e,t){let r=e["dist-tags"]?.[t];return r||(xe.default.valid(t)?t:xe.default.maxSatisfying(Object.keys(e.versions??{}),t))}function $c(e,t,r){let n=r||"latest",s=gc(e,n),o=e.versions?.[s];if(!o||!xe.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:o}}async function yc(e,t,r,{fetchImpl:n,signal:s}){let o=new URL(t.dist?.tarball,r);if(o.protocol!=="https:"&&o.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let i=await n(o,{signal:s});if(!i.ok)throw new Error(`Package download for ${e}: HTTP ${i.status}`);let a=await un(i);return{bytes:a,integrity:await Et(a,t.dist.integrity)}}function ot(e){let t=new URL(e,globalThis.location?.href),r=t.origin===globalThis.location?.origin;if(e.startsWith("/")?!et(e)||!r:t.protocol!=="https:"&&!r)throw new Error(`The npm registry must use HTTPS or the application origin: ${e}`);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function D(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!nt(e))throw new Error(`Unsupported npm package name: ${e}`);let o=ot(r),i={fetchImpl:n,signal:s},{version:a,manifest:c}=$c(await Ec(e,o,i),e,t),{bytes:l,integrity:u}=await yc(e,c,o,i),f=await fn(l),m=pn(f,e,a);return{id:Re(e,a),key:st(e,a,u),manifest:m,integrity:u,files:f}}var be=z(C(),1);function xc(e,t,r){let n=e?.roots?.[t];return n?.requested===r&&e.packages[n.id]?e.packages[n.id]:be.default.validRange(r)?Object.values(e?.packages??{}).filter(o=>o.name===t&&be.default.satisfies(o.version,r)).sort((o,i)=>be.default.rcompare(o.version,i.version))[0]??null:null}function gn({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=D,previous:s}){let o=new Map;return async(i,a)=>{let c=`${i}@${a}`;if(o.has(c))return o.get(c);let l=xc(s,i,a),u=await n(i,l?.version??a,{registry:e,fetchImpl:t,signal:r});if(l&&u.integrity!==l.integrity)throw new Error(`${u.id} no longer matches the integrity recorded in the lock`);return o.set(c,u),u}}var $n=z(C(),1),yn=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function Rc(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw yn(e,t,r)}function bc(e,[t,r],{nodes:n,roots:s}){let o=s[t]?.id??e.dependencies[t];if(!o)return Rc(e,t,r);if(!$n.default.satisfies(n[o].version,r))throw yn(e,t,r);return o}function Oc(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=bc(e,r,t);n&&(e.dependencies[r[0]]=n)}}function xn(e,t){for(let r of Object.values(e))Oc(r,{nodes:e,roots:t})}var Rn=z(C(),1);function vc(e,t){return!nt(t.name)||!Rn.default.valid(t.version)?!1:e===Re(t.name,t.version)}function Ic(e){return e.integrity?.startsWith("sha512-")?e.key===st(e.name,e.version,e.integrity):!1}function Nc(e,t,r){if(!vc(t,r)||!Ic(r))throw new Error("Invalid locked package");for(let n of r.files)A(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function Sc(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function it(e){if(!Sc(e))throw new Error("Unsupported package lock");if(Object.keys(e.packages).length>512)throw new Error("The package lock exceeds 512 packages");for(let[t,r]of Object.entries(e.packages))Nc(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function kc(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function Lc(e,t){let r={};for(let n of e){let{name:s,version:o}=ie(n);r[s]={requested:o||"latest",id:await t(s,o||"latest")}}return r}async function bn(e,t={}){let r=gn(t),n={nodes:{},downloads:new Map,total:0},s=async(i,a)=>{t.signal?.throwIfAborted();let c=await r(i,a);if(n.nodes[c.id])return c.id;kc(n,i,c);for(let[l,u]of Object.entries(c.manifest.dependencies??{}).sort())n.nodes[c.id].dependencies[l]=await s(l,u);return c.id},o=await Lc(e,s);return xn(n.nodes,o),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:o,packages:n.nodes},downloads:n.downloads}}var ct=z(C(),1);var Ac=new TextDecoder,jc=new TextEncoder,Oe="No webfront.project.json: run wf init",ve="The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again";async function On(e,t){try{return await G(e,t)}catch(r){if(r.message.includes("Cannot read project file:"))return null;throw r}}function Tc(e,t,r){return t?r===t.requested?!0:ct.default.validRange(r)!==null&&ct.default.satisfies(e.packages[t.id].version,r):!1}function Pc(e,t){let r=Object.keys(t);return r.length===Object.keys(e.roots).length&&r.every(n=>Tc(e,e.roots[n],t[n]))}function qc(e,t,r){return e?t?t.manifestDigest===void 0?Pc(t,e.dependencies)?"legacy":"desynchronized":t.manifestDigest===r?"consistent":"desynchronized":"unlocked":"no-manifest"}async function re(e){let t=await x(e,"state",`${R} +var Gn=Object.create;var mt=Object.defineProperty;var Mn=Object.getOwnPropertyDescriptor;var Wn=Object.getOwnPropertyNames;var _n=Object.getPrototypeOf,Vn=Object.prototype.hasOwnProperty;var w=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var Xn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Wn(t))!Vn.call(e,s)&&s!==r&&mt(e,s,{get:()=>t[s],enumerable:!(n=Mn(t,s))||n.enumerable});return e};var z=(e,t,r)=>(r=e!=null?Gn(_n(e)):{},Xn(t||!e||!e.__esModule?mt(r,"default",{value:e,enumerable:!0}):r,e));var V=w((Ea,xt)=>{"use strict";var Kn="2.0.0",Qn=Number.MAX_SAFE_INTEGER||9007199254740991,es=16,ts=250,rs=["major","premajor","minor","preminor","patch","prepatch","prerelease"];xt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:es,MAX_SAFE_BUILD_LENGTH:ts,MAX_SAFE_INTEGER:Qn,RELEASE_TYPES:rs,SEMVER_SPEC_VERSION:Kn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var X=w((ga,Rt)=>{"use strict";var ns=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Rt.exports=ns});var F=w((j,bt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Te,MAX_SAFE_BUILD_LENGTH:ss,MAX_LENGTH:os}=V(),is=X();j=bt.exports={};var cs=j.re=[],as=j.safeRe=[],p=j.src=[],ls=j.safeSrc=[],h=j.t={},us=0,je="[a-zA-Z0-9-]",fs=[["\\s",1],["\\d",os],[je,ss]],ps=e=>{for(let[t,r]of fs)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},E=(e,t,r)=>{let n=ps(t),s=us++;is(e,s,t),h[e]=s,p[s]=t,ls[s]=n,cs[s]=new RegExp(t,r?"g":void 0),as[s]=new RegExp(n,r?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${je}*`);E("MAINVERSION",`(${p[h.NUMERICIDENTIFIER]})\\.(${p[h.NUMERICIDENTIFIER]})\\.(${p[h.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${p[h.NUMERICIDENTIFIERLOOSE]})\\.(${p[h.NUMERICIDENTIFIERLOOSE]})\\.(${p[h.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${p[h.NONNUMERICIDENTIFIER]}|${p[h.NUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${p[h.NONNUMERICIDENTIFIER]}|${p[h.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASE",`(?:-(${p[h.PRERELEASEIDENTIFIER]}(?:\\.${p[h.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${p[h.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${p[h.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${je}+`);E("BUILD",`(?:\\+(${p[h.BUILDIDENTIFIER]}(?:\\.${p[h.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${p[h.MAINVERSION]}${p[h.PRERELEASE]}?${p[h.BUILD]}?`);E("FULL",`^${p[h.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${p[h.MAINVERSIONLOOSE]}${p[h.PRERELEASELOOSE]}?${p[h.BUILD]}?`);E("LOOSE",`^${p[h.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${p[h.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${p[h.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${p[h.XRANGEIDENTIFIER]})(?:\\.(${p[h.XRANGEIDENTIFIER]})(?:\\.(${p[h.XRANGEIDENTIFIER]})(?:${p[h.PRERELEASE]})?${p[h.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${p[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${p[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${p[h.XRANGEIDENTIFIERLOOSE]})(?:${p[h.PRERELEASELOOSE]})?${p[h.BUILD]}?)?)?`);E("XRANGE",`^${p[h.GTLT]}\\s*${p[h.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${p[h.GTLT]}\\s*${p[h.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Te}})(?:\\.(\\d{1,${Te}}))?(?:\\.(\\d{1,${Te}}))?`);E("COERCE",`${p[h.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",p[h.COERCEPLAIN]+`(?:${p[h.PRERELEASE]})?(?:${p[h.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",p[h.COERCE],!0);E("COERCERTLFULL",p[h.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${p[h.LONETILDE]}\\s+`,!0);j.tildeTrimReplace="$1~";E("TILDE",`^${p[h.LONETILDE]}${p[h.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${p[h.LONETILDE]}${p[h.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${p[h.LONECARET]}\\s+`,!0);j.caretTrimReplace="$1^";E("CARET",`^${p[h.LONECARET]}${p[h.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${p[h.LONECARET]}${p[h.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${p[h.GTLT]}\\s*(${p[h.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${p[h.GTLT]}\\s*(${p[h.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${p[h.GTLT]}\\s*(${p[h.LOOSEPLAIN]}|${p[h.XRANGEPLAIN]})`,!0);j.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${p[h.XRANGEPLAIN]})\\s+-\\s+(${p[h.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${p[h.XRANGEPLAINLOOSE]})\\s+-\\s+(${p[h.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ce=w(($a,Ot)=>{"use strict";var hs=Object.freeze({loose:!0}),ds=Object.freeze({}),ms=e=>e?typeof e!="object"?hs:e:ds;Ot.exports=ms});var Pe=w((ya,Nt)=>{"use strict";var vt=/^[0-9]+$/,It=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:eIt(t,e);Nt.exports={compareIdentifiers:It,rcompareIdentifiers:ws}});var b=w((xa,kt)=>{"use strict";var ae=X(),{MAX_LENGTH:St,MAX_SAFE_INTEGER:le}=V(),{safeRe:ue,t:fe}=F(),Es=ce(),{compareIdentifiers:qe}=Pe(),Ce=class e{constructor(t,r){if(r=Es(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>St)throw new TypeError(`version is longer than ${St} characters`);ae("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?ue[fe.LOOSE]:ue[fe.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>le||this.major<0)throw new TypeError("Invalid major version");if(this.minor>le||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>le||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let o=+s;if(o>=0&&ot.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=t.prerelease[r];if(ae("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return qe(n,s)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],s=t.build[r];if(ae("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return qe(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?ue[fe.PRERELEASELOOSE]:ue[fe.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let o=[r,s];n===!1&&(o=[r]),qe(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};kt.exports=Ce});var q=w((Ra,At)=>{"use strict";var Lt=b(),gs=(e,t,r=!1)=>{if(e instanceof Lt)return e;try{return new Lt(e,t)}catch(n){if(!r)return null;throw n}};At.exports=gs});var jt=w((ba,Tt)=>{"use strict";var $s=q(),ys=(e,t)=>{let r=$s(e,t);return r?r.version:null};Tt.exports=ys});var qt=w((Oa,Pt)=>{"use strict";var xs=q(),Rs=(e,t)=>{let r=xs(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};Pt.exports=Rs});var Ut=w((va,Dt)=>{"use strict";var Ct=b(),bs=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new Ct(e instanceof Ct?e.version:e,r).inc(t,n,s).version}catch{return null}};Dt.exports=bs});var Gt=w((Ia,Ft)=>{"use strict";var zt=q(),Os=(e,t)=>{let r=zt(e,null,!0),n=zt(t,null,!0),s=r.compare(n);if(s===0)return null;let o=s>0,i=o?r:n,a=o?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0)return a.minor&&!a.patch?"minor":"patch"}let u=c?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};Ft.exports=Os});var Wt=w((Na,Mt)=>{"use strict";var vs=b(),Is=(e,t)=>new vs(e,t).major;Mt.exports=Is});var Vt=w((Sa,_t)=>{"use strict";var Ns=b(),Ss=(e,t)=>new Ns(e,t).minor;_t.exports=Ss});var Bt=w((ka,Xt)=>{"use strict";var ks=b(),Ls=(e,t)=>new ks(e,t).patch;Xt.exports=Ls});var Yt=w((La,Ht)=>{"use strict";var As=q(),Ts=(e,t)=>{let r=As(e,t);return r&&r.prerelease.length?r.prerelease:null};Ht.exports=Ts});var k=w((Aa,Zt)=>{"use strict";var Jt=b(),js=(e,t,r)=>new Jt(e,r).compare(new Jt(t,r));Zt.exports=js});var Qt=w((Ta,Kt)=>{"use strict";var Ps=k(),qs=(e,t,r)=>Ps(t,e,r);Kt.exports=qs});var tr=w((ja,er)=>{"use strict";var Cs=k(),Ds=(e,t)=>Cs(e,t,!0);er.exports=Ds});var pe=w((Pa,nr)=>{"use strict";var rr=b(),Us=(e,t,r)=>{let n=new rr(e,r),s=new rr(t,r);return n.compare(s)||n.compareBuild(s)};nr.exports=Us});var or=w((qa,sr)=>{"use strict";var zs=pe(),Fs=(e,t)=>e.sort((r,n)=>zs(r,n,t));sr.exports=Fs});var cr=w((Ca,ir)=>{"use strict";var Gs=pe(),Ms=(e,t)=>e.sort((r,n)=>Gs(n,r,t));ir.exports=Ms});var B=w((Da,ar)=>{"use strict";var Ws=k(),_s=(e,t,r)=>Ws(e,t,r)>0;ar.exports=_s});var he=w((Ua,lr)=>{"use strict";var Vs=k(),Xs=(e,t,r)=>Vs(e,t,r)<0;lr.exports=Xs});var De=w((za,ur)=>{"use strict";var Bs=k(),Hs=(e,t,r)=>Bs(e,t,r)===0;ur.exports=Hs});var Ue=w((Fa,fr)=>{"use strict";var Ys=k(),Js=(e,t,r)=>Ys(e,t,r)!==0;fr.exports=Js});var de=w((Ga,pr)=>{"use strict";var Zs=k(),Ks=(e,t,r)=>Zs(e,t,r)>=0;pr.exports=Ks});var me=w((Ma,hr)=>{"use strict";var Qs=k(),eo=(e,t,r)=>Qs(e,t,r)<=0;hr.exports=eo});var ze=w((Wa,dr)=>{"use strict";var to=De(),ro=Ue(),no=B(),so=de(),oo=he(),io=me(),co=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return to(e,r,n);case"!=":return ro(e,r,n);case">":return no(e,r,n);case">=":return so(e,r,n);case"<":return oo(e,r,n);case"<=":return io(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};dr.exports=co});var wr=w((_a,mr)=>{"use strict";var ao=b(),lo=q(),{safeRe:we,t:Ee}=F(),uo=(e,t)=>{if(e instanceof ao)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?we[Ee.COERCEFULL]:we[Ee.COERCE]);else{let c=t.includePrerelease?we[Ee.COERCERTLFULL]:we[Ee.COERCERTL],l;for(;(l=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||l.index+l[0].length!==r.index+r[0].length)&&(r=l),c.lastIndex=l.index+l[1].length+l[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",o=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return lo(`${n}.${s}.${o}${i}${a}`,t)};mr.exports=uo});var gr=w((Va,Er)=>{"use strict";var Fe=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}};Er.exports=Fe});var L=w((Xa,Rr)=>{"use strict";var fo=/\s+/g,Ge=class e{constructor(t,r){if(r=ho(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Me)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(fo," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!yr(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&xo(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&$o)|(this.options.loose&&yo))+":"+t,s=$r.get(n);if(s)return s;let o=this.options.loose,i=o?v[O.HYPHENRANGELOOSE]:v[O.HYPHENRANGE];t=t.replace(i,Ao(this.options.includePrerelease)),g("hyphen replace",t),t=t.replace(v[O.COMPARATORTRIM],wo),g("comparator trim",t),t=t.replace(v[O.TILDETRIM],Eo),g("tilde trim",t),t=t.replace(v[O.CARETTRIM],go),g("caret trim",t);let a=t.split(" ").map(f=>Ro(f,this.options)).join(" ").split(/\s+/).map(f=>Lo(f,this.options));o&&(a=a.filter(f=>(g("loose invalid filter",f,this.options),!!f.match(v[O.COMPARATORLOOSE])))),g("range list",a);let c=new Map,l=a.map(f=>new Me(f,this.options));for(let f of l){if(yr(f))return[f];c.set(f.value,f)}c.size>1&&c.has("")&&c.delete("");let u=[...c.values()];return $r.set(n,u),u}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>xr(n,r)&&t.set.some(s=>xr(s,r)&&n.every(o=>s.every(i=>o.intersects(i,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new mo(t,this.options)}catch{return!1}for(let r=0;re.value==="<0.0.0-0",xo=e=>e.value==="",xr=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();for(;r&&n.length;)r=n.every(o=>s.intersects(o,t)),s=n.pop();return r},Ro=(e,t)=>(e=e.replace(v[O.BUILD],""),g("comp",e,t),e=vo(e,t),g("caret",e),e=bo(e,t),g("tildes",e),e=No(e,t),g("xrange",e),e=ko(e,t),g("stars",e),e),I=e=>!e||e.toLowerCase()==="x"||e==="*",bo=(e,t)=>e.trim().split(/\s+/).map(r=>Oo(r,t)).join(" "),Oo=(e,t)=>{let r=t.loose?v[O.TILDELOOSE]:v[O.TILDE];return e.replace(r,(n,s,o,i,a)=>{g("tilde",e,n,s,o,i,a);let c;return I(s)?c="":I(o)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:I(i)?c=`>=${s}.${o}.0 <${s}.${+o+1}.0-0`:a?(g("replaceTilde pr",a),c=`>=${s}.${o}.${i}-${a} <${s}.${+o+1}.0-0`):c=`>=${s}.${o}.${i} <${s}.${+o+1}.0-0`,g("tilde return",c),c})},vo=(e,t)=>e.trim().split(/\s+/).map(r=>Io(r,t)).join(" "),Io=(e,t)=>{g("caret",e,t);let r=t.loose?v[O.CARETLOOSE]:v[O.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,o,i,a,c)=>{g("caret",e,s,o,i,a,c);let l;return I(o)?l="":I(i)?l=`>=${o}.0.0${n} <${+o+1}.0.0-0`:I(a)?o==="0"?l=`>=${o}.${i}.0${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.0${n} <${+o+1}.0.0-0`:c?(g("replaceCaret pr",c),o==="0"?i==="0"?l=`>=${o}.${i}.${a}-${c} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}-${c} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a}-${c} <${+o+1}.0.0-0`):(g("no pr"),o==="0"?i==="0"?l=`>=${o}.${i}.${a}${n} <${o}.${i}.${+a+1}-0`:l=`>=${o}.${i}.${a}${n} <${o}.${+i+1}.0-0`:l=`>=${o}.${i}.${a} <${+o+1}.0.0-0`),g("caret return",l),l})},No=(e,t)=>(g("replaceXRanges",e,t),e.split(/\s+/).map(r=>So(r,t)).join(" ")),So=(e,t)=>{e=e.trim();let r=t.loose?v[O.XRANGELOOSE]:v[O.XRANGE];return e.replace(r,(n,s,o,i,a,c)=>{g("xRange",e,n,s,o,i,a,c);let l=I(o),u=l||I(i),f=u||I(a),m=f;return s==="="&&m&&(s=""),c=t.includePrerelease?"-0":"",l?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&m?(u&&(i=0),a=0,s===">"?(s=">=",u?(o=+o+1,i=0,a=0):(i=+i+1,a=0)):s==="<="&&(s="<",u?o=+o+1:i=+i+1),s==="<"&&(c="-0"),n=`${s+o}.${i}.${a}${c}`):u?n=`>=${o}.0.0${c} <${+o+1}.0.0-0`:f&&(n=`>=${o}.${i}.0${c} <${o}.${+i+1}.0-0`),g("xRange return",n),n})},ko=(e,t)=>(g("replaceStars",e,t),e.trim().replace(v[O.STAR],"")),Lo=(e,t)=>(g("replaceGTE0",e,t),e.trim().replace(v[t.includePrerelease?O.GTE0PRE:O.GTE0],"")),Ao=e=>(t,r,n,s,o,i,a,c,l,u,f,m)=>(I(n)?r="":I(s)?r=`>=${n}.0.0${e?"-0":""}`:I(o)?r=`>=${n}.${s}.0${e?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,I(l)?c="":I(u)?c=`<${+l+1}.0.0-0`:I(f)?c=`<${l}.${+u+1}.0-0`:m?c=`<=${l}.${u}.${f}-${m}`:e?c=`<${l}.${u}.${+f+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),To=(e,t,r)=>{for(let n=0;n0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}});var H=w((Ba,Sr)=>{"use strict";var Y=Symbol("SemVer ANY"),Ve=class e{static get ANY(){return Y}constructor(t,r){if(r=br(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),_e("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===Y?this.value="":this.value=this.operator+this.semver.version,_e("comp",this)}parse(t){let r=this.options.loose?Or[vr.COMPARATORLOOSE]:Or[vr.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new Ir(n[2],this.options.loose):this.semver=Y}toString(){return this.value}test(t){if(_e("Comparator.test",t,this.options.loose),this.semver===Y||t===Y)return!0;if(typeof t=="string")try{t=new Ir(t,this.options)}catch{return!1}return We(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Nr(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new Nr(this.value,r).test(t.semver):(r=br(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||We(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||We(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Sr.exports=Ve;var br=ce(),{safeRe:Or,t:vr}=F(),We=ze(),_e=X(),Ir=b(),Nr=L()});var J=w((Ha,kr)=>{"use strict";var jo=L(),Po=(e,t,r)=>{try{t=new jo(t,r)}catch{return!1}return t.test(e)};kr.exports=Po});var Ar=w((Ya,Lr)=>{"use strict";var qo=L(),Co=(e,t)=>new qo(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Lr.exports=Co});var jr=w((Ja,Tr)=>{"use strict";var Do=b(),Uo=L(),zo=(e,t,r)=>{let n=null,s=null,o=null;try{o=new Uo(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===-1)&&(n=i,s=new Do(n,r))}),n};Tr.exports=zo});var qr=w((Za,Pr)=>{"use strict";var Fo=b(),Go=L(),Mo=(e,t,r)=>{let n=null,s=null,o=null;try{o=new Go(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===1)&&(n=i,s=new Fo(n,r))}),n};Pr.exports=Mo});var Ur=w((Ka,Dr)=>{"use strict";var Xe=b(),Wo=L(),Cr=B(),_o=(e,t)=>{e=new Wo(e,t);let r=new Xe("0.0.0");if(e.test(r)||(r=new Xe("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{let a=new Xe(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||Cr(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||Cr(r,o))&&(r=o)}return r&&e.test(r)?r:null};Dr.exports=_o});var Fr=w((Qa,zr)=>{"use strict";var Vo=L(),Xo=(e,t)=>{try{return new Vo(e,t).range||"*"}catch{return null}};zr.exports=Xo});var ge=w((el,_r)=>{"use strict";var Bo=b(),Wr=H(),{ANY:Ho}=Wr,Yo=L(),Jo=J(),Gr=B(),Mr=he(),Zo=me(),Ko=de(),Qo=(e,t,r,n)=>{e=new Bo(e,n),t=new Yo(t,n);let s,o,i,a,c;switch(r){case">":s=Gr,o=Zo,i=Mr,a=">",c=">=";break;case"<":s=Mr,o=Ko,i=Gr,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Jo(e,t,n))return!1;for(let l=0;l{d.semver===Ho&&(d=new Wr(">=0.0.0")),f=f||d,m=m||d,s(d.semver,f.semver,n)?f=d:i(d.semver,m.semver,n)&&(m=d)}),f.operator===a||f.operator===c||(!m.operator||m.operator===a)&&o(e,m.semver))return!1;if(m.operator===c&&i(e,m.semver))return!1}return!0};_r.exports=Qo});var Xr=w((tl,Vr)=>{"use strict";var ei=ge(),ti=(e,t,r)=>ei(e,t,">",r);Vr.exports=ti});var Hr=w((rl,Br)=>{"use strict";var ri=ge(),ni=(e,t,r)=>ri(e,t,"<",r);Br.exports=ni});var Zr=w((nl,Jr)=>{"use strict";var Yr=L(),si=(e,t,r)=>(e=new Yr(e,r),t=new Yr(t,r),e.intersects(t,r));Jr.exports=si});var Qr=w((sl,Kr)=>{"use strict";var oi=J(),ii=k();Kr.exports=(e,t,r)=>{let n=[],s=null,o=null,i=e.sort((u,f)=>ii(u,f,r));for(let u of i)oi(u,t,r)?(o=u,s||(s=u)):(o&&n.push([s,o]),o=null,s=null);s&&n.push([s,null]);let a=[];for(let[u,f]of n)u===f?a.push(u):!f&&u===i[0]?a.push("*"):f?u===i[0]?a.push(`<=${f}`):a.push(`${u} - ${f}`):a.push(`>=${u}`);let c=a.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return c.length{"use strict";var en=L(),He=H(),{ANY:Be}=He,Z=J(),Ye=k(),ci=(e,t,r={})=>{if(e===t)return!0;e=new en(e,r),t=new en(t,r);let n=!1;e:for(let s of e.set){for(let o of t.set){let i=li(s,o,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},ai=[new He(">=0.0.0-0")],tn=[new He(">=0.0.0")],li=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Be){if(t.length===1&&t[0].semver===Be)return!0;r.includePrerelease?e=ai:e=tn}if(t.length===1&&t[0].semver===Be){if(r.includePrerelease)return!0;t=tn}let n=new Set,s,o;for(let d of e)d.operator===">"||d.operator===">="?s=rn(s,d,r):d.operator==="<"||d.operator==="<="?o=nn(o,d,r):n.add(d.semver);if(n.size>1)return null;let i;if(s&&o){if(i=Ye(s.semver,o.semver,r),i>0)return null;if(i===0&&(s.operator!==">="||o.operator!=="<="))return null}for(let d of n){if(s&&!Z(d,String(s),r)||o&&!Z(d,String(o),r))return null;for(let T of t)if(!Z(d,String(T),r))return!1;return!0}let a,c,l,u,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,m=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;f&&f.prerelease.length===1&&o.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(let d of t){if(u=u||d.operator===">"||d.operator===">=",l=l||d.operator==="<"||d.operator==="<=",s){if(m&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===m.major&&d.semver.minor===m.minor&&d.semver.patch===m.patch&&(m=!1),d.operator===">"||d.operator===">="){if(a=rn(s,d,r),a===d&&a!==s)return!1}else if(s.operator===">="&&!Z(s.semver,String(d),r))return!1}if(o){if(f&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===f.major&&d.semver.minor===f.minor&&d.semver.patch===f.patch&&(f=!1),d.operator==="<"||d.operator==="<="){if(c=nn(o,d,r),c===d&&c!==o)return!1}else if(o.operator==="<="&&!Z(o.semver,String(d),r))return!1}if(!d.operator&&(o||s)&&i!==0)return!1}return!(s&&l&&!o&&i!==0||o&&u&&!s&&i!==0||m||f)},rn=(e,t,r)=>{if(!e)return t;let n=Ye(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},nn=(e,t,r)=>{if(!e)return t;let n=Ye(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};sn.exports=ci});var C=w((il,ln)=>{"use strict";var Je=F(),cn=V(),ui=b(),an=Pe(),fi=q(),pi=jt(),hi=qt(),di=Ut(),mi=Gt(),wi=Wt(),Ei=Vt(),gi=Bt(),$i=Yt(),yi=k(),xi=Qt(),Ri=tr(),bi=pe(),Oi=or(),vi=cr(),Ii=B(),Ni=he(),Si=De(),ki=Ue(),Li=de(),Ai=me(),Ti=ze(),ji=wr(),Pi=H(),qi=L(),Ci=J(),Di=Ar(),Ui=jr(),zi=qr(),Fi=Ur(),Gi=Fr(),Mi=ge(),Wi=Xr(),_i=Hr(),Vi=Zr(),Xi=Qr(),Bi=on();ln.exports={parse:fi,valid:pi,clean:hi,inc:di,diff:mi,major:wi,minor:Ei,patch:gi,prerelease:$i,compare:yi,rcompare:xi,compareLoose:Ri,compareBuild:bi,sort:Oi,rsort:vi,gt:Ii,lt:Ni,eq:Si,neq:ki,gte:Li,lte:Ai,cmp:Ti,coerce:ji,Comparator:Pi,Range:qi,satisfies:Ci,toComparators:Di,maxSatisfying:Ui,minSatisfying:zi,minVersion:Fi,validRange:Gi,outside:Mi,gtr:Wi,ltr:_i,intersects:Vi,simplifyRange:Xi,subset:Bi,SemVer:ui,re:Je.re,src:Je.src,tokens:Je.t,SEMVER_SPEC_VERSION:cn.SEMVER_SPEC_VERSION,RELEASE_TYPES:cn.RELEASE_TYPES,compareIdentifiers:an.compareIdentifiers,rcompareIdentifiers:an.rcompareIdentifiers}});var Ae=new TextDecoder;function ie(e){let t=e.indexOf("@",e.startsWith("@")?1:0);return t<0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}async function Et(e,t){let r=String(t??"").split(/\s+/).filter(o=>o.startsWith("sha512-")).map(o=>o.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),s="sha512-"+btoa(Array.from(n,o=>String.fromCharCode(o)).join(""));if(!r.includes(s))throw new Error(`Integrity check failed: expected ${r[0]}, got ${s}`);return s}async function gt(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],s=0;for(let o=await r.read();!o.done;o=await r.read()){if(s+=o.value.length,s>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(o.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function _(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return Ae.decode(s<0?n:n.subarray(0,s))}function $t(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((s,o)=>s*256+o,e[t]&127);let n=_(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function Bn(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if($t(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function Hn(e){let t={},r=0;for(;r0)||r+s>e.length)throw new Error("Corrupt pax header");let o=Ae.decode(e.subarray(n+1,r+s-1)),i=o.indexOf("=");t[o.slice(0,i)]=o.slice(i+1),r+=s}return t}function Yn(e,t){let r=e.subarray(t,t+512);Bn(r);let n=$t(r,124,12),s=t+512;if(s+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(s,s+n),next:s+Math.ceil(n/512)*512}}function Jn(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function Zn(e){let t=_(e,0,100),r=_(e,257,5)==="ustar"?_(e,345,155):"";return r?`${r}/${t}`:t}var wt={x:(e,t)=>({...e,pax:Hn(t).path}),L:(e,t)=>({...e,long:_(t,0,t.length)}),g:e=>e};function yt(e){let t=[],r={};for(let n=0;!Jn(e,n);){let{header:s,type:o,data:i,next:a}=Yn(e,n);if(n=a,Object.hasOwn(wt,o)){r=wt[o](r,i);continue}(o==="0"||o==="7")&&t.push({path:r.pax??r.long??Zn(s),bytes:i}),r={}}return t}var xe=z(C(),1);var x=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function G(e,t){let r=[],n=0;for(;;){let s=await x(e,"read",t,n);if(r.push(s),n+=s.length,s.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function K(e,{id:t,path:r,bytes:n},s){for(let o=0;o{}),a}}async function Hi(e,t){let r=[],n=0;for(;;){let{done:s,value:o}=await e.read();if(s)return r;if(n+=o.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(o)}}async function Yi(e,t){try{return await Hi(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function un(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await Yi(e.body.getReader(),t)).arrayBuffer())}var M=".webfront/developer/packages",Ji=/[\\\0:*?"<>|]/,Zi=e=>e.split("/").some(t=>!t||t==="."||t==="..");function Ki(e){return typeof e!="string"||!e||Ji.test(e)?!0:Zi(e)}function A(e){if(Ki(e))throw new Error(`Unsafe package path: ${e}`);return e}var Qi=new TextDecoder,ec=["preinstall","install","postinstall"];async function fn(e){let t=new Map;for(let r of yt(await gt(e))){if(!r.path.startsWith("package/"))throw new Error("Invalid npm tarball root");let n=A(r.path.slice(8));if(t.has(n))throw new Error(`Duplicate package path: ${n}`);t.set(n,r.bytes)}return t}var tc=e=>ec.some(t=>e.scripts?.[t]),rc=e=>e.has("binding.gyp")||[...e.keys()].some(t=>t.endsWith(".node"));function nc(e,t){return tc(e)||e.gypfile?!0:rc(t)}function pn(e,t,r){let n=JSON.parse(Qi.decode(e.get("package.json")));if(n.name!==t||n.version!==r)throw new Error("npm archive identity mismatch");if(nc(n,e))throw new Error(`${t} needs an unsupported install script or native module`);return n}function W(e){return!e||typeof e!="object"?!1:!Array.isArray(e)}var R="webfront.project.json",S="webfront-packages.lock.json",ee=1,Ze=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,sc=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,oc=/^[0-9A-Za-z.+\-^~<>=*| ]{1,128}$/,hn=/^[A-Za-z0-9][A-Za-z0-9:_.-]{0,63}$/,Ke=/^[A-Za-z_][A-Za-z0-9_]*$/,dn=["format","name","version","dependencies","registry","scripts","entries","providers","test","permissions"],ic=["files","publish","fetch"],$=e=>{throw new Error(`${R}: ${e}`)};function P(e,t){return W(e)||$(`${t} must be an object`),e}function Qe(e,t,r){for(let n of Object.keys(e))t.includes(n)||$(`unknown key "${n}" in ${r}`)}function $e(e,t){typeof e!="string"&&$(`${t} must be a project path`);try{return A(e)}catch{return $(`${t} is not a safe project-relative path: ${e}`)}}function mn(e,t){return(!Array.isArray(e)||e.length>256)&&$(`${t} must be an array of at most 256 paths`),e.map((r,n)=>$e(r,`${t}[${n}]`))}function cc(e){let t=P(e,"dependencies");for(let[r,n]of Object.entries(t))Ze.test(r)||$(`invalid npm package name "${r}"`),(typeof n!="string"||!oc.test(n)||n!==n.trim())&&$(`invalid version range for "${r}"`);return t}var et=e=>e.startsWith("/")&&!e.startsWith("//")&&!e.includes("\\");function ac(e){if(typeof e!="string"&&$("registry must be a URL"),et(e))return e;let t;try{t=new URL(e)}catch{return $("registry must be an https URL or an absolute path")}return t.protocol!=="https:"&&$("registry must use https"),e}function lc(e){let t=P(e,"scripts");for(let[r,n]of Object.entries(t))(!hn.test(r)||typeof n!="string"||!n||n.length>1024)&&$(`invalid script "${r}"`);return t}function uc(e){let t=P(e,"entries");for(let[r,n]of Object.entries(t))hn.test(r)||$(`invalid entry name "${r}"`),$e(n,`entries.${r}`);return t}function fc(e,t){let r=P(e,"providers");for(let[n,s]of Object.entries(r))Ke.test(n)||$(`invalid provider name "${n}"`),P(s,`providers.${n}`),Qe(s,["entry","output"],`providers.${n}`),typeof s.entry!="string"&&$(`providers.${n}.entry must name an entry or a path`),Object.hasOwn(t,s.entry)||$e(s.entry,`providers.${n}.entry`),$e(s.output,`providers.${n}.output`).endsWith(".hpp")||$(`providers.${n}.output must be a .hpp file`);return r}function pc(e){let t=P(e,"test");return Qe(t,["specs"],"test"),t.specs!==void 0&&mn(t.specs,"test.specs"),t}function hc(e,t){let r;try{r=new URL(e)}catch{return $(`${t} must be an https origin`)}return(r.protocol!=="https:"||r.origin!==e)&&$(`${t} must be an https origin without a path`),e}function dc(e){let t=P(e,"permissions");for(let r of Object.keys(t))ic.includes(r)||$(`unknown permission "${r}"`);for(let r of["files","publish"])t[r]!==void 0&&mn(t[r],`permissions.${r}`);return t.fetch!==void 0&&((!Array.isArray(t.fetch)||t.fetch.length>64)&&$("permissions.fetch must be an array of origins"),t.fetch.forEach((r,n)=>hc(r,`permissions.fetch[${n}]`))),t}function mc(e){(typeof e.name!="string"||!Ze.test(e.name))&&$("name must be a lower-case npm package name"),(typeof e.version!="string"||!sc.test(e.version))&&$("version must be a semantic version")}function wc(e){e.format!==ee&&(Number.isInteger(e.format)&&e.format>ee&&$(`format ${e.format} is not supported by this environment (it reads format ${ee}); update the environment`),$(`format must be ${ee}`))}function te(e){P(e,"the manifest"),wc(e),Qe(e,dn,"the manifest"),mc(e);let t=e.entries===void 0?{}:uc(e.entries);return{...e,dependencies:e.dependencies===void 0?{}:cc(e.dependencies),entries:t,providers:e.providers===void 0?{}:fc(e.providers,t),...e.registry===void 0?{}:{registry:ac(e.registry)},...e.scripts===void 0?{}:{scripts:lc(e.scripts)},...e.test===void 0?{}:{test:pc(e.test)},...e.permissions===void 0?{}:{permissions:dc(e.permissions)}}}function tt(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{return $("not valid JSON")}return{source:t,manifest:te(t)}}function gl(e){return tt(e).manifest}function rt(e){let t={};for(let r of dn)e[r]!==void 0&&(t[r]=e[r]);return JSON.stringify(t,null,2)+` +`}function wn(e){return{format:ee,name:e,version:"0.1.0",dependencies:{}}}function En(e){let r=(String(e??"").split("/").filter(Boolean).pop()??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"");return Ze.test(r)?r:"webfront-app"}async function ye(e){let t=JSON.stringify(Object.entries(e).sort(([n],[s])=>ns?1:0)),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(r)].map(n=>n.toString(16).padStart(2,"0")).join("")}var nt=e=>/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e),Re=(e,t)=>`${e.replace("/","+")}@${t}`,st=(e,t,r)=>`${Re(e,t)}-${r.slice(7).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}`;async function Ec(e,t,{fetchImpl:r,signal:n}){let s=await r(new URL(e.replace("/","%2f"),t),{signal:n});if(!s.ok)throw new Error(`Registry metadata for ${e}: HTTP ${s.status}`);return s.json()}function gc(e,t){let r=e["dist-tags"]?.[t];return r||(xe.default.valid(t)?t:xe.default.maxSatisfying(Object.keys(e.versions??{}),t))}function $c(e,t,r){let n=r||"latest",s=gc(e,n),o=e.versions?.[s];if(!o||!xe.default.valid(s))throw new Error(`Cannot resolve ${t}@${n}`);return{version:s,manifest:o}}async function yc(e,t,r,{fetchImpl:n,signal:s}){let o=new URL(t.dist?.tarball,r);if(o.protocol!=="https:"&&o.origin!==r.origin)throw new Error("Package tarballs must use HTTPS or the registry origin");let i=await n(o,{signal:s});if(!i.ok)throw new Error(`Package download for ${e}: HTTP ${i.status}`);let a=await un(i);return{bytes:a,integrity:await Et(a,t.dist.integrity)}}function ot(e){let t=new URL(e,globalThis.location?.href),r=t.origin===globalThis.location?.origin;if(e.startsWith("/")?!et(e)||!r:t.protocol!=="https:"&&!r)throw new Error(`The npm registry must use HTTPS or the application origin: ${e}`);return t.pathname.endsWith("/")||(t.pathname+="/"),t}async function D(e,t,{registry:r,fetchImpl:n=fetch,signal:s}){if(!nt(e))throw new Error(`Unsupported npm package name: ${e}`);let o=ot(r),i={fetchImpl:n,signal:s},{version:a,manifest:c}=$c(await Ec(e,o,i),e,t),{bytes:l,integrity:u}=await yc(e,c,o,i),f=await fn(l),m=pn(f,e,a);return{id:Re(e,a),key:st(e,a,u),manifest:m,integrity:u,files:f}}var be=z(C(),1);function xc(e,t,r){let n=e?.roots?.[t];return n?.requested===r&&e.packages[n.id]?e.packages[n.id]:be.default.validRange(r)?Object.values(e?.packages??{}).filter(o=>o.name===t&&be.default.satisfies(o.version,r)).sort((o,i)=>be.default.rcompare(o.version,i.version))[0]??null:null}function gn({registry:e="https://registry.npmjs.org/",fetchImpl:t=fetch,signal:r,download:n=D,previous:s}){let o=new Map;return async(i,a)=>{let c=`${i}@${a}`;if(o.has(c))return o.get(c);let l=xc(s,i,a),u=await n(i,l?.version??a,{registry:e,fetchImpl:t,signal:r});if(l&&u.integrity!==l.integrity)throw new Error(`${u.id} no longer matches the integrity recorded in the lock`);return o.set(c,u),u}}var $n=z(C(),1),yn=(e,t,r)=>new Error(`${e.name}@${e.version} requires peer ${t}@${r}; install a compatible root explicitly`);function Rc(e,t,r){if(e.manifest.peerDependenciesMeta?.[t]?.optional)return null;throw yn(e,t,r)}function bc(e,[t,r],{nodes:n,roots:s}){let o=s[t]?.id??e.dependencies[t];if(!o)return Rc(e,t,r);if(!$n.default.satisfies(n[o].version,r))throw yn(e,t,r);return o}function Oc(e,t){for(let r of Object.entries(e.manifest.peerDependencies??{})){let n=bc(e,r,t);n&&(e.dependencies[r[0]]=n)}}function xn(e,t){for(let r of Object.values(e))Oc(r,{nodes:e,roots:t})}var Rn=z(C(),1);function vc(e,t){return!nt(t.name)||!Rn.default.valid(t.version)?!1:e===Re(t.name,t.version)}function Ic(e){return e.integrity?.startsWith("sha512-")?e.key===st(e.name,e.version,e.integrity):!1}function Nc(e,t,r){if(!vc(t,r)||!Ic(r))throw new Error("Invalid locked package");for(let n of r.files)A(n);if(Object.values(r.dependencies).some(n=>!e.packages[n]))throw new Error("Dangling locked dependency")}function Sc(e){return e?.format!==1?!1:!!e.roots&&!!e.packages}function it(e){if(!Sc(e))throw new Error("Unsupported package lock");if(Object.keys(e.packages).length>512)throw new Error("The package lock exceeds 512 packages");for(let[t,r]of Object.entries(e.packages))Nc(e,t,r);if(Object.values(e.roots).some(t=>!e.packages[t.id]))throw new Error("Dangling locked root");return e}function kc(e,t,r){if(Object.keys(e.nodes).length>=512)throw new Error("Dependency graph exceeds 512 packages");for(let n of r.files.values())e.total+=n.length;if(e.total>256*1024*1024)throw new Error("Dependency graph exceeds 256 MiB");e.nodes[r.id]={name:t,version:r.manifest.version,integrity:r.integrity,key:r.key,manifest:r.manifest,files:[...r.files.keys()].sort(),dependencies:{}},e.downloads.set(r.id,r.files)}async function Lc(e,t){let r={};for(let n of e){let{name:s,version:o}=ie(n);r[s]={requested:o||"latest",id:await t(s,o||"latest")}}return r}async function bn(e,t={}){let r=gn(t),n={nodes:{},downloads:new Map,total:0},s=async(i,a)=>{t.signal?.throwIfAborted();let c=await r(i,a);if(n.nodes[c.id])return c.id;kc(n,i,c);for(let[l,u]of Object.entries(c.manifest.dependencies??{}).sort())n.nodes[c.id].dependencies[l]=await s(l,u);return c.id},o=await Lc(e,s);return xn(n.nodes,o),{lock:{format:1,registry:t.registry??"https://registry.npmjs.org/",roots:o,packages:n.nodes},downloads:n.downloads}}var ct=z(C(),1);var Ac=new TextDecoder,Tc=new TextEncoder,Oe="No webfront.project.json: run wf init",ve="The lock does not match the dependencies of webfront.project.json; run wf install --update to resolve them again";async function On(e,t){try{return await G(e,t)}catch(r){if(r.message.includes("Cannot read project file:"))return null;throw r}}function jc(e,t,r){return t?r===t.requested?!0:ct.default.validRange(r)!==null&&ct.default.satisfies(e.packages[t.id].version,r):!1}function Pc(e,t){let r=Object.keys(t);return r.length===Object.keys(e.roots).length&&r.every(n=>jc(e,e.roots[n],t[n]))}function qc(e,t,r){return e?t?t.manifestDigest===void 0?Pc(t,e.dependencies)?"legacy":"desynchronized":t.manifestDigest===r?"consistent":"desynchronized":"unlocked":"no-manifest"}async function re(e){let t=await x(e,"state",`${R} ${S}`),r=await On(e,R),n=await On(e,S),{source:s,manifest:o}=r?tt(r):{source:null,manifest:null},i=n?it(JSON.parse(Ac.decode(n))):null,a=o?await ye(o.dependencies):null;return{manifest:o,source:s,lock:i,token:t,status:qc(o,i,a),digest:a}}var In=e=>e.status==="desynchronized"?`Warning: ${ve}.\r `:"";async function Nn(e,t,r,{signal:n}={}){let s=[];try{for(let[o,i]of t){n?.throwIfAborted();let a=await x(e,"begin",o,!1);s.push(a),await K(e,{id:a,path:"output",bytes:i},n)}n?.throwIfAborted(),await x(e,"commitGroup",s.join(` `),`${R} -${S}`,r.token)}catch(o){for(let i of s)await x(e,"abort",i).catch(()=>{});throw o}}function vn(e,t,r){let n=e?.entries??{};if(t!==void 0)return Object.hasOwn(n,t)?n[t]:t;if(Object.hasOwn(n,"main"))return n.main;let s=Object.keys(n);if(s.length===1)return n[s[0]];throw new Error(`Usage: ${r} (declare entries.main in ${R} to omit the entry)`)}function Gl(e,[t,r,n,...s]){if(t&&Object.hasOwn(e?.providers??{},t)&&r===void 0){let i=e.providers[t];return{entry:vn(e,i.entry),output:i.output,className:t}}if(!t||r!=="--output"||s.length||!n?.endsWith(".hpp"))throw new Error("wf embed requires or --output ");let o=n.split("/").pop().slice(0,-4);if(!Ke.test(o))throw new Error(`wf embed: ${o} is not a C++ class name; name the output .hpp`);return{entry:vn(e,t),output:n,className:o}}var Ie=e=>jc.encode(e);var pt=z(C(),1);var Sn=e=>`${M}/${e.key}`,kn=e=>`${M}/${e.key}.json`,Dc=new TextEncoder,Uc=new TextDecoder,Ln=e=>e.message.includes("Cannot read project file:");async function An(e){return[...new Uint8Array(await crypto.subtle.digest("SHA-256",e))].map(r=>r.toString(16).padStart(2,"0")).join("")}async function Ne(e,t,r,{signal:n}={}){let s={};for(let i of[...r.keys()].sort())s[i]=await An(r.get(i));await Q(e,Sn(t),r,{signal:n});let o=JSON.stringify({format:1,integrity:t.integrity,files:s},null,2)+` +${S}`,r.token)}catch(o){for(let i of s)await x(e,"abort",i).catch(()=>{});throw o}}function vn(e,t,r){let n=e?.entries??{};if(t!==void 0)return Object.hasOwn(n,t)?n[t]:t;if(Object.hasOwn(n,"main"))return n.main;let s=Object.keys(n);if(s.length===1)return n[s[0]];throw new Error(`Usage: ${r} (declare entries.main in ${R} to omit the entry)`)}function Gl(e,[t,r,n,...s]){if(t&&Object.hasOwn(e?.providers??{},t)&&r===void 0){let i=e.providers[t];return{entry:vn(e,i.entry),output:i.output,className:t}}if(!t||r!=="--output"||s.length||!n?.endsWith(".hpp"))throw new Error("wf embed requires or --output ");let o=n.split("/").pop().slice(0,-4);if(!Ke.test(o))throw new Error(`wf embed: ${o} is not a C++ class name; name the output .hpp`);return{entry:vn(e,t),output:n,className:o}}var Ie=e=>Tc.encode(e);var pt=z(C(),1);var Sn=e=>`${M}/${e.key}`,kn=e=>`${M}/${e.key}.json`,Dc=new TextEncoder,Uc=new TextDecoder,Ln=e=>e.message.includes("Cannot read project file:");async function An(e){return[...new Uint8Array(await crypto.subtle.digest("SHA-256",e))].map(r=>r.toString(16).padStart(2,"0")).join("")}async function Ne(e,t,r,{signal:n}={}){let s={};for(let i of[...r.keys()].sort())s[i]=await An(r.get(i));await Q(e,Sn(t),r,{signal:n});let o=JSON.stringify({format:1,integrity:t.integrity,files:s},null,2)+` `;await Q(e,kn(t),new Map([["output",Dc.encode(o)]]),{directory:!1,signal:n})}async function zc(e,t){let r;try{r=await G(e,kn(t))}catch(n){if(Ln(n))return null;throw n}try{return JSON.parse(Uc.decode(r))}catch{return{}}}var Fc=(e,t)=>Object.keys(e.files).sort().join(` `)===[...t.files].sort().join(` -`);async function Gc(e,t,r){let n=[],s=0;for(;;){let o;try{o=await x(e,"read",t,s)}catch(i){if(Ln(i))return null;throw i}if(s+=o.length,s>r)return null;if(n.push(o),o.length<262144)return new Uint8Array(await new Blob(n).arrayBuffer())}}async function at(e,t,{signal:r,limit:n=1/0}={}){let s=await zc(e,t);if(!s)return{state:"missing",size:0};if(s.integrity!==t.integrity||!W(s.files)||!Fc(s,t))return{state:"corrupted",size:0};let o=0;for(let i of t.files){r?.throwIfAborted();let a=await Gc(e,`${Sn(t)}/${i}`,n-o);if(!a||await An(a)!==s.files[i])return{state:"corrupted",size:0};o+=a.length}return{state:"valid",size:o}}var Bl=async(e,t,r)=>(await at(e,t,r)).state;var Mc="https://registry.npmjs.org/";function Wc({registry:e,registryExplicit:t}={},r){return t&&e?{url:e,source:"application option"}:r?.registry?{url:r.registry,source:R}:{url:e||Mc,source:"default"}}function lt(e,t){let r=Wc(e,t);return ot(r.url),r}var ut=({url:e,source:t})=>`Registry: ${e} (${t})`,_c=256*1024*1024,Vc=e=>[...e.values()].reduce((t,r)=>t+r.length,0),Xc=e=>new Error(`The locked packages exceed ${e/(1024*1024)} MiB unpacked`);async function Bc(e,t,{signal:r,limit:n}){let s=[],o=0;for(let[i,a]of Object.entries(t.packages)){r?.throwIfAborted();let c=await at(e,a,{signal:r,limit:n-o});o+=c.size,s.push({id:i,node:a,state:c.state})}return{states:s,size:o}}async function ft(e,t,{registry:r,offline:n=!1,signal:s,progress:o=()=>{},fetchImpl:i=fetch,limit:a=_c}){let{states:c,size:l}=await Bc(e,t,{signal:s,limit:a}),u=l,f={verified:c.filter(({state:m})=>m==="valid").length,restored:0,problems:[]};for(let{id:m,node:d,state:j}of c.filter(({state:N})=>N!=="valid")){if(n){f.problems.push(`${m} (${j})`);continue}o(`Restoring ${m}${j==="corrupted"?" (corrupted in the cache)":""}`);let N=await D(d.name,d.version,{registry:r,fetchImpl:i,signal:s});if(N.integrity!==d.integrity)throw new Error(`${m} no longer matches the integrity recorded in the lock`);if(u+=Vc(N.files),u>a)throw Xc(a);await Ne(e,d,N.files,{signal:s}),f.restored++}if(f.problems.length)throw new Error(`The cache does not match ${S}; missing or corrupted, nothing downloaded:\r +`);async function Gc(e,t,r){let n=[],s=0;for(;;){let o;try{o=await x(e,"read",t,s)}catch(i){if(Ln(i))return null;throw i}if(s+=o.length,s>r)return null;if(n.push(o),o.length<262144)return new Uint8Array(await new Blob(n).arrayBuffer())}}async function at(e,t,{signal:r,limit:n=1/0}={}){let s=await zc(e,t);if(!s)return{state:"missing",size:0};if(s.integrity!==t.integrity||!W(s.files)||!Fc(s,t))return{state:"corrupted",size:0};let o=0;for(let i of t.files){r?.throwIfAborted();let a=await Gc(e,`${Sn(t)}/${i}`,n-o);if(!a||await An(a)!==s.files[i])return{state:"corrupted",size:0};o+=a.length}return{state:"valid",size:o}}var Bl=async(e,t,r)=>(await at(e,t,r)).state;var Mc="https://registry.npmjs.org/";function Wc({registry:e,registryExplicit:t}={},r){return t&&e?{url:e,source:"application option"}:r?.registry?{url:r.registry,source:R}:{url:e||Mc,source:"default"}}function lt(e,t){let r=Wc(e,t);return ot(r.url),r}var ut=({url:e,source:t})=>`Registry: ${e} (${t})`,_c=256*1024*1024,Vc=e=>[...e.values()].reduce((t,r)=>t+r.length,0),Xc=e=>new Error(`The locked packages exceed ${e/(1024*1024)} MiB unpacked`);async function Bc(e,t,{signal:r,limit:n}){let s=[],o=0;for(let[i,a]of Object.entries(t.packages)){r?.throwIfAborted();let c=await at(e,a,{signal:r,limit:n-o});o+=c.size,s.push({id:i,node:a,state:c.state})}return{states:s,size:o}}async function ft(e,t,{registry:r,offline:n=!1,signal:s,progress:o=()=>{},fetchImpl:i=fetch,limit:a=_c}){let{states:c,size:l}=await Bc(e,t,{signal:s,limit:a}),u=l,f={verified:c.filter(({state:m})=>m==="valid").length,restored:0,problems:[]};for(let{id:m,node:d,state:T}of c.filter(({state:N})=>N!=="valid")){if(n){f.problems.push(`${m} (${T})`);continue}o(`Restoring ${m}${T==="corrupted"?" (corrupted in the cache)":""}`);let N=await D(d.name,d.version,{registry:r,fetchImpl:i,signal:s});if(N.integrity!==d.integrity)throw new Error(`${m} no longer matches the integrity recorded in the lock`);if(u+=Vc(N.files),u>a)throw Xc(a);await Ne(e,d,N.files,{signal:s}),f.restored++}if(f.problems.length)throw new Error(`The cache does not match ${S}; missing or corrupted, nothing downloaded:\r ${f.problems.join(`\r `)}\r -Run wf restore to download them.`);return f}function Hc(e){let t=e.includes("--offline");if(e.some(r=>r!=="--offline"))throw new Error("Usage: wf restore [--offline]");return{offline:t}}async function Ql(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}={}){let{offline:a}=Hc(t),c=await re(e);if(!c.manifest)throw new Error(Oe);if(!c.lock)throw new Error(`No ${S}: run wf install to resolve the dependencies`);let l=a?null:lt({registry:r,registryExplicit:n},c.manifest);o(a?"Offline: no registry is contacted":ut(l));let u=await ft(e,c.lock,{registry:l?.url,offline:a,signal:s,progress:o,fetchImpl:i}),f=Object.keys(c.lock.packages).length,m=a?`Cache verified offline: ${f} packages match ${S}.`:`Restored ${u.restored} of ${f} packages (${u.verified} already in the cache). Lock: ${S}`;return{...u,registry:l,text:In(c)+m}}var Pn=e=>{let{name:t,version:r}=ie(e);return[t,r||void 0]};function Yc(e,t){let{version:r}=e.packages[t.id];return!(pt.default.valid(t.requested)!==null)&&t.requested!=="latest"&&pt.default.validRange(t.requested)!==null?t.requested:`^${r}`}async function au(e,[t,...r],{signal:n}={}){if(r.length)throw new Error("Usage: wf init [name]");let{lock:s}=await re(e),o=wn(t??En(""));s&&(o.dependencies=Object.fromEntries(Object.entries(s.roots).map(([a,c])=>[a,Yc(s,c)]))),te(o),await Q(e,R,new Map([["output",Ie(rt(o))]]),{directory:!1,replace:!1,signal:n});let i=s?` with the ${Object.keys(o.dependencies).length} dependencies of ${S}`:"";return`Created ${R}${i}. Add libraries with wf install .`}function Jc(e,t){let r={...e.manifest.dependencies},n=new Set;for(let s of t){let[o,i]=Pn(s);r[o]=i??"latest",i&&i!=="latest"&&n.add(o)}return te({...e.source,dependencies:r}),{dependencies:r,explicit:n}}function Zc(e,t){let r={...e.source,dependencies:t};return te(r),r}function Kc({dependencies:e,explicit:t},r,n){let s={...e};for(let o of n){let i=Pn(o)[0];t.has(i)||(s[i]=`^${r.packages[r.roots[i].id].version}`)}return s}async function Qc(e,t,r){let n=Object.entries(e).map(([i,a])=>`${i}@${a}`),{lock:s,downloads:o}=await bn(n,{registry:r.registry,signal:r.signal,fetchImpl:r.fetchImpl,previous:t,download:async(...i)=>(r.progress(`Resolving ${i[0]}@${i[1]}`),D(...i))});return{lock:s,downloads:o}}async function ea(e,t,r,{signal:n,progress:s}){for(let[o,i]of r)s(`Storing ${o}`),await Ne(e,t.packages[o],i,{signal:n})}function ta(e){let t=e.includes("--update"),r=e.filter(n=>n!=="--update");if(r.some(n=>n.startsWith("-")))throw new Error("Usage: wf install [--update] [[@range] ...]");return{update:t,specs:r}}async function jn(e,t,{manifest:r,lock:n},s){let o=new Map([[S,Ie(JSON.stringify(n,null,2)+` -`)]]);r&&o.set(R,Ie(rt(r))),await Nn(e,o,t,s)}var Tn=async(e,t)=>({format:e.format,manifestDigest:await ye(t),...e});async function lu(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}){let{update:a,specs:c}=ta(t),l=await re(e);if(!l.manifest)throw new Error(Oe);let u=lt({registry:r,registryExplicit:n},l.manifest),f={registry:u.url,signal:s,fetchImpl:i,progress:o};if(c.length&&a)throw new Error("Usage: wf install --update does not take packages");if(c.length&&l.status==="desynchronized")throw new Error(ve);if(!c.length&&!a&&l.status==="desynchronized")throw new Error(ve);o(ut(u));let m=l.status==="consistent"||l.status==="legacy";if(!c.length&&!a&&m){let{restored:U}=await ft(e,l.lock,f);if(l.status==="consistent")return{lock:l.lock,restored:U,registry:u};let oe=await Tn(l.lock,l.manifest.dependencies);return await jn(e,l,{manifest:null,lock:oe},{signal:s}),{lock:oe,restored:U,registry:u}}let d=Jc(l,c),j=m&&!a?l.lock:void 0,N=await Qc(d.dependencies,j,f),Le=Kc(d,N.lock,c);await ea(e,N.lock,N.downloads,{signal:s,progress:o});let se=await Tn(N.lock,Le),y=c.length?Zc(l,Le):null;return await jn(e,l,{manifest:y,lock:se},{signal:s}),{lock:se,restored:0,registry:u}}var ra=[R,S,".webfront"],ne=(e,t)=>e===t||e.startsWith(t+"/");function ht(e){try{return A(e)}catch{throw new Error(`Not a project-relative path: ${e}`)}}var Se=(e,t,r)=>new Error(`Permission denied: ${e} ${t} is not granted by permissions.${r} in ${R}`);function qn(e,t){let r=ht(t);if(![...e?.files??[],...e?.publish??[]].some(s=>ne(r,s)))throw Se("reading",t,"files");return r}function Cn(e,t){let r=t===""||t==="."?"":ht(t),n=[...e?.files??[],...e?.publish??[]];if(r&&n.some(o=>ne(r,o)))return{path:r,keep:()=>!0};let s=o=>n.some(i=>ne(o,i)||i.startsWith(o+"/"));if(!n.some(o=>r===""||o.startsWith(r+"/")))throw Se("listing",r||"the project root","files");return{path:r,keep:o=>s(r?`${r}/${o.replace(/\/$/,"")}`:o.replace(/\/$/,""))}}function Dn(e,t){let r=ht(t);if(ra.some(n=>ne(r,n)))throw new Error(`Permission denied: ${t} is managed by wf and never written by a script`);if(!(e?.publish??[]).some(n=>ne(r,n)))throw Se("writing",t,"publish");return r}function hu(e,t,r){let n=new URL(t,r);if(!(e?.fetch??[]).includes(n.origin))throw Se("fetching",n.origin,"fetch");return n}var na=2e3,zn=600,ke=[1,3600],Un=4,dt=class extends Error{constructor(t,r){super(t),this.exitCode=r}},$u=(e,t=1/0,r=Date.now())=>Math.min(r+e*1e3,t),yu=(e,t=Date.now())=>Math.max(0,(e-t)/1e3);function xu(e,t){let r=zn,n=e;if(n[0]==="--timeout"){if(r=Number(n[1]),!Number.isInteger(r)||rke[1])throw new Error(`--timeout expects whole seconds from ${ke[0]} to ${ke[1]}`);n=n.slice(2)}if(!n.length||n[0].startsWith("-"))throw new Error(`Usage: ${t}`);return{timeout:r,target:n[0],args:n.slice(1)}}function Ru(e,t,r,n,s=0){let o=e?.scripts??{};if(!Object.hasOwn(o,t)){let c=Object.keys(o).sort().join(", ")||"none";throw new Error(`No script "${t}" in ${R} (scripts: ${c})`)}let[i,...a]=n(o[t]);if(i==="wf"){if(s>=Un)throw new Error(`Scripts call wf more than ${Un} levels deep`);return{kind:"wf",argv:[...a,...r]}}return{kind:"module",entry:{namespace:"project",path:A(i)},args:[...a,...r]}}function Fn(e,t){if(e?.roots&&Object.hasOwn(e.roots,t)){let{id:n}=e.roots[t];return[n,e.packages[n]]}let r=Object.entries(e?.packages??{}).filter(([,n])=>n.name===t);if(r.length>1)throw new Error(`${t} is locked at several versions; install it as a root to choose one`);return r[0]??null}function sa(e,t){let r=t.webfront?.bin;if(typeof r=="string")return{[t.name.split("/").pop()]:r};if(r&&typeof r=="object"&&!Array.isArray(r))return r;throw t.bin?new Error(`${e} only declares an npm "bin" (a Node.js program); wf exec runs only "webfront.bin" entries`):new Error(`${e} has no WebFront executable entry ("webfront.bin" in its package.json)`)}function bu(e,t){let r=t.indexOf(":",t.startsWith("@")?t.indexOf("/"):0),[n,s]=r<0?[t,void 0]:[t.slice(0,r),t.slice(r+1)],o=Fn(e,n);if(!o)throw new Error(`${n} is not installed: run wf install ${n}`);let[i,a]=o,c=sa(i,a.manifest),l=Object.keys(c),u=s??(l.length===1?l[0]:void 0);if(!u||!Object.hasOwn(c,u))throw new Error(`${i} has the WebFront entries ${l.join(", ")||"none"}: run wf exec ${n}:`);let f=String(c[u]).replace(/^\.\//,"");if(!a.files.includes(A(f)))throw new Error(`${i}: webfront.bin entry ${u} names a missing file ${f}`);return{id:i,name:u,entry:{namespace:"npm",path:`${i}/${f}`}}}var oa=new TextDecoder;function Ou({bridge:e,permissions:t,lock:r}){let n=new AbortController,s=[],o=new Set;async function i(c,l){let u=Dn(t,c);if(!(l instanceof Uint8Array))throw new TypeError("context.project.write expects a string or a Uint8Array");let f={path:u,state:"staging"};s.push(f);let m=null;try{m=await x(e,"begin",u,!1),await K(e,{id:m,path:"output",bytes:l},n.signal),n.signal.throwIfAborted(),f.state="committing",await x(e,"commit",m),f.state="applied"}catch(d){let j=n.signal.aborted&&f.state!=="committing";throw f.state=j?"abandoned":"failed",m!==null&&await x(e,"abort",m).catch(()=>{}),d}}let a={read:c=>G(e,qn(t,c)),list:async(c="")=>{let{path:l,keep:u}=Cn(t,c);return JSON.parse(oa.decode(await x(e,"list",l))).filter(u)},write:i,resolve:c=>{let l=Fn(r,c)?.[1];return l?{name:l.name,version:l.version,integrity:l.integrity}:null}};return{publications:s,async handle({operation:c,args:l}){if(n.signal.aborted)throw new Error("The script was stopped");if(!Object.hasOwn(a,c))throw new Error(`Unknown context operation: ${c}`);let u=a[c](...l);o.add(u);try{return await u}finally{o.delete(u)}},async finish(){for(let c of s)(c.state==="staging"||c.state==="committing")&&(c.unawaited=!0);for(;o.size;)await Promise.allSettled([...o]);await this.stop()},async stop(){n.abort(new Error("The script was stopped")),await Promise.allSettled([...o])}}}function vu({createWorker:e,host:t,message:r,signal:n,timeout:s=zn,grace:o=na,write:i}){return new Promise(a=>{let c=e(),l=[],u=null,f=!1,m=()=>u==="timeout"?124:130,d=y=>{f||(f=!0,c.terminate(),l.forEach(clearTimeout),n?.removeEventListener("abort",N),a({reason:u??"exit",...y}))},j=y=>{u||f||(u=y,c.postMessage({type:"abort"}),l.push(setTimeout(()=>d({code:m(),forced:o}),o)))},N=()=>j("interrupted"),se={console:y=>i(String(y.text).replace(/\r?\n/g,`\r +Run wf restore to download them.`);return f}function Hc(e){let t=e.includes("--offline");if(e.some(r=>r!=="--offline"))throw new Error("Usage: wf restore [--offline]");return{offline:t}}async function Ql(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}={}){let{offline:a}=Hc(t),c=await re(e);if(!c.manifest)throw new Error(Oe);if(!c.lock)throw new Error(`No ${S}: run wf install to resolve the dependencies`);let l=a?null:lt({registry:r,registryExplicit:n},c.manifest);o(a?"Offline: no registry is contacted":ut(l));let u=await ft(e,c.lock,{registry:l?.url,offline:a,signal:s,progress:o,fetchImpl:i}),f=Object.keys(c.lock.packages).length,m=a?`Cache verified offline: ${f} packages match ${S}.`:`Restored ${u.restored} of ${f} packages (${u.verified} already in the cache). Lock: ${S}`;return{...u,registry:l,text:In(c)+m}}var Pn=e=>{let{name:t,version:r}=ie(e);return[t,r||void 0]};function Yc(e,t){let{version:r}=e.packages[t.id];return!(pt.default.valid(t.requested)!==null)&&t.requested!=="latest"&&pt.default.validRange(t.requested)!==null?t.requested:`^${r}`}async function au(e,[t,...r],{signal:n}={}){if(r.length)throw new Error("Usage: wf init [name]");let{lock:s}=await re(e),o=wn(t??En(""));s&&(o.dependencies=Object.fromEntries(Object.entries(s.roots).map(([a,c])=>[a,Yc(s,c)]))),te(o),await Q(e,R,new Map([["output",Ie(rt(o))]]),{directory:!1,replace:!1,signal:n});let i=s?` with the ${Object.keys(o.dependencies).length} dependencies of ${S}`:"";return`Created ${R}${i}. Add libraries with wf install .`}function Jc(e,t){let r={...e.manifest.dependencies},n=new Set;for(let s of t){let[o,i]=Pn(s);r[o]=i??"latest",i&&i!=="latest"&&n.add(o)}return te({...e.source,dependencies:r}),{dependencies:r,explicit:n}}function Zc(e,t){let r={...e.source,dependencies:t};return te(r),r}function Kc({dependencies:e,explicit:t},r,n){let s={...e};for(let o of n){let i=Pn(o)[0];t.has(i)||(s[i]=`^${r.packages[r.roots[i].id].version}`)}return s}async function Qc(e,t,r){let n=Object.entries(e).map(([i,a])=>`${i}@${a}`),{lock:s,downloads:o}=await bn(n,{registry:r.registry,signal:r.signal,fetchImpl:r.fetchImpl,previous:t,download:async(...i)=>(r.progress(`Resolving ${i[0]}@${i[1]}`),D(...i))});return{lock:s,downloads:o}}async function ea(e,t,r,{signal:n,progress:s}){for(let[o,i]of r)s(`Storing ${o}`),await Ne(e,t.packages[o],i,{signal:n})}function ta(e){let t=e.includes("--update"),r=e.filter(n=>n!=="--update");if(r.some(n=>n.startsWith("-")))throw new Error("Usage: wf install [--update] [[@range] ...]");return{update:t,specs:r}}async function Tn(e,t,{manifest:r,lock:n},s){let o=new Map([[S,Ie(JSON.stringify(n,null,2)+` +`)]]);r&&o.set(R,Ie(rt(r))),await Nn(e,o,t,s)}var jn=async(e,t)=>({format:e.format,manifestDigest:await ye(t),...e});async function lu(e,t,{registry:r,registryExplicit:n,signal:s,progress:o=()=>{},fetchImpl:i=fetch}){let{update:a,specs:c}=ta(t),l=await re(e);if(!l.manifest)throw new Error(Oe);let u=lt({registry:r,registryExplicit:n},l.manifest),f={registry:u.url,signal:s,fetchImpl:i,progress:o};if(c.length&&a)throw new Error("Usage: wf install --update does not take packages");if(c.length&&l.status==="desynchronized")throw new Error(ve);if(!c.length&&!a&&l.status==="desynchronized")throw new Error(ve);o(ut(u));let m=l.status==="consistent"||l.status==="legacy";if(!c.length&&!a&&m){let{restored:U}=await ft(e,l.lock,f);if(l.status==="consistent")return{lock:l.lock,restored:U,registry:u};let oe=await jn(l.lock,l.manifest.dependencies);return await Tn(e,l,{manifest:null,lock:oe},{signal:s}),{lock:oe,restored:U,registry:u}}let d=Jc(l,c),T=m&&!a?l.lock:void 0,N=await Qc(d.dependencies,T,f),Le=Kc(d,N.lock,c);await ea(e,N.lock,N.downloads,{signal:s,progress:o});let se=await jn(N.lock,Le),y=c.length?Zc(l,Le):null;return await Tn(e,l,{manifest:y,lock:se},{signal:s}),{lock:se,restored:0,registry:u}}var ra=[R,S,".webfront"],ne=(e,t)=>e===t||e.startsWith(t+"/");function ht(e){try{return A(e)}catch{throw new Error(`Not a project-relative path: ${e}`)}}var Se=(e,t,r)=>new Error(`Permission denied: ${e} ${t} is not granted by permissions.${r} in ${R}`);function qn(e,t){let r=ht(t);if(![...e?.files??[],...e?.publish??[]].some(s=>ne(r,s)))throw Se("reading",t,"files");return r}function Cn(e,t){let r=t===""||t==="."?"":ht(t),n=[...e?.files??[],...e?.publish??[]];if(r&&n.some(o=>ne(r,o)))return{path:r,keep:()=>!0};let s=o=>n.some(i=>ne(o,i)||i.startsWith(o+"/"));if(!n.some(o=>r===""||o.startsWith(r+"/")))throw Se("listing",r||"the project root","files");return{path:r,keep:o=>s(r?`${r}/${o.replace(/\/$/,"")}`:o.replace(/\/$/,""))}}function Dn(e,t){let r=ht(t);if(ra.some(n=>ne(r,n)))throw new Error(`Permission denied: ${t} is managed by wf and never written by a script`);if(!(e?.publish??[]).some(n=>ne(r,n)))throw Se("writing",t,"publish");return r}function hu(e,t,r){let n=new URL(t,r);if(!(e?.fetch??[]).includes(n.origin))throw Se("fetching",n.origin,"fetch");return n}var na=2e3,zn=600,ke=[1,3600],Un=4,dt=class extends Error{constructor(t,r){super(t),this.exitCode=r}},$u=(e,t=1/0,r=Date.now())=>Math.min(r+e*1e3,t),yu=(e,t=Date.now())=>Math.max(0,(e-t)/1e3);function xu(e,t){let r=zn,n=e;if(n[0]==="--timeout"){if(r=Number(n[1]),!Number.isInteger(r)||rke[1])throw new Error(`--timeout expects whole seconds from ${ke[0]} to ${ke[1]}`);n=n.slice(2)}if(!n.length||n[0].startsWith("-"))throw new Error(`Usage: ${t}`);return{timeout:r,target:n[0],args:n.slice(1)}}function Ru(e,t,r,n,s=0){let o=e?.scripts??{};if(!Object.hasOwn(o,t)){let c=Object.keys(o).sort().join(", ")||"none";throw new Error(`No script "${t}" in ${R} (scripts: ${c})`)}let[i,...a]=n(o[t]);if(i==="wf"){if(s>=Un)throw new Error(`Scripts call wf more than ${Un} levels deep`);return{kind:"wf",argv:[...a,...r]}}return{kind:"module",entry:{namespace:"project",path:A(i)},args:[...a,...r]}}function Fn(e,t){if(e?.roots&&Object.hasOwn(e.roots,t)){let{id:n}=e.roots[t];return[n,e.packages[n]]}let r=Object.entries(e?.packages??{}).filter(([,n])=>n.name===t);if(r.length>1)throw new Error(`${t} is locked at several versions; install it as a root to choose one`);return r[0]??null}function sa(e,t){let r=t.webfront?.bin;if(typeof r=="string")return{[t.name.split("/").pop()]:r};if(r&&typeof r=="object"&&!Array.isArray(r))return r;throw t.bin?new Error(`${e} only declares an npm "bin" (a Node.js program); wf exec runs only "webfront.bin" entries`):new Error(`${e} has no WebFront executable entry ("webfront.bin" in its package.json)`)}function bu(e,t){let r=t.indexOf(":",t.startsWith("@")?t.indexOf("/"):0),[n,s]=r<0?[t,void 0]:[t.slice(0,r),t.slice(r+1)],o=Fn(e,n);if(!o)throw new Error(`${n} is not installed: run wf install ${n}`);let[i,a]=o,c=sa(i,a.manifest),l=Object.keys(c),u=s??(l.length===1?l[0]:void 0);if(!u||!Object.hasOwn(c,u))throw new Error(`${i} has the WebFront entries ${l.join(", ")||"none"}: run wf exec ${n}:`);let f=String(c[u]).replace(/^\.\//,"");if(!a.files.includes(A(f)))throw new Error(`${i}: webfront.bin entry ${u} names a missing file ${f}`);return{id:i,name:u,entry:{namespace:"npm",path:`${i}/${f}`}}}var oa=new TextDecoder;function Ou({bridge:e,permissions:t,lock:r}){let n=new AbortController,s=[],o=new Set;async function i(c,l){let u=Dn(t,c);if(!(l instanceof Uint8Array))throw new TypeError("context.project.write expects a string or a Uint8Array");let f={path:u,state:"staging"};s.push(f);let m=null;try{m=await x(e,"begin",u,!1),await K(e,{id:m,path:"output",bytes:l},n.signal),n.signal.throwIfAborted(),f.state="committing",await x(e,"commit",m),f.state="applied"}catch(d){let T=n.signal.aborted&&f.state!=="committing";throw f.state=T?"abandoned":"failed",m!==null&&await x(e,"abort",m).catch(()=>{}),d}}let a={read:c=>G(e,qn(t,c)),list:async(c="")=>{let{path:l,keep:u}=Cn(t,c);return JSON.parse(oa.decode(await x(e,"list",l))).filter(u)},write:i,resolve:c=>{let l=Fn(r,c)?.[1];return l?{name:l.name,version:l.version,integrity:l.integrity}:null}};return{publications:s,async handle({operation:c,args:l}){if(n.signal.aborted)throw new Error("The script was stopped");if(!Object.hasOwn(a,c))throw new Error(`Unknown context operation: ${c}`);let u=a[c](...l);o.add(u);try{return await u}finally{o.delete(u)}},async finish(){for(let c of s)(c.state==="staging"||c.state==="committing")&&(c.unawaited=!0);for(;o.size;)await Promise.allSettled([...o]);await this.stop()},async stop(){n.abort(new Error("The script was stopped")),await Promise.allSettled([...o])}}}function vu({createWorker:e,host:t,message:r,signal:n,timeout:s=zn,grace:o=na,write:i}){return new Promise(a=>{let c=e(),l=[],u=null,f=!1,m=()=>u==="timeout"?124:130,d=y=>{f||(f=!0,c.terminate(),l.forEach(clearTimeout),n?.removeEventListener("abort",N),a({reason:u??"exit",...y}))},T=y=>{u||f||(u=y,c.postMessage({type:"abort"}),l.push(setTimeout(()=>d({code:m(),forced:o}),o)))},N=()=>T("interrupted"),se={console:y=>i(String(y.text).replace(/\r?\n/g,`\r `)+`\r -`,y.stream),exit:y=>d({code:u&&y.code===0?m():y.code}),error:y=>d({code:u?m():1,error:y.error}),call:async y=>{let U;try{U={value:await t.handle(y)}}catch(oe){U={error:oe.message}}f||c.postMessage({type:"reply",id:y.id,...U})}};c.onmessage=({data:y})=>se[y?.type]?.(y),c.onerror=y=>{y.preventDefault?.(),d({code:1,error:y.message||"The script Worker failed"})},n?.addEventListener("abort",N,{once:!0}),l.push(setTimeout(()=>j("timeout"),s*1e3)),c.postMessage({type:"run",...r}),n?.aborted&&N()})}function ia(e,t){let r=t?e:e.filter(o=>o.unawaited),n=o=>r.filter(i=>i.state===o).map(({path:i})=>i),s=[];return t&&n("applied").length&&s.push(`Applied before the stop: ${n("applied").join(", ")}`),n("abandoned").length&&s.push(`Abandoned, unchanged: ${n("abandoned").join(", ")}`),n("failed").length&&s.push(`Failed, unchanged: ${n("failed").join(", ")}`),s}function Iu(e,t,r){let n={interrupted:"stopped by Ctrl+C",timeout:"stopped at its time limit"}[t.reason],s=ia(r,n!==void 0);if(t.code===0&&!n&&!s.length)return`${e} completed.`;let o=t.forced?` (terminated after the ${t.forced/1e3} s grace period)`:"",i=t.code===0&&!n?1:t.code,a=n?`${n}${o}`:t.code===0?"ended without applying all its writes":`exited with code ${t.code}`;throw new dt([t.error,`${e} ${a}`,...s].filter(Boolean).join(`\r +`,y.stream),exit:y=>d({code:u&&y.code===0?m():y.code}),error:y=>d({code:u?m():1,error:y.error}),call:async y=>{let U;try{U={value:await t.handle(y)}}catch(oe){U={error:oe.message}}f||c.postMessage({type:"reply",id:y.id,...U})}};c.onmessage=({data:y})=>se[y?.type]?.(y),c.onerror=y=>{y.preventDefault?.(),d({code:1,error:y.message||"The script Worker failed"})},n?.addEventListener("abort",N,{once:!0}),l.push(setTimeout(()=>T("timeout"),s*1e3)),c.postMessage({type:"run",...r}),n?.aborted&&N()})}function ia(e,t){let r=t?e:e.filter(o=>o.unawaited),n=o=>r.filter(i=>i.state===o).map(({path:i})=>i),s=[];return t&&n("applied").length&&s.push(`Applied before the stop: ${n("applied").join(", ")}`),n("abandoned").length&&s.push(`Abandoned, unchanged: ${n("abandoned").join(", ")}`),n("failed").length&&s.push(`Failed, unchanged: ${n("failed").join(", ")}`),s}function Iu(e,t,r){let n={interrupted:"stopped by Ctrl+C",timeout:"stopped at its time limit"}[t.reason],s=ia(r,n!==void 0);if(t.code===0&&!n&&!s.length)return`${e} completed.`;let o=t.forced?` (terminated after the ${t.forced/1e3} s grace period)`:"",i=t.code===0&&!n?1:t.code,a=n?`${n}${o}`:t.code===0?"ended without applying all its writes":`exited with code ${t.code}`;throw new dt([t.error,`${e} ${a}`,...s].filter(Boolean).join(`\r `),i)}var Pu=new TextDecoder,la=["",".tsx",".ts",".jsx",".js",".mjs",".cjs",".json",".css","/index.tsx","/index.ts","/index.js"],qu=new Map(Object.entries({mjs:"js",cjs:"js",js:"js",jsx:"jsx",ts:"ts",tsx:"tsx",css:"css",json:"json"}));async function ua(e,t,r){try{return await e(t,r)}catch(n){if(t!=="project")throw n;return}}function fa(e,t,r,n){let s=new Map,o=(c,l)=>{let u=n?.packages?.[c];if(u)return s.has(c)||s.set(c,new Set(u.files)),s.get(c).has(l)?t(`${M}/${u.key}/${l}`):void 0},i=async(c,l)=>{if(c==="project")return t(l);let u=l.indexOf("/"),[f,m]=[l.slice(0,u),l.slice(u+1)];return e?e[f]?.get(m):o(f,m)};return{read:i,find:async(c,l)=>{for(let u of la){let f=await ua(i,c,l+u);if(f!==void 0)return r.set(`${c}:${l+u}`,f),{path:l+u,namespace:c}}throw new Error(`Cannot resolve ${l}`)}}}var pa=new Set(["assert","async_hooks","buffer","child_process","cluster","console","constants","crypto","dgram","diagnostics_channel","dns","domain","events","fs","http","http2","https","inspector","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","string_decoder","sys","timers","tls","trace_events","tty","url","util","v8","vm","wasi","worker_threads","zlib"]),ha=/^(?:node:|[a-z_][a-z0-9_]*(?:\/|$))/;function da(e){if(e.startsWith("node:"))return e.slice(5).split("/")[0];let t=e.split("/")[0];return pa.has(t)?t:null}export{dt as ScriptExit,Bl as cacheState,hu as checkFetch,qn as checkRead,Dn as checkWrite,fa as createFinder,Mc as defaultRegistry,zn as defaultTimeout,ye as dependenciesDigest,ut as describeRegistry,ve as desynchronized,D as downloadPackage,Wc as effectiveRegistry,Gl as embedTarget,sc as exactVersion,bu as execTarget,na as gracePeriod,Ke as identifier,au as initProject,at as inspectCache,lu as install,Cn as listable,re as loadProject,S as lockPath,Fn as lockedPackage,Pc as locksDependencies,ee as manifestFormat,En as manifestName,R as manifestPath,wn as newManifest,Oe as noManifest,da as nodeBuiltin,ha as nodeImport,Ze as npmName,Sn as packageDirectory,M as packageRoot,gl as parseManifest,xu as parseRunOptions,Nn as publishTogether,tt as readManifest,kn as recordPath,vn as resolveEntry,bn as resolvePackages,Ql as restore,ft as restorePackages,$u as runDeadline,Iu as runResult,vu as runWorker,A as safePackagePath,et as sameOriginPath,Ru as scriptCommand,Ou as scriptHost,yu as secondsLeft,rt as serializeManifest,Ne as storePackage,In as syncNotice,Ie as textBytes,ke as timeoutBounds,_c as unpackedLimit,lt as usableRegistry,it as validateLock,te as validateManifest}; diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index 7e2d9733..5031e8f4 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -13,7 +13,7 @@ import {restore, describeRegistry} from './restore.mjs'; import {loadProject, syncNotice, resolveEntry, embedTarget, lockPath, packageRoot, noManifest} from './project.mjs'; import {parseRunOptions, scriptCommand, execTarget, scriptHost, runWorker, runResult, runDeadline, secondsLeft} from './scripts.mjs'; import {build, dev} from './development.mjs'; -import {parseTestOptions, specFiles, jasmineCore, runnerFiles, runInFrame, reportResult, testDirectory} from './testing.mjs'; +import {parseTestOptions, specFiles, jasmineCore, runnerFiles, runInFrame, reportResult, fitResult, stoppedRun, testDirectory} from './testing.mjs'; import {generateProvider, applicationPage} from './embed.mjs'; import {typescriptPackage, parseCheckOptions, checkHost} from './typecheck.mjs'; @@ -202,21 +202,39 @@ async function check(args, {bridge, signal, write = () => {}, createWorker = che // context.onReport receives the structured report, also when the run fails. async function test(args, {bridge, signal, write = () => {}, createFrame, onReport}) { const {timeout, pattern} = parseTestOptions(args); - const project = await loadManifest(bridge); - const specs = specFiles(project.manifest); - const lock = project.lock ?? {format: 1, roots: {}, packages: {}}; - const jasmine = jasmineCore(lock); - const files = await buildInWorker(bridge, {type: 'tests', specs, lock}, signal); - const jasmineBytes = await readProject(bridge, `${packageRoot}/${jasmine.node.key}/${jasmine.path}`); - await publish(bridge, testDirectory, runnerFiles(files.get('specs.js'), jasmineBytes), {signal}); - write(syncNotice(project)); - let report; - try { report = await runInFrame({pattern, timeout, signal, write, createFrame}); } - catch (error) { if (error.report) onReport?.({...error.report, jasmine: jasmine.node.version}); throw error; } - report.jasmine = jasmine.node.version; - onReport?.(report); - write('\n'); - return reportResult(report); + // --timeout covers the whole command: the build, the publication and the run share one deadline. + const deadline = Date.now() + timeout * 1000; + const limit = new AbortController(); + const timer = setTimeout(() => limit.abort(), timeout * 1000); + const preparing = signal ? AbortSignal.any([signal, limit.signal]) : limit.signal; + const runId = crypto.randomUUID(); + const directory = `${testDirectory}/${runId}`; + let jasmineVersion = ''; + let reported = false; + const finished = report => { reported = true; report.jasmine = jasmineVersion; onReport?.(report); return report; }; + try { + const project = await loadManifest(bridge); + const specs = specFiles(project.manifest); + const lock = project.lock ?? {format: 1, roots: {}, packages: {}}; + const jasmine = jasmineCore(lock); + jasmineVersion = jasmine.node.version; + const files = await buildInWorker(bridge, {type: 'tests', specs, lock}, preparing); + const jasmineBytes = await readProject(bridge, `${packageRoot}/${jasmine.node.key}/${jasmine.path}`); + await publish(bridge, directory, runnerFiles(files, jasmineBytes), {signal: preparing}); + write(syncNotice(project)); + const report = finished(await runInFrame({pattern, timeout: Math.max(0.001, (deadline - Date.now()) / 1000), runId, signal, write, createFrame})); + write('\n'); + return reportResult(report); + } catch (error) { + // The limit's own abort ends the preparation like the limit ends the run: with exit code 124 and its report. + if (limit.signal.aborted && !signal?.aborted && !error.report) error = stoppedRun('timeout', pattern); + if (error.report && !reported) finished(error.report); + throw error; + } finally { + clearTimeout(timer); + // The files of the run are not needed any more; an empty directory replaces them (best effort). + await publish(bridge, directory, new Map()).catch(() => {}); + } } async function list(_args, {bridge}) { @@ -238,7 +256,7 @@ export async function execute(args, context) { * Runs one wf command without a terminal, for a page that the application drives: the command's output goes to * `write`, and the result {exitCode, output, report} is sent to C++ as JSON through `reporter` (for example * json => bridge.cppFunction('app.report')(json)) before `onExit(exitCode)` ends the session (by default, closes the - * window). `report` is the structured report of wf test, null for other commands. A command that fails, or a result + * window). `report` is the structured report of wf test, null for other commands; the result is cut to fit a bridge string (see fitResult). A command that fails, or a result * that cannot be sent, ends with a non-zero code; it never stays open. Resolves with the result. */ export async function runNonInteractive(argv, {reporter, onExit = code => globalThis.close(code), write = () => {}, ...context}) { @@ -250,7 +268,7 @@ export async function runNonInteractive(argv, {reporter, onExit = code => global output += error?.message ?? String(error); } const result = {exitCode, output, report}; - try { await reporter?.(JSON.stringify(result)); } + try { await reporter?.(JSON.stringify(fitResult(result))); } catch (error) { result.exitCode = exitCode || 1; result.output += `\nThe result could not be sent to the application: ${error?.message ?? error}`; diff --git a/js/developer/environment/testing.mjs b/js/developer/environment/testing.mjs index 89273c1f..25f5c0e0 100644 --- a/js/developer/environment/testing.mjs +++ b/js/developer/environment/testing.mjs @@ -3,6 +3,7 @@ import {ScriptExit, lockedPackage} from './scripts.mjs'; import {manifestPath} from './manifest.mjs'; +/** Each run publishes its own directory under this one: two sessions on a project never run each other's specs. */ export const testDirectory = '.webfront/developer/test'; export const testTimeout = {default: 60, bounds: [1, 3600]}; export const reportLimits = {failures: 100, messages: 8, text: 16 * 1024, pending: 100}; @@ -49,8 +50,18 @@ const pattern = new URLSearchParams(location.search).get('pattern') ?? ''; const clip = (value, limit = ${reportLimits.text}) => String(value ?? '').slice(0, limit); const problems = list => (list ?? []).slice(0, ${reportLimits.messages}).map(({message, stack}) => ({message: clip(message), stack: clip(stack)})); const specs = []; +const suites = []; +// jasmine.js of version 7 installs the globals itself; earlier versions leave that to their boot file, done here. +function boot() { + if (globalThis.jasmine) return; + const jasmine = jasmineRequire.core(jasmineRequire); + const members = jasmineRequire.interface(jasmine, jasmine.getEnv()); + globalThis.jasmine = jasmine; + for (const name in members) globalThis[name] = members[name]; +} try { try { await webFront.ready; } catch { /* the specs that need the bridge fail on their own */ } + boot(); const env = jasmine.getEnv(); env.configure({random: false, specFilter: spec => spec.getFullName().includes(pattern)}); env.addReporter({ @@ -59,8 +70,12 @@ try { failures: problems(result.failedExpectations)}); post({type: 'spec', status: result.status}); }, + suiteDone(result) { + // An afterAll that throws is reported here, not by any spec. + if (result.failedExpectations?.length) suites.push({name: clip(result.fullName, 1024), failures: problems(result.failedExpectations)}); + }, jasmineDone(info) { - post({type: 'done', version: jasmine.version, specs, overall: info.overallStatus, durationMs: info.totalTime, + post({type: 'done', version: jasmine.version, specs, suites, overall: info.overallStatus, durationMs: info.totalTime, incomplete: clip(info.incompleteReason, 1024), global: problems(info.failedExpectations)}); }, }); @@ -72,17 +87,17 @@ try { } `; -/** The files of a runner: the page, the module that runs the specs, the locked Jasmine and the compiled specs. */ -export function runnerFiles(specs, jasmine) { - const page = '\nWebFront tests' + +/** The files of a runner: the page, the module that runs the specs, the locked Jasmine and everything the specs built (JS, CSS, assets). */ +export function runnerFiles(compiled, jasmine) { + const stylesheet = compiled.has('specs.css') ? '' : ''; + const page = `\nWebFront tests${stylesheet}` + '' + '\n'; - return new Map([['index.html', encoder.encode(page)], ['runner.js', encoder.encode(runnerSource)], - ['jasmine.js', jasmine], ['specs.js', specs]]); + return new Map([...compiled, ['index.html', encoder.encode(page)], ['runner.js', encoder.encode(runnerSource)], ['jasmine.js', jasmine]]); } const emptyReport = (status, exitCode, extra = {}) => ({status, exitCode, jasmine: '', pattern: '', incomplete: '', total: 0, passed: 0, - failed: 0, pending: 0, excluded: 0, durationMs: 0, failures: [], pendingSpecs: [], global: [], ...extra}); + failed: 0, pending: 0, excluded: 0, durationMs: 0, failures: [], pendingSpecs: [], suites: [], global: [], ...extra}); const finite = value => Number.isFinite(value) && value >= 0 ? Math.round(value) : 0; const text = (value, limit) => typeof value === 'string' ? value.slice(0, limit) : ''; const problems = list => Array.isArray(list) ? list.slice(0, reportLimits.messages).map(item => @@ -101,16 +116,17 @@ export function buildReport(data, {pattern = ''} = {}) { const failedSpecs = specs.filter(spec => spec.status === 'failed'); const executed = specs.filter(spec => spec.status !== 'excluded').length; const global = problems(data.global); + const suites = Array.isArray(data.suites) ? data.suites.slice(0, reportLimits.failures).map(({name, failures}) => ({name: text(name, 1024), messages: problems(failures)})) : []; let status = ['passed', 'failed', 'incomplete'].includes(data.overall) ? data.overall : 'failed'; let incomplete = text(data.incomplete, 1024); - if (status === 'passed' && (failedSpecs.length || global.length)) status = 'failed'; + if (status === 'passed' && (failedSpecs.length || global.length || suites.length)) status = 'failed'; if (status === 'passed' && !executed) { status = 'incomplete'; incomplete = pattern ? `No spec matches "${pattern}"` : 'No specs found'; } return {status, exitCode: status === 'passed' ? 0 : 1, jasmine: text(data.version, 32), pattern, incomplete, total: executed, passed: count('passed'), failed: failedSpecs.length, pending: count('pending'), excluded: count('excluded'), durationMs: finite(data.durationMs), failures: failedSpecs.slice(0, reportLimits.failures).map(({name, failures}) => ({name: text(name, 1024), messages: problems(failures)})), pendingSpecs: specs.filter(spec => spec.status === 'pending').slice(0, reportLimits.pending).map(({name, reason}) => ({name: text(name, 1024), reason: text(reason, 1024)})), - global}; + suites, global}; } const plural = (count, word) => `${count} ${word}${count === 1 ? '' : 's'}`; @@ -125,13 +141,14 @@ export function formatReport(report) { const lines = [`${report.status === 'passed' ? 'PASSED' : 'FAILED'}: ${summary.join(', ')} (${report.durationMs} ms, jasmine-core ${report.jasmine})`]; if (report.incomplete) lines.push(report.incomplete); for (const {name, messages} of report.failures) lines.push(`FAIL ${name}`, ...messages.flatMap(problemLines)); + for (const {name, messages} of report.suites) lines.push(`FAIL ${name} (suite)`, ...messages.flatMap(problemLines)); if (report.global.length) lines.push('Failures outside the specs:', ...report.global.flatMap(problemLines)); for (const {name, reason} of report.pendingSpecs) lines.push(`PENDING ${name}${reason ? `: ${reason}` : ''}`); return lines.join('\n'); } const progress = {passed: '.', failed: 'F', pending: '*'}; -const stopped = (reason, pattern) => { +export const stoppedRun = (reason, pattern) => { const [message, exitCode] = reason === 'timeout' ? ['Tests stopped at their time limit', 124] : ['Tests stopped by Ctrl+C', 130]; return Object.assign(new ScriptExit(message, exitCode), {report: emptyReport(reason, exitCode, {pattern, error: message})}); }; @@ -150,7 +167,7 @@ function defaultFrame() { * `signal` aborts (130) or after `timeout` seconds (124); the frame is removed in every case. `createFrame` makes the * frame element. */ -export function runInFrame({pattern, timeout, signal, write = () => {}, createFrame = defaultFrame}) { +export function runInFrame({pattern, timeout, runId, signal, write = () => {}, createFrame = defaultFrame}) { return new Promise((resolve, reject) => { const frame = createFrame(); let timer; @@ -167,12 +184,12 @@ export function runInFrame({pattern, timeout, signal, write = () => {}, createFr if (message?.type === 'spec') write(progress[message.status] ?? ''); else if (message?.type === 'done' || message?.type === 'error') finish(null, buildReport(message, {pattern})); }; - const interrupt = () => finish(stopped('interrupted', pattern)); + const interrupt = () => finish(stoppedRun('interrupted', pattern)); addEventListener('message', receive); signal?.addEventListener('abort', interrupt, {once: true}); - timer = setTimeout(() => finish(stopped('timeout', pattern)), timeout * 1000); + timer = setTimeout(() => finish(stoppedRun('timeout', pattern)), timeout * 1000); if (signal?.aborted) return interrupt(); - frame.src = `/webfront/developer/test/index.html?pattern=${encodeURIComponent(pattern)}&run=${Date.now()}`; + frame.src = `/webfront/developer/test/${runId}/index.html?pattern=${encodeURIComponent(pattern)}&run=${Date.now()}`; document.body.append(frame); }); } @@ -183,3 +200,35 @@ export function reportResult(report) { if (report.exitCode === 0) return output; throw Object.assign(new ScriptExit(output, report.exitCode), {report}); } + +// A bridge string carries a 16-bit length, in UTF-8 bytes: the result must fit in one, with a margin. +export const resultLimit = 60000; +const byteLength = value => encoder.encode(JSON.stringify(value)).length; +const clipText = (text, length) => text.length > length ? `${text.slice(0, length)}…` : text; + +/** + * The result cut to `limit` bytes of JSON, so that it can cross the bridge: the output first, then the stack frames, + * then the messages, then the lists of failures; the counts and statuses are never changed. A result that was cut says + * so in `truncated`. + */ +export function fitResult(result, limit = resultLimit) { + if (byteLength(result) <= limit) return result; + const fitted = structuredClone(result); + fitted.truncated = true; + const problems = report => [...report.failures, ...report.suites ?? []].flatMap(({messages}) => messages).concat(report.global ?? []); + const steps = [ + ...[4096, 1024, 256].map(length => () => { fitted.output = clipText(fitted.output, length); }), + () => { for (const problem of problems(fitted.report)) problem.stack = ''; }, + ...[2048, 512, 128].map(length => () => { for (const problem of problems(fitted.report)) problem.message = clipText(problem.message, length); }), + ...[10, 3, 0].map(count => () => { + for (const key of ['failures', 'suites', 'pendingSpecs']) if (fitted.report[key]) fitted.report[key].length = Math.min(fitted.report[key].length, count); + fitted.report.global.length = Math.min(fitted.report.global.length, count); + }), + () => { fitted.output = ''; }, + ]; + for (const step of fitted.report ? steps : steps.slice(0, 3).concat(steps.at(-1))) { + step(); + if (byteLength(fitted) <= limit) break; + } + return fitted; +} diff --git a/js/developer/tools/testing-check.mjs b/js/developer/tools/testing-check.mjs index 58f8b814..79144257 100644 --- a/js/developer/tools/testing-check.mjs +++ b/js/developer/tools/testing-check.mjs @@ -19,7 +19,7 @@ async function load(entry) { return await import(pathToFileURL(path)); } finally { await rm(temporary, {recursive: true, force: true}); } } -const {parseTestOptions, specFiles, jasmineCore, buildReport, formatReport, reportResult, runnerFiles} = await load('js/developer/environment/testing.mjs'); +const {parseTestOptions, specFiles, jasmineCore, buildReport, formatReport, reportResult, runnerFiles, fitResult} = await load('js/developer/environment/testing.mjs'); const {bundleTests} = await load('js/developer/environment/bundler.mjs'); const encode = text => new TextEncoder().encode(text); const decode = bytes => new TextDecoder().decode(bytes); @@ -69,6 +69,35 @@ test('a report counts exactly, names the failures and fails for anything but a p assert.deepEqual([broken.status, broken.exitCode, broken.error], ['error', 1, 'Error: boom']); }); +test('failures of a suite (an afterAll) are collected, counted and shown', () => { + const report = buildReport({type: 'done', version: '7.0.2', overall: 'passed', durationMs: 1, global: [], specs: [spec('cleanup passes', 'passed')], + suites: [{name: 'cleanup', failures: [failure('afterAll boom')]}]}); + assert.deepEqual([report.status, report.exitCode, report.failed, report.suites.map(suite => suite.name)], ['failed', 1, 0, ['cleanup']]); + assert.match(formatReport(report), /FAIL cleanup \(suite\)\n afterAll boom/); + assert.deepEqual(buildReport({type: 'done', overall: 'passed', global: [], specs: [spec('a', 'passed')]}).suites, []); +}); + +test('a result is cut to fit a bridge string, keeping the counts and the status', () => { + const encoded = value => new TextEncoder().encode(JSON.stringify(value)).length; + const huge = 'é'.repeat(10000); + const report = buildReport({type: 'done', version: '7.0.2', overall: 'failed', durationMs: 1, global: [failure(huge)], specs: + Array.from({length: 4}, (_, index) => spec(`big ${index}`, 'failed', {failures: [failure(huge, `Error: ${huge}\n at f (http://127.0.0.1/specs.js:1:1)`)]}))}); + const result = {exitCode: 1, output: formatReport(report), report}; + assert.ok(encoded(result) > 65535, 'the result of four 10,000-character failures does not fit a bridge string'); + const fitted = fitResult(result); + assert.ok(encoded(fitted) <= 60000, `fitted to ${encoded(fitted)} bytes`); + assert.deepEqual([fitted.truncated, fitted.exitCode, fitted.report.status, fitted.report.failed, fitted.report.total], [true, 1, 'failed', 4, 4]); + assert.deepEqual(fitted.report.failures.map(failure => failure.name), ['big 0', 'big 1', 'big 2', 'big 3']); + // What fits is left alone, and the original is never changed. + const small = {exitCode: 0, output: 'ok', report: null}; + assert.equal(fitResult(small), small); + assert.ok(encoded(result) > 65535 && result.report.failures[0].messages[0].message.length === 10000); + // A tiny limit still ends with a result that has its counts. + const tiny = fitResult(result, 2000); + assert.ok(encoded(tiny) <= 2000 && tiny.report.failed === 4 && tiny.exitCode === 1); + assert.ok(encoded(fitResult({exitCode: 1, output: 'x'.repeat(100000), report: null})) <= 60000); +}); + test('a report is bounded: what the specs post is cut, not trusted', () => { const many = Array.from({length: 300}, (_, index) => spec(`s${index}`, 'failed', {failures: Array.from({length: 20}, () => failure('m'.repeat(50000)))})); const report = buildReport({type: 'done', overall: 'failed', specs: many, global: [], durationMs: Infinity, version: 'v'.repeat(100)}); @@ -102,8 +131,15 @@ test('a result is the text on success and an error with the exit code and the re }); test('the runner page loads the locked jasmine before the specs and the specs as a module', () => { - const files = runnerFiles(encode('specs'), encode('jasmine')); + const files = runnerFiles(new Map([['specs.js', encode('specs')]]), encode('jasmine')); assert.deepEqual([...files.keys()].sort(), ['index.html', 'jasmine.js', 'runner.js', 'specs.js']); + assert.ok(!decode(files.get('index.html')).includes('stylesheet')); + // What the specs built is published whole, and the stylesheet is loaded before the specs run. + const styled = runnerFiles(new Map([['specs.js', encode('s')], ['specs.css', encode('c')], ['assets/logo-1.png', encode('p')]]), encode('jasmine')); + assert.deepEqual([...styled.keys()].sort(), ['assets/logo-1.png', 'index.html', 'jasmine.js', 'runner.js', 'specs.css', 'specs.js']); + assert.match(decode(styled.get('index.html')), //); + // jasmine.js of versions before 7 only exposes jasmineRequire: the runner boots it as boot0.js does. + assert.match(decode(files.get('runner.js')), /globalThis\.jasmine\) return;[\s\S]*jasmineRequire\.core\(jasmineRequire\)[\s\S]*jasmineRequire\.interface/); const page = decode(files.get('index.html')); assert.ok(page.indexOf('./jasmine.js') > page.indexOf('/WebFront.js') && page.indexOf('./jasmine.js') < page.indexOf('./runner.js')); assert.match(decode(files.get('runner.js')), /specFilter: spec => spec\.getFullName\(\)\.includes\(pattern\)/); @@ -119,8 +155,11 @@ test('specs bundle in the manifest order with their imports, TypeScript and lock if (!bytes) throw new Error(`Cannot read project file: ${path}`); return encode(bytes); }; + files.set('b.css', '.probe { width: 37px }'); + files.set('b.spec.js', `import './b.css';\n${files.get('b.spec.js')}`); const output = await bundleTests(esbuild, {specs: ['a.spec.ts', 'b.spec.js'], lock, readProject}); - assert.deepEqual([...output.keys()], ['specs.js']); + assert.deepEqual([...output.keys()].sort(), ['specs.css', 'specs.js']); + assert.match(decode(output.get('specs.css')), /width: 37px/); const code = decode(output.get('specs.js')); const evaluated = new Function('globalThis', code.replace(/^export .*$/gm, '')); const sandbox = {}; diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index f0c536ac..633ab241 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -452,6 +452,15 @@ try { assert(filtered.report?.status === 'passed' && filtered.report.total === 3 && filtered.report.excluded === 4 && /4 filtered out/.test(filtered.text), `A pattern must filter the specs: ${filtered.error}\n${JSON.stringify(filtered.report)}`); const unmatched = await tested(['no such spec']); assert(unmatched.error?.exitCode === 1 && unmatched.report?.status === 'incomplete' && /No spec matches "no such spec"/.test(unmatched.error.message), `A pattern matching nothing must fail: ${unmatched.error}`); + // An afterAll that throws is reported with its suite; a stylesheet a spec imports is applied to its page. + await writeFile('tests/styled.css', '.probe { display: block; width: 37px; }\n'); + await writeFile('tests/suite.spec.js', "import './styled.css';\ndescribe('cleanup', () => {\n it('passes', () => {});\n afterAll(() => { throw new Error('afterAll boom'); });\n});\n" + + "describe('styled', () => {\n it('applies the imported stylesheet', () => {\n const probe = document.createElement('div');\n probe.className = 'probe';\n document.body.append(probe);\n expect(getComputedStyle(probe).width).toBe('37px');\n probe.remove();\n });\n});\n"); + await specsOf(['tests/suite.spec.js']); + const suiteFailure = await tested(); + assert(suiteFailure.error?.exitCode === 1 && suiteFailure.report?.status === 'failed' && suiteFailure.report.total === 2 && suiteFailure.report.passed === 2 && suiteFailure.report.failed === 0 && + suiteFailure.report.suites.length === 1 && suiteFailure.report.suites[0].name === 'cleanup' && /afterAll boom/.test(suiteFailure.report.suites[0].messages[0].message) && + /FAIL cleanup \(suite\)/.test(suiteFailure.error.message), `An afterAll failure must be reported with its suite, and the stylesheet applied: ${suiteFailure.error}\n${JSON.stringify(suiteFailure.report)}`); // A spec that does not load fails the run: it is a build error for one that does not compile, a report for one that throws. await writeFile('tests/missing.spec.js', "import './absent';\n"); await specsOf(['tests/pass.spec.js', 'tests/missing.spec.js']); @@ -477,6 +486,18 @@ try { stopTests.abort(new Error('Interrupted')); const interruptedRun = await interrupted; assert(interruptedRun.error?.exitCode === 130 && interruptedRun.report?.status === 'interrupted' && !document.querySelector('iframe[title="WebFront tests"]'), `Ctrl+C must stop a run: ${interruptedRun.error}`); + // --timeout covers the preparation too: slow project reads cannot hold a run past its limit. + const slowBridge = {socket: webFront.socket, cppFunction: name => name === 'webfront.developer.read' ? + async (...parameters) => { await delay(700); return webFront.cppFunction(name)(...parameters); } : webFront.cppFunction(name)}; + await specsOf(['tests/pass.spec.js']); + const slowStarted = performance.now(); + const slowRun = await tested(['--timeout', '1'], {bridge: slowBridge}); + assert(slowRun.error?.exitCode === 124 && slowRun.report?.status === 'timeout' && performance.now() - slowStarted < 20000 && !document.querySelector('iframe[title="WebFront tests"]'), + `The time limit must cover the preparation of a run: ${slowRun.error}`); + // Each run publishes its own directory, emptied at the end: runs of two sessions never share files. + const runDirectories = JSON.parse(new TextDecoder().decode(await call('list', '.webfront/developer/test'))); + assert(runDirectories.length > 1 && runDirectories.every(name => /^[0-9a-f-]{36}\/?$/.test(name)), `Each run must have its own directory: ${runDirectories}`); + for (const name of runDirectories) assert(JSON.parse(new TextDecoder().decode(await call('list', `.webfront/developer/test/${name.replace(/\/$/, '')}`))).length === 0, `The files of a finished run must be removed: ${name}`); assert(/--timeout expects whole seconds/.test((await tested(['--timeout', '0'])).error?.message) && /Usage: wf test/.test((await tested(['a', 'b'])).error?.message), 'wf test must check its options'); // Without a terminal: the result reaches C++ through the bridge and the session ends with the command's status. await specsOf(['tests/pass.spec.js', 'tests/fail.spec.ts']); @@ -489,6 +510,14 @@ try { await runtime.runNonInteractive(['test'], {...runContext(), reporter: json => webFront.cppFunction('test.result')(json), onExit: code => exits.push(code)}); const success = JSON.parse(await webFront.cppFunction('test.lastResult')()); assert(exits[1] === 0 && success.exitCode === 0 && success.report.status === 'passed', `A non-interactive success must end the session with 0: ${JSON.stringify(success)}`); + // A report too large for a bridge string is cut, not lost: C++ still receives the counts and the exit status. + await writeFile('tests/big.spec.js', "describe('big', () => {\n for (let index = 0; index < 4; ++index) it('fails with a long message ' + index, () => { throw new Error('x'.repeat(10000)); });\n});\n"); + await specsOf(['tests/big.spec.js']); + await runtime.runNonInteractive(['test'], {...runContext(), reporter: json => webFront.cppFunction('test.result')(json), onExit: code => exits.push(code)}); + const cut = JSON.parse(await webFront.cppFunction('test.lastResult')()); + assert(exits[2] === 1 && cut.exitCode === 1 && cut.truncated === true && cut.report?.failed === 4 && cut.report.total === 4 && cut.report.failures.length === 4, + `An oversized result must be cut to cross the bridge: ${JSON.stringify(cut).slice(0, 300)}`); + exits.splice(2, 1); await runtime.runNonInteractive(['test', '--timeout', 'x'], {...runContext(), reporter: () => { throw new Error('bridge down'); }, onExit: code => exits.push(code)}); assert(exits[2] === 1, 'A command that fails and a result that cannot be sent must both end non-zero'); await runtime.runNonInteractive(['list'], {...runContext(), reporter: () => { throw new Error('bridge down'); }, onExit: code => exits.push(code)}); From 04779d9b259a22e13ea9cc2bad3c07052db94504 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 14:02:21 +0200 Subject: [PATCH 055/134] Bound every wf test step by its deadline and Ctrl+C, inherit the script deadline and cut the whole report [#310] --- docs/DEVELOPER_ENVIRONMENT.md | 2 +- js/developer/environment/bundles.json | 4 +-- js/developer/environment/runtime.mjs | 35 +++++++++++++++------------ js/developer/environment/testing.mjs | 23 ++++++++++++++++-- js/developer/tools/testing-check.mjs | 27 ++++++++++++++++++++- test/web/developer-specs.mjs | 17 +++++++++++++ 6 files changed, 87 insertions(+), 21 deletions(-) diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 8a2009ce..80b0e671 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -468,7 +468,7 @@ and integrity. Nothing else is needed: no Node.js, no npm and no public network - Exit codes: 0 when every executed spec passed; 1 for a failed spec, a failure outside the specs, an unhandled asynchronous exception or rejection (Jasmine reports both as failures), a spec file that does not build or load, `fit`/`fdescribe`, and a run that executed nothing (no specs, or a pattern matching none); 124 at the time limit - (`--timeout`, default 60 s, 1 to 3600, covering the build and the publication as well as the run); 130 on Ctrl+C. Jasmine's own per-spec timeout (5 s by default) still ends a + (`--timeout`, default 60 s, 1 to 3600, covering the build and the publication as well as the run, and never later than the `--timeout` of a `wf run` script that runs `wf test`); 130 on Ctrl+C, at any step. Jasmine's own per-spec timeout (5 s by default) still ends a spec that never completes, which fails. - A synchronous infinite loop in a spec blocks the page that hosts the frame, as it would in any same-origin frame: the time limit cannot fire. Use asynchronous waits, which the time limit and Ctrl+C do stop. diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index e4770a53..326258d5 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -16,9 +16,9 @@ "js/developer/environment/packages.mjs": "6636219f3fef20ea1d274dc9298d8af451ef257b86fe6c1ed0de9a7c797b11d8", "js/developer/environment/starter.mjs": "f38e290e03aebe146623c2ca9b590d645fb91a51acdf7a98101bb00b5b88096c", "js/developer/environment/paths.mjs": "3b6114df78eb193161c5c84499dda084cb7ff91c56a4496371c30295d00880e3", - "js/developer/environment/runtime.mjs": "cd9e942bc0db8fe0d61a1ac219320221c0e7b9eb06dc1b738731fc6746bfab99", + "js/developer/environment/runtime.mjs": "a469f6af149e92c2d25d6055ff69a4af5304d9ccd287d915a29f861fb363d25b", "js/developer/environment/development.mjs": "dd07bc64e12c3392223f0e7aab0ae2f5223e093930bee8abe78a0cd3e2940d85", - "js/developer/environment/testing.mjs": "a450c27236ed23d9a1cb4b34fec3f22f3a16412c673a5cb6ce83db12fdd345c2", + "js/developer/environment/testing.mjs": "326e003f114bdbad68fedbceaded30717b3fc15315e6d87fa747972b681e2dce", "js/developer/environment/terminal.mjs": "7ffcf7ac6ef63c35cdf5ef70284b384525b13ba18422af069289e53b6c4f6be1", "js/developer/environment/tarball.mjs": "1c1e1aea067910e1fec74e85b4bf9fbefed9b38187a04d8d2764f0b9a96fca39", "js/developer/environment/commands.mjs": "8de20c01f02f33c0566f204fcf1ee2382a23344d2103581fe2914469ec570531", diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index 5031e8f4..921148ac 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -13,7 +13,7 @@ import {restore, describeRegistry} from './restore.mjs'; import {loadProject, syncNotice, resolveEntry, embedTarget, lockPath, packageRoot, noManifest} from './project.mjs'; import {parseRunOptions, scriptCommand, execTarget, scriptHost, runWorker, runResult, runDeadline, secondsLeft} from './scripts.mjs'; import {build, dev} from './development.mjs'; -import {parseTestOptions, specFiles, jasmineCore, runnerFiles, runInFrame, reportResult, fitResult, stoppedRun, testDirectory} from './testing.mjs'; +import {parseTestOptions, specFiles, jasmineCore, runnerFiles, runInFrame, reportResult, fitResult, stoppedRun, abortable, testDirectory} from './testing.mjs'; import {generateProvider, applicationPage} from './embed.mjs'; import {typescriptPackage, parseCheckOptions, checkHost} from './typecheck.mjs'; @@ -199,41 +199,46 @@ async function check(args, {bridge, signal, write = () => {}, createWorker = che } // wf test [--timeout ] [pattern]: the specs of "test.specs" under the Jasmine of the lock, in a frame of this page. -// context.onReport receives the structured report, also when the run fails. -async function test(args, {bridge, signal, write = () => {}, createFrame, onReport}) { +// context.onReport receives the structured report, also when the run fails. --timeout, never later than the deadline +// of the wf script that runs this command, covers the whole command: no step waits for the bridge past it, and Ctrl+C +// ends every step as well. +async function test(args, {bridge, signal, write = () => {}, createFrame, onReport, deadline: inherited}) { const {timeout, pattern} = parseTestOptions(args); - // --timeout covers the whole command: the build, the publication and the run share one deadline. - const deadline = Date.now() + timeout * 1000; + const deadline = runDeadline(timeout, inherited); const limit = new AbortController(); - const timer = setTimeout(() => limit.abort(), timeout * 1000); + const timer = setTimeout(() => limit.abort(), secondsLeft(deadline) * 1000); const preparing = signal ? AbortSignal.any([signal, limit.signal]) : limit.signal; + const step = promise => abortable(promise, preparing); const runId = crypto.randomUUID(); const directory = `${testDirectory}/${runId}`; let jasmineVersion = ''; let reported = false; const finished = report => { reported = true; report.jasmine = jasmineVersion; onReport?.(report); return report; }; try { - const project = await loadManifest(bridge); + const project = await step(loadManifest(bridge)); const specs = specFiles(project.manifest); const lock = project.lock ?? {format: 1, roots: {}, packages: {}}; const jasmine = jasmineCore(lock); jasmineVersion = jasmine.node.version; - const files = await buildInWorker(bridge, {type: 'tests', specs, lock}, preparing); - const jasmineBytes = await readProject(bridge, `${packageRoot}/${jasmine.node.key}/${jasmine.path}`); - await publish(bridge, directory, runnerFiles(files, jasmineBytes), {signal: preparing}); + const files = await step(buildInWorker(bridge, {type: 'tests', specs, lock}, preparing)); + const jasmineBytes = await step(readProject(bridge, `${packageRoot}/${jasmine.node.key}/${jasmine.path}`)); + await step(publish(bridge, directory, runnerFiles(files, jasmineBytes), {signal: preparing})); write(syncNotice(project)); - const report = finished(await runInFrame({pattern, timeout: Math.max(0.001, (deadline - Date.now()) / 1000), runId, signal, write, createFrame})); + const report = finished(await runInFrame({pattern, timeout: Math.max(0.001, secondsLeft(deadline)), runId, signal, write, createFrame})); write('\n'); return reportResult(report); } catch (error) { - // The limit's own abort ends the preparation like the limit ends the run: with exit code 124 and its report. - if (limit.signal.aborted && !signal?.aborted && !error.report) error = stoppedRun('timeout', pattern); + // An abort of the preparation ends the command like it ends a run: Ctrl+C with 130, the limit with 124, and a report. + if (!error.report) { + if (signal?.aborted) error = stoppedRun('interrupted', pattern); + else if (limit.signal.aborted) error = stoppedRun('timeout', pattern); + } if (error.report && !reported) finished(error.report); throw error; } finally { clearTimeout(timer); - // The files of the run are not needed any more; an empty directory replaces them (best effort). - await publish(bridge, directory, new Map()).catch(() => {}); + // The files of the run are not needed any more: an empty directory replaces them, for at most two seconds. + await Promise.race([publish(bridge, directory, new Map()).catch(() => {}), new Promise(resolve => setTimeout(resolve, 2000))]); } } diff --git a/js/developer/environment/testing.mjs b/js/developer/environment/testing.mjs index 25f5c0e0..08cd1982 100644 --- a/js/developer/environment/testing.mjs +++ b/js/developer/environment/testing.mjs @@ -148,6 +148,16 @@ export function formatReport(report) { } const progress = {passed: '.', failed: 'F', pending: '*'}; +/** The promise, or a rejection with the signal's reason as soon as the signal aborts, whatever the promise is waiting for. */ +export function abortable(promise, signal) { + return new Promise((resolve, reject) => { + const abort = () => reject(signal.reason); + if (signal.aborted) abort(); + signal.addEventListener('abort', abort, {once: true}); + promise.then(resolve, reject).finally(() => signal.removeEventListener('abort', abort)); + }); +} + export const stoppedRun = (reason, pattern) => { const [message, exitCode] = reason === 'timeout' ? ['Tests stopped at their time limit', 124] : ['Tests stopped by Ctrl+C', 130]; return Object.assign(new ScriptExit(message, exitCode), {report: emptyReport(reason, exitCode, {pattern, error: message})}); @@ -219,14 +229,23 @@ export function fitResult(result, limit = resultLimit) { const steps = [ ...[4096, 1024, 256].map(length => () => { fitted.output = clipText(fitted.output, length); }), () => { for (const problem of problems(fitted.report)) problem.stack = ''; }, - ...[2048, 512, 128].map(length => () => { for (const problem of problems(fitted.report)) problem.message = clipText(problem.message, length); }), + ...[2048, 512, 128].map(length => () => { + for (const problem of problems(fitted.report)) problem.message = clipText(problem.message, length); + for (const key of ['error', 'incomplete', 'pattern']) if (typeof fitted.report[key] === 'string') fitted.report[key] = clipText(fitted.report[key], length); + }), ...[10, 3, 0].map(count => () => { for (const key of ['failures', 'suites', 'pendingSpecs']) if (fitted.report[key]) fitted.report[key].length = Math.min(fitted.report[key].length, count); fitted.report.global.length = Math.min(fitted.report.global.length, count); }), () => { fitted.output = ''; }, + // Whatever is left: the status and the counts, which are numbers and short words. + () => { + const {status, exitCode, jasmine, total, passed, failed, pending, excluded, durationMs} = fitted.report; + fitted.report = {status, exitCode, jasmine: clipText(String(jasmine ?? ''), 32), total, passed, failed, pending, excluded, durationMs, + failures: [], pendingSpecs: [], suites: [], global: [], pattern: '', incomplete: '', error: ''}; + }, ]; - for (const step of fitted.report ? steps : steps.slice(0, 3).concat(steps.at(-1))) { + for (const step of fitted.report ? steps : steps.slice(0, 3).concat(steps.at(-2))) { step(); if (byteLength(fitted) <= limit) break; } diff --git a/js/developer/tools/testing-check.mjs b/js/developer/tools/testing-check.mjs index 79144257..68a9d317 100644 --- a/js/developer/tools/testing-check.mjs +++ b/js/developer/tools/testing-check.mjs @@ -19,7 +19,7 @@ async function load(entry) { return await import(pathToFileURL(path)); } finally { await rm(temporary, {recursive: true, force: true}); } } -const {parseTestOptions, specFiles, jasmineCore, buildReport, formatReport, reportResult, runnerFiles, fitResult} = await load('js/developer/environment/testing.mjs'); +const {parseTestOptions, specFiles, jasmineCore, buildReport, formatReport, reportResult, runnerFiles, fitResult, abortable} = await load('js/developer/environment/testing.mjs'); const {bundleTests} = await load('js/developer/environment/bundler.mjs'); const encode = text => new TextEncoder().encode(text); const decode = bytes => new TextDecoder().decode(bytes); @@ -96,6 +96,31 @@ test('a result is cut to fit a bridge string, keeping the counts and the status' const tiny = fitResult(result, 2000); assert.ok(encoded(tiny) <= 2000 && tiny.report.failed === 4 && tiny.exitCode === 1); assert.ok(encoded(fitResult({exitCode: 1, output: 'x'.repeat(100000), report: null})) <= 60000); + // Every string of the report counts: a load error of NUL characters is six bytes each once encoded as JSON. + const unloaded = buildReport({type: 'error', message: '\u0000'.repeat(16384)}, {pattern: '\u0000'.repeat(5000)}); + const unloadedResult = {exitCode: 1, output: formatReport(unloaded), report: unloaded}; + assert.ok(encoded(unloadedResult) > 65535); + const unloadedFitted = fitResult(unloadedResult); + assert.ok(encoded(unloadedFitted) <= 60000 && unloadedFitted.report.status === 'error' && unloadedFitted.exitCode === 1, `fitted to ${encoded(unloadedFitted)} bytes`); + // Whatever the report holds, the limit is kept and the status and the counts survive. + const crowded = buildReport({type: 'done', version: 'v', overall: 'failed', durationMs: 1, specs: Array.from({length: 100}, (_, index) => spec('n'.repeat(1000) + index, index % 2 ? 'failed' : 'pending', + {reason: 'r'.repeat(1000), failures: [failure('\u0000'.repeat(16000), '\u0001'.repeat(16000))]})), global: [failure('\u0000'.repeat(16000))], + suites: [{name: 's'.repeat(1000), failures: [failure('\u0000'.repeat(16000))]}], incomplete: 'i'.repeat(1000)}, {pattern: 'p'.repeat(10000)}); + for (const limit of [60000, 20000, 5000]) { + const result = fitResult({exitCode: 1, output: 'o'.repeat(50000), report: crowded}, limit); + assert.ok(encoded(result) <= limit && result.report.failed === 50 && result.report.pending === 50 && result.report.status === 'failed', `limit ${limit}: ${encoded(result)} bytes`); + } +}); + +test('abortable stops waiting at once, whatever the promise waits for', async () => { + const controller = new AbortController(); + const never = new Promise(() => {}); + const waiting = abortable(never, controller.signal); + controller.abort(new Error('stopped')); + await assert.rejects(waiting, /stopped/); + await assert.rejects(abortable(never, controller.signal), /stopped/); + assert.equal(await abortable(Promise.resolve(3), new AbortController().signal), 3); + await assert.rejects(abortable(Promise.reject(new Error('own')), new AbortController().signal), /own/); }); test('a report is bounded: what the specs post is cut, not trusted', () => { diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index 633ab241..8b23abf8 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -494,6 +494,23 @@ try { const slowRun = await tested(['--timeout', '1'], {bridge: slowBridge}); assert(slowRun.error?.exitCode === 124 && slowRun.report?.status === 'timeout' && performance.now() - slowStarted < 20000 && !document.querySelector('iframe[title="WebFront tests"]'), `The time limit must cover the preparation of a run: ${slowRun.error}`); + // A bridge operation that never returns, Ctrl+C during the build, and a script's deadline: each ends the command. + const stuckBridge = {socket: webFront.socket, cppFunction: name => name === 'webfront.developer.read' ? () => new Promise(() => {}) : webFront.cppFunction(name)}; + const stuckStarted = performance.now(); + const stuck = await tested(['--timeout', '1'], {bridge: stuckBridge}); + assert(stuck.error?.exitCode === 124 && stuck.report?.status === 'timeout' && performance.now() - stuckStarted < 8000, `A blocked bridge operation must not hold the command past its limit: ${stuck.error}`); + const interruptPreparing = new AbortController(); + const preparingRun = tested([], {bridge: slowBridge, signal: interruptPreparing.signal}); + await delay(300); + interruptPreparing.abort(new Error('Interrupted')); + const preparingResult = await preparingRun; + assert(preparingResult.error?.exitCode === 130 && preparingResult.report?.status === 'interrupted', `Ctrl+C during the preparation must end with 130 and a report: ${preparingResult.error}`); + const withScript = await readManifest(); + await writeFile('webfront.project.json', JSON.stringify({...withScript, scripts: {...withScript.scripts, specs: 'wf test'}}, null, 2)); + const quickBridge = {socket: webFront.socket, cppFunction: name => name === 'webfront.developer.read' ? + async (...parameters) => { await delay(400); return webFront.cppFunction(name)(...parameters); } : webFront.cppFunction(name)}; + const inherited = await runtime.execute(['run', '--timeout', '1', 'specs'], {...runContext(), bridge: quickBridge, onReport: () => {}}).then(() => null, error => error); + assert(inherited?.exitCode === 124, `wf test must keep the deadline of the script that runs it: ${inherited}`); // Each run publishes its own directory, emptied at the end: runs of two sessions never share files. const runDirectories = JSON.parse(new TextDecoder().decode(await call('list', '.webfront/developer/test'))); assert(runDirectories.length > 1 && runDirectories.every(name => /^[0-9a-f-]{36}\/?$/.test(name)), `Each run must have its own directory: ${runDirectories}`); From 35c0741fd76a18016e36cef5a0faed71aeb38cec Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 14:30:23 +0200 Subject: [PATCH 056/134] Add the webfront-wf driver, configure-time bootstrap provisioning and the environment compatibility contract [#321] --- .github/workflows/BuildAndTest.yml | 12 +- AGENTS.md | 2 +- cmake/WebFrontBootstrap.cmake | 148 +++++++ docs/CHANGELOG.md | 7 + docs/DEVELOPER_ENVIRONMENT.md | 40 +- docs/PROJECT_STATUS.md | 2 +- include/webfront/DeveloperApp.hpp | 9 +- .../system/DeveloperBootstrapData.hpp | 193 ++++----- js/core/bootstrap/bootstrap.bundle.mjs | 2 +- js/developer/environment/bootstrap.mjs | 34 +- js/developer/environment/bundles.json | 6 +- js/developer/tools/build.mjs | 2 +- js/developer/tools/check.mjs | 10 +- test/cmake/CheckBootstrapProvisioning.cmake | 110 ++++++ test/cmake/PrepareWfProject.cmake | 4 + test/cmake/RunWfDriver.cmake | 58 +++ test/driver/WebFrontWf.cpp | 365 ++++++++++++++++++ .../wf-project/tests/arithmetic.spec.js | 4 + test/fixtures/wf-project/tools/sleep.mjs | 2 + .../fixtures/wf-project/webfront.project.json | 8 + test/unit/CMakeLists.txt | 3 + test/unit/DeveloperTests.cpp | 4 +- test/web/CMakeLists.txt | 75 ++++ 23 files changed, 985 insertions(+), 115 deletions(-) create mode 100644 cmake/WebFrontBootstrap.cmake create mode 100644 test/cmake/CheckBootstrapProvisioning.cmake create mode 100644 test/cmake/PrepareWfProject.cmake create mode 100644 test/cmake/RunWfDriver.cmake create mode 100644 test/driver/WebFrontWf.cpp create mode 100644 test/fixtures/wf-project/tests/arithmetic.spec.js create mode 100644 test/fixtures/wf-project/tools/sleep.mjs create mode 100644 test/fixtures/wf-project/webfront.project.json diff --git a/.github/workflows/BuildAndTest.yml b/.github/workflows/BuildAndTest.yml index 133f2d27..d5728b7e 100644 --- a/.github/workflows/BuildAndTest.yml +++ b/.github/workflows/BuildAndTest.yml @@ -280,12 +280,22 @@ jobs: run: cmake . -B ${{github.workspace}}/build-cef -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=ON -DWEBFRONT_BUILD_EXAMPLES=OFF -DENABLE_TESTING=ON -DWEBFRONT_DEVELOPER_FIXTURES=${{github.workspace}}/build-developer-environment - name: Build browser test - run: cmake --build ${{github.workspace}}/build-cef --target webtest developer_integration --parallel 2 + run: cmake --build ${{github.workspace}}/build-cef --target webtest developer_integration webfront-wf --parallel 2 + # Everything is provisioned by the configure step: the tests must not reach the public network. + - name: Cut the public network + run: | + sudo iptables -A OUTPUT ! -o lo -j REJECT + sudo ip6tables -A OUTPUT ! -o lo -j REJECT - name: Run Jasmine bridge test run: >- ctest --test-dir ${{github.workspace}}/build-cef -L web-integration --output-on-failure --no-tests=error --parallel 4 --output-junit "${{ github.workspace }}/build-cef/test-results.xml" + - name: Restore the network + if: always() + run: | + sudo iptables -F OUTPUT + sudo ip6tables -F OUTPUT - name: Retain test timings and diagnostics if: always() uses: actions/upload-artifact@v4 diff --git a/AGENTS.md b/AGENTS.md index 6782434e..910b6d3c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -20,7 +20,7 @@ The README introduces WebFront through the Game of Life walkthrough, demonstrati - `examples/`: only Hello World (`hello-world/`) and Game of Life (`life/`, with console, developer and embedded stages). - `js/core/`: readable browser bridge, fallback and bootstrap loader compiled into `include/webfront/`, plus the embedding CMake modules; `js/developer/`: developer environment (its terminal and `wf`), build and vendoring tools. Production C++ remains header-only in `include/webfront/`. - `js/developer/tools/starters/pi/`, `test/fixtures/`, `test/web/fixtures/`: retained package and regression fixtures, not public example applications. -- `test/unit/`: Catch2 unit tests; `test/web/`: Jasmine real-browser integration test; `test/fuzz/`, `test/fixtures/`; `test/cmake/`: CMake test scripts and sub-projects. The `RepositoryLayout` CTest case pins the tracked root. +- `test/unit/`: Catch2 unit tests; `test/web/`: Jasmine real-browser integration test; `test/driver/`: `webfront-wf`, the non-interactive `wf` driver for tests; `test/fuzz/`, `test/fixtures/`; `test/cmake/`: CMake test scripts and sub-projects. The `RepositoryLayout` CTest case pins the tracked root. - `cmake/`: build modules (frontends, CEF, CPM, compiler options); `.github/`: workflows, `.github/CONTRIBUTING.md`. - `.devcontainer/`: devcontainer and its Dockerfile; `docs/`: documentation, `docs/CHANGELOG.md`, `docs/Doxyfile.in`. - `docs/PROJECT_STATUS.md`: evidence-based status snapshot and known limitations. diff --git a/cmake/WebFrontBootstrap.cmake b/cmake/WebFrontBootstrap.cmake new file mode 100644 index 00000000..513b0a4a --- /dev/null +++ b/cmake/WebFrontBootstrap.cmake @@ -0,0 +1,148 @@ +# Bootstrap environment used to test WebFront: the pinned archive wf runs from, provisioned at configure time. +# +# It is distinct from include/webfront/system/DeveloperReleaseData.hpp (the environment applications start from) and is +# updated by an explicit pull request, once a published environment can build and test itself without interaction. +# 0.5.0 is the last published environment: it has no non-interactive mode yet, so the driver tests run the environment built +# from the current sources (the "environment under test") until the first environment that can bootstrap itself is pinned. +set(WEBFRONT_BOOTSTRAP_VERSION "0.5.0") +set(WEBFRONT_BOOTSTRAP_URL "https://ambroise-leclerc.github.io/WebFront/developer/0.5.0/environment.tgz") +set(WEBFRONT_BOOTSTRAP_INTEGRITY "sha512-TV6S61kUhnCJc99/Ow890Pro47mfZ0fBqki17lx0xnpCNmcfcqZPpO1SG09Su50WIEtRDopMxt3yvanFwbLEdQ==") + +# A directory holding environment.tgz (the pinned archive) replaces the download on a machine without network access. +set(WEBFRONT_BOOTSTRAP_DIR "" CACHE PATH "Directory with the pinned bootstrap environment.tgz, instead of downloading it") + +# Converts a base64 value to lowercase hexadecimal bytes. +function(webfront_base64_to_hex value output) + set(alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/") + string(LENGTH "${value}" length) + math(EXPR remainder "${length} % 4") + if(NOT remainder EQUAL 0) + message(FATAL_ERROR "Invalid base64 value (length ${length})") + endif() + set(hex "") + math(EXPR last "${length} - 1") + foreach(start RANGE 0 ${last} 4) + set(group 0) + set(padding 0) + foreach(offset RANGE 0 3) + math(EXPR position "${start} + ${offset}") + string(SUBSTRING "${value}" ${position} 1 character) + if(character STREQUAL "=") + math(EXPR padding "${padding} + 1") + set(sextet 0) + else() + string(FIND "${alphabet}" "${character}" sextet) + if(sextet EQUAL -1) + message(FATAL_ERROR "Invalid base64 character '${character}'") + endif() + endif() + math(EXPR group "(${group} << 6) | ${sextet}") + endforeach() + math(EXPR bytes "3 - ${padding}") + foreach(index RANGE 0 ${bytes}) + if(index EQUAL bytes) + break() + endif() + math(EXPR shift "16 - 8 * ${index}") + math(EXPR byte "(${group} >> ${shift}) & 255" OUTPUT_FORMAT HEXADECIMAL) + string(SUBSTRING "${byte}" 2 -1 digits) + string(LENGTH "${digits}" digitCount) + if(digitCount EQUAL 1) + set(digits "0${digits}") + endif() + string(APPEND hex "${digits}") + endforeach() + endforeach() + set(${output} "${hex}" PARENT_SCOPE) +endfunction() + +# The hexadecimal SHA-512 of an SRI value ("sha512-"). +function(webfront_sri_to_sha512 integrity output) + if(NOT integrity MATCHES "^sha512-([A-Za-z0-9+/]+=*)$") + message(FATAL_ERROR "Bootstrap integrity must be a sha512- SRI value: '${integrity}'") + endif() + webfront_base64_to_hex("${CMAKE_MATCH_1}" hex) + string(LENGTH "${hex}" length) + if(NOT length EQUAL 128) + message(FATAL_ERROR "Bootstrap integrity is not a SHA-512 digest") + endif() + set(${output} "${hex}" PARENT_SCOPE) +endfunction() + +# Makes the verified path of an environment archive: / when LOCAL_DIR is given, else the +# download of URL into DESTINATION (reused when it already matches). A wrong digest or a missing file stops the configure. +function(webfront_provision_bootstrap archive) + cmake_parse_arguments(ARG "" "URL;INTEGRITY;DESTINATION;LOCAL_DIR" "" ${ARGN}) + webfront_sri_to_sha512("${ARG_INTEGRITY}" expected) + get_filename_component(name "${ARG_URL}" NAME) + if(ARG_LOCAL_DIR) + set(path "${ARG_LOCAL_DIR}/${name}") + if(NOT EXISTS "${path}") + message(FATAL_ERROR "Bootstrap environment ${path} is missing: WEBFRONT_BOOTSTRAP_DIR must hold ${name}") + endif() + else() + set(path "${ARG_DESTINATION}/${name}") + set(present FALSE) + if(EXISTS "${path}") + file(SHA512 "${path}" actual) + if(actual STREQUAL expected) + set(present TRUE) + endif() + endif() + if(NOT present) + file(MAKE_DIRECTORY "${ARG_DESTINATION}") + file(DOWNLOAD "${ARG_URL}" "${path}" STATUS result TLS_VERIFY ON) + list(GET result 0 code) + if(NOT code EQUAL 0) + file(REMOVE "${path}") + list(GET result 1 reason) + message(FATAL_ERROR "Cannot download the bootstrap environment ${ARG_URL}: ${reason}. " + "Provision it with -DWEBFRONT_BOOTSTRAP_DIR=.") + endif() + endif() + endif() + file(SHA512 "${path}" actual) + if(NOT actual STREQUAL expected) + if(NOT ARG_LOCAL_DIR) + file(REMOVE "${path}") + endif() + message(FATAL_ERROR "Bootstrap environment integrity check failed for ${path}: expected ${ARG_INTEGRITY}") + endif() + set(${archive} "${path}" PARENT_SCOPE) +endfunction() + +# The SRI value ("sha512-") of a file, for archives a test builds itself. +function(webfront_file_sri file output) + file(SHA512 "${file}" hex) + set(alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/") + string(LENGTH "${hex}" length) + set(encoded "") + foreach(start RANGE 0 ${length} 6) + if(start GREATER_EQUAL length) + break() + endif() + math(EXPR remaining "(${length} - ${start}) / 2") + string(SUBSTRING "${hex}" ${start} 6 digits) + string(LENGTH "${digits}" digitCount) + string(APPEND digits "000000") + string(SUBSTRING "${digits}" 0 6 digits) + math(EXPR group "0x${digits}") + set(characters 4) + if(remaining EQUAL 1) + set(characters 2) + elseif(remaining EQUAL 2) + set(characters 3) + endif() + foreach(index RANGE 0 3) + math(EXPR shift "18 - 6 * ${index}") + math(EXPR sextet "(${group} >> ${shift}) & 63") + if(index LESS characters) + string(SUBSTRING "${alphabet}" ${sextet} 1 character) + else() + set(character "=") + endif() + string(APPEND encoded "${character}") + endforeach() + endforeach() + set(${output} "sha512-${encoded}" PARENT_SCOPE) +endfunction() diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 7de45e54..9f658b3f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -4,6 +4,13 @@ ### Added +- `webfront-wf` test driver and bootstrap provisioning (#321): runs one `wf` command without interaction on a project + and exits with its status (64 usage, 70 bootstrap failure, 71 time limit, 72 no result), with an optional JSON report. + `cmake/WebFrontBootstrap.cmake` pins the bootstrap environment (0.5.0 for now) and, with `ENABLE_TESTING=ON`, downloads + and verifies it at configure time, or takes it from `WEBFRONT_BOOTSTRAP_DIR`. `environment.json` declares `protocol` and + `api`; `webfront.developer.config` exposes the supported versions and the loader refuses an incompatible archive with an + explicit diagnostic. The Linux CEF job blocks the public network after configure. + - `wf test [--timeout ] [pattern]` (#310, environment sources; release pin unchanged): builds the manifest's `test.specs` with esbuild-wasm and runs them under the project's locked `jasmine-core`, obtained by `wf install` from the registry, in a hidden same-origin frame. Progress and a summary stream to the terminal; the structured report diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 80b0e671..7a5c12f5 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -481,7 +481,7 @@ each per spec). `status` is `passed`, `failed`, `incomplete`, `error` (the specs ### Without a terminal -An application that drives the environment from its own page (the C++ driver of #321 will be one) calls +An application that drives the environment from its own page (`webfront-wf`, below, is one) calls `runNonInteractive(argv, {bridge, config, preview, reporter, onExit})` from `runtime.mjs`: ```js @@ -496,6 +496,44 @@ by default closes the window. A command that fails, or a result that cannot be s the session is never left open. The C++ side reads the result, closes the application's window if it has not been closed and returns the code as its process status. +### The test driver (`webfront-wf`) and the bootstrap environment + +`webfront-wf` (`test/driver/WebFrontWf.cpp`, built with the browser tests) starts a `BasicDeveloperApp` on a project, runs +one `wf` command through `runNonInteractive`, prints its output and exits with its status: + +```sh +webfront-wf --project [--environment --integrity ] [--registry-dir ] \ + [--report ] [--timeout ] [--] [arguments...] +``` + +- Without `--environment`, it uses the **bootstrap environment** provisioned at configure time. `cmake/WebFrontBootstrap.cmake` + pins its URL and SHA-512 (distinct from `DeveloperReleaseData.hpp`, the environment applications start from, and changed + by an explicit pull request). With `ENABLE_TESTING=ON`, configure downloads it to `/bootstrap/` and verifies the + digest; a wrong digest or an unreachable URL stops the configure. On a machine without network access, pass + `-DWEBFRONT_BOOTSTRAP_DIR=`: the archive is verified the same way. +- `--environment` and `--integrity` run an archive built elsewhere, such as the one built from the current sources (the + environment under test of #315). `--registry-dir` serves a local npm registry from the driver's origin and imposes it. + The project is the directory `wf` reads and writes; run `wf install` once, then the other commands, on the same project. +- Exit status: the command's own (`wf test`: 0, 1, 124, 130); **64** usage; **70** bootstrap failure (archive absent, wrong + integrity, incompatible protocol or API, no non-interactive mode); **71** the driver's `--timeout` (default 600 s) elapsed, + after asking the page to close; **72** the browser closed without a result. `--report` writes the JSON result + `{exitCode, output, report}` of the command, cut to fit a bridge string as described above. + +**Compatibility contract.** `environment.json` declares `protocol` (the environment's wire protocol) and `api` (the +`webfront.developer.*` callbacks it expects; absent means 1, the value of every environment published before the +field). `webfront.developer.config` carries `supported: {protocol: [1], api: [1]}`, from `developer::protocolVersion` and +`developer::apiVersion`. The loader refuses an archive outside those lists before publishing anything, with +`Incompatible WebFront developer environment: api version 2, this application supports 1`; it never falls back. A change +to the callbacks increments `apiVersion` and requires publishing a new bootstrap environment. + +The pin is 0.5.0, the last published environment, which has no non-interactive mode: the driver reports it as a bootstrap +failure (70). Until an environment that can run `wf test` is published and pinned (the milestone of #321, a maintainer +step), the CTest cases `WfDriver*` run the environment built from the current sources (`WEBFRONT_DEVELOPER_FIXTURES`): +`wf install` and `wf test` on a fixture project (pass, fail, report file), an unknown command, the time limit, a wrong +integrity, a missing archive and archives with an incompatible protocol or API. `BootstrapProvisioning` checks the +configure-time provisioning (verified download, reuse, local directory, wrong digest, malformed value). The Linux CEF CI job +blocks the public network after the configure step. + ## Dependencies, storage and limitations - `wf install` accepts exact versions, registry tags and semver ranges, resolves ordinary diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index f9079dcf..6ddad553 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -132,7 +132,7 @@ Status snapshot: 2026-07-19. Optional mddlog integration note: 2026-10-02. Newco manifest permissions, which frame the `context` API only and are not a sandbox. Peers require explicit compatible roots/direct dependencies. The environment's terminal (#308) runs `wf`, built-in and C++ commands (`webfront::Commands`: per-browser coroutine sessions, streamed output, Ctrl+C cancellation without waiting, drained at shutdown) with - multi-row editing, CJK/emoji widths, persistent history and completion. `wf build` / `wf dev` (#309, environment sources) publish manifest entries and rebuild the preview automatically with a reused esbuild context, bounded input polling, error overlays and Ctrl+C cancellation; `wf test` (#310, environment sources) runs the manifest's specs under the project's locked `jasmine-core` in a hidden frame, with a structured report, exit codes 0/1/124/130 and a non-interactive entry that reports to C++; the release pin is unchanged. `wf restore [--offline]` (0.5.0, #306) rebuilds or checks + multi-row editing, CJK/emoji widths, persistent history and completion. `wf build` / `wf dev` (#309, environment sources) publish manifest entries and rebuild the preview automatically with a reused esbuild context, bounded input polling, error overlays and Ctrl+C cancellation; `wf test` (#310, environment sources) runs the manifest's specs under the project's locked `jasmine-core` in a hidden frame, with a structured report, exit codes 0/1/124/130 and a non-interactive entry that reports to C++; the release pin is unchanged. `webfront-wf` (#321) runs one `wf` command without interaction and returns its status; the bootstrap environment is pinned and verified at configure time (0.5.0 for now: the first environment able to run `wf test` still has to be published and pinned), and `environment.json` declares the `protocol` and `api` versions that the loader checks. `wf restore [--offline]` (0.5.0, #306) rebuilds or checks the cache from the lock, from the application's registry option, else the manifest's, else npmjs. See [DEVELOPER_ENVIRONMENT](DEVELOPER_ENVIRONMENT.md) for exact commands and limits. diff --git a/include/webfront/DeveloperApp.hpp b/include/webfront/DeveloperApp.hpp index a212c2e3..aa92e66f 100644 --- a/include/webfront/DeveloperApp.hpp +++ b/include/webfront/DeveloperApp.hpp @@ -45,6 +45,12 @@ inline void validateBootstrap(std::string_view mode, const std::filesystem::path throw std::invalid_argument("The developer registry must be an HTTPS URL or a same-origin path"); } +/// The environment contract this C++ implements. An environment's environment.json declares the "protocol" it +/// speaks and the "api" (the webfront.developer.* callbacks) it expects; the loader refuses any other version. +/// Changing a callback increments apiVersion and requires publishing a new bootstrap environment. +inline constexpr int protocolVersion = 1; +inline constexpr int apiVersion = 1; + inline constexpr std::string_view defaultRegistry{"https://registry.npmjs.org/"}; /// The configuration the environment reads. "registry" always names a usable registry, for environments @@ -52,7 +58,8 @@ inline constexpr std::string_view defaultRegistry{"https://registry.npmjs.org/"} inline std::string bootstrapConfig(const DeveloperBootstrapOptions& options) { return "{\"environment\":" + json::quote(options.environment) + ",\"integrity\":" + json::quote(options.integrity) + ",\"registry\":" + json::quote(options.registry.value_or(std::string(defaultRegistry))) - + ",\"registryExplicit\":" + (options.registry ? "true" : "false") + "}"; + + ",\"registryExplicit\":" + (options.registry ? "true" : "false") + + ",\"supported\":{\"protocol\":[" + std::to_string(protocolVersion) + "],\"api\":[" + std::to_string(apiVersion) + "]}}"; } } // namespace developer diff --git a/include/webfront/system/DeveloperBootstrapData.hpp b/include/webfront/system/DeveloperBootstrapData.hpp index 0f656918..2bbdc69e 100644 --- a/include/webfront/system/DeveloperBootstrapData.hpp +++ b/include/webfront/system/DeveloperBootstrapData.hpp @@ -9,9 +9,9 @@ namespace webfront::fs::generated { struct DeveloperBootstrapData { static constexpr std::string_view encoding{}; - static constexpr std::size_t dataSize{6195}; - static constexpr std::array data{ - 0x766172206c3d6e65, 0x7720546578744465, 0x636f6465723b6173, 0x796e632066756e63, 0x74696f6e20682865, + static constexpr std::size_t dataSize{6534}; + static constexpr std::array data{ + 0x766172206c3d6e65, 0x7720546578744465, 0x636f6465723b6173, 0x796e632066756e63, 0x74696f6e20772865, 0x2c74297b6c657420, 0x723d537472696e67, 0x28743f3f2222292e, 0x73706c6974282f5c, 0x732b2f292e66696c, 0x74657228613d3e61, 0x2e73746172747357, 0x6974682822736861, 0x3531322d2229292e, 0x6d617028613d3e61, 0x2e73706c69742822, 0x3f22295b305d293b, 0x696628722e6c656e, 0x6774683d3d3d3029, 0x7468726f77206e65, @@ -24,7 +24,7 @@ struct DeveloperBootstrapData { 0x792e66726f6d286e, 0x2c613d3e53747269, 0x6e672e66726f6d43, 0x686172436f646528, 0x6129292e6a6f696e, 0x28222229293b6966, 0x2821722e696e636c, 0x75646573286f2929, 0x7468726f77206e65, 0x77204572726f7228, 0x60496e7465677269, 0x747920636865636b, 0x206661696c65643a, 0x2065787065637465, 0x6420247b725b305d, - 0x7d2c20676f742024, 0x7b6f7d60293b7265, 0x7475726e206f7d61, 0x73796e632066756e, 0x6374696f6e207028, + 0x7d2c20676f742024, 0x7b6f7d60293b7265, 0x7475726e206f7d61, 0x73796e632066756e, 0x6374696f6e206828, 0x652c743d32363834, 0x3335343536297b6c, 0x657420723d6e6577, 0x20426c6f62285b65, 0x5d292e7374726561, 0x6d28292e70697065, 0x5468726f75676828, 0x6e6577204465636f, 0x6d7072657373696f, 0x6e53747265616d28, 0x22677a6970222929, 0x2e67657452656164, 0x657228292c6e3d5b, 0x5d2c6f3d303b666f, 0x72286c657420613d, @@ -41,131 +41,140 @@ struct DeveloperBootstrapData { 0x293b6c6574206e3d, 0x7528652c742c7229, 0x2e7472696d28293b, 0x696628212f5e5b30, 0x2d375d2a242f2e74, 0x657374286e292974, 0x68726f77206e6577, 0x204572726f722822, 0x436f727275707420, 0x7461722068656164, 0x657222293b726574, 0x75726e206e3d3d3d, 0x22223f303a706172, 0x7365496e74286e2c, 0x38297d66756e6374, - 0x696f6e207a286529, 0x7b6c657420743d30, 0x3b666f72286c6574, 0x20723d303b723c35, 0x31323b2b2b722974, + 0x696f6e2042286529, 0x7b6c657420743d30, 0x3b666f72286c6574, 0x20723d303b723c35, 0x31323b2b2b722974, 0x2b3d723e3d313438, 0x2626723c3135363f, 0x33323a655b725d3b, 0x6966287928652c31, 0x34382c3829213d3d, 0x74297468726f7720, 0x6e6577204572726f, 0x722822436f727275, 0x7074207461722068, 0x6561646572206368, - 0x65636b73756d2229, 0x7d66756e6374696f, 0x6e20422865297b6c, 0x657420743d7b7d2c, 0x723d303b666f7228, + 0x65636b73756d2229, 0x7d66756e6374696f, 0x6e20542865297b6c, 0x657420743d7b7d2c, 0x723d303b666f7228, 0x3b723c652e6c656e, 0x6774683b297b6c65, 0x74206e3d652e696e, 0x6465784f66283332, 0x2c72292c6f3d6e3c, 0x303f4e614e3a4e75, 0x6d626572286c2e64, 0x65636f646528652e, 0x7375626172726179, 0x28722c6e2929293b, 0x69662821286f3e30, 0x297c7c722b6f3e65, 0x2e6c656e67746829, 0x7468726f77206e65, 0x77204572726f7228, 0x22436f7272757074, 0x2070617820686561, 0x64657222293b6c65, 0x7420613d6c2e6465, 0x636f646528652e73, 0x7562617272617928, 0x6e2b312c722b6f2d, 0x3129292c693d612e, 0x696e6465784f6628, 0x223d22293b745b61, 0x2e736c6963652830, 0x2c69295d3d612e73, 0x6c69636528692b31, 0x292c722b3d6f7d72, 0x657475726e20747d, - 0x66756e6374696f6e, 0x205428652c74297b, 0x6c657420723d652e, 0x7375626172726179, 0x28742c742b353132, - 0x293b7a2872293b6c, 0x6574206e3d792872, 0x2c3132342c313229, 0x2c6f3d742b353132, 0x3b6966286f2b6e3e, + 0x66756e6374696f6e, 0x204328652c74297b, 0x6c657420723d652e, 0x7375626172726179, 0x28742c742b353132, + 0x293b422872293b6c, 0x6574206e3d792872, 0x2c3132342c313229, 0x2c6f3d742b353132, 0x3b6966286f2b6e3e, 0x652e6c656e677468, 0x297468726f77206e, 0x6577204572726f72, 0x28225472756e6361, 0x7465642074617220, 0x6172636869766522, 0x293b72657475726e, 0x7b6865616465723a, 0x722c747970653a72, 0x5b3135365d3d3d3d, 0x303f2230223a5374, 0x72696e672e66726f, 0x6d43686172436f64, 0x6528725b3135365d, 0x292c646174613a65, 0x2e73756261727261, 0x79286f2c6f2b6e29, 0x2c6e6578743a6f2b, 0x4d6174682e636569, 0x6c286e2f35313229, - 0x2a3531327d7d6675, 0x6e6374696f6e2043, 0x28652c74297b7265, 0x7475726e20742b35, 0x31323e652e6c656e, + 0x2a3531327d7d6675, 0x6e6374696f6e2049, 0x28652c74297b7265, 0x7475726e20742b35, 0x31323e652e6c656e, 0x6774687c7c652e73, 0x7562617272617928, 0x742c742b35313229, 0x2e65766572792872, 0x3d3e723d3d3d3029, - 0x7d66756e6374696f, 0x6e20492865297b6c, 0x657420743d752865, 0x2c302c313030292c, 0x723d7528652c3235, + 0x7d66756e6374696f, 0x6e20552865297b6c, 0x657420743d752865, 0x2c302c313030292c, 0x723d7528652c3235, 0x372c35293d3d3d22, 0x7573746172223f75, 0x28652c3334352c31, 0x3535293a22223b72, 0x657475726e20723f, - 0x60247b727d2f247b, 0x747d603a747d7661, 0x7220773d7b783a28, 0x652c74293d3e287b, 0x2e2e2e652c706178, - 0x3a422874292e7061, 0x74687d292c4c3a28, 0x652c74293d3e287b, 0x2e2e2e652c6c6f6e, 0x673a7528742c302c, + 0x60247b727d2f247b, 0x747d603a747d7661, 0x7220703d7b783a28, 0x652c74293d3e287b, 0x2e2e2e652c706178, + 0x3a542874292e7061, 0x74687d292c4c3a28, 0x652c74293d3e287b, 0x2e2e2e652c6c6f6e, 0x673a7528742c302c, 0x742e6c656e677468, 0x297d292c673a653d, 0x3e657d3b66756e63, 0x74696f6e206d2865, 0x297b6c657420743d, - 0x5b5d2c723d7b7d3b, 0x666f72286c657420, 0x6e3d303b21432865, 0x2c6e293b297b6c65, 0x747b686561646572, - 0x3a6f2c747970653a, 0x612c646174613a69, 0x2c6e6578743a737d, 0x3d5428652c6e293b, 0x6966286e3d732c4f, - 0x626a6563742e6861, 0x734f776e28772c61, 0x29297b723d775b61, 0x5d28722c69293b63, 0x6f6e74696e75657d, + 0x5b5d2c723d7b7d3b, 0x666f72286c657420, 0x6e3d303b21492865, 0x2c6e293b297b6c65, 0x747b686561646572, + 0x3a6f2c747970653a, 0x612c646174613a69, 0x2c6e6578743a637d, 0x3d4328652c6e293b, 0x6966286e3d632c4f, + 0x626a6563742e6861, 0x734f776e28702c61, 0x29297b723d705b61, 0x5d28722c69293b63, 0x6f6e74696e75657d, 0x28613d3d3d223022, 0x7c7c613d3d3d2237, 0x22292626742e7075, 0x7368287b70617468, 0x3a722e7061783f3f, - 0x722e6c6f6e673f3f, 0x49286f292c627974, 0x65733a697d292c72, 0x3d7b7d7d72657475, 0x726e20747d766172, - 0x20633d28652c742c, 0x2e2e2e72293d3e65, 0x2e63707046756e63, 0x74696f6e28607765, 0x6266726f6e742e64, - 0x6576656c6f706572, 0x2e247b747d602928, 0x2e2e2e72293b6173, 0x796e632066756e63, 0x74696f6e20672865, - 0x2c74297b6c657420, 0x723d5b5d2c6e3d30, 0x3b666f72283b3b29, 0x7b6c6574206f3d61, 0x7761697420632865, + 0x722e6c6f6e673f3f, 0x55286f292c627974, 0x65733a697d292c72, 0x3d7b7d7d72657475, 0x726e20747d766172, + 0x20733d28652c742c, 0x2e2e2e72293d3e65, 0x2e63707046756e63, 0x74696f6e28607765, 0x6266726f6e742e64, + 0x6576656c6f706572, 0x2e247b747d602928, 0x2e2e2e72293b6173, 0x796e632066756e63, 0x74696f6e20622865, + 0x2c74297b6c657420, 0x723d5b5d2c6e3d30, 0x3b666f72283b3b29, 0x7b6c6574206f3d61, 0x7761697420732865, 0x2c2272656164222c, 0x742c6e293b696628, 0x722e70757368286f, 0x292c6e2b3d6f2e6c, 0x656e6774682c6f2e, 0x6c656e6774683c32, 0x3632313434296272, 0x65616b3b6966286e, 0x3e3235362a313032, 0x342a313032342974, 0x68726f77206e6577, 0x204572726f722822, 0x50726f6a65637420, 0x66696c6520697320, 0x746f6f206c617267, 0x6522297d72657475, 0x726e206e65772055, 0x696e743841727261, 0x7928617761697420, 0x6e657720426c6f62, - 0x2872292e61727261, 0x7942756666657228, 0x29297d6173796e63, 0x2066756e6374696f, 0x6e205528652c7b69, + 0x2872292e61727261, 0x7942756666657228, 0x29297d6173796e63, 0x2066756e6374696f, 0x6e202428652c7b69, 0x643a742c70617468, 0x3a722c6279746573, 0x3a6e7d2c6f297b66, 0x6f72286c65742061, 0x3d303b613c6e2e6c, 0x656e6774687c7c61, 0x3d3d3d303b612b3d, 0x323632313434296f, 0x3f2e7468726f7749, 0x6641626f72746564, - 0x28292c6177616974, 0x206328652c227772, 0x697465222c742c72, 0x2c612c6e2e737562, 0x617272617928612c, - 0x612b323632313434, 0x29297d6173796e63, 0x2066756e6374696f, 0x6e206628652c742c, 0x722c7b6469726563, + 0x28292c6177616974, 0x207328652c227772, 0x697465222c742c72, 0x2c612c6e2e737562, 0x617272617928612c, + 0x612b323632313434, 0x29297d6173796e63, 0x2066756e6374696f, 0x6e206428652c742c, 0x722c7b6469726563, 0x746f72793a6e3d21, 0x302c7369676e616c, 0x3a6f2c7265706c61, 0x63653a613d21307d, 0x3d7b7d297b6c6574, - 0x20693d6177616974, 0x206328652c613f22, 0x626567696e223a22, 0x626567696e4e6577, 0x222c742c6e293b74, - 0x72797b666f72286c, 0x65745b732c535d6f, 0x6620722961776169, 0x74205528652c7b69, 0x643a692c70617468, - 0x3a732c6279746573, 0x3a537d2c6f293b6f, 0x3f2e7468726f7749, 0x6641626f72746564, 0x28292c6177616974, - 0x206328652c22636f, 0x6d6d6974222c6929, 0x7d63617463682873, 0x297b7468726f7720, 0x6177616974206328, - 0x652c2261626f7274, 0x222c69292e636174, 0x63682828293d3e7b, 0x7d292c737d7d6173, 0x796e632066756e63, - 0x74696f6e20502865, 0x2c74297b6c657420, 0x723d5b5d2c6e3d30, 0x3b666f72283b3b29, 0x7b6c65747b646f6e, + 0x20693d6177616974, 0x207328652c613f22, 0x626567696e223a22, 0x626567696e4e6577, 0x222c742c6e293b74, + 0x72797b666f72286c, 0x65745b632c7a5d6f, 0x6620722961776169, 0x74202428652c7b69, 0x643a692c70617468, + 0x3a632c6279746573, 0x3a7a7d2c6f293b6f, 0x3f2e7468726f7749, 0x6641626f72746564, 0x28292c6177616974, + 0x207328652c22636f, 0x6d6d6974222c6929, 0x7d63617463682863, 0x297b7468726f7720, 0x6177616974207328, + 0x652c2261626f7274, 0x222c69292e636174, 0x63682828293d3e7b, 0x7d292c637d7d6173, 0x796e632066756e63, + 0x74696f6e206a2865, 0x2c74297b6c657420, 0x723d5b5d2c6e3d30, 0x3b666f72283b3b29, 0x7b6c65747b646f6e, 0x653a6f2c76616c75, 0x653a617d3d617761, 0x697420652e726561, 0x6428293b6966286f, 0x2972657475726e20, 0x723b6966286e2b3d, 0x612e6c656e677468, 0x2c6e3e7429746872, 0x6f77206e65772045, 0x72726f722822436f, 0x6d70726573736564, 0x20646f776e6c6f61, 0x6420657863656564, 0x7320697473206279, 0x7465206c696d6974, - 0x22293b722e707573, 0x682861297d7d6173, 0x796e632066756e63, 0x74696f6e20242865, 0x2c74297b7472797b, - 0x72657475726e2061, 0x7761697420502865, 0x2c74297d63617463, 0x682872297b746872, 0x6f77206177616974, + 0x22293b722e707573, 0x682861297d7d6173, 0x796e632066756e63, 0x74696f6e20502865, 0x2c74297b7472797b, + 0x72657475726e2061, 0x77616974206a2865, 0x2c74297d63617463, 0x682872297b746872, 0x6f77206177616974, 0x20652e63616e6365, 0x6c28292e63617463, 0x682828293d3e7b7d, 0x292c727d66696e61, 0x6c6c797b652e7265, - 0x6c656173654c6f63, 0x6b28297d7d617379, 0x6e632066756e6374, 0x696f6e206228652c, 0x743d36342a313032, + 0x6c656173654c6f63, 0x6b28297d7d617379, 0x6e632066756e6374, 0x696f6e207628652c, 0x743d36342a313032, 0x342a31303234297b, 0x69662821652e6f6b, 0x297468726f77206e, 0x6577204572726f72, 0x2860446f776e6c6f, 0x61643a2048545450, 0x20247b652e737461, 0x7475737d60293b69, 0x66284e756d626572, 0x28652e6865616465, 0x72732e6765742822, 0x636f6e74656e742d, 0x6c656e6774682229, 0x293e74297468726f, 0x77206e6577204572, 0x726f722822436f6d, 0x7072657373656420, 0x646f776e6c6f6164, 0x2065786365656473, 0x2069747320627974, 0x65206c696d697422, 0x293b72657475726e, 0x206e65772055696e, 0x7438417272617928, 0x6177616974206e65, - 0x7720426c6f622861, 0x7761697420242865, 0x2e626f64792e6765, 0x7452656164657228, 0x292c7429292e6172, - 0x7261794275666665, 0x722829297d766172, 0x206a3d2f5b5c5c5c, 0x303a2a3f223c3e7c, 0x5d2f2c413d653d3e, + 0x7720426c6f622861, 0x7761697420502865, 0x2e626f64792e6765, 0x7452656164657228, 0x292c7429292e6172, + 0x7261794275666665, 0x722829297d766172, 0x204f3d2f5b5c5c5c, 0x303a2a3f223c3e7c, 0x5d2f2c413d653d3e, 0x652e73706c697428, 0x222f22292e736f6d, 0x6528743d3e21747c, 0x7c743d3d3d222e22, 0x7c7c743d3d3d222e, - 0x2e22293b66756e63, 0x74696f6e20762865, 0x297b72657475726e, 0x20747970656f6620, 0x65213d2273747269, - 0x6e67227c7c21657c, 0x7c6a2e7465737428, 0x65293f21303a4128, 0x65297d7661722064, 0x3d653d3e21762865, - 0x292c4f3d6e657720, 0x546578744465636f, 0x6465723b66756e63, 0x74696f6e20462865, 0x2c74297b69662821, + 0x2e22293b66756e63, 0x74696f6e20672865, 0x297b72657475726e, 0x20747970656f6620, 0x65213d2273747269, + 0x6e67227c7c21657c, 0x7c4f2e7465737428, 0x65293f21303a4128, 0x65297d7661722066, 0x3d653d3e21672865, + 0x292c463d6e657720, 0x546578744465636f, 0x6465723b66756e63, 0x74696f6e204c2865, 0x2c74297b69662821, 0x742e706174682e73, 0x7461727473576974, 0x6828227061636b61, 0x67652f2229297468, 0x726f77206e657720, 0x4572726f72282249, 0x6e76616c69642065, 0x6e7669726f6e6d65, 0x6e74206172636869, 0x766520726f6f7422, - 0x293b6c657420723d, 0x742e706174682e73, 0x6c6963652838293b, 0x6966282164287229, 0x7c7c652e68617328, + 0x293b6c657420723d, 0x742e706174682e73, 0x6c6963652838293b, 0x6966282166287229, 0x7c7c652e68617328, 0x7229297468726f77, 0x206e657720457272, 0x6f722822496e7661, 0x6c6964206f722064, 0x75706c6963617465, 0x20656e7669726f6e, 0x6d656e7420706174, 0x6822293b652e7365, 0x7428722c742e6279, 0x746573297d66756e, - 0x6374696f6e204c28, 0x65297b6c65742074, 0x3d6e6577204d6170, 0x3b666f72286c6574, 0x2072206f66206d28, - 0x6529294628742c72, 0x293b72657475726e, 0x20747d66756e6374, 0x696f6e204e28652c, 0x74297b7265747572, - 0x6e20652e70726f74, 0x6f636f6c213d3d31, 0x7c7c216428652e65, 0x6e747279293f2131, 0x3a742e6861732865, - 0x2e656e747279297d, 0x6173796e63206675, 0x6e6374696f6e2078, 0x28652c74297b6177, 0x616974206828652c, - 0x74293b6c65742072, 0x3d4c286177616974, 0x2070286529293b69, 0x662821722e686173, 0x2822656e7669726f, - 0x6e6d656e742e6a73, 0x6f6e222929746872, 0x6f77206e65772045, 0x72726f722822456e, 0x7669726f6e6d656e, - 0x7420617263686976, 0x6520686173206e6f, 0x20656e7669726f6e, 0x6d656e742e6a736f, 0x6e22293b6c657420, - 0x6e3d4a534f4e2e70, 0x61727365284f2e64, 0x65636f646528722e, 0x6765742822656e76, 0x69726f6e6d656e74, - 0x2e6a736f6e222929, 0x293b696628214e28, 0x6e2c722929746872, 0x6f77206e65772045, 0x72726f722822556e, - 0x737570706f727465, 0x642057656246726f, 0x6e7420646576656c, 0x6f70657220656e76, 0x69726f6e6d656e74, - 0x22293b7265747572, 0x6e7b66696c65733a, 0x722c6d616e696665, 0x73743a6e7d7d7661, 0x7220453d222e7765, - 0x6266726f6e742f64, 0x6576656c6f706572, 0x2f656e7669726f6e, 0x6d656e742e74677a, 0x223b6173796e6320, - 0x66756e6374696f6e, 0x205228652c74297b, 0x7472797b6c657420, 0x723d617761697420, 0x6728652c45293b72, - 0x657475726e206177, 0x616974207828722c, 0x74292c727d636174, 0x63687b7265747572, 0x6e206e756c6c7d7d, - 0x6173796e63206675, 0x6e6374696f6e2044, 0x28652c74297b6c65, 0x7420723d6e657720, 0x55524c28652e656e, - 0x7669726f6e6d656e, 0x742c6c6f63617469, 0x6f6e2e6872656629, 0x3b696628722e7072, 0x6f746f636f6c213d, - 0x3d2268747470733a, 0x222626722e6f7269, 0x67696e213d3d6c6f, 0x636174696f6e2e6f, 0x726967696e297468, - 0x726f77206e657720, 0x4572726f72282254, 0x686520656e766972, 0x6f6e6d656e74206d, 0x7573742075736520, - 0x4854545053206f72, 0x2074686520617070, 0x6c69636174696f6e, 0x206f726967696e22, 0x293b6c6574206e3d, - 0x6177616974207428, 0x72293b696628216e, 0x2e6f6b297468726f, 0x77206e6577204572, 0x726f722860456e76, - 0x69726f6e6d656e74, 0x20646f776e6c6f61, 0x643a204854545020, 0x247b6e2e73746174, 0x75737d60293b7265, - 0x7475726e2062286e, 0x297d66756e637469, 0x6f6e20482865297b, 0x72657475726e2165, 0x7c7c216428652e61, - 0x726368697665293f, 0x21313a537472696e, 0x6728652e696e7465, 0x6772697479292e73, 0x7461727473576974, - 0x6828227368613531, 0x322d22297d66756e, 0x6374696f6e205728, 0x652c74297b726574, 0x75726e204f626a65, - 0x63742e66726f6d45, 0x6e7472696573284f, 0x626a6563742e656e, 0x747269657328652e, 0x7374617274657273, - 0x3f3f7b7d292e6d61, 0x7028285b722c6e5d, 0x293d3e7b69662821, 0x48286e2929746872, 0x6f77206e65772045, - 0x72726f722822496e, 0x76616c6964207069, 0x6e6e656420737461, 0x72746572206d6574, 0x616461746122293b, - 0x72657475726e5b72, 0x2c7b75726c3a6e65, 0x772055524c286e2e, 0x617263686976652c, 0x74292e687265662c, - 0x696e746567726974, 0x793a6e2e696e7465, 0x67726974797d5d7d, 0x29297d6173796e63, 0x2066756e6374696f, - 0x6e206b28652c742c, 0x723d66657463682c, 0x6e3d28293d3e7b7d, 0x297b6c6574206f3d, 0x6177616974205228, - 0x652c742e696e7465, 0x6772697479293b6f, 0x3f6e28225573696e, 0x6720766572696669, 0x6564206361636865, - 0x6420646576656c6f, 0x70657220656e7669, 0x726f6e6d656e7422, 0x293a286e2822446f, 0x776e6c6f6164696e, - 0x6720646576656c6f, 0x70657220656e7669, 0x726f6e6d656e7422, 0x292c6f3d61776169, 0x74204428742c7229, - 0x293b6c65747b6669, 0x6c65733a612c6d61, 0x6e69666573743a69, 0x7d3d617761697420, 0x78286f2c742e696e, - 0x7465677269747929, 0x2c733d5728692c6e, 0x65772055524c2874, 0x2e656e7669726f6e, 0x6d656e742c6c6f63, - 0x6174696f6e2e6872, 0x656629293b726574, 0x75726e2061776169, 0x74206628652c222e, 0x77656266726f6e74, - 0x2f646576656c6f70, 0x65722f656e766972, 0x6f6e6d656e74222c, 0x61292c6177616974, 0x206628652c452c6e, - 0x6577204d6170285b, 0x5b226f7574707574, 0x222c6f5d5d292c7b, 0x6469726563746f72, 0x793a21317d292c7b, - 0x75726c3a602f7765, 0x6266726f6e742f64, 0x6576656c6f706572, 0x2f656e7669726f6e, 0x6d656e742f247b69, - 0x2e656e7472797d60, 0x2c636f6e6669673a, 0x7b2e2e2e742c7374, 0x6172746572733a73, 0x7d7d7d6966287479, - 0x70656f6620646f63, 0x756d656e743c2275, 0x222626646f63756d, 0x656e742e67657445, 0x6c656d656e744279, - 0x4964282272657472, 0x792229297b6c6574, 0x20653d646f63756d, 0x656e742e67657445, 0x6c656d656e744279, - 0x4964282273746174, 0x757322292c743d64, 0x6f63756d656e742e, 0x676574456c656d65, 0x6e74427949642822, - 0x726574727922292c, 0x723d6173796e6328, 0x293d3e7b742e6869, 0x6464656e3d21303b, 0x7472797b61776169, - 0x742077656246726f, 0x6e742e7265616479, 0x3b6c6574206e3d4a, 0x534f4e2e70617273, 0x6528617761697420, - 0x632877656246726f, 0x6e742c22636f6e66, 0x69672229292c7b75, 0x726c3a6f2c636f6e, 0x6669673a617d3d61, - 0x77616974206b2877, 0x656246726f6e742c, 0x6e2c66657463682c, 0x733d3e7b652e7465, 0x7874436f6e74656e, - 0x743d737d293b6177, 0x6169742861776169, 0x7420696d706f7274, 0x286f29292e6d6f75, 0x6e74287b62726964, - 0x67653a7765624672, 0x6f6e742c636f6e66, 0x69673a612c746572, 0x6d696e616c3a646f, 0x63756d656e742e67, - 0x6574456c656d656e, 0x7442794964282274, 0x65726d696e616c22, 0x292c707265766965, 0x773a646f63756d65, - 0x6e742e676574456c, 0x656d656e74427949, 0x6428227072657669, 0x657722297d292c65, 0x2e74657874436f6e, - 0x74656e743d224465, 0x76656c6f70657220, 0x656e7669726f6e6d, 0x656e742072656164, 0x792e205479706520, - 0x77662068656c702e, 0x227d636174636828, 0x6e297b652e746578, 0x74436f6e74656e74, 0x3d60426f6f747374, - 0x726170206661696c, 0x65643a20247b6e2e, 0x6d6573736167657d, 0x602c742e68696464, 0x656e3d21317d7d3b, - 0x742e616464457665, 0x6e744c697374656e, 0x65722822636c6963, 0x6b222c72292c7228, 0x297d0a0000000000 + 0x6374696f6e204e28, 0x65297b6c65742074, 0x3d6e6577204d6170, 0x3b666f72286c6574, 0x2072206f66206d28, + 0x6529294c28742c72, 0x293b72657475726e, 0x20747d7661722078, 0x3d7b70726f746f63, 0x6f6c3a5b315d2c61, + 0x70693a5b315d7d3b, 0x66756e6374696f6e, 0x205228652c74297b, 0x6c657420723d7b70, 0x726f746f636f6c3a, + 0x652e70726f746f63, 0x6f6c2c6170693a65, 0x2e6170693f3f317d, 0x3b666f72286c6574, 0x5b6e2c6f5d6f6620, + 0x4f626a6563742e65, 0x6e74726965732872, 0x29297b6c65742061, 0x3d743f2e5b6e5d3f, 0x3f785b6e5d3b6966, + 0x2821612e696e636c, 0x75646573286f2929, 0x7468726f77206e65, 0x77204572726f7228, 0x60496e636f6d7061, + 0x7469626c65205765, 0x6246726f6e742064, 0x6576656c6f706572, 0x20656e7669726f6e, 0x6d656e743a20247b, + 0x6e7d207665727369, 0x6f6e20247b6f7d2c, 0x2074686973206170, 0x706c69636174696f, 0x6e20737570706f72, + 0x747320247b612e6a, 0x6f696e28222c2022, 0x297d60297d7d6675, 0x6e6374696f6e2044, 0x28652c74297b6966, + 0x28747970656f6620, 0x652e656e74727921, 0x3d22737472696e67, 0x227c7c216628652e, 0x656e747279297c7c, + 0x21742e6861732865, 0x2e656e7472792929, 0x7468726f77206e65, 0x77204572726f7228, 0x22556e737570706f, + 0x7274656420576562, 0x46726f6e74206465, 0x76656c6f70657220, 0x656e7669726f6e6d, 0x656e743a20696e76, + 0x616c696420656e74, 0x727922297d617379, 0x6e632066756e6374, 0x696f6e204528652c, 0x742c723d78297b61, + 0x7761697420772865, 0x2c74293b6c657420, 0x6e3d4e2861776169, 0x742068286529293b, 0x696628216e2e6861, + 0x732822656e766972, 0x6f6e6d656e742e6a, 0x736f6e2229297468, 0x726f77206e657720, 0x4572726f72282245, + 0x6e7669726f6e6d65, 0x6e74206172636869, 0x766520686173206e, 0x6f20656e7669726f, 0x6e6d656e742e6a73, + 0x6f6e22293b6c6574, 0x206f3d4a534f4e2e, 0x706172736528462e, 0x6465636f6465286e, 0x2e6765742822656e, + 0x7669726f6e6d656e, 0x742e6a736f6e2229, 0x29293b7265747572, 0x6e2052286f2c7229, 0x2c44286f2c6e292c, + 0x7b66696c65733a6e, 0x2c6d616e69666573, 0x743a6f7d7d766172, 0x206b3d222e776562, 0x66726f6e742f6465, + 0x76656c6f7065722f, 0x656e7669726f6e6d, 0x656e742e74677a22, 0x3b6173796e632066, 0x756e6374696f6e20, + 0x5728652c742c7229, 0x7b7472797b6c6574, 0x206e3d6177616974, 0x206228652c6b293b, 0x72657475726e2061, + 0x776169742045286e, 0x2c742c72292c6e7d, 0x63617463687b7265, 0x7475726e206e756c, 0x6c7d7d6173796e63, + 0x2066756e6374696f, 0x6e204828652c7429, 0x7b6c657420723d6e, 0x65772055524c2865, 0x2e656e7669726f6e, + 0x6d656e742c6c6f63, 0x6174696f6e2e6872, 0x6566293b69662872, 0x2e70726f746f636f, 0x6c213d3d22687474, + 0x70733a222626722e, 0x6f726967696e213d, 0x3d6c6f636174696f, 0x6e2e6f726967696e, 0x297468726f77206e, + 0x6577204572726f72, 0x282254686520656e, 0x7669726f6e6d656e, 0x74206d7573742075, 0x7365204854545053, + 0x206f722074686520, 0x6170706c69636174, 0x696f6e206f726967, 0x696e22293b6c6574, 0x206e3d6177616974, + 0x20742872293b6966, 0x28216e2e6f6b2974, 0x68726f77206e6577, 0x204572726f722860, 0x456e7669726f6e6d, + 0x656e7420646f776e, 0x6c6f61643a204854, 0x545020247b6e2e73, 0x74617475737d6029, 0x3b72657475726e20, + 0x76286e297d66756e, 0x6374696f6e204d28, 0x65297b7265747572, 0x6e21657c7c216628, 0x652e617263686976, + 0x65293f21313a5374, 0x72696e6728652e69, 0x6e74656772697479, 0x292e737461727473, 0x5769746828227368, + 0x613531322d22297d, 0x66756e6374696f6e, 0x204a28652c74297b, 0x72657475726e204f, 0x626a6563742e6672, + 0x6f6d456e74726965, 0x73284f626a656374, 0x2e656e7472696573, 0x28652e7374617274, 0x6572733f3f7b7d29, + 0x2e6d617028285b72, 0x2c6e5d293d3e7b69, 0x6628214d286e2929, 0x7468726f77206e65, 0x77204572726f7228, + 0x22496e76616c6964, 0x2070696e6e656420, 0x7374617274657220, 0x6d65746164617461, 0x22293b7265747572, + 0x6e5b722c7b75726c, 0x3a6e65772055524c, 0x286e2e6172636869, 0x76652c74292e6872, 0x65662c696e746567, + 0x726974793a6e2e69, 0x6e74656772697479, 0x7d5d7d29297d6173, 0x796e632066756e63, 0x74696f6e20532865, + 0x2c742c723d666574, 0x63682c6e3d28293d, 0x3e7b7d297b6c6574, 0x206f3d6177616974, 0x205728652c742e69, + 0x6e74656772697479, 0x2c742e737570706f, 0x72746564293b6f3f, 0x6e28225573696e67, 0x2076657269666965, + 0x6420636163686564, 0x20646576656c6f70, 0x657220656e766972, 0x6f6e6d656e742229, 0x3a286e2822446f77, + 0x6e6c6f6164696e67, 0x20646576656c6f70, 0x657220656e766972, 0x6f6e6d656e742229, 0x2c6f3d6177616974, + 0x204828742c722929, 0x3b6c65747b66696c, 0x65733a612c6d616e, 0x69666573743a697d, 0x3d61776169742045, + 0x286f2c742e696e74, 0x6567726974792c74, 0x2e737570706f7274, 0x6564292c633d4a28, 0x692c6e6577205552, + 0x4c28742e656e7669, 0x726f6e6d656e742c, 0x6c6f636174696f6e, 0x2e6872656629293b, 0x72657475726e2061, + 0x7761697420642865, 0x2c222e7765626672, 0x6f6e742f64657665, 0x6c6f7065722f656e, 0x7669726f6e6d656e, + 0x74222c61292c6177, 0x616974206428652c, 0x6b2c6e6577204d61, 0x70285b5b226f7574, 0x707574222c6f5d5d, + 0x292c7b6469726563, 0x746f72793a21317d, 0x292c7b75726c3a60, 0x2f77656266726f6e, 0x742f646576656c6f, + 0x7065722f656e7669, 0x726f6e6d656e742f, 0x247b692e656e7472, 0x797d602c636f6e66, 0x69673a7b2e2e2e74, + 0x2c73746172746572, 0x733a637d7d7d6966, 0x28747970656f6620, 0x646f63756d656e74, 0x3c2275222626646f, + 0x63756d656e742e67, 0x6574456c656d656e, 0x7442794964282272, 0x657472792229297b, 0x6c657420653d646f, + 0x63756d656e742e67, 0x6574456c656d656e, 0x7442794964282273, 0x746174757322292c, 0x743d646f63756d65, + 0x6e742e676574456c, 0x656d656e74427949, 0x6428227265747279, 0x22292c723d617379, 0x6e6328293d3e7b74, + 0x2e68696464656e3d, 0x21303b7472797b61, 0x7761697420776562, 0x46726f6e742e7265, 0x6164793b6c657420, + 0x6e3d4a534f4e2e70, 0x6172736528617761, 0x6974207328776562, 0x46726f6e742c2263, 0x6f6e666967222929, + 0x2c7b75726c3a6f2c, 0x636f6e6669673a61, 0x7d3d617761697420, 0x532877656246726f, 0x6e742c6e2c666574, + 0x63682c633d3e7b65, 0x2e74657874436f6e, 0x74656e743d637d29, 0x3b61776169742861, 0x7761697420696d70, + 0x6f7274286f29292e, 0x6d6f756e74287b62, 0x72696467653a7765, 0x6246726f6e742c63, 0x6f6e6669673a612c, + 0x7465726d696e616c, 0x3a646f63756d656e, 0x742e676574456c65, 0x6d656e7442794964, 0x28227465726d696e, + 0x616c22292c707265, 0x766965773a646f63, 0x756d656e742e6765, 0x74456c656d656e74, 0x4279496428227072, + 0x657669657722297d, 0x292c652e74657874, 0x436f6e74656e743d, 0x22446576656c6f70, 0x657220656e766972, + 0x6f6e6d656e742072, 0x656164792e205479, 0x7065207766206865, 0x6c702e227d636174, 0x6368286e297b652e, + 0x74657874436f6e74, 0x656e743d60426f6f, 0x7473747261702066, 0x61696c65643a2024, 0x7b6e2e6d65737361, + 0x67657d602c742e68, 0x696464656e3d2131, 0x7d7d3b742e616464, 0x4576656e744c6973, 0x74656e6572282263, + 0x6c69636b222c7229, 0x2c7228297d0a0000 }; }; diff --git a/js/core/bootstrap/bootstrap.bundle.mjs b/js/core/bootstrap/bootstrap.bundle.mjs index 6aa88502..5e4f2eb0 100644 --- a/js/core/bootstrap/bootstrap.bundle.mjs +++ b/js/core/bootstrap/bootstrap.bundle.mjs @@ -1 +1 @@ -var l=new TextDecoder;async function h(e,t){let r=String(t??"").split(/\s+/).filter(a=>a.startsWith("sha512-")).map(a=>a.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),o="sha512-"+btoa(Array.from(n,a=>String.fromCharCode(a)).join(""));if(!r.includes(o))throw new Error(`Integrity check failed: expected ${r[0]}, got ${o}`);return o}async function p(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],o=0;for(let a=await r.read();!a.done;a=await r.read()){if(o+=a.value.length,o>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(a.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function u(e,t,r){let n=e.subarray(t,t+r),o=n.indexOf(0);return l.decode(o<0?n:n.subarray(0,o))}function y(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((o,a)=>o*256+a,e[t]&127);let n=u(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function z(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if(y(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function B(e){let t={},r=0;for(;r0)||r+o>e.length)throw new Error("Corrupt pax header");let a=l.decode(e.subarray(n+1,r+o-1)),i=a.indexOf("=");t[a.slice(0,i)]=a.slice(i+1),r+=o}return t}function T(e,t){let r=e.subarray(t,t+512);z(r);let n=y(r,124,12),o=t+512;if(o+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(o,o+n),next:o+Math.ceil(n/512)*512}}function C(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function I(e){let t=u(e,0,100),r=u(e,257,5)==="ustar"?u(e,345,155):"";return r?`${r}/${t}`:t}var w={x:(e,t)=>({...e,pax:B(t).path}),L:(e,t)=>({...e,long:u(t,0,t.length)}),g:e=>e};function m(e){let t=[],r={};for(let n=0;!C(e,n);){let{header:o,type:a,data:i,next:s}=T(e,n);if(n=s,Object.hasOwn(w,a)){r=w[a](r,i);continue}(a==="0"||a==="7")&&t.push({path:r.pax??r.long??I(o),bytes:i}),r={}}return t}var c=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function g(e,t){let r=[],n=0;for(;;){let o=await c(e,"read",t,n);if(r.push(o),n+=o.length,o.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function U(e,{id:t,path:r,bytes:n},o){for(let a=0;a{}),s}}async function P(e,t){let r=[],n=0;for(;;){let{done:o,value:a}=await e.read();if(o)return r;if(n+=a.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(a)}}async function $(e,t){try{return await P(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function b(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await $(e.body.getReader(),t)).arrayBuffer())}var j=/[\\\0:*?"<>|]/,A=e=>e.split("/").some(t=>!t||t==="."||t==="..");function v(e){return typeof e!="string"||!e||j.test(e)?!0:A(e)}var d=e=>!v(e),O=new TextDecoder;function F(e,t){if(!t.path.startsWith("package/"))throw new Error("Invalid environment archive root");let r=t.path.slice(8);if(!d(r)||e.has(r))throw new Error("Invalid or duplicate environment path");e.set(r,t.bytes)}function L(e){let t=new Map;for(let r of m(e))F(t,r);return t}function N(e,t){return e.protocol!==1||!d(e.entry)?!1:t.has(e.entry)}async function x(e,t){await h(e,t);let r=L(await p(e));if(!r.has("environment.json"))throw new Error("Environment archive has no environment.json");let n=JSON.parse(O.decode(r.get("environment.json")));if(!N(n,r))throw new Error("Unsupported WebFront developer environment");return{files:r,manifest:n}}var E=".webfront/developer/environment.tgz";async function R(e,t){try{let r=await g(e,E);return await x(r,t),r}catch{return null}}async function D(e,t){let r=new URL(e.environment,location.href);if(r.protocol!=="https:"&&r.origin!==location.origin)throw new Error("The environment must use HTTPS or the application origin");let n=await t(r);if(!n.ok)throw new Error(`Environment download: HTTP ${n.status}`);return b(n)}function H(e){return!e||!d(e.archive)?!1:String(e.integrity).startsWith("sha512-")}function W(e,t){return Object.fromEntries(Object.entries(e.starters??{}).map(([r,n])=>{if(!H(n))throw new Error("Invalid pinned starter metadata");return[r,{url:new URL(n.archive,t).href,integrity:n.integrity}]}))}async function k(e,t,r=fetch,n=()=>{}){let o=await R(e,t.integrity);o?n("Using verified cached developer environment"):(n("Downloading developer environment"),o=await D(t,r));let{files:a,manifest:i}=await x(o,t.integrity),s=W(i,new URL(t.environment,location.href));return await f(e,".webfront/developer/environment",a),await f(e,E,new Map([["output",o]]),{directory:!1}),{url:`/webfront/developer/environment/${i.entry}`,config:{...t,starters:s}}}if(typeof document<"u"&&document.getElementById("retry")){let e=document.getElementById("status"),t=document.getElementById("retry"),r=async()=>{t.hidden=!0;try{await webFront.ready;let n=JSON.parse(await c(webFront,"config")),{url:o,config:a}=await k(webFront,n,fetch,s=>{e.textContent=s});await(await import(o)).mount({bridge:webFront,config:a,terminal:document.getElementById("terminal"),preview:document.getElementById("preview")}),e.textContent="Developer environment ready. Type wf help."}catch(n){e.textContent=`Bootstrap failed: ${n.message}`,t.hidden=!1}};t.addEventListener("click",r),r()} +var l=new TextDecoder;async function w(e,t){let r=String(t??"").split(/\s+/).filter(a=>a.startsWith("sha512-")).map(a=>a.split("?")[0]);if(r.length===0)throw new Error("The package has no SHA-512 integrity");if(!globalThis.crypto?.subtle)throw new Error("Integrity checks need a secure context (https or localhost)");let n=new Uint8Array(await crypto.subtle.digest("SHA-512",e)),o="sha512-"+btoa(Array.from(n,a=>String.fromCharCode(a)).join(""));if(!r.includes(o))throw new Error(`Integrity check failed: expected ${r[0]}, got ${o}`);return o}async function h(e,t=268435456){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")).getReader(),n=[],o=0;for(let a=await r.read();!a.done;a=await r.read()){if(o+=a.value.length,o>t)throw await r.cancel(),new Error(`The tarball unpacks to more than ${t} bytes`);n.push(a.value)}return new Uint8Array(await new Blob(n).arrayBuffer())}function u(e,t,r){let n=e.subarray(t,t+r),o=n.indexOf(0);return l.decode(o<0?n:n.subarray(0,o))}function y(e,t,r){if(e[t]&128)return e.subarray(t+1,t+r).reduce((o,a)=>o*256+a,e[t]&127);let n=u(e,t,r).trim();if(!/^[0-7]*$/.test(n))throw new Error("Corrupt tar header");return n===""?0:parseInt(n,8)}function B(e){let t=0;for(let r=0;r<512;++r)t+=r>=148&&r<156?32:e[r];if(y(e,148,8)!==t)throw new Error("Corrupt tar header checksum")}function T(e){let t={},r=0;for(;r0)||r+o>e.length)throw new Error("Corrupt pax header");let a=l.decode(e.subarray(n+1,r+o-1)),i=a.indexOf("=");t[a.slice(0,i)]=a.slice(i+1),r+=o}return t}function C(e,t){let r=e.subarray(t,t+512);B(r);let n=y(r,124,12),o=t+512;if(o+n>e.length)throw new Error("Truncated tar archive");return{header:r,type:r[156]===0?"0":String.fromCharCode(r[156]),data:e.subarray(o,o+n),next:o+Math.ceil(n/512)*512}}function I(e,t){return t+512>e.length||e.subarray(t,t+512).every(r=>r===0)}function U(e){let t=u(e,0,100),r=u(e,257,5)==="ustar"?u(e,345,155):"";return r?`${r}/${t}`:t}var p={x:(e,t)=>({...e,pax:T(t).path}),L:(e,t)=>({...e,long:u(t,0,t.length)}),g:e=>e};function m(e){let t=[],r={};for(let n=0;!I(e,n);){let{header:o,type:a,data:i,next:c}=C(e,n);if(n=c,Object.hasOwn(p,a)){r=p[a](r,i);continue}(a==="0"||a==="7")&&t.push({path:r.pax??r.long??U(o),bytes:i}),r={}}return t}var s=(e,t,...r)=>e.cppFunction(`webfront.developer.${t}`)(...r);async function b(e,t){let r=[],n=0;for(;;){let o=await s(e,"read",t,n);if(r.push(o),n+=o.length,o.length<262144)break;if(n>256*1024*1024)throw new Error("Project file is too large")}return new Uint8Array(await new Blob(r).arrayBuffer())}async function $(e,{id:t,path:r,bytes:n},o){for(let a=0;a{}),c}}async function j(e,t){let r=[],n=0;for(;;){let{done:o,value:a}=await e.read();if(o)return r;if(n+=a.length,n>t)throw new Error("Compressed download exceeds its byte limit");r.push(a)}}async function P(e,t){try{return await j(e,t)}catch(r){throw await e.cancel().catch(()=>{}),r}finally{e.releaseLock()}}async function v(e,t=64*1024*1024){if(!e.ok)throw new Error(`Download: HTTP ${e.status}`);if(Number(e.headers.get("content-length"))>t)throw new Error("Compressed download exceeds its byte limit");return new Uint8Array(await new Blob(await P(e.body.getReader(),t)).arrayBuffer())}var O=/[\\\0:*?"<>|]/,A=e=>e.split("/").some(t=>!t||t==="."||t==="..");function g(e){return typeof e!="string"||!e||O.test(e)?!0:A(e)}var f=e=>!g(e),F=new TextDecoder;function L(e,t){if(!t.path.startsWith("package/"))throw new Error("Invalid environment archive root");let r=t.path.slice(8);if(!f(r)||e.has(r))throw new Error("Invalid or duplicate environment path");e.set(r,t.bytes)}function N(e){let t=new Map;for(let r of m(e))L(t,r);return t}var x={protocol:[1],api:[1]};function R(e,t){let r={protocol:e.protocol,api:e.api??1};for(let[n,o]of Object.entries(r)){let a=t?.[n]??x[n];if(!a.includes(o))throw new Error(`Incompatible WebFront developer environment: ${n} version ${o}, this application supports ${a.join(", ")}`)}}function D(e,t){if(typeof e.entry!="string"||!f(e.entry)||!t.has(e.entry))throw new Error("Unsupported WebFront developer environment: invalid entry")}async function E(e,t,r=x){await w(e,t);let n=N(await h(e));if(!n.has("environment.json"))throw new Error("Environment archive has no environment.json");let o=JSON.parse(F.decode(n.get("environment.json")));return R(o,r),D(o,n),{files:n,manifest:o}}var k=".webfront/developer/environment.tgz";async function W(e,t,r){try{let n=await b(e,k);return await E(n,t,r),n}catch{return null}}async function H(e,t){let r=new URL(e.environment,location.href);if(r.protocol!=="https:"&&r.origin!==location.origin)throw new Error("The environment must use HTTPS or the application origin");let n=await t(r);if(!n.ok)throw new Error(`Environment download: HTTP ${n.status}`);return v(n)}function M(e){return!e||!f(e.archive)?!1:String(e.integrity).startsWith("sha512-")}function J(e,t){return Object.fromEntries(Object.entries(e.starters??{}).map(([r,n])=>{if(!M(n))throw new Error("Invalid pinned starter metadata");return[r,{url:new URL(n.archive,t).href,integrity:n.integrity}]}))}async function S(e,t,r=fetch,n=()=>{}){let o=await W(e,t.integrity,t.supported);o?n("Using verified cached developer environment"):(n("Downloading developer environment"),o=await H(t,r));let{files:a,manifest:i}=await E(o,t.integrity,t.supported),c=J(i,new URL(t.environment,location.href));return await d(e,".webfront/developer/environment",a),await d(e,k,new Map([["output",o]]),{directory:!1}),{url:`/webfront/developer/environment/${i.entry}`,config:{...t,starters:c}}}if(typeof document<"u"&&document.getElementById("retry")){let e=document.getElementById("status"),t=document.getElementById("retry"),r=async()=>{t.hidden=!0;try{await webFront.ready;let n=JSON.parse(await s(webFront,"config")),{url:o,config:a}=await S(webFront,n,fetch,c=>{e.textContent=c});await(await import(o)).mount({bridge:webFront,config:a,terminal:document.getElementById("terminal"),preview:document.getElementById("preview")}),e.textContent="Developer environment ready. Type wf help."}catch(n){e.textContent=`Bootstrap failed: ${n.message}`,t.hidden=!1}};t.addEventListener("click",r),r()} diff --git a/js/developer/environment/bootstrap.mjs b/js/developer/environment/bootstrap.mjs index d27284db..3b1f8ee4 100644 --- a/js/developer/environment/bootstrap.mjs +++ b/js/developer/environment/bootstrap.mjs @@ -19,27 +19,41 @@ function archiveFiles(tarball) { return files; } -function supported(manifest, files) { - if (manifest.protocol !== 1) return false; - if (!safePath(manifest.entry)) return false; - return files.has(manifest.entry); +// What the current C++ accepts when it does not say (a test, a config written before the contract): the first release. +const defaultSupported = {protocol: [1], api: [1]}; + +// An archive is refused with the reason, never used with a fallback. An environment that predates "api" was built for the +// first webfront.developer.* API, so a missing "api" reads as 1; any other declared version must be one the C++ supports. +function checkCompatible(manifest, supported) { + const versions = {protocol: manifest.protocol, api: manifest.api ?? 1}; + for (const [name, version] of Object.entries(versions)) { + const accepted = supported?.[name] ?? defaultSupported[name]; + if (!accepted.includes(version)) + throw new Error(`Incompatible WebFront developer environment: ${name} version ${version}, this application supports ${accepted.join(', ')}`); + } +} + +function checkEntry(manifest, files) { + if (typeof manifest.entry !== 'string' || !safePath(manifest.entry) || !files.has(manifest.entry)) + throw new Error('Unsupported WebFront developer environment: invalid entry'); } -export async function environmentFiles(bytes, integrity) { +export async function environmentFiles(bytes, integrity, supported = defaultSupported) { await verifyIntegrity(bytes, integrity); const files = archiveFiles(await gunzip(bytes)); if (!files.has('environment.json')) throw new Error('Environment archive has no environment.json'); const manifest = JSON.parse(decoder.decode(files.get('environment.json'))); - if (!supported(manifest, files)) throw new Error('Unsupported WebFront developer environment'); + checkCompatible(manifest, supported); + checkEntry(manifest, files); return {files, manifest}; } const cachedPath = '.webfront/developer/environment.tgz'; -async function verifiedCache(bridge, integrity) { +async function verifiedCache(bridge, integrity, supported) { try { const candidate = await readProject(bridge, cachedPath); - await environmentFiles(candidate, integrity); + await environmentFiles(candidate, integrity, supported); return candidate; } catch { return null; } } @@ -67,13 +81,13 @@ function pinnedStarters(manifest, environmentUrl) { } export async function bootstrap(bridge, config, fetchImpl = fetch, progress = () => {}) { - let bytes = await verifiedCache(bridge, config.integrity); + let bytes = await verifiedCache(bridge, config.integrity, config.supported); if (bytes) progress('Using verified cached developer environment'); else { progress('Downloading developer environment'); bytes = await downloadEnvironment(config, fetchImpl); } - const {files, manifest} = await environmentFiles(bytes, config.integrity); + const {files, manifest} = await environmentFiles(bytes, config.integrity, config.supported); const starters = pinnedStarters(manifest, new URL(config.environment, location.href)); // All files and the trusted archive are published only after validation succeeds. await publish(bridge, '.webfront/developer/environment', files); diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 326258d5..ccaf989f 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -11,7 +11,7 @@ "js/developer/environment/typecheck-snapshot.mjs": "2b68ae117cb39a3f67e3fe2c0b88c479ed0aed31f793c95725488b0af7d97d54", "js/developer/environment/typecheck-worker.mjs": "7c072f7ce902ba8d6ee59015be93c3a5c358d95a5153758309ea825bd39a903e", "js/developer/environment/packages-entry.mjs": "e0b4acd4330b8b51eb0e695384c8df2b103a4be4f598ac83277838022f747e30", - "js/developer/environment/bootstrap.mjs": "b46c9d66ea7083f17fc9b29a8cd9c350966e2420b39fd44b910e8fdd274854df", + "js/developer/environment/bootstrap.mjs": "5fa50cc9264809a6a9eb03564a60fbe3171a3ffcc781d26352ae59e2866a7090", "js/developer/environment/bootstrap-entry.mjs": "ff8084f23f5acc721f97eb1ed0a454e7bfee1894de17d54f0100fa11f7ef8b77", "js/developer/environment/packages.mjs": "6636219f3fef20ea1d274dc9298d8af451ef257b86fe6c1ed0de9a7c797b11d8", "js/developer/environment/starter.mjs": "f38e290e03aebe146623c2ca9b590d645fb91a51acdf7a98101bb00b5b88096c", @@ -40,11 +40,11 @@ "examples/life/ui/main.tsx": "ed11a82aad1639eb6997af8b0fca4d5c5ed4c36422c22a74ac49ae73078d0a91", "examples/life/ui/style.css": "9bb55eb0f0a3287e5b7dc78af9d69608b87ff42c4d9c8a653bc83a52fe293c44", "js/developer/tools/distribution.json": "4c8703b10e0bfca70e47e1c2b9f5afe7bbe4b4b87cd8be99e15082cfd2915373", - "js/developer/tools/build.mjs": "c0ee8d7502688f14cc45f0234cc90d3df062c9d05e4e51597ce435a63fa41662", + "js/developer/tools/build.mjs": "c9767060d2d181a6d048d9a878e622297a929597b73a1e396b69e1d186ac5d42", "js/developer/tools/site.mjs": "1827d3fd7e1e470336aab25ea8686c912c2b674a10f7be496f2f0077fbc45292", "js/developer/tools/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b", "js/developer/vendor/package-lock.json": "f6aefe8b4cb0b15f866f41eae425f6654d2c6c2d96438fd0da878c5651585616", - "js/core/bootstrap/bootstrap.bundle.mjs": "1069b307799ed2b0de53914748521731bc9796414a416d56340bbda983ef2443", + "js/core/bootstrap/bootstrap.bundle.mjs": "536831257f0fc92e31911841750e1e59247f7c64e756b0fcb878efd9860a741f", "js/developer/environment/packages.bundle.mjs": "e36d1052285a313f7db67c1f58f8332da9e97446b1e2085422ebdae379288045", "include/webfront/system/DeveloperReleaseData.hpp": "d5aaddb2ba839e4c8df46b7d37e2861163233a9018b0f2fb35a6f79831e16569" } diff --git a/js/developer/tools/build.mjs b/js/developer/tools/build.mjs index a766ed60..f816e6bb 100644 --- a/js/developer/tools/build.mjs +++ b/js/developer/tools/build.mjs @@ -57,7 +57,7 @@ for (const [name, provider] of [['pi', 'PiUI'], ['life', 'LifeUI']]) { await writeFile(resolve(output, archive), starterBytes); starters[name] = {archive, integrity: 'sha512-' + createHash('sha512').update(starterBytes).digest('base64')}; } -await writeFile(resolve(output, 'environment.json'), JSON.stringify({protocol: 1, version, entry: 'runtime.mjs', +await writeFile(resolve(output, 'environment.json'), JSON.stringify({protocol: 1, api: 1, version, entry: 'runtime.mjs', compiler: `esbuild-wasm@${dependencies['esbuild-wasm']}`, semver: dependencies.semver, starters}, null, 2) + '\n'); await writeFile(resolve(output, 'package.json'), JSON.stringify({name: '@webfront/developer-environment', version, description: 'Browser-powered WebFront developer environment', type: 'module', diff --git a/js/developer/tools/check.mjs b/js/developer/tools/check.mjs index cc2aa0e0..6b38c389 100644 --- a/js/developer/tools/check.mjs +++ b/js/developer/tools/check.mjs @@ -128,7 +128,15 @@ test('environment integrity and protocol are checked before publication', async assert.equal(environment.manifest.entry, 'runtime.mjs'); await assert.rejects(environmentFiles(archive, integrity(encode('wrong'))), /Integrity check failed/); const wrong = compress(tar(new Map([['package/environment.json', encode({protocol: 2, entry: 'runtime.mjs'})], ['package/runtime.mjs', encode('')]]))); - await assert.rejects(environmentFiles(wrong, integrity(wrong)), /Unsupported WebFront/); + await assert.rejects(environmentFiles(wrong, integrity(wrong)), /Incompatible WebFront developer environment: protocol version 2, this application supports 1/); + // The API an environment expects must be one the C++ declares; an environment from before "api" reads as API 1. + const withApi = api => compress(tar(new Map([['package/environment.json', encode({protocol: 1, api, entry: 'runtime.mjs'})], ['package/runtime.mjs', encode('')]]))); + const newer = withApi(2); + await assert.rejects(environmentFiles(newer, integrity(newer)), /api version 2, this application supports 1/); + assert.equal((await environmentFiles(newer, integrity(newer), {protocol: [1], api: [1, 2]})).manifest.api, 2); + await assert.rejects(environmentFiles(archive, integrity(archive), {protocol: [1], api: [2]}), /api version 1, this application supports 2/); + const current = withApi(1); + assert.equal((await environmentFiles(current, integrity(current))).manifest.api, 1); const missing = compress(tar(new Map([['package/runtime.mjs', encode('')]]))); await assert.rejects(environmentFiles(missing, integrity(missing)), /no environment\.json/); }); diff --git a/test/cmake/CheckBootstrapProvisioning.cmake b/test/cmake/CheckBootstrapProvisioning.cmake new file mode 100644 index 00000000..60c5c7f2 --- /dev/null +++ b/test/cmake/CheckBootstrapProvisioning.cmake @@ -0,0 +1,110 @@ +# Bootstrap provisioning at configure time: SRI conversion, verified download, local directory, integrity failures. +# Usage: cmake -DROOT= -DWORK= -P CheckBootstrapProvisioning.cmake +include("${ROOT}/cmake/WebFrontBootstrap.cmake") + +set(content "webfront bootstrap test archive\n") +set(sri "sha512-k0ItCZvKz9jrgv4XNPzy3yvOrM7JhFjHoBM8YdCPu8FxcXuDSfGXOpWgeHndSdPASykMPm7I2RKFLU8sThVZ+w==") +set(hex "93422d099bcacfd8eb82fe1734fcf2df2bceaccec98458c7a0133c61d08fbbc171717b8349f1973a95a07879dd49d3c04b290c3e6ec8d912852d4f2c4e1559fb") + +function(expect_equal actual expected message) + if(NOT actual STREQUAL expected) + message(FATAL_ERROR "${message}: expected '${expected}', got '${actual}'") + endif() +endfunction() + +# The pinned value of the repository is a well-formed SHA-512. +webfront_sri_to_sha512("${WEBFRONT_BOOTSTRAP_INTEGRITY}" pinned) +string(LENGTH "${pinned}" pinnedLength) +expect_equal("${pinnedLength}" 128 "The pinned integrity must decode to 64 bytes") + +webfront_sri_to_sha512("${sri}" decoded) +expect_equal("${decoded}" "${hex}" "SRI conversion") + +file(REMOVE_RECURSE "${WORK}") +# The SRI of a file built by a test round-trips through the conversion above. +file(MAKE_DIRECTORY "${WORK}") +file(WRITE "${WORK}/sri.bin" "${content}") +webfront_file_sri("${WORK}/sri.bin" encoded) +expect_equal("${encoded}" "${sri}" "SRI encoding") + +# Each case runs in its own cmake process: a failed integrity check is a FATAL_ERROR. +file(MAKE_DIRECTORY "${WORK}/source" "${WORK}/local") +file(WRITE "${WORK}/source/environment.tgz" "${content}") +file(WRITE "${WORK}/local/environment.tgz" "${content}") +file(WRITE "${WORK}/tampered.tgz" "tampered\n") +file(WRITE "${WORK}/run.cmake" [[ +include("${ROOT}/cmake/WebFrontBootstrap.cmake") +if(LOCAL) + webfront_provision_bootstrap(archive URL "${URL}" INTEGRITY "${INTEGRITY}" DESTINATION "${WORK}/cache" LOCAL_DIR "${LOCAL}") +else() + webfront_provision_bootstrap(archive URL "${URL}" INTEGRITY "${INTEGRITY}" DESTINATION "${WORK}/cache") +endif() +message(STATUS "provisioned ${archive}") +]]) + +function(provision name result_var output_var) + cmake_parse_arguments(ARG "" "URL;INTEGRITY;LOCAL" "" ${ARGN}) + execute_process(COMMAND "${CMAKE_COMMAND}" -DROOT=${ROOT} -DWORK=${WORK} -DURL=${ARG_URL} -DINTEGRITY=${ARG_INTEGRITY} + -DLOCAL=${ARG_LOCAL} -P "${WORK}/run.cmake" + RESULT_VARIABLE result OUTPUT_VARIABLE out ERROR_VARIABLE err) + set(${result_var} "${result}" PARENT_SCOPE) + set(${output_var} "${out}${err}" PARENT_SCOPE) +endfunction() + +# A file URL: a Windows drive letter needs a third slash. +if(WORK MATCHES "^[A-Za-z]:") + set(scheme "file:///") +else() + set(scheme "file://") +endif() +set(url "${scheme}${WORK}/source/environment.tgz") + +provision(download result text URL "${url}" INTEGRITY "${sri}") +expect_equal("${result}" 0 "A matching download must be provisioned: ${text}") +if(NOT EXISTS "${WORK}/cache/environment.tgz") + message(FATAL_ERROR "The verified archive must be kept in the destination") +endif() + +# A cached archive is reused without the source. +file(REMOVE "${WORK}/source/environment.tgz") +provision(reuse result text URL "${url}" INTEGRITY "${sri}") +expect_equal("${result}" 0 "A verified cached archive must be reused: ${text}") + +# A wrong digest stops the configure and leaves no unverified archive behind. +file(REMOVE_RECURSE "${WORK}/cache") +file(COPY "${WORK}/tampered.tgz" DESTINATION "${WORK}/source") +file(RENAME "${WORK}/source/tampered.tgz" "${WORK}/source/environment.tgz") +provision(wrong result text URL "${url}" INTEGRITY "${sri}") +if(result EQUAL 0 OR NOT text MATCHES "integrity check failed") + message(FATAL_ERROR "A wrong integrity must fail the configure: ${result} ${text}") +endif() +if(EXISTS "${WORK}/cache/environment.tgz") + message(FATAL_ERROR "A downloaded archive that fails its integrity check must be removed") +endif() + +# A download failure names the offline alternative. +provision(missing result text URL "${scheme}${WORK}/absent/environment.tgz" INTEGRITY "${sri}") +if(result EQUAL 0 OR NOT text MATCHES "WEBFRONT_BOOTSTRAP_DIR") + message(FATAL_ERROR "A failed download must point to WEBFRONT_BOOTSTRAP_DIR: ${result} ${text}") +endif() + +# A local provisioning directory replaces the download and is verified too. +provision(local result text URL "https://offline.invalid/environment.tgz" INTEGRITY "${sri}" LOCAL "${WORK}/local") +expect_equal("${result}" 0 "A local directory must replace the download: ${text}") +file(WRITE "${WORK}/local/environment.tgz" "tampered\n") +provision(localWrong result text URL "https://offline.invalid/environment.tgz" INTEGRITY "${sri}" LOCAL "${WORK}/local") +if(result EQUAL 0 OR NOT text MATCHES "integrity check failed") + message(FATAL_ERROR "A tampered local archive must fail the configure: ${result} ${text}") +endif() +file(REMOVE "${WORK}/local/environment.tgz") +provision(localMissing result text URL "https://offline.invalid/environment.tgz" INTEGRITY "${sri}" LOCAL "${WORK}/local") +if(result EQUAL 0 OR NOT text MATCHES "is missing") + message(FATAL_ERROR "An absent local archive must fail the configure: ${result} ${text}") +endif() + +# A malformed integrity is refused before anything is downloaded. +provision(malformed result text URL "${url}" INTEGRITY "sha256-abc") +if(result EQUAL 0 OR NOT text MATCHES "sha512- SRI") + message(FATAL_ERROR "A non SHA-512 integrity must be refused: ${result} ${text}") +endif() +message(STATUS "Bootstrap provisioning checks passed") diff --git a/test/cmake/PrepareWfProject.cmake b/test/cmake/PrepareWfProject.cmake new file mode 100644 index 00000000..ff6e10dc --- /dev/null +++ b/test/cmake/PrepareWfProject.cmake @@ -0,0 +1,4 @@ +# Gives the driver tests a fresh copy of the fixture project. +# Usage: cmake -DSOURCE= -DPROJECT= -P PrepareWfProject.cmake +file(REMOVE_RECURSE "${PROJECT}") +file(COPY "${SOURCE}/" DESTINATION "${PROJECT}") diff --git a/test/cmake/RunWfDriver.cmake b/test/cmake/RunWfDriver.cmake new file mode 100644 index 00000000..babb9b95 --- /dev/null +++ b/test/cmake/RunWfDriver.cmake @@ -0,0 +1,58 @@ +# Runs webfront-wf and checks its exit status and output. +# Usage: cmake -DDRIVER= -DPROJECT= -DEXPECT_STATUS= [-DENVIRONMENT= -DINTEGRITY=] +# [-DREGISTRY=] [-DTIMEOUT=] [-DEXPECT_OUTPUT=] [-DEXPECT_REPORT=] [-DFORGE=: +# -DWORK=] -DCOMMAND=|... -P RunWfDriver.cmake +# FORGE replaces ENVIRONMENT with an archive whose environment.json declares the given protocol and API versions. +if(FORGE) + include("${ROOT}/cmake/WebFrontBootstrap.cmake") + string(REPLACE ":" ";" versions "${FORGE}") + list(GET versions 0 protocol) + list(GET versions 1 api) + file(REMOVE_RECURSE "${WORK}/forged") + file(MAKE_DIRECTORY "${WORK}/forged/package") + file(WRITE "${WORK}/forged/package/environment.json" "{\"protocol\": ${protocol}, \"api\": ${api}, \"entry\": \"runtime.mjs\"}\n") + file(WRITE "${WORK}/forged/package/runtime.mjs" "export function mount() {}\n") + execute_process(COMMAND "${CMAKE_COMMAND}" -E tar czf "${WORK}/forged.tgz" --format=gnutar package + WORKING_DIRECTORY "${WORK}/forged" RESULT_VARIABLE tarred) + if(NOT tarred EQUAL 0) + message(FATAL_ERROR "Cannot build the forged environment") + endif() + set(ENVIRONMENT "${WORK}/forged.tgz") + webfront_file_sri("${ENVIRONMENT}" INTEGRITY) +endif() + +set(arguments --project "${PROJECT}") +if(ENVIRONMENT) + list(APPEND arguments --environment "${ENVIRONMENT}" --integrity "${INTEGRITY}") +endif() +if(REGISTRY) + list(APPEND arguments --registry-dir "${REGISTRY}") +endif() +if(TIMEOUT) + list(APPEND arguments --timeout "${TIMEOUT}") +endif() +if(EXPECT_REPORT) + set(report "${PROJECT}/report.json") + file(REMOVE "${report}") + list(APPEND arguments --report "${report}") +endif() +string(REPLACE "|" ";" command "${COMMAND}") +execute_process(COMMAND "${DRIVER}" ${arguments} -- ${command} + RESULT_VARIABLE status OUTPUT_VARIABLE output ERROR_VARIABLE errors) +set(text "${output}${errors}") +message(STATUS "exit status ${status}\n${text}") +if(NOT status EQUAL EXPECT_STATUS) + message(FATAL_ERROR "Expected exit status ${EXPECT_STATUS}, got ${status}") +endif() +if(EXPECT_OUTPUT AND NOT text MATCHES "${EXPECT_OUTPUT}") + message(FATAL_ERROR "The output does not match '${EXPECT_OUTPUT}'") +endif() +if(EXPECT_REPORT) + if(NOT EXISTS "${report}") + message(FATAL_ERROR "The driver wrote no report") + endif() + file(READ "${report}" content) + if(NOT content MATCHES "${EXPECT_REPORT}") + message(FATAL_ERROR "The report does not match '${EXPECT_REPORT}': ${content}") + endif() +endif() diff --git a/test/driver/WebFrontWf.cpp b/test/driver/WebFrontWf.cpp new file mode 100644 index 00000000..d2e05538 --- /dev/null +++ b/test/driver/WebFrontWf.cpp @@ -0,0 +1,365 @@ +// webfront-wf: runs one wf command of the browser developer environment without interaction and exits with its status. +// +// webfront-wf --project [--environment --integrity ] [--registry-dir ] +// [--report ] [--timeout ] [--] [arguments...] +// +// The environment defaults to the provisioned bootstrap archive (cmake/WebFrontBootstrap.cmake); the project is the +// directory wf reads and writes. Exit status: the command's own status; 64 usage; 70 bootstrap failure (archive missing, +// wrong integrity, incompatible protocol or API); 71 time limit of the driver; 72 the browser closed without a result. +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef WEBFRONT_DRIVER_FRONTEND + #error "WEBFRONT_DRIVER_FRONTEND must name the browser frontend" +#endif + +namespace { +using namespace std::chrono_literals; + +constexpr int usageStatus = 64; +constexpr int bootstrapStatus = 70; +constexpr int timeoutStatus = 71; +constexpr int noResultStatus = 72; + +struct Options { + std::filesystem::path project; + std::optional environment; + std::optional integrity; + std::optional registryDirectory; + std::optional report; + std::chrono::seconds timeout{600}; + std::vector command; +}; + +struct UsageError : std::invalid_argument { + using std::invalid_argument::invalid_argument; +}; + +Options parse(int argc, char** argv) { + Options options; + const std::vector arguments(argv + 1, argv + argc); + for (std::size_t i = 0; i < arguments.size(); ++i) { + const auto& argument = arguments[i]; + const auto value = [&]() -> const std::string& { + if (++i == arguments.size()) + throw UsageError(argument + " expects a value"); + return arguments[i]; + }; + if (argument == "--") { + options.command.assign(arguments.begin() + static_cast(i) + 1, arguments.end()); + break; + } + if (argument == "--project") + options.project = value(); + else if (argument == "--environment") + options.environment = value(); + else if (argument == "--integrity") + options.integrity = value(); + else if (argument == "--registry-dir") + options.registryDirectory = value(); + else if (argument == "--report") + options.report = value(); + else if (argument == "--timeout") { + const auto& seconds = value(); + std::size_t used = 0; + const long parsed = seconds.empty() || seconds[0] == '-' ? 0 : std::stol(seconds, &used); + if (parsed < 1 || used != seconds.size()) + throw UsageError("--timeout expects whole seconds"); + options.timeout = std::chrono::seconds(parsed); + } else if (argument.starts_with("--")) + throw UsageError("Unknown option " + argument); + else { + options.command.assign(arguments.begin() + static_cast(i), arguments.end()); + break; + } + } + if (options.project.empty()) + throw UsageError("--project is required"); + if (options.command.empty()) + throw UsageError("A wf command is required"); + if (options.environment.has_value() != options.integrity.has_value()) + throw UsageError("--environment and --integrity go together"); +#if defined(WEBFRONT_BOOTSTRAP_ARCHIVE) && defined(WEBFRONT_BOOTSTRAP_INTEGRITY) + if (!options.environment) { + options.environment = WEBFRONT_BOOTSTRAP_ARCHIVE; + options.integrity = WEBFRONT_BOOTSTRAP_INTEGRITY; + } +#endif + if (!options.environment) + throw UsageError("Pass --environment and --integrity: no bootstrap archive was provisioned at build time"); + return options; +} + +// Where DriverFS finds what it serves: a filesystem provider is built from the project directory alone, and this process +// runs a single application. +struct Sources { + std::filesystem::path archive; + std::optional registry; +}; +Sources& sources() { + static Sources instance; + return instance; +} + +/// Serves the environment archive and the optional local registry under /driver/, from outside the project. +class DriverFS { +public: + explicit DriverFS(const std::filesystem::path&) {} + + std::optional open(std::filesystem::path path) const { + const auto relative = path.relative_path().generic_string(); + if (relative == "driver/environment.tgz") + return read(sources().archive); + constexpr std::string_view prefix = "driver/registry/"; + if (sources().registry && relative.starts_with(prefix)) { + try { + return read(webfront::developer::projectPath(*sources().registry, std::string_view(relative).substr(prefix.size()))); + } catch (const std::exception&) {} + } + return {}; + } + +private: + static std::optional read(const std::filesystem::path& file) { + std::ifstream stream(file, std::ios::binary); + if (stream && std::filesystem::is_regular_file(file)) + return webfront::fs::File{std::move(stream)}; + return {}; + } +}; + +// What the page reports: the command's result, or the reason the environment could not start. +class Outcome { +public: + void result(int exitCode, std::string json) { + finish([&] { + status = exitCode; + resultJson = std::move(json); + hasResult = true; + }); + } + void bootstrapFailed(std::string message) { + finish([&] { + status = bootstrapStatus; + failure = std::move(message); + }); + } + void timedOut() { + finish([&] { + status = timeoutStatus; + failure = "The time limit of the driver elapsed"; + }); + } + bool finished() const { + std::scoped_lock lock{mutex}; + return done; + } + template + void inspect(Function&& function) const { + std::scoped_lock lock{mutex}; + function(done, status, hasResult, resultJson, failure); + } + bool wait(std::chrono::seconds limit) { + std::unique_lock lock{mutex}; + return changed.wait_for(lock, limit, [this] { + return done; + }); + } + +private: + template + void finish(Function&& function) { + { + std::scoped_lock lock{mutex}; + if (done) + return; // the first outcome wins + function(); + done = true; + } + changed.notify_all(); + } + + mutable std::mutex mutex; + std::condition_variable changed; + bool done = false; + bool hasResult = false; + int status = noResultStatus; + std::string resultJson; + std::string failure; +}; + +// Waits for the environment, runs the command and reports to C++; the page closes itself when it is done. +constexpr auto driverScript = R"JS( +(async () => { + const report = (name, ...args) => webFront.cppFunction(name)(...args); + const stop = () => window.close(); + try { + await webFront.ready; + for (;;) { + const text = document.getElementById('status')?.textContent ?? ''; + if (text.startsWith('Bootstrap failed:')) throw Object.assign(new Error(text), {bootstrap: true}); + if (text.startsWith('Developer environment ready.')) break; + await new Promise(resolve => setTimeout(resolve, 50)); + } + const runtime = await import('/webfront/developer/environment/runtime.mjs'); + if (typeof runtime.runNonInteractive !== 'function') + throw Object.assign(new Error('Bootstrap failed: this developer environment has no non-interactive mode'), {bootstrap: true}); + const config = JSON.parse(await report('webfront.developer.config')); + const environment = await (await fetch('/webfront/developer/environment/environment.json')).json(); + config.starters = Object.fromEntries(Object.entries(environment.starters ?? {}).map(([name, value]) => + [name, {url: new URL(value.archive, new URL(config.environment, location.href)).href, integrity: value.integrity}])); + const argv = JSON.parse(await report('wf.arguments')); + await runtime.runNonInteractive(argv, {bridge: webFront, config, preview: document.getElementById('preview'), + signal: new AbortController().signal, write: () => {}, onExit: () => {}, + reporter: json => report('wf.result', JSON.parse(json).exitCode, json)}); + } catch (error) { + await report('wf.bootstrapFailed', String(error?.message ?? error)).catch(() => {}); + } finally { stop(); } +})(); +)JS"; + +std::string jsonArray(const std::vector& items) { + std::string json = "["; + for (const auto& item : items) + json += (json.size() > 1 ? "," : "") + webfront::json::quote(item); + return json + "]"; +} + +void writeReport(const Options& options, const std::string& json) { + if (!options.report) + return; + std::ofstream file(*options.report, std::ios::binary | std::ios::trunc); + file << json << '\n'; + if (!file) + throw std::runtime_error("Cannot write the report " + options.report->string()); +} + +// Prints what the command wrote: the "output" member of the result. +void printOutput(const std::string& json) { + webfront::json::Reader reader{json}; + reader.object([&](const std::string& key) { + if (key == "output") + std::cout << reader.string() << std::endl; + else + reader.skipValue(); + }); +} + +int run(const Options& options) { + using App = webfront::BasicDeveloperApp; + if (!std::filesystem::is_regular_file(*options.environment)) { + std::cerr << "Bootstrap environment archive not found: " << *options.environment << '\n'; + return bootstrapStatus; + } + if (!std::filesystem::is_directory(options.project)) { + std::cerr << "Project directory not found: " << options.project << '\n'; + return usageStatus; + } + sources() = {std::filesystem::canonical(*options.environment), options.registryDirectory}; + if (sources().registry) + sources().registry = std::filesystem::canonical(*sources().registry); + + Outcome outcome; + App app{options.project, {}}; + app.cppFunction("wf.arguments", [arguments = jsonArray(options.command)] { + return arguments; + }); + app.cppFunction("wf.result", [&outcome](double exitCode, std::string json) { + outcome.result(static_cast(exitCode), std::move(json)); + }); + app.cppFunction("wf.bootstrapFailed", [&outcome](std::string message) { + outcome.bootstrapFailed(std::move(message)); + }); + app.bootstrap("developer", + {.environment = "/driver/environment.tgz", + .integrity = *options.integrity, + .registry = options.registryDirectory ? std::optional{"/driver/registry/"} : std::nullopt}); + + std::mutex uiMutex; + std::optional browser; + auto subscription = app.subscribeUIStarted([&](App::UI ui) { + ui.addScript(driverScript); + std::scoped_lock lock{uiMutex}; + browser.emplace(ui); + }); + // The time limit: ask the page to close, then end the process if the browser does not follow. + std::jthread watchdog([&](std::stop_token stop) { + std::mutex mutex; + std::condition_variable_any wake; + std::unique_lock lock{mutex}; + if (wake.wait_for(lock, + stop, + options.timeout, + [] { + return false; + }) + || stop.stop_requested()) + return; + outcome.timedOut(); + { + std::scoped_lock ui{uiMutex}; + if (browser) + browser->addScript("window.close()"); + } + if (!stop.stop_requested() + && !wake.wait_for(lock, + stop, + 10s, + [] { + return false; + }) + && !stop.stop_requested()) { + std::cerr << "The browser did not close after the time limit of " << options.timeout.count() << " s\n"; + std::cerr.flush(); + std::_Exit(timeoutStatus); + } + }); + app.show(); + watchdog.request_stop(); + app.shutdown(); + + int status = noResultStatus; + bool hasResult = false; + std::string json, failure; + outcome.inspect([&](bool, int code, bool result, const std::string& resultJson, const std::string& reason) { + status = code; + hasResult = result; + json = resultJson; + failure = reason; + }); + if (hasResult) { + printOutput(json); + writeReport(options, json); + } else if (status == bootstrapStatus || status == timeoutStatus) + std::cerr << failure << '\n'; + else + std::cerr << "The browser closed before the command reported a result\n"; + return status; +} +} // namespace + +int main(int argc, char** argv) { + try { + // CEF child processes must dispatch before interpreting application arguments or creating files. + webfront::detail::ensureFrontendInitialized(); + return run(parse(argc, argv)); + } catch (const UsageError& error) { + std::cerr << "webfront-wf: " << error.what() << "\nUsage: webfront-wf --project [--environment --integrity ] " + << "[--registry-dir ] [--report ] [--timeout ] [--] [arguments...]\n"; + return usageStatus; + } catch (const std::exception& error) { + std::cerr << "webfront-wf: " << error.what() << '\n'; + return bootstrapStatus; + } +} diff --git a/test/fixtures/wf-project/tests/arithmetic.spec.js b/test/fixtures/wf-project/tests/arithmetic.spec.js new file mode 100644 index 00000000..79d6d09a --- /dev/null +++ b/test/fixtures/wf-project/tests/arithmetic.spec.js @@ -0,0 +1,4 @@ +describe('arithmetic', () => { + it('adds', () => { expect(1 + 1).toBe(2); }); + it('fails on purpose', () => { expect(1 + 1).toBe(3); }); +}); diff --git a/test/fixtures/wf-project/tools/sleep.mjs b/test/fixtures/wf-project/tools/sleep.mjs new file mode 100644 index 00000000..519e2131 --- /dev/null +++ b/test/fixtures/wf-project/tools/sleep.mjs @@ -0,0 +1,2 @@ +// A command longer than any driver time limit of the tests. +export default async () => new Promise(resolve => setTimeout(resolve, 120000)); diff --git a/test/fixtures/wf-project/webfront.project.json b/test/fixtures/wf-project/webfront.project.json new file mode 100644 index 00000000..3802a327 --- /dev/null +++ b/test/fixtures/wf-project/webfront.project.json @@ -0,0 +1,8 @@ +{ + "format": 1, + "name": "wf-driver-fixture", + "version": "0.1.0", + "dependencies": {}, + "scripts": {"sleep": "tools/sleep.mjs"}, + "test": {"specs": ["tests/arithmetic.spec.js"]} +} diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 97831848..0cf4c524 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -40,6 +40,9 @@ add_test(NAME ReleaseVersionRegression COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -DWORK=${CMAKE_CURRENT_BINARY_DIR}/release-version-regression -P ${PROJECT_SOURCE_DIR}/test/cmake/CheckReleaseVersionTests.cmake) +add_test(NAME BootstrapProvisioning + COMMAND ${CMAKE_COMMAND} -DROOT=${PROJECT_SOURCE_DIR} -DWORK=${CMAKE_CURRENT_BINARY_DIR}/bootstrap-provisioning + -P ${PROJECT_SOURCE_DIR}/test/cmake/CheckBootstrapProvisioning.cmake) # Windows bash.exe may be the WSL launcher rather than a native Bash runtime. if(UNIX) diff --git a/test/unit/DeveloperTests.cpp b/test/unit/DeveloperTests.cpp index 39d1856d..0fb73423 100644 --- a/test/unit/DeveloperTests.cpp +++ b/test/unit/DeveloperTests.cpp @@ -359,14 +359,14 @@ SCENARIO("The environment learns whether the application chose the npm registry" GIVEN("no registry option") { THEN("the default registry is passed and marked as not chosen, so the manifest's applies") { REQUIRE(developer::bootstrapConfig(trusted) - == R"({"environment":"https://example.test/env.tgz","integrity":"sha512-abc","registry":"https://registry.npmjs.org/","registryExplicit":false})"); + == R"({"environment":"https://example.test/env.tgz","integrity":"sha512-abc","registry":"https://registry.npmjs.org/","registryExplicit":false,"supported":{"protocol":[1],"api":[1]}})"); } } GIVEN("a same-origin mirror chosen by the application") { auto options = trusted; options.registry = "/mirror/"; THEN("it is passed as the application's choice") { - REQUIRE_THAT(developer::bootstrapConfig(options), Catch::Matchers::EndsWith(R"("registry":"/mirror/","registryExplicit":true})")); + REQUIRE_THAT(developer::bootstrapConfig(options), Catch::Matchers::EndsWith(R"("registry":"/mirror/","registryExplicit":true,"supported":{"protocol":[1],"api":[1]}})")); } } } diff --git a/test/web/CMakeLists.txt b/test/web/CMakeLists.txt index 58db65df..f845f65c 100644 --- a/test/web/CMakeLists.txt +++ b/test/web/CMakeLists.txt @@ -18,6 +18,21 @@ if(${WEBFRONT_FRONTEND_${WEBFRONT_WEBTEST_FRONTEND}_OPTION} endif() webfront_add_browser_tests(webtest "${WEBFRONT_WEBTEST_FRONTEND}" "${CMAKE_CURRENT_SOURCE_DIR}" frontend_lifecycle) +# The pinned bootstrap environment is downloaded and verified at configure time (or taken from WEBFRONT_BOOTSTRAP_DIR on a +# machine without network access); webfront-wf runs wf commands without interaction from it, or from an environment passed +# explicitly (the one built from the current sources). +include(WebFrontBootstrap) +if(${WEBFRONT_FRONTEND_${WEBFRONT_WEBTEST_FRONTEND}_OPTION} + AND CMAKE_SYSTEM_NAME IN_LIST WEBFRONT_FRONTEND_${WEBFRONT_WEBTEST_FRONTEND}_TEST_PLATFORMS) + webfront_provision_bootstrap(WEBFRONT_BOOTSTRAP_ARCHIVE URL "${WEBFRONT_BOOTSTRAP_URL}" + INTEGRITY "${WEBFRONT_BOOTSTRAP_INTEGRITY}" DESTINATION "${CMAKE_BINARY_DIR}/bootstrap" LOCAL_DIR "${WEBFRONT_BOOTSTRAP_DIR}") + add_executable(webfront-wf ../driver/WebFrontWf.cpp) + target_link_libraries(webfront-wf PRIVATE WebFront_test_hardening WebFront WebFront_warnings WebFront_options) + target_compile_definitions(webfront-wf PRIVATE WEBFRONT_DRIVER_FRONTEND=${WEBFRONT_WEBTEST_FRONTEND_TYPE} + WEBFRONT_BOOTSTRAP_ARCHIVE="${WEBFRONT_BOOTSTRAP_ARCHIVE}" WEBFRONT_BOOTSTRAP_INTEGRITY="${WEBFRONT_BOOTSTRAP_INTEGRITY}") + webfront_setup_frontends_for_target(webfront-wf) +endif() + # Exercise actual CEF command IDs, context-menu filtering and DevTools creation in the vendored runtime. if(WEBFRONT_EMBED_CEF AND CMAKE_SYSTEM_NAME STREQUAL "Linux") add_executable(cef_content_policy CEFContentPolicy.cpp) @@ -55,6 +70,66 @@ if(WEBFRONT_DEVELOPER_FIXTURES "${WEBFRONT_DEVELOPER_FIXTURES}" "${CMAKE_CURRENT_BINARY_DIR}/developer-generated") webfront_set_browser_test_properties(DeveloperBrowserIntegration "${CMAKE_CURRENT_SOURCE_DIR}" 180) set_tests_properties(DeveloperBrowserIntegration PROPERTIES FIXTURES_SETUP DeveloperGenerated) + # The driver on the environment built from the current sources: statuses, output and reports reach CTest. + if(TARGET webfront-wf) + file(READ "${WEBFRONT_DEVELOPER_FIXTURES}/provision.json" _provision) + string(JSON _environment_integrity GET "${_provision}" integrity) + set(_wf_project "${CMAKE_CURRENT_BINARY_DIR}/wf-driver-project") + set(_wf_run "${CMAKE_COMMAND}" -DROOT=${PROJECT_SOURCE_DIR} -DDRIVER=$ + -DPROJECT=${_wf_project} -DWORK=${CMAKE_CURRENT_BINARY_DIR}/wf-driver-work + -DENVIRONMENT=${WEBFRONT_DEVELOPER_FIXTURES}/environment.tgz -DINTEGRITY=${_environment_integrity} + -DREGISTRY=${WEBFRONT_DEVELOPER_FIXTURES}/registry) + if(_developer_xvfb) + set(_wf_run "${_developer_xvfb}" -a ${_wf_run}) + endif() + add_test(NAME WfDriverProject + COMMAND ${CMAKE_COMMAND} -DSOURCE=${PROJECT_SOURCE_DIR}/test/fixtures/wf-project -DPROJECT=${_wf_project} + -P ${PROJECT_SOURCE_DIR}/test/cmake/PrepareWfProject.cmake) + set_tests_properties(WfDriverProject PROPERTIES FIXTURES_SETUP WfDriverProject LABELS "web-integration" TIMEOUT 30) + + # webfront_add_driver_test( + # [OUTPUT ] [REPORT ] [DRIVER_TIMEOUT ] [FORGE :] + # [ENVIRONMENT INTEGRITY ] [REQUIRES ] [PROVIDES ]) + function(webfront_add_driver_test name status command) + cmake_parse_arguments(ARG "" "OUTPUT;REPORT;DRIVER_TIMEOUT;FORGE;ENVIRONMENT;INTEGRITY;REQUIRES;PROVIDES" "" ${ARGN}) + set(options -DEXPECT_STATUS=${status} "-DCOMMAND=${command}") + foreach(option OUTPUT REPORT) + if(ARG_${option}) + list(APPEND options "-DEXPECT_${option}=${ARG_${option}}") + endif() + endforeach() + foreach(option FORGE ENVIRONMENT INTEGRITY) + if(ARG_${option}) + list(APPEND options "-D${option}=${ARG_${option}}") + endif() + endforeach() + if(ARG_DRIVER_TIMEOUT) + list(APPEND options -DTIMEOUT=${ARG_DRIVER_TIMEOUT}) + endif() + add_test(NAME ${name} COMMAND ${_wf_run} ${options} -P ${PROJECT_SOURCE_DIR}/test/cmake/RunWfDriver.cmake) + webfront_set_browser_test_properties(${name} "${CMAKE_CURRENT_SOURCE_DIR}" 120) + set_tests_properties(${name} PROPERTIES FIXTURES_REQUIRED "WfDriverProject;${ARG_REQUIRES}") + if(ARG_PROVIDES) + set_tests_properties(${name} PROPERTIES FIXTURES_SETUP ${ARG_PROVIDES}) + endif() + endfunction() + + # The fixture manifest has no jasmine-core: wf test asks for it, and wf install resolves it from the local registry. + webfront_add_driver_test(WfDriverInstall 0 "install|jasmine-core" OUTPUT "Installed 1 packages" PROVIDES WfDriverInstalled) + webfront_add_driver_test(WfDriverTestPasses 0 "test|adds" OUTPUT "PASSED: 1 spec" REPORT "\"status\":\"passed\"" REQUIRES WfDriverInstalled) + # A failing command: its status, its output and the structured report reach CTest. + webfront_add_driver_test(WfDriverTestFails 1 "test|fails" OUTPUT "FAILED: 1 spec, 1 failure" REPORT "\"failed\":1" REQUIRES WfDriverInstalled) + webfront_add_driver_test(WfDriverUnknownCommand 1 "nosuchcommand" OUTPUT "nosuchcommand") + webfront_add_driver_test(WfDriverTimeout 71 "run|sleep" OUTPUT "time limit of the driver" DRIVER_TIMEOUT 4) + webfront_add_driver_test(WfDriverWrongIntegrity 70 "list" OUTPUT "Integrity check failed" + INTEGRITY "sha512-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==") + webfront_add_driver_test(WfDriverMissingArchive 70 "list" OUTPUT "archive not found" + ENVIRONMENT "${CMAKE_CURRENT_BINARY_DIR}/wf-driver-work/absent.tgz") + webfront_add_driver_test(WfDriverIncompatibleApi 70 "list" OUTPUT "api version 2, this application supports 1" FORGE "1:2") + webfront_add_driver_test(WfDriverIncompatibleProtocol 70 "list" OUTPUT "protocol version 2, this application supports 1" FORGE "2:1") + add_test(NAME WfDriverUsage COMMAND webfront-wf --project "${_wf_project}") + set_tests_properties(WfDriverUsage PROPERTIES PASS_REGULAR_EXPRESSION "A wf command is required" LABELS "web-integration" TIMEOUT 30) + endif() # Build the actual browser-generated header only after the setup test has produced it. add_executable(developer_embedded EXCLUDE_FROM_ALL DeveloperEmbeddedTest.cpp) target_link_libraries(developer_embedded PRIVATE WebFront_test_hardening WebFront WebFront_warnings WebFront_options) From 751771a34d78d53007078a65b659cf606db81bde Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 14:38:58 +0200 Subject: [PATCH 057/134] Run the driver usage test under the display wrapper like the other browser cases [#321] --- test/web/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/web/CMakeLists.txt b/test/web/CMakeLists.txt index f845f65c..dfdd407c 100644 --- a/test/web/CMakeLists.txt +++ b/test/web/CMakeLists.txt @@ -79,8 +79,10 @@ if(WEBFRONT_DEVELOPER_FIXTURES -DPROJECT=${_wf_project} -DWORK=${CMAKE_CURRENT_BINARY_DIR}/wf-driver-work -DENVIRONMENT=${WEBFRONT_DEVELOPER_FIXTURES}/environment.tgz -DINTEGRITY=${_environment_integrity} -DREGISTRY=${WEBFRONT_DEVELOPER_FIXTURES}/registry) + set(_developer_xvfb_prefix "") if(_developer_xvfb) - set(_wf_run "${_developer_xvfb}" -a ${_wf_run}) + set(_developer_xvfb_prefix "${_developer_xvfb}" -a) + set(_wf_run ${_developer_xvfb_prefix} ${_wf_run}) endif() add_test(NAME WfDriverProject COMMAND ${CMAKE_COMMAND} -DSOURCE=${PROJECT_SOURCE_DIR}/test/fixtures/wf-project -DPROJECT=${_wf_project} @@ -127,7 +129,7 @@ if(WEBFRONT_DEVELOPER_FIXTURES ENVIRONMENT "${CMAKE_CURRENT_BINARY_DIR}/wf-driver-work/absent.tgz") webfront_add_driver_test(WfDriverIncompatibleApi 70 "list" OUTPUT "api version 2, this application supports 1" FORGE "1:2") webfront_add_driver_test(WfDriverIncompatibleProtocol 70 "list" OUTPUT "protocol version 2, this application supports 1" FORGE "2:1") - add_test(NAME WfDriverUsage COMMAND webfront-wf --project "${_wf_project}") + add_test(NAME WfDriverUsage COMMAND ${_developer_xvfb_prefix} $ --project "${_wf_project}") set_tests_properties(WfDriverUsage PROPERTIES PASS_REGULAR_EXPRESSION "A wf command is required" LABELS "web-integration" TIMEOUT 30) endif() # Build the actual browser-generated header only after the setup test has produced it. From 58b00e963b6bd1ce7351a810f11b6667f74cf31d Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 14:42:18 +0200 Subject: [PATCH 058/134] Keep established connections when the network is cut, bound the bootstrap download and report a bad --timeout as usage [#321] --- .github/workflows/BuildAndTest.yml | 2 ++ cmake/WebFrontBootstrap.cmake | 2 +- test/driver/WebFrontWf.cpp | 9 +++++---- test/web/CMakeLists.txt | 2 ++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/BuildAndTest.yml b/.github/workflows/BuildAndTest.yml index d5728b7e..8ba21550 100644 --- a/.github/workflows/BuildAndTest.yml +++ b/.github/workflows/BuildAndTest.yml @@ -285,7 +285,9 @@ jobs: # Everything is provisioned by the configure step: the tests must not reach the public network. - name: Cut the public network run: | + sudo iptables -A OUTPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT sudo iptables -A OUTPUT ! -o lo -j REJECT + sudo ip6tables -A OUTPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT sudo ip6tables -A OUTPUT ! -o lo -j REJECT - name: Run Jasmine bridge test run: >- diff --git a/cmake/WebFrontBootstrap.cmake b/cmake/WebFrontBootstrap.cmake index 513b0a4a..66eec1aa 100644 --- a/cmake/WebFrontBootstrap.cmake +++ b/cmake/WebFrontBootstrap.cmake @@ -91,7 +91,7 @@ function(webfront_provision_bootstrap archive) endif() if(NOT present) file(MAKE_DIRECTORY "${ARG_DESTINATION}") - file(DOWNLOAD "${ARG_URL}" "${path}" STATUS result TLS_VERIFY ON) + file(DOWNLOAD "${ARG_URL}" "${path}" STATUS result TLS_VERIFY ON INACTIVITY_TIMEOUT 60 TIMEOUT 600) list(GET result 0 code) if(NOT code EQUAL 0) file(REMOVE "${path}") diff --git a/test/driver/WebFrontWf.cpp b/test/driver/WebFrontWf.cpp index d2e05538..a60ab9ac 100644 --- a/test/driver/WebFrontWf.cpp +++ b/test/driver/WebFrontWf.cpp @@ -8,6 +8,7 @@ // wrong integrity, incompatible protocol or API); 71 time limit of the driver; 72 the browser closed without a result. #include +#include #include #include #include @@ -71,10 +72,10 @@ Options parse(int argc, char** argv) { else if (argument == "--report") options.report = value(); else if (argument == "--timeout") { - const auto& seconds = value(); - std::size_t used = 0; - const long parsed = seconds.empty() || seconds[0] == '-' ? 0 : std::stol(seconds, &used); - if (parsed < 1 || used != seconds.size()) + const auto& seconds = value(); + long parsed = 0; + const auto [end, error] = std::from_chars(seconds.data(), seconds.data() + seconds.size(), parsed); + if (error != std::errc{} || end != seconds.data() + seconds.size() || parsed < 1) throw UsageError("--timeout expects whole seconds"); options.timeout = std::chrono::seconds(parsed); } else if (argument.starts_with("--")) diff --git a/test/web/CMakeLists.txt b/test/web/CMakeLists.txt index dfdd407c..9305ca30 100644 --- a/test/web/CMakeLists.txt +++ b/test/web/CMakeLists.txt @@ -130,6 +130,8 @@ if(WEBFRONT_DEVELOPER_FIXTURES webfront_add_driver_test(WfDriverIncompatibleApi 70 "list" OUTPUT "api version 2, this application supports 1" FORGE "1:2") webfront_add_driver_test(WfDriverIncompatibleProtocol 70 "list" OUTPUT "protocol version 2, this application supports 1" FORGE "2:1") add_test(NAME WfDriverUsage COMMAND ${_developer_xvfb_prefix} $ --project "${_wf_project}") + add_test(NAME WfDriverBadTimeout COMMAND ${_developer_xvfb_prefix} $ --project "${_wf_project}" --timeout abc -- list) + set_tests_properties(WfDriverBadTimeout PROPERTIES PASS_REGULAR_EXPRESSION "--timeout expects whole seconds" LABELS "web-integration" TIMEOUT 30) set_tests_properties(WfDriverUsage PROPERTIES PASS_REGULAR_EXPRESSION "A wf command is required" LABELS "web-integration" TIMEOUT 30) endif() # Build the actual browser-generated header only after the setup test has produced it. From 6b6b113dd59c77cda5f32c43f5f87248b2e06468 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 14:59:37 +0200 Subject: [PATCH 059/134] Serve the pinned starters from the driver and survive a lost bridge at the time limit [#321] --- test/cmake/RunWfDriver.cmake | 7 ++++++- test/driver/WebFrontWf.cpp | 14 ++++++++++++-- test/web/CMakeLists.txt | 9 ++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/test/cmake/RunWfDriver.cmake b/test/cmake/RunWfDriver.cmake index babb9b95..280c0634 100644 --- a/test/cmake/RunWfDriver.cmake +++ b/test/cmake/RunWfDriver.cmake @@ -1,7 +1,7 @@ # Runs webfront-wf and checks its exit status and output. # Usage: cmake -DDRIVER= -DPROJECT= -DEXPECT_STATUS= [-DENVIRONMENT= -DINTEGRITY=] # [-DREGISTRY=] [-DTIMEOUT=] [-DEXPECT_OUTPUT=] [-DEXPECT_REPORT=] [-DFORGE=: -# -DWORK=] -DCOMMAND=|... -P RunWfDriver.cmake +# -DWORK=] [-DFRESH_PROJECT=: an empty project instead of PROJECT] -DCOMMAND=|... -P RunWfDriver.cmake # FORGE replaces ENVIRONMENT with an archive whose environment.json declares the given protocol and API versions. if(FORGE) include("${ROOT}/cmake/WebFrontBootstrap.cmake") @@ -21,6 +21,11 @@ if(FORGE) webfront_file_sri("${ENVIRONMENT}" INTEGRITY) endif() +if(FRESH_PROJECT) + set(PROJECT "${FRESH_PROJECT}") + file(REMOVE_RECURSE "${PROJECT}") + file(MAKE_DIRECTORY "${PROJECT}") +endif() set(arguments --project "${PROJECT}") if(ENVIRONMENT) list(APPEND arguments --environment "${ENVIRONMENT}" --integrity "${INTEGRITY}") diff --git a/test/driver/WebFrontWf.cpp b/test/driver/WebFrontWf.cpp index a60ab9ac..ccdd6450 100644 --- a/test/driver/WebFrontWf.cpp +++ b/test/driver/WebFrontWf.cpp @@ -122,6 +122,13 @@ class DriverFS { const auto relative = path.relative_path().generic_string(); if (relative == "driver/environment.tgz") return read(sources().archive); + // The starters the environment pins sit next to its archive: plain file names only. + constexpr std::string_view driverPrefix = "driver/"; + if (relative.starts_with(driverPrefix)) { + const std::filesystem::path name = relative.substr(driverPrefix.size()); + if (name.extension() == ".tgz" && name == name.filename() && name.string().find("..") == std::string::npos) + return read(sources().archive.parent_path() / name); + } constexpr std::string_view prefix = "driver/registry/"; if (sources().registry && relative.starts_with(prefix)) { try { @@ -310,8 +317,11 @@ int run(const Options& options) { outcome.timedOut(); { std::scoped_lock ui{uiMutex}; - if (browser) - browser->addScript("window.close()"); + if (browser) { + try { + browser->addScript("window.close()"); + } catch (const std::exception&) {} // the bridge is gone: the forced exit below still applies + } } if (!stop.stop_requested() && !wake.wait_for(lock, diff --git a/test/web/CMakeLists.txt b/test/web/CMakeLists.txt index 9305ca30..de30d2c7 100644 --- a/test/web/CMakeLists.txt +++ b/test/web/CMakeLists.txt @@ -91,16 +91,16 @@ if(WEBFRONT_DEVELOPER_FIXTURES # webfront_add_driver_test( # [OUTPUT ] [REPORT ] [DRIVER_TIMEOUT ] [FORGE :] - # [ENVIRONMENT INTEGRITY ] [REQUIRES ] [PROVIDES ]) + # [ENVIRONMENT INTEGRITY ] [FRESH_PROJECT ] [REQUIRES ] [PROVIDES ]) function(webfront_add_driver_test name status command) - cmake_parse_arguments(ARG "" "OUTPUT;REPORT;DRIVER_TIMEOUT;FORGE;ENVIRONMENT;INTEGRITY;REQUIRES;PROVIDES" "" ${ARGN}) + cmake_parse_arguments(ARG "" "OUTPUT;REPORT;DRIVER_TIMEOUT;FORGE;ENVIRONMENT;INTEGRITY;FRESH_PROJECT;REQUIRES;PROVIDES" "" ${ARGN}) set(options -DEXPECT_STATUS=${status} "-DCOMMAND=${command}") foreach(option OUTPUT REPORT) if(ARG_${option}) list(APPEND options "-DEXPECT_${option}=${ARG_${option}}") endif() endforeach() - foreach(option FORGE ENVIRONMENT INTEGRITY) + foreach(option FORGE ENVIRONMENT INTEGRITY FRESH_PROJECT) if(ARG_${option}) list(APPEND options "-D${option}=${ARG_${option}}") endif() @@ -121,6 +121,9 @@ if(WEBFRONT_DEVELOPER_FIXTURES webfront_add_driver_test(WfDriverTestPasses 0 "test|adds" OUTPUT "PASSED: 1 spec" REPORT "\"status\":\"passed\"" REQUIRES WfDriverInstalled) # A failing command: its status, its output and the structured report reach CTest. webfront_add_driver_test(WfDriverTestFails 1 "test|fails" OUTPUT "FAILED: 1 spec, 1 failure" REPORT "\"failed\":1" REQUIRES WfDriverInstalled) + # The starters pinned by the environment are served next to its archive. + webfront_add_driver_test(WfDriverCreateStarter 0 "create|pi" OUTPUT "Created" + FRESH_PROJECT "${CMAKE_CURRENT_BINARY_DIR}/wf-driver-starter") webfront_add_driver_test(WfDriverUnknownCommand 1 "nosuchcommand" OUTPUT "nosuchcommand") webfront_add_driver_test(WfDriverTimeout 71 "run|sleep" OUTPUT "time limit of the driver" DRIVER_TIMEOUT 4) webfront_add_driver_test(WfDriverWrongIntegrity 70 "list" OUTPUT "Integrity check failed" From f68a82821ea492a74a4f0a1e64e10cdbfbad7a70 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 15:16:21 +0200 Subject: [PATCH 060/134] Follow the entry declared by environment.json and keep the provisioning digests independent of line endings [#321] --- test/cmake/CheckBootstrapProvisioning.cmake | 7 +++--- test/cmake/RunWfDriver.cmake | 25 ++++++++++++++++++++- test/driver/WebFrontWf.cpp | 6 ++--- test/web/CMakeLists.txt | 8 ++++--- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/test/cmake/CheckBootstrapProvisioning.cmake b/test/cmake/CheckBootstrapProvisioning.cmake index 60c5c7f2..7b107b08 100644 --- a/test/cmake/CheckBootstrapProvisioning.cmake +++ b/test/cmake/CheckBootstrapProvisioning.cmake @@ -2,9 +2,10 @@ # Usage: cmake -DROOT= -DWORK= -P CheckBootstrapProvisioning.cmake include("${ROOT}/cmake/WebFrontBootstrap.cmake") -set(content "webfront bootstrap test archive\n") -set(sri "sha512-k0ItCZvKz9jrgv4XNPzy3yvOrM7JhFjHoBM8YdCPu8FxcXuDSfGXOpWgeHndSdPASykMPm7I2RKFLU8sThVZ+w==") -set(hex "93422d099bcacfd8eb82fe1734fcf2df2bceaccec98458c7a0133c61d08fbbc171717b8349f1973a95a07879dd49d3c04b290c3e6ec8d912852d4f2c4e1559fb") +# No line break: a text-mode write would turn it into CRLF on Windows and change the digest. +set(content "webfront bootstrap test archive") +set(sri "sha512-tp5zEsnN4U2b4SrnPY7GY6cYRK/sFQRO9ZX/xlR7mRyMxqedrks3Oc6EVPRYECyrQE8C4FAg6wH5CVNFoNoT6Q==") +set(hex "b69e7312c9cde14d9be12ae73d8ec663a71844afec15044ef595ffc6547b991c8cc6a79dae4b3739ce8454f458102cab404f02e05020eb01f9095345a0da13e9") function(expect_equal actual expected message) if(NOT actual STREQUAL expected) diff --git a/test/cmake/RunWfDriver.cmake b/test/cmake/RunWfDriver.cmake index 280c0634..2c975008 100644 --- a/test/cmake/RunWfDriver.cmake +++ b/test/cmake/RunWfDriver.cmake @@ -1,7 +1,7 @@ # Runs webfront-wf and checks its exit status and output. # Usage: cmake -DDRIVER= -DPROJECT= -DEXPECT_STATUS= [-DENVIRONMENT= -DINTEGRITY=] # [-DREGISTRY=] [-DTIMEOUT=] [-DEXPECT_OUTPUT=] [-DEXPECT_REPORT=] [-DFORGE=: -# -DWORK=] [-DFRESH_PROJECT=: an empty project instead of PROJECT] -DCOMMAND=|... -P RunWfDriver.cmake +# -DWORK=] [-DRENAME_ENTRY=] [-DFRESH_PROJECT=: an empty project instead of PROJECT] -DCOMMAND=|... -P RunWfDriver.cmake # FORGE replaces ENVIRONMENT with an archive whose environment.json declares the given protocol and API versions. if(FORGE) include("${ROOT}/cmake/WebFrontBootstrap.cmake") @@ -26,6 +26,29 @@ if(FRESH_PROJECT) file(REMOVE_RECURSE "${PROJECT}") file(MAKE_DIRECTORY "${PROJECT}") endif() +if(RENAME_ENTRY) + # The real environment, with its entry module renamed: the driver must follow environment.json. + include("${ROOT}/cmake/WebFrontBootstrap.cmake") + file(REMOVE_RECURSE "${WORK}/renamed") + file(MAKE_DIRECTORY "${WORK}/renamed") + execute_process(COMMAND "${CMAKE_COMMAND}" -E tar xzf "${ENVIRONMENT}" WORKING_DIRECTORY "${WORK}/renamed" RESULT_VARIABLE unpacked) + if(NOT unpacked EQUAL 0) + message(FATAL_ERROR "Cannot unpack the environment") + endif() + file(RENAME "${WORK}/renamed/package/runtime.mjs" "${WORK}/renamed/package/${RENAME_ENTRY}") + file(READ "${WORK}/renamed/package/environment.json" manifest) + string(JSON manifest SET "${manifest}" entry "\"${RENAME_ENTRY}\"") + file(WRITE "${WORK}/renamed/package/environment.json" "${manifest}") + file(REMOVE "${WORK}/renamed.tgz") + execute_process(COMMAND "${CMAKE_COMMAND}" -E tar czf "${WORK}/renamed.tgz" --format=gnutar package + WORKING_DIRECTORY "${WORK}/renamed" RESULT_VARIABLE packed) + if(NOT packed EQUAL 0) + message(FATAL_ERROR "Cannot repack the environment") + endif() + set(ENVIRONMENT "${WORK}/renamed.tgz") + webfront_file_sri("${ENVIRONMENT}" INTEGRITY) +endif() + set(arguments --project "${PROJECT}") if(ENVIRONMENT) list(APPEND arguments --environment "${ENVIRONMENT}" --integrity "${INTEGRITY}") diff --git a/test/driver/WebFrontWf.cpp b/test/driver/WebFrontWf.cpp index ccdd6450..ef6cb3f7 100644 --- a/test/driver/WebFrontWf.cpp +++ b/test/driver/WebFrontWf.cpp @@ -220,11 +220,11 @@ constexpr auto driverScript = R"JS( if (text.startsWith('Developer environment ready.')) break; await new Promise(resolve => setTimeout(resolve, 50)); } - const runtime = await import('/webfront/developer/environment/runtime.mjs'); - if (typeof runtime.runNonInteractive !== 'function') - throw Object.assign(new Error('Bootstrap failed: this developer environment has no non-interactive mode'), {bootstrap: true}); const config = JSON.parse(await report('webfront.developer.config')); const environment = await (await fetch('/webfront/developer/environment/environment.json')).json(); + const runtime = await import(`/webfront/developer/environment/${environment.entry}`); + if (typeof runtime.runNonInteractive !== 'function') + throw Object.assign(new Error('Bootstrap failed: this developer environment has no non-interactive mode'), {bootstrap: true}); config.starters = Object.fromEntries(Object.entries(environment.starters ?? {}).map(([name, value]) => [name, {url: new URL(value.archive, new URL(config.environment, location.href)).href, integrity: value.integrity}])); const argv = JSON.parse(await report('wf.arguments')); diff --git a/test/web/CMakeLists.txt b/test/web/CMakeLists.txt index de30d2c7..73dd3041 100644 --- a/test/web/CMakeLists.txt +++ b/test/web/CMakeLists.txt @@ -91,16 +91,16 @@ if(WEBFRONT_DEVELOPER_FIXTURES # webfront_add_driver_test( # [OUTPUT ] [REPORT ] [DRIVER_TIMEOUT ] [FORGE :] - # [ENVIRONMENT INTEGRITY ] [FRESH_PROJECT ] [REQUIRES ] [PROVIDES ]) + # [ENVIRONMENT INTEGRITY ] [FRESH_PROJECT ] [RENAME_ENTRY ] [REQUIRES ] [PROVIDES ]) function(webfront_add_driver_test name status command) - cmake_parse_arguments(ARG "" "OUTPUT;REPORT;DRIVER_TIMEOUT;FORGE;ENVIRONMENT;INTEGRITY;FRESH_PROJECT;REQUIRES;PROVIDES" "" ${ARGN}) + cmake_parse_arguments(ARG "" "OUTPUT;REPORT;DRIVER_TIMEOUT;FORGE;ENVIRONMENT;INTEGRITY;FRESH_PROJECT;RENAME_ENTRY;REQUIRES;PROVIDES" "" ${ARGN}) set(options -DEXPECT_STATUS=${status} "-DCOMMAND=${command}") foreach(option OUTPUT REPORT) if(ARG_${option}) list(APPEND options "-DEXPECT_${option}=${ARG_${option}}") endif() endforeach() - foreach(option FORGE ENVIRONMENT INTEGRITY FRESH_PROJECT) + foreach(option FORGE ENVIRONMENT INTEGRITY FRESH_PROJECT RENAME_ENTRY) if(ARG_${option}) list(APPEND options "-D${option}=${ARG_${option}}") endif() @@ -124,6 +124,8 @@ if(WEBFRONT_DEVELOPER_FIXTURES # The starters pinned by the environment are served next to its archive. webfront_add_driver_test(WfDriverCreateStarter 0 "create|pi" OUTPUT "Created" FRESH_PROJECT "${CMAKE_CURRENT_BINARY_DIR}/wf-driver-starter") + # The entry module is the one environment.json declares, not a fixed name. + webfront_add_driver_test(WfDriverRenamedEntry 0 "list" RENAME_ENTRY runner.mjs) webfront_add_driver_test(WfDriverUnknownCommand 1 "nosuchcommand" OUTPUT "nosuchcommand") webfront_add_driver_test(WfDriverTimeout 71 "run|sleep" OUTPUT "time limit of the driver" DRIVER_TIMEOUT 4) webfront_add_driver_test(WfDriverWrongIntegrity 70 "list" OUTPUT "Integrity check failed" From f05eaa9c6c54eb52a823f63b700ea564efde0392 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 15:34:34 +0200 Subject: [PATCH 061/134] Pin developer environment 0.6.0 [#321] --- include/webfront/system/DeveloperReleaseData.hpp | 6 +++--- js/developer/environment/bundles.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/webfront/system/DeveloperReleaseData.hpp b/include/webfront/system/DeveloperReleaseData.hpp index 32c7ae3b..97bbb2e8 100644 --- a/include/webfront/system/DeveloperReleaseData.hpp +++ b/include/webfront/system/DeveloperReleaseData.hpp @@ -4,7 +4,7 @@ #include namespace webfront::developer::release { -inline constexpr std::string_view version{"0.5.0"}; -inline constexpr std::string_view environment{"https://ambroise-leclerc.github.io/WebFront/developer/0.5.0/environment.tgz"}; -inline constexpr std::string_view integrity{"sha512-TV6S61kUhnCJc99/Ow890Pro47mfZ0fBqki17lx0xnpCNmcfcqZPpO1SG09Su50WIEtRDopMxt3yvanFwbLEdQ=="}; +inline constexpr std::string_view version{"0.6.0"}; +inline constexpr std::string_view environment{"https://ambroise-leclerc.github.io/WebFront/developer/0.6.0/environment.tgz"}; +inline constexpr std::string_view integrity{"sha512-xidz8ggQFo/UUTttIii+3FRJmGpQPoHhbmk9Fv/wxRA4EKEhD5WeiAcstsuY8H/wXc/jo/bljIYkzyyyrJ1oEg=="}; } // namespace webfront::developer::release diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index ccaf989f..9e67694a 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -46,5 +46,5 @@ "js/developer/vendor/package-lock.json": "f6aefe8b4cb0b15f866f41eae425f6654d2c6c2d96438fd0da878c5651585616", "js/core/bootstrap/bootstrap.bundle.mjs": "536831257f0fc92e31911841750e1e59247f7c64e756b0fcb878efd9860a741f", "js/developer/environment/packages.bundle.mjs": "e36d1052285a313f7db67c1f58f8332da9e97446b1e2085422ebdae379288045", - "include/webfront/system/DeveloperReleaseData.hpp": "d5aaddb2ba839e4c8df46b7d37e2861163233a9018b0f2fb35a6f79831e16569" + "include/webfront/system/DeveloperReleaseData.hpp": "ad3707e158b1f268c679545e17d67b6ba245b2129614cf04dfeacdb351f2a354" } From c381e91588e91cc56d723a6d0dd7830f2066b816 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 15:40:24 +0200 Subject: [PATCH 062/134] Pin the bootstrap environment of the tests on 0.6.0 and document the release [#321] --- cmake/WebFrontBootstrap.cmake | 10 +++++----- docs/CHANGELOG.md | 4 ++-- docs/DEVELOPER_ENVIRONMENT.md | 14 ++++++-------- docs/PROJECT_STATUS.md | 6 +++--- js/developer/tools/RELEASE_NOTES.md | 2 +- test/web/CMakeLists.txt | 10 ++++++++-- 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/cmake/WebFrontBootstrap.cmake b/cmake/WebFrontBootstrap.cmake index 66eec1aa..37211659 100644 --- a/cmake/WebFrontBootstrap.cmake +++ b/cmake/WebFrontBootstrap.cmake @@ -2,11 +2,11 @@ # # It is distinct from include/webfront/system/DeveloperReleaseData.hpp (the environment applications start from) and is # updated by an explicit pull request, once a published environment can build and test itself without interaction. -# 0.5.0 is the last published environment: it has no non-interactive mode yet, so the driver tests run the environment built -# from the current sources (the "environment under test") until the first environment that can bootstrap itself is pinned. -set(WEBFRONT_BOOTSTRAP_VERSION "0.5.0") -set(WEBFRONT_BOOTSTRAP_URL "https://ambroise-leclerc.github.io/WebFront/developer/0.5.0/environment.tgz") -set(WEBFRONT_BOOTSTRAP_INTEGRITY "sha512-TV6S61kUhnCJc99/Ow890Pro47mfZ0fBqki17lx0xnpCNmcfcqZPpO1SG09Su50WIEtRDopMxt3yvanFwbLEdQ==") +# 0.6.0 is the first published environment that runs a wf command without interaction (runNonInteractive). The driver tests also +# run the environment built from the current sources (the "environment under test"), which may be ahead of this pin. +set(WEBFRONT_BOOTSTRAP_VERSION "0.6.0") +set(WEBFRONT_BOOTSTRAP_URL "https://ambroise-leclerc.github.io/WebFront/developer/0.6.0/environment.tgz") +set(WEBFRONT_BOOTSTRAP_INTEGRITY "sha512-xidz8ggQFo/UUTttIii+3FRJmGpQPoHhbmk9Fv/wxRA4EKEhD5WeiAcstsuY8H/wXc/jo/bljIYkzyyyrJ1oEg==") # A directory holding environment.tgz (the pinned archive) replaces the download on a machine without network access. set(WEBFRONT_BOOTSTRAP_DIR "" CACHE PATH "Directory with the pinned bootstrap environment.tgz, instead of downloading it") diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9f658b3f..25e7edbd 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -4,9 +4,9 @@ ### Added -- `webfront-wf` test driver and bootstrap provisioning (#321): runs one `wf` command without interaction on a project +- `webfront-wf` test driver and bootstrap provisioning (#321, developer distribution 0.6.0 published as `developer-v0.6.0`, pinned by `DeveloperReleaseData.hpp` and by the bootstrap): runs one `wf` command without interaction on a project and exits with its status (64 usage, 70 bootstrap failure, 71 time limit, 72 no result), with an optional JSON report. - `cmake/WebFrontBootstrap.cmake` pins the bootstrap environment (0.5.0 for now) and, with `ENABLE_TESTING=ON`, downloads + `cmake/WebFrontBootstrap.cmake` pins the bootstrap environment (0.6.0) and, with `ENABLE_TESTING=ON`, downloads and verifies it at configure time, or takes it from `WEBFRONT_BOOTSTRAP_DIR`. `environment.json` declares `protocol` and `api`; `webfront.developer.config` exposes the supported versions and the loader refuses an incompatible archive with an explicit diagnostic. The Linux CEF job blocks the public network after configure. diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 7a5c12f5..40b9628b 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -48,7 +48,7 @@ native tests from empty working directories, with developer callbacks absent. Pa HTTP 200, CORS `*` and the pinned archive bytes. These checks supplement offline CTest fixtures. The default configuration is generated in `include/webfront/system/DeveloperReleaseData.hpp` and targets -`https://ambroise-leclerc.github.io/WebFront/developer/0.5.0/environment.tgz`. This version (project manifest, `wf restore`, `wf run`, `wf check` and the complete terminal) is published and archived as `developer-v0.5.0`. Published 0.4.1 and 0.4.0 stay immutable; 0.4.0 targets the former include layout. The configuration pins one version and +`https://ambroise-leclerc.github.io/WebFront/developer/0.6.0/environment.tgz`. This version (`wf build`, `wf dev`, `wf test` and the non-interactive entry, on top of the 0.5.0 manifest, `wf restore`, `wf run`, `wf check` and the complete terminal) is published and archived as `developer-v0.6.0`. Published 0.5.0, 0.4.1 and 0.4.0 stay immutable; 0.4.0 targets the former include layout. The configuration pins one version and its SHA-512 rather than resolving a mutable `latest` channel. An explicit `DeveloperBootstrapOptions{.environment = url, .integrity = trustedHash}` still selects a different HTTPS/CORS repository or a same-origin test fixture. Users install neither npm nor Node.js. @@ -435,8 +435,7 @@ the Worker, cancels polling and aborts staged publication; a publication already the preview before stopping. The last successful preview stays available. Browser disconnection also stops the loop. -`wf build`, `wf dev` and `wf test` are in the 0.6.0 environment sources (not published); the release pin stays on published 0.5.0. To try -them before the next release, provision an archive rebuilt from these sources as described below. +`wf build`, `wf dev` and `wf test` are in developer distribution 0.6.0, which `DeveloperReleaseData.hpp` pins (published as `developer-v0.6.0`). ## Tests (`wf test`) @@ -526,11 +525,10 @@ field). `webfront.developer.config` carries `supported: {protocol: [1], api: [1] `Incompatible WebFront developer environment: api version 2, this application supports 1`; it never falls back. A change to the callbacks increments `apiVersion` and requires publishing a new bootstrap environment. -The pin is 0.5.0, the last published environment, which has no non-interactive mode: the driver reports it as a bootstrap -failure (70). Until an environment that can run `wf test` is published and pinned (the milestone of #321, a maintainer -step), the CTest cases `WfDriver*` run the environment built from the current sources (`WEBFRONT_DEVELOPER_FIXTURES`): -`wf install` and `wf test` on a fixture project (pass, fail, report file), an unknown command, the time limit, a wrong -integrity, a missing archive and archives with an incompatible protocol or API. `BootstrapProvisioning` checks the +The pin is 0.6.0, the first published environment with a non-interactive mode (`WfDriverPinned` runs `wf init` from it; the starters are not provisioned, only the archive). The other `WfDriver*` cases run the environment built from the current sources +(`WEBFRONT_DEVELOPER_FIXTURES`), which may be ahead of the pin: `wf install` and `wf test` on a fixture project (pass, fail, +report file), a starter, an entry module renamed in `environment.json`, an unknown command, the time limit, a wrong integrity, +a missing archive and archives with an incompatible protocol or API. `BootstrapProvisioning` checks the configure-time provisioning (verified download, reuse, local directory, wrong digest, malformed value). The Linux CEF CI job blocks the public network after the configure step. diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index 6ddad553..7ab77891 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -10,8 +10,8 @@ removed without redirect headers (see `docs/CHANGELOG.md`). Browser sources live components, build tools, vendoring tools); tests live in `test/{unit,web,fuzz,fixtures,cmake}`. The CTest case `RepositoryLayout` enforces the root. The generated-provider include changed, so the developer distribution is bumped to 0.4.1, published and archived as `developer-v0.4.1`. Version 0.5.0 (project manifest, `wf restore`, -`wf run`/`wf exec`, `wf check`, the complete terminal) is pinned by `DeveloperReleaseData.hpp`, published and archived as `developer-v0.5.0`. On 2026-10-23 Pages returned HTTP 200, -CORS `*` and archives byte-identical to a reproducible local build; the live `--public` test (CEF, Linux) downloaded them, +`wf run`/`wf exec`, `wf check`, the complete terminal) was published as `developer-v0.5.0`; 0.6.0 (`wf build`, `wf dev`, `wf test`, the non-interactive entry) is pinned by `DeveloperReleaseData.hpp`, published and archived as `developer-v0.6.0`. On 2026-10-23 Pages returned HTTP 200 for 0.6.0, +CORS `*` and archives byte-identical to a reproducible local build; the live `--public` test (WebKitGTK, Linux) downloaded them, fetched React from npm, ran the PI and Life previews and generated both providers. ## CI test duration (#298, 2026-10-21) @@ -132,7 +132,7 @@ Status snapshot: 2026-07-19. Optional mddlog integration note: 2026-10-02. Newco manifest permissions, which frame the `context` API only and are not a sandbox. Peers require explicit compatible roots/direct dependencies. The environment's terminal (#308) runs `wf`, built-in and C++ commands (`webfront::Commands`: per-browser coroutine sessions, streamed output, Ctrl+C cancellation without waiting, drained at shutdown) with - multi-row editing, CJK/emoji widths, persistent history and completion. `wf build` / `wf dev` (#309, environment sources) publish manifest entries and rebuild the preview automatically with a reused esbuild context, bounded input polling, error overlays and Ctrl+C cancellation; `wf test` (#310, environment sources) runs the manifest's specs under the project's locked `jasmine-core` in a hidden frame, with a structured report, exit codes 0/1/124/130 and a non-interactive entry that reports to C++; the release pin is unchanged. `webfront-wf` (#321) runs one `wf` command without interaction and returns its status; the bootstrap environment is pinned and verified at configure time (0.5.0 for now: the first environment able to run `wf test` still has to be published and pinned), and `environment.json` declares the `protocol` and `api` versions that the loader checks. `wf restore [--offline]` (0.5.0, #306) rebuilds or checks + multi-row editing, CJK/emoji widths, persistent history and completion. `wf build` / `wf dev` (#309, environment sources) publish manifest entries and rebuild the preview automatically with a reused esbuild context, bounded input polling, error overlays and Ctrl+C cancellation; `wf test` (#310, environment sources) runs the manifest's specs under the project's locked `jasmine-core` in a hidden frame, with a structured report, exit codes 0/1/124/130 and a non-interactive entry that reports to C++; the release pin is 0.6.0. `webfront-wf` (#321) runs one `wf` command without interaction and returns its status; the bootstrap environment is pinned and verified at configure time (0.6.0, which also contains `wf build`, `wf dev` and `wf test`), and `environment.json` declares the `protocol` and `api` versions that the loader checks. `wf restore [--offline]` (0.5.0, #306) rebuilds or checks the cache from the lock, from the application's registry option, else the manifest's, else npmjs. See [DEVELOPER_ENVIRONMENT](DEVELOPER_ENVIRONMENT.md) for exact commands and limits. diff --git a/js/developer/tools/RELEASE_NOTES.md b/js/developer/tools/RELEASE_NOTES.md index bb9be579..1f0e9e24 100644 --- a/js/developer/tools/RELEASE_NOTES.md +++ b/js/developer/tools/RELEASE_NOTES.md @@ -10,4 +10,4 @@ Version 0.4.0 updates the Life starter text for a developer audience. The simula Version 0.5.0 introduces the project manifest `webfront.project.json`: `wf init`, manifest-driven `wf install` (with `--update`), `wf preview` and `wf embed`, and a lock that records the digest of the manifest dependencies. `wf install` now requires a manifest. The starters ship their own manifest. -Version 0.6.0 (in development, not published) adds `wf test` (the project's Jasmine, obtained by `wf install jasmine-core`, runs the specs of `test.specs` in the browser, with a structured report and a non-interactive entry), `wf build` and incremental `wf dev`, with bounded input polling, diagnostics in the preview and Ctrl+C cancellation. A publication whose commit has completed is displayed before cancellation ends the command. The default pin remains on published 0.5.0. +Version 0.6.0 (published as `developer-v0.6.0`) adds `wf test` (the project's Jasmine, obtained by `wf install jasmine-core`, runs the specs of `test.specs` in the browser, with a structured report and a non-interactive entry), `wf build` and incremental `wf dev`, with bounded input polling, diagnostics in the preview and Ctrl+C cancellation. A publication whose commit has completed is displayed before cancellation ends the command. `DeveloperReleaseData.hpp` and the bootstrap environment of the tests pin it. `environment.json` now declares `api` (the `webfront.developer.*` version, 1); an environment that predates the field reads as 1. diff --git a/test/web/CMakeLists.txt b/test/web/CMakeLists.txt index 73dd3041..57679989 100644 --- a/test/web/CMakeLists.txt +++ b/test/web/CMakeLists.txt @@ -91,9 +91,9 @@ if(WEBFRONT_DEVELOPER_FIXTURES # webfront_add_driver_test( # [OUTPUT ] [REPORT ] [DRIVER_TIMEOUT ] [FORGE :] - # [ENVIRONMENT INTEGRITY ] [FRESH_PROJECT ] [RENAME_ENTRY ] [REQUIRES ] [PROVIDES ]) + # [ENVIRONMENT INTEGRITY ] [FRESH_PROJECT ] [RENAME_ENTRY ] [PINNED] [REQUIRES ] [PROVIDES ]) function(webfront_add_driver_test name status command) - cmake_parse_arguments(ARG "" "OUTPUT;REPORT;DRIVER_TIMEOUT;FORGE;ENVIRONMENT;INTEGRITY;FRESH_PROJECT;RENAME_ENTRY;REQUIRES;PROVIDES" "" ${ARGN}) + cmake_parse_arguments(ARG "PINNED" "OUTPUT;REPORT;DRIVER_TIMEOUT;FORGE;ENVIRONMENT;INTEGRITY;FRESH_PROJECT;RENAME_ENTRY;REQUIRES;PROVIDES" "" ${ARGN}) set(options -DEXPECT_STATUS=${status} "-DCOMMAND=${command}") foreach(option OUTPUT REPORT) if(ARG_${option}) @@ -105,6 +105,10 @@ if(WEBFRONT_DEVELOPER_FIXTURES list(APPEND options "-D${option}=${ARG_${option}}") endif() endforeach() + if(ARG_PINNED) + # No environment passed: the driver runs the pinned bootstrap environment provisioned at configure time. + list(APPEND options -DENVIRONMENT= -DINTEGRITY= -DREGISTRY=) + endif() if(ARG_DRIVER_TIMEOUT) list(APPEND options -DTIMEOUT=${ARG_DRIVER_TIMEOUT}) endif() @@ -126,6 +130,8 @@ if(WEBFRONT_DEVELOPER_FIXTURES FRESH_PROJECT "${CMAKE_CURRENT_BINARY_DIR}/wf-driver-starter") # The entry module is the one environment.json declares, not a fixed name. webfront_add_driver_test(WfDriverRenamedEntry 0 "list" RENAME_ENTRY runner.mjs) + # The pinned bootstrap environment, downloaded and verified at configure time, runs a command by itself. + webfront_add_driver_test(WfDriverPinned 0 "init" PINNED OUTPUT "Created webfront.project.json" FRESH_PROJECT "${CMAKE_CURRENT_BINARY_DIR}/wf-driver-pinned") webfront_add_driver_test(WfDriverUnknownCommand 1 "nosuchcommand" OUTPUT "nosuchcommand") webfront_add_driver_test(WfDriverTimeout 71 "run|sleep" OUTPUT "time limit of the driver" DRIVER_TIMEOUT 4) webfront_add_driver_test(WfDriverWrongIntegrity 70 "list" OUTPUT "Integrity check failed" From 9b39d8c512996357b0b18f1c07f20c017cc3f841 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 16:17:18 +0200 Subject: [PATCH 063/134] Run the browser integration suite through wf test and the local registry [#311] test/web/suite is a WebFront project (jasmine-core, react, react-dom). webtest becomes the webfront-wf driver with the callbacks of the specs; the Signal Studio page is a JSX module built by esbuild-wasm. SpecRunner.html and the JasmineFS/ReactFS/BabelFS composition leave the test. --- AGENTS.md | 12 +- cmake/Frontends.cmake | 15 +- docs/CHANGELOG.md | 6 + docs/DEVELOPER_ENVIRONMENT.md | 4 + docs/PROJECT_STATUS.md | 14 + docs/WEBVIEW2.md | 2 +- .../ADR-003-protocole-binaire-et-bornes.md | 2 +- .../ADR-004-appels-asynchrones-et-erreurs.md | 2 +- ...DR-008-contenu-de-confiance-et-origines.md | 2 +- ...DR-009-modules-et-assets-reproductibles.md | 2 +- test/driver/WebFrontWf.cpp | 363 +--------------- test/driver/WfDriver.hpp | 399 ++++++++++++++++++ test/web/CMakeLists.txt | 45 +- test/web/JasmineTest.cpp | 205 ++++----- test/web/SpecRunner.html | 18 - test/web/fixtures/react.html | 173 -------- test/web/js/react-demo-specs.mjs | 76 ---- test/web/suite/pages/a+b.html | 3 + .../web/{ => suite/pages}/js/origin-probe.mjs | 0 test/web/{ => suite/pages}/origin-probe.html | 0 test/web/suite/react-demo/SignalStudio.jsx | 100 +++++ test/web/suite/react-demo/style.css | 59 +++ .../specs}/content-policy-specs.mjs | 2 +- .../{js => suite/specs}/module-fixture.mjs | 0 test/web/suite/specs/react-demo-specs.mjs | 72 ++++ .../{js => suite/specs}/webfront-specs.mjs | 31 +- test/web/suite/webfront.project.json | 7 + 27 files changed, 821 insertions(+), 793 deletions(-) create mode 100644 test/driver/WfDriver.hpp delete mode 100644 test/web/SpecRunner.html delete mode 100644 test/web/fixtures/react.html delete mode 100644 test/web/js/react-demo-specs.mjs create mode 100644 test/web/suite/pages/a+b.html rename test/web/{ => suite/pages}/js/origin-probe.mjs (100%) rename test/web/{ => suite/pages}/origin-probe.html (100%) create mode 100644 test/web/suite/react-demo/SignalStudio.jsx create mode 100644 test/web/suite/react-demo/style.css rename test/web/{js => suite/specs}/content-policy-specs.mjs (98%) rename test/web/{js => suite/specs}/module-fixture.mjs (100%) create mode 100644 test/web/suite/specs/react-demo-specs.mjs rename test/web/{js => suite/specs}/webfront-specs.mjs (92%) create mode 100644 test/web/suite/webfront.project.json diff --git a/AGENTS.md b/AGENTS.md index 910b6d3c..7dfb7f47 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -20,7 +20,7 @@ The README introduces WebFront through the Game of Life walkthrough, demonstrati - `examples/`: only Hello World (`hello-world/`) and Game of Life (`life/`, with console, developer and embedded stages). - `js/core/`: readable browser bridge, fallback and bootstrap loader compiled into `include/webfront/`, plus the embedding CMake modules; `js/developer/`: developer environment (its terminal and `wf`), build and vendoring tools. Production C++ remains header-only in `include/webfront/`. - `js/developer/tools/starters/pi/`, `test/fixtures/`, `test/web/fixtures/`: retained package and regression fixtures, not public example applications. -- `test/unit/`: Catch2 unit tests; `test/web/`: Jasmine real-browser integration test; `test/driver/`: `webfront-wf`, the non-interactive `wf` driver for tests; `test/fuzz/`, `test/fixtures/`; `test/cmake/`: CMake test scripts and sub-projects. The `RepositoryLayout` CTest case pins the tracked root. +- `test/unit/`: Catch2 unit tests; `test/web/`: real-browser integration (`suite/` is the WebFront project of the Jasmine specs, run by `webtest` through `wf test`); `test/driver/`: `webfront-wf`, the non-interactive `wf` driver for tests; `test/fuzz/`, `test/fixtures/`; `test/cmake/`: CMake test scripts and sub-projects. The `RepositoryLayout` CTest case pins the tracked root. - `cmake/`: build modules (frontends, CEF, CPM, compiler options); `.github/`: workflows, `.github/CONTRIBUTING.md`. - `.devcontainer/`: devcontainer and its Dockerfile; `docs/`: documentation, `docs/CHANGELOG.md`, `docs/Doxyfile.in`. - `docs/PROJECT_STATUS.md`: evidence-based status snapshot and known limitations. @@ -51,10 +51,12 @@ ctest --test-dir build --output-on-failure --parallel 4 # Run one Catch2 scenario directly ./build/test/unit/tests "Scenario: JsFunction" -# Linux real-browser integration test +# Linux real-browser integration test (the Jasmine suite needs the offline registry of the fixtures) +node js/developer/tools/build.mjs build-developer-environment +node js/developer/tools/fixtures.mjs build-developer-environment cmake -S . -B build-cef -DCMAKE_BUILD_TYPE=Release \ - -DWEBFRONT_EMBED_CEF=ON -DENABLE_TESTING=ON -cmake --build build-cef --target webtest --parallel + -DWEBFRONT_EMBED_CEF=ON -DENABLE_TESTING=ON -DWEBFRONT_DEVELOPER_FIXTURES=$PWD/build-developer-environment +cmake --build build-cef --target webtest webfront-wf --parallel ctest --test-dir build-cef -L web-integration --output-on-failure --parallel 4 ``` @@ -97,7 +99,7 @@ Exception: a purely C++ change that reuses an existing encoding, introduces no n - Keep production implementation header-only under `include/`; `examples/` contains the two public examples; browser resources live in `js/`. - Prefer standard-library facilities and explicit ownership. Keep public headers ODR-safe (`inline`/templates as appropriate). - Catch2 tests use `SCENARIO`/`GIVEN`/`WHEN`/`THEN` and deterministic mocks. -- Jasmine tests use native modules and must report completion to C++, close themselves, return a meaningful process status, and have a CTest timeout. +- Jasmine specs are the project `test/web/suite/`, built by esbuild-wasm and run by `wf test` under the locked `jasmine-core` (installed from the local registry by `WebSuiteInstall`); `webtest` is the `webfront-wf` driver plus the C++ callbacks of the specs. The specs tell C++ they are done (`specsFinished`), the process status is that of `wf test` (or 1 when C++ did not observe every call), and the CTest case has a timeout. Without `WEBFRONT_DEVELOPER_FIXTURES` the Jasmine case is not registered. - Every bug fix needs a failing regression test at the lowest useful level. Bridge changes also need the browser integration test. - Tests must not require user input, a fixed pre-existing browser session, or public network access after dependencies are configured. diff --git a/cmake/Frontends.cmake b/cmake/Frontends.cmake index 1c6bb516..742a9f5c 100644 --- a/cmake/Frontends.cmake +++ b/cmake/Frontends.cmake @@ -177,7 +177,10 @@ function(webfront_set_browser_test_properties name assets_directory timeout) endfunction() # Shared Jasmine and lifecycle registration; engine-specific cases stay in the support module. +# ARGUMENTS are passed to the Jasmine target (webtest runs `wf test` on a prepared project); SKIP_JASMINE registers the +# lifecycle and engine cases only, when the target cannot run on this configuration. function(webfront_add_browser_tests target frontend assets_directory lifecycle_target) + cmake_parse_arguments(ARG "SKIP_JASMINE" "" "ARGUMENTS" ${ARGN}) if(NOT frontend IN_LIST WEBFRONT_FRONTEND_REGISTRY) message(FATAL_ERROR "Unknown browser-test frontend '${frontend}'") endif() @@ -218,11 +221,13 @@ function(webfront_add_browser_tests target frontend assets_directory lifecycle_t webfront_set_browser_test_properties("${lifecycle_name}" "${assets_directory}" "${WEBFRONT_FRONTEND_${frontend}_TEST_TIMEOUT}") endforeach() - set(name "${WEBFRONT_FRONTEND_${frontend}_TEST_NAME}") - add_test(NAME ${name} COMMAND ${command}) - list(APPEND shared_tests "${name}") - webfront_set_browser_test_properties("${name}" "${assets_directory}" - "${WEBFRONT_FRONTEND_${frontend}_TEST_TIMEOUT}") + if(NOT ARG_SKIP_JASMINE) + set(name "${WEBFRONT_FRONTEND_${frontend}_TEST_NAME}") + add_test(NAME ${name} COMMAND ${command} ${ARG_ARGUMENTS}) + list(APPEND shared_tests "${name}") + webfront_set_browser_test_properties("${name}" "${assets_directory}" + "${WEBFRONT_FRONTEND_${frontend}_TEST_TIMEOUT}") + endif() endif() # Per-engine tests may be independent of a display and must not be skipped with Jasmine. set(setup "${WEBFRONT_FRONTEND_${frontend}_TEST_SETUP}") diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 25e7edbd..1aaf8c5e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -81,6 +81,12 @@ ### Changed +- The browser integration suite `test/web/` runs through `wf test` (#311): `test/web/suite/` is a WebFront project + (`jasmine-core`, `react`, `react-dom` from the local registry), `webtest` is the `webfront-wf` driver with the + callbacks of the specs (`test/driver/WfDriver.hpp`), and the Signal Studio page is a JSX module built by esbuild-wasm. + `SpecRunner.html` and the `TestFS` composition of `JasmineFS`, `ReactFS` and `BabelFS` are removed from the test. The + Jasmine CTest case needs `WEBFRONT_DEVELOPER_FIXTURES` (otherwise only the lifecycle and engine cases are registered); + the pinned bootstrap environment runs it. - **Breaking:** `BasicWF::getLink(id)`, whose reference could outlive a released connection, is replaced by `findLink(id)`, which shares the link with the caller (null once the browser is gone). - `DeveloperBootstrapOptions::registry` is now `std::optional`: unset, the manifest's registry diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 40b9628b..1038b841 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -518,6 +518,10 @@ webfront-wf --project [--environment --integrity