cf-workers-native 0.0.0-stage → 0.1.2-beta.local.sha2f5e4e6956f4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/Package.swift +25 -0
- package/README.md +92 -2
- package/dist/android.d.ts +2 -0
- package/dist/android.js +1 -0
- package/dist/browser/abort/index.d.ts +13 -0
- package/dist/browser/abort/index.js +66 -0
- package/dist/browser/body/index.d.ts +24 -0
- package/dist/browser/body/index.js +116 -0
- package/dist/browser/body/stream-body.d.ts +13 -0
- package/dist/browser/body/stream-body.js +84 -0
- package/dist/browser/documents/body.d.ts +3 -0
- package/dist/browser/documents/body.js +48 -0
- package/dist/browser/documents/form-body.d.ts +1 -0
- package/dist/browser/documents/form-body.js +54 -0
- package/dist/browser/documents/host.d.ts +11 -0
- package/dist/browser/documents/host.js +256 -0
- package/dist/browser/documents/links-source.d.ts +1 -0
- package/dist/browser/documents/links-source.js +1 -0
- package/dist/browser/documents/links.d.ts +1 -0
- package/dist/browser/documents/links.js +33 -0
- package/dist/browser/documents/page-config.d.ts +5 -0
- package/dist/browser/documents/page-config.js +5 -0
- package/dist/browser/documents/page-source.d.ts +1 -0
- package/dist/browser/documents/page-source.js +1 -0
- package/dist/browser/documents/page.d.ts +2 -0
- package/dist/browser/documents/page.js +153 -0
- package/dist/browser/documents/registration.d.ts +5 -0
- package/dist/browser/documents/registration.js +75 -0
- package/dist/browser/documents/runtime.d.ts +7 -0
- package/dist/browser/documents/runtime.js +161 -0
- package/dist/browser/documents/service-worker.js +285 -0
- package/dist/browser/encoding/index.d.ts +7 -0
- package/dist/browser/encoding/index.js +3 -0
- package/dist/browser/fetch/LICENSE-3RD-PARTY.md +9 -0
- package/dist/browser/fetch/LICENSE-APACHE +177 -0
- package/dist/browser/fetch/host-call.d.ts +3 -0
- package/dist/browser/fetch/host-call.js +67 -0
- package/dist/browser/fetch/index.d.ts +5 -0
- package/dist/browser/fetch/index.js +96 -0
- package/dist/browser/fetch/interop.d.ts +6 -0
- package/dist/browser/fetch/interop.js +48 -0
- package/dist/browser/fetch/native-network.d.ts +20 -0
- package/dist/browser/fetch/native-network.js +233 -0
- package/dist/browser/fetch/outbound.d.ts +2 -0
- package/dist/browser/fetch/outbound.js +11 -0
- package/dist/browser/fetch/relay.d.ts +7 -0
- package/dist/browser/fetch/relay.js +100 -0
- package/dist/browser/fetch/scope.d.ts +8 -0
- package/dist/browser/fetch/scope.js +108 -0
- package/dist/browser/fetch/transport.d.ts +39 -0
- package/dist/browser/fetch/transport.js +136 -0
- package/dist/browser/headers/LICENSE-3RD-PARTY.md +9 -0
- package/dist/browser/headers/LICENSE-APACHE +177 -0
- package/dist/browser/headers/index.d.ts +20 -0
- package/dist/browser/headers/index.js +194 -0
- package/dist/browser/isolated/bridge.d.ts +8 -0
- package/dist/browser/isolated/bridge.js +267 -0
- package/dist/browser/isolated/protocol.d.ts +40 -0
- package/dist/browser/isolated/protocol.js +1 -0
- package/dist/browser/isolated/transport.d.ts +2 -0
- package/dist/browser/isolated/transport.js +157 -0
- package/dist/browser/request/LICENSE-3RD-PARTY.md +10 -0
- package/dist/browser/request/LICENSE-APACHE +177 -0
- package/dist/browser/request/index.d.ts +48 -0
- package/dist/browser/request/index.js +182 -0
- package/dist/browser/response/LICENSE-3RD-PARTY.md +10 -0
- package/dist/browser/response/LICENSE-APACHE +177 -0
- package/dist/browser/response/index.d.ts +43 -0
- package/dist/browser/response/index.js +192 -0
- package/dist/browser/response/status.d.ts +1 -0
- package/dist/browser/response/status.js +75 -0
- package/dist/browser/structured-clone/index.d.ts +1 -0
- package/dist/browser/structured-clone/index.js +479 -0
- package/dist/cloudflare/apis/cloudflare-node/index.d.ts +18 -0
- package/dist/cloudflare/apis/cloudflare-node/index.js +150 -0
- package/dist/cloudflare/apis/cloudflare-workers/index.d.ts +8 -0
- package/dist/cloudflare/apis/cloudflare-workers/index.js +37 -0
- package/dist/cloudflare/apis/types.d.ts +7 -0
- package/dist/cloudflare/apis/types.js +1 -0
- package/dist/cloudflare/bindings/config.d.ts +42 -0
- package/dist/cloudflare/bindings/config.js +280 -0
- package/dist/cloudflare/bindings/kv/contract.d.ts +6 -0
- package/dist/cloudflare/bindings/kv/contract.js +181 -0
- package/dist/cloudflare/bindings/kv/index.d.ts +18 -0
- package/dist/cloudflare/bindings/kv/index.js +61 -0
- package/dist/cloudflare/bindings/kv/storage.d.ts +25 -0
- package/dist/cloudflare/bindings/kv/storage.js +320 -0
- package/dist/cloudflare/bindings/kv/types.d.ts +50 -0
- package/dist/cloudflare/bindings/kv/types.js +1 -0
- package/dist/cloudflare/bindings/remote.d.ts +8 -0
- package/dist/cloudflare/bindings/remote.js +261 -0
- package/dist/cloudflare/workers/contract.d.ts +8 -0
- package/dist/cloudflare/workers/contract.js +65 -0
- package/dist/cloudflare/workers/feature.d.ts +10 -0
- package/dist/cloudflare/workers/feature.js +28 -0
- package/dist/cloudflare/workers/runtime.d.ts +23 -0
- package/dist/cloudflare/workers/runtime.js +121 -0
- package/dist/cloudflare/workers/types.d.ts +49 -0
- package/dist/cloudflare/workers/types.js +1 -0
- package/dist/cloudflare/workers/worker-runtime.d.ts +44 -0
- package/dist/cloudflare/workers/worker-runtime.js +267 -0
- package/dist/compat/assert/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/assert/LICENSE-APACHE +177 -0
- package/dist/compat/assert/assertion-error.d.ts +26 -0
- package/dist/compat/assert/assertion-error.js +468 -0
- package/dist/compat/assert/diff.d.ts +26 -0
- package/dist/compat/assert/diff.js +329 -0
- package/dist/compat/assert/errors.d.ts +11 -0
- package/dist/compat/assert/errors.js +55 -0
- package/dist/compat/assert/index.cjs +24 -0
- package/dist/compat/assert/index.d.cts +43 -0
- package/dist/compat/assert/index.d.ts +50 -0
- package/dist/compat/assert/index.js +858 -0
- package/dist/compat/async-hooks/LICENSE-APACHE +177 -0
- package/dist/compat/async-hooks/NOTICE.md +8 -0
- package/dist/compat/async-hooks/callbacks.d.ts +7 -0
- package/dist/compat/async-hooks/callbacks.js +18 -0
- package/dist/compat/async-hooks/hooks.d.ts +10 -0
- package/dist/compat/async-hooks/hooks.js +111 -0
- package/dist/compat/async-hooks/index.d.ts +41 -0
- package/dist/compat/async-hooks/index.js +298 -0
- package/dist/compat/buffer/LICENSE-3RD-PARTY.md +15 -0
- package/dist/compat/buffer/LICENSE-APACHE +177 -0
- package/dist/compat/buffer/blob.d.ts +22 -0
- package/dist/compat/buffer/blob.js +210 -0
- package/dist/compat/buffer/bytes.d.ts +34 -0
- package/dist/compat/buffer/bytes.js +228 -0
- package/dist/compat/buffer/errors.d.ts +41 -0
- package/dist/compat/buffer/errors.js +265 -0
- package/dist/compat/buffer/index.d.ts +25 -0
- package/dist/compat/buffer/index.js +24 -0
- package/dist/compat/buffer/internal-buffer.d.ts +148 -0
- package/dist/compat/buffer/internal-buffer.js +1809 -0
- package/dist/compat/buffer/support.d.ts +13 -0
- package/dist/compat/buffer/support.js +65 -0
- package/dist/compat/child-process/LICENSE-3RD-PARTY.md +8 -0
- package/dist/compat/child-process/LICENSE-APACHE +177 -0
- package/dist/compat/child-process/errors.d.ts +4 -0
- package/dist/compat/child-process/errors.js +6 -0
- package/dist/compat/child-process/index.d.ts +49 -0
- package/dist/compat/child-process/index.js +96 -0
- package/dist/compat/cluster/LICENSE-3RD-PARTY.md +40 -0
- package/dist/compat/cluster/LICENSE-APACHE +177 -0
- package/dist/compat/cluster/errors.d.ts +4 -0
- package/dist/compat/cluster/errors.js +6 -0
- package/dist/compat/cluster/index.d.ts +47 -0
- package/dist/compat/cluster/index.js +88 -0
- package/dist/compat/constants/LICENSE-3RD-PARTY.md +6 -0
- package/dist/compat/constants/LICENSE-APACHE +177 -0
- package/dist/compat/constants/index.d.ts +481 -0
- package/dist/compat/constants/index.js +488 -0
- package/dist/compat/dgram/LICENSE-3RD-PARTY.md +8 -0
- package/dist/compat/dgram/LICENSE-APACHE +177 -0
- package/dist/compat/dgram/index.d.ts +10 -0
- package/dist/compat/dgram/index.js +132 -0
- package/dist/compat/diagnostics-channel/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/diagnostics-channel/LICENSE-APACHE +177 -0
- package/dist/compat/diagnostics-channel/index.d.ts +73 -0
- package/dist/compat/diagnostics-channel/index.js +261 -0
- package/dist/compat/diagnostics-channel/native.d.ts +26 -0
- package/dist/compat/diagnostics-channel/native.js +154 -0
- package/dist/compat/dns/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/dns/LICENSE-APACHE +177 -0
- package/dist/compat/dns/client.d.ts +72 -0
- package/dist/compat/dns/client.js +161 -0
- package/dist/compat/dns/constants.d.ts +27 -0
- package/dist/compat/dns/constants.js +31 -0
- package/dist/compat/dns/errors.d.ts +8 -0
- package/dist/compat/dns/errors.js +12 -0
- package/dist/compat/dns/index.d.ts +97 -0
- package/dist/compat/dns/index.js +127 -0
- package/dist/compat/dns/parser.d.ts +18 -0
- package/dist/compat/dns/parser.js +144 -0
- package/dist/compat/dns/promise-resolver.d.ts +82 -0
- package/dist/compat/dns/promise-resolver.js +113 -0
- package/dist/compat/dns/promises.d.ts +50 -0
- package/dist/compat/dns/promises.js +53 -0
- package/dist/compat/dns/resolver.d.ts +34 -0
- package/dist/compat/dns/resolver.js +415 -0
- package/dist/compat/domain/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/domain/LICENSE-APACHE +177 -0
- package/dist/compat/domain/index.d.ts +22 -0
- package/dist/compat/domain/index.js +79 -0
- package/dist/compat/fs/index.d.ts +85 -0
- package/dist/compat/fs/index.js +255 -0
- package/dist/compat/fs/promises/index.d.ts +3 -0
- package/dist/compat/fs/promises/index.js +3 -0
- package/dist/compat/http/index.d.ts +322 -0
- package/dist/compat/http/index.js +1356 -0
- package/dist/compat/http/registry.d.ts +19 -0
- package/dist/compat/http/registry.js +13 -0
- package/dist/compat/http-agent/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/http-agent/LICENSE-APACHE +177 -0
- package/dist/compat/http-agent/index.d.ts +7 -0
- package/dist/compat/http-agent/index.js +10 -0
- package/dist/compat/http-client/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/http-client/LICENSE-APACHE +177 -0
- package/dist/compat/http-client/index.d.ts +6 -0
- package/dist/compat/http-client/index.js +7 -0
- package/dist/compat/http-incoming/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/http-incoming/LICENSE-APACHE +177 -0
- package/dist/compat/http-incoming/index.d.ts +6 -0
- package/dist/compat/http-incoming/index.js +9 -0
- package/dist/compat/http2/LICENSE-3RD-PARTY.md +29 -0
- package/dist/compat/http2/LICENSE-APACHE +177 -0
- package/dist/compat/http2/constants.d.ts +255 -0
- package/dist/compat/http2/constants.js +515 -0
- package/dist/compat/http2/errors.d.ts +4 -0
- package/dist/compat/http2/errors.js +6 -0
- package/dist/compat/http2/index.d.ts +283 -0
- package/dist/compat/http2/index.js +68 -0
- package/dist/compat/https/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/https/LICENSE-APACHE +177 -0
- package/dist/compat/https/agent.d.ts +10 -0
- package/dist/compat/https/agent.js +99 -0
- package/dist/compat/https/errors.d.ts +4 -0
- package/dist/compat/https/errors.js +6 -0
- package/dist/compat/https/index.d.ts +20 -0
- package/dist/compat/https/index.js +50 -0
- package/dist/compat/https/server.d.ts +8 -0
- package/dist/compat/https/server.js +27 -0
- package/dist/compat/immediate/index.d.ts +11 -0
- package/dist/compat/immediate/index.js +58 -0
- package/dist/compat/inspector/LICENSE-3RD-PARTY.md +34 -0
- package/dist/compat/inspector/LICENSE-APACHE +177 -0
- package/dist/compat/inspector/errors.d.ts +4 -0
- package/dist/compat/inspector/errors.js +6 -0
- package/dist/compat/inspector/index.d.ts +18 -0
- package/dist/compat/inspector/index.js +117 -0
- package/dist/compat/inspector/promises.d.ts +18 -0
- package/dist/compat/inspector/promises.js +114 -0
- package/dist/compat/module/index.cjs +2 -0
- package/dist/compat/module/index.d.cts +2 -0
- package/dist/compat/module/index.d.ts +11 -0
- package/dist/compat/module/index.js +44 -0
- package/dist/compat/module/resolve-unavailable.d.ts +1 -0
- package/dist/compat/module/resolve-unavailable.js +3 -0
- package/dist/compat/net/LICENSE-3RD-PARTY.md +15 -0
- package/dist/compat/net/LICENSE-APACHE +177 -0
- package/dist/compat/net/error-base.d.ts +14 -0
- package/dist/compat/net/error-base.js +62 -0
- package/dist/compat/net/errors.d.ts +76 -0
- package/dist/compat/net/errors.js +333 -0
- package/dist/compat/net/index.d.ts +23 -0
- package/dist/compat/net/index.js +46 -0
- package/dist/compat/net/internal-net.d.ts +236 -0
- package/dist/compat/net/internal-net.js +2292 -0
- package/dist/compat/net/ports.d.ts +32 -0
- package/dist/compat/net/ports.js +149 -0
- package/dist/compat/net/reader.d.ts +8 -0
- package/dist/compat/net/reader.js +36 -0
- package/dist/compat/net/sockets.d.ts +20 -0
- package/dist/compat/net/sockets.js +195 -0
- package/dist/compat/net/validators.d.ts +18 -0
- package/dist/compat/net/validators.js +154 -0
- package/dist/compat/os/LICENSE-3RD-PARTY.md +8 -0
- package/dist/compat/os/LICENSE-APACHE +177 -0
- package/dist/compat/os/index.d.ts +329 -0
- package/dist/compat/os/index.js +278 -0
- package/dist/compat/path/LICENSE-3RD-PARTY.md +35 -0
- package/dist/compat/path/LICENSE-APACHE +177 -0
- package/dist/compat/path/index.d.ts +4 -0
- package/dist/compat/path/index.js +11 -0
- package/dist/compat/path/internal-path.d.ts +95 -0
- package/dist/compat/path/internal-path.js +1542 -0
- package/dist/compat/path/posix/index.d.ts +4 -0
- package/dist/compat/path/posix/index.js +5 -0
- package/dist/compat/path/win32/index.d.ts +4 -0
- package/dist/compat/path/win32/index.js +5 -0
- package/dist/compat/perf-hooks/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/perf-hooks/LICENSE-APACHE +177 -0
- package/dist/compat/perf-hooks/index.d.ts +85 -0
- package/dist/compat/perf-hooks/index.js +79 -0
- package/dist/compat/perf-hooks/performance.d.ts +96 -0
- package/dist/compat/perf-hooks/performance.js +445 -0
- package/dist/compat/punycode/LICENSE-3RD-PARTY.md +7 -0
- package/dist/compat/punycode/LICENSE-APACHE +177 -0
- package/dist/compat/punycode/index.d.ts +93 -0
- package/dist/compat/punycode/index.js +410 -0
- package/dist/compat/querystring/LICENSE-3RD-PARTY.md +35 -0
- package/dist/compat/querystring/LICENSE-APACHE +177 -0
- package/dist/compat/querystring/index.d.ts +14 -0
- package/dist/compat/querystring/index.js +18 -0
- package/dist/compat/querystring/internal-querystring.d.ts +22 -0
- package/dist/compat/querystring/internal-querystring.js +498 -0
- package/dist/compat/readline/LICENSE-3RD-PARTY.md +37 -0
- package/dist/compat/readline/LICENSE-APACHE +177 -0
- package/dist/compat/readline/index.d.ts +21 -0
- package/dist/compat/readline/index.js +56 -0
- package/dist/compat/readline/interface.d.ts +22 -0
- package/dist/compat/readline/interface.js +85 -0
- package/dist/compat/readline/internal-promises.d.ts +32 -0
- package/dist/compat/readline/internal-promises.js +104 -0
- package/dist/compat/readline/promises.d.ts +8 -0
- package/dist/compat/readline/promises.js +32 -0
- package/dist/compat/repl/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/repl/LICENSE-APACHE +177 -0
- package/dist/compat/repl/builtin-modules.d.ts +1 -0
- package/dist/compat/repl/builtin-modules.js +101 -0
- package/dist/compat/repl/errors.d.ts +4 -0
- package/dist/compat/repl/errors.js +6 -0
- package/dist/compat/repl/index.d.ts +53 -0
- package/dist/compat/repl/index.js +106 -0
- package/dist/compat/sqlite/LICENSE-3RD-PARTY.md +6 -0
- package/dist/compat/sqlite/LICENSE-APACHE +177 -0
- package/dist/compat/sqlite/index.d.ts +12 -0
- package/dist/compat/sqlite/index.js +101 -0
- package/dist/compat/sqlite/native.d.ts +16 -0
- package/dist/compat/sqlite/native.js +33 -0
- package/dist/compat/stream/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/stream/LICENSE-APACHE +177 -0
- package/dist/compat/stream/add-abort-signal.d.ts +4 -0
- package/dist/compat/stream/add-abort-signal.js +73 -0
- package/dist/compat/stream/compose.d.ts +1 -0
- package/dist/compat/stream/compose.js +313 -0
- package/dist/compat/stream/destroy.d.ts +5 -0
- package/dist/compat/stream/destroy.js +315 -0
- package/dist/compat/stream/duplex.d.ts +48 -0
- package/dist/compat/stream/duplex.js +789 -0
- package/dist/compat/stream/end-of-stream.d.ts +16 -0
- package/dist/compat/stream/end-of-stream.js +269 -0
- package/dist/compat/stream/errors.d.ts +40 -0
- package/dist/compat/stream/errors.js +86 -0
- package/dist/compat/stream/events.d.ts +6 -0
- package/dist/compat/stream/events.js +28 -0
- package/dist/compat/stream/index.cjs +27 -0
- package/dist/compat/stream/index.d.cts +25 -0
- package/dist/compat/stream/index.d.ts +20 -0
- package/dist/compat/stream/index.js +55 -0
- package/dist/compat/stream/legacy.d.ts +8 -0
- package/dist/compat/stream/legacy.js +105 -0
- package/dist/compat/stream/once.d.ts +7 -0
- package/dist/compat/stream/once.js +13 -0
- package/dist/compat/stream/pipeline.d.ts +5 -0
- package/dist/compat/stream/pipeline.js +567 -0
- package/dist/compat/stream/process.d.ts +1 -0
- package/dist/compat/stream/process.js +4 -0
- package/dist/compat/stream/promises.d.ts +7 -0
- package/dist/compat/stream/promises.js +60 -0
- package/dist/compat/stream/readable.d.ts +29 -0
- package/dist/compat/stream/readable.js +2267 -0
- package/dist/compat/stream/state.d.ts +8 -0
- package/dist/compat/stream/state.js +63 -0
- package/dist/compat/stream/transform.d.ts +2 -0
- package/dist/compat/stream/transform.js +202 -0
- package/dist/compat/stream/util.d.ts +55 -0
- package/dist/compat/stream/util.js +345 -0
- package/dist/compat/stream/validators.d.ts +2 -0
- package/dist/compat/stream/validators.js +14 -0
- package/dist/compat/stream/writable.d.ts +21 -0
- package/dist/compat/stream/writable.js +1325 -0
- package/dist/compat/stream-consumers/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/stream-consumers/LICENSE-APACHE +177 -0
- package/dist/compat/stream-consumers/index.d.ts +14 -0
- package/dist/compat/stream-consumers/index.js +62 -0
- package/dist/compat/stream-consumers/iterable.d.ts +1 -0
- package/dist/compat/stream-consumers/iterable.js +34 -0
- package/dist/compat/stream-duplex/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/stream-duplex/LICENSE-APACHE +177 -0
- package/dist/compat/stream-duplex/index.cjs +3 -0
- package/dist/compat/stream-duplex/index.d.cts +2 -0
- package/dist/compat/stream-duplex/index.d.ts +3 -0
- package/dist/compat/stream-duplex/index.js +8 -0
- package/dist/compat/stream-passthrough/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/stream-passthrough/LICENSE-APACHE +177 -0
- package/dist/compat/stream-passthrough/index.cjs +3 -0
- package/dist/compat/stream-passthrough/index.d.cts +2 -0
- package/dist/compat/stream-passthrough/index.d.ts +3 -0
- package/dist/compat/stream-passthrough/index.js +8 -0
- package/dist/compat/stream-promises/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/stream-promises/LICENSE-APACHE +177 -0
- package/dist/compat/stream-promises/index.d.ts +1 -0
- package/dist/compat/stream-promises/index.js +1 -0
- package/dist/compat/stream-readable/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/stream-readable/LICENSE-APACHE +177 -0
- package/dist/compat/stream-readable/index.cjs +3 -0
- package/dist/compat/stream-readable/index.d.cts +2 -0
- package/dist/compat/stream-readable/index.d.ts +3 -0
- package/dist/compat/stream-readable/index.js +8 -0
- package/dist/compat/stream-transform/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/stream-transform/LICENSE-APACHE +177 -0
- package/dist/compat/stream-transform/index.cjs +3 -0
- package/dist/compat/stream-transform/index.d.cts +2 -0
- package/dist/compat/stream-transform/index.d.ts +3 -0
- package/dist/compat/stream-transform/index.js +8 -0
- package/dist/compat/stream-web/LICENSE-MIT +22 -0
- package/dist/compat/stream-web/NOTICE.md +3 -0
- package/dist/compat/stream-web/context.d.ts +2 -0
- package/dist/compat/stream-web/context.js +35 -0
- package/dist/compat/stream-web/index.d.ts +80 -0
- package/dist/compat/stream-web/index.js +129 -0
- package/dist/compat/stream-web/interop.d.ts +6 -0
- package/dist/compat/stream-web/interop.js +72 -0
- package/dist/compat/stream-web/ponyfill.d.ts +1 -0
- package/dist/compat/stream-web/ponyfill.js +2093 -0
- package/dist/compat/stream-web/runtime.d.ts +16 -0
- package/dist/compat/stream-web/runtime.js +51 -0
- package/dist/compat/stream-writable/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/stream-writable/LICENSE-APACHE +177 -0
- package/dist/compat/stream-writable/index.cjs +3 -0
- package/dist/compat/stream-writable/index.d.cts +2 -0
- package/dist/compat/stream-writable/index.d.ts +3 -0
- package/dist/compat/stream-writable/index.js +8 -0
- package/dist/compat/string-decoder/LICENSE-3RD-PARTY.md +38 -0
- package/dist/compat/string-decoder/LICENSE-APACHE +177 -0
- package/dist/compat/string-decoder/index.d.ts +33 -0
- package/dist/compat/string-decoder/index.js +518 -0
- package/dist/compat/test/LICENSE-3RD-PARTY.md +37 -0
- package/dist/compat/test/LICENSE-APACHE +177 -0
- package/dist/compat/test/index.d.ts +9 -0
- package/dist/compat/test/index.js +11 -0
- package/dist/compat/test/mock.d.ts +103 -0
- package/dist/compat/test/mock.js +397 -0
- package/dist/compat/test/validators.d.ts +2 -0
- package/dist/compat/test/validators.js +14 -0
- package/dist/compat/timers/LICENSE-3RD-PARTY.md +7 -0
- package/dist/compat/timers/LICENSE-APACHE +177 -0
- package/dist/compat/timers/errors.d.ts +28 -0
- package/dist/compat/timers/errors.js +206 -0
- package/dist/compat/timers/host.d.ts +11 -0
- package/dist/compat/timers/host.js +60 -0
- package/dist/compat/timers/index.cjs +3 -0
- package/dist/compat/timers/index.d.cts +23 -0
- package/dist/compat/timers/index.d.ts +36 -0
- package/dist/compat/timers/index.js +20 -0
- package/dist/compat/timers/installation.d.ts +4 -0
- package/dist/compat/timers/installation.js +61 -0
- package/dist/compat/timers/internal-promises.d.ts +19 -0
- package/dist/compat/timers/internal-promises.js +173 -0
- package/dist/compat/timers/promises.cjs +2 -0
- package/dist/compat/timers/promises.d.cts +12 -0
- package/dist/compat/timers/promises.d.ts +14 -0
- package/dist/compat/timers/promises.js +3 -0
- package/dist/compat/timers/timers.d.ts +32 -0
- package/dist/compat/timers/timers.js +147 -0
- package/dist/compat/timers/validation.d.ts +5 -0
- package/dist/compat/timers/validation.js +22 -0
- package/dist/compat/timers/wait.d.ts +4 -0
- package/dist/compat/timers/wait.js +91 -0
- package/dist/compat/tls-common/LICENSE-3RD-PARTY.md +11 -0
- package/dist/compat/tls-common/LICENSE-APACHE +177 -0
- package/dist/compat/tls-common/index.d.ts +14 -0
- package/dist/compat/tls-common/index.js +88 -0
- package/dist/compat/trace-events/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/trace-events/LICENSE-APACHE +177 -0
- package/dist/compat/trace-events/index.d.ts +18 -0
- package/dist/compat/trace-events/index.js +88 -0
- package/dist/compat/tty/LICENSE-3RD-PARTY.md +8 -0
- package/dist/compat/tty/LICENSE-APACHE +177 -0
- package/dist/compat/tty/index.d.ts +17 -0
- package/dist/compat/tty/index.js +101 -0
- package/dist/compat/url/LICENSE-3RD-PARTY.md +63 -0
- package/dist/compat/url/LICENSE-ADA +18 -0
- package/dist/compat/url/LICENSE-APACHE +177 -0
- package/dist/compat/url/LICENSE-UNICODE +39 -0
- package/dist/compat/url/LICENSE-WHATWG-URL +21 -0
- package/dist/compat/url/brand.d.ts +4 -0
- package/dist/compat/url/brand.js +10 -0
- package/dist/compat/url/constants.d.ts +27 -0
- package/dist/compat/url/constants.js +28 -0
- package/dist/compat/url/errors.d.ts +44 -0
- package/dist/compat/url/errors.js +248 -0
- package/dist/compat/url/idna-data.d.ts +3958 -0
- package/dist/compat/url/idna-data.js +22 -0
- package/dist/compat/url/idna.d.ts +9 -0
- package/dist/compat/url/idna.js +47 -0
- package/dist/compat/url/index.d.ts +48 -0
- package/dist/compat/url/index.js +39 -0
- package/dist/compat/url/installation.d.ts +4 -0
- package/dist/compat/url/installation.js +61 -0
- package/dist/compat/url/internal-url.d.ts +34 -0
- package/dist/compat/url/internal-url.js +264 -0
- package/dist/compat/url/legacy-url.d.ts +28 -0
- package/dist/compat/url/legacy-url.js +870 -0
- package/dist/compat/url/parser-platform.d.ts +3 -0
- package/dist/compat/url/parser-platform.js +26 -0
- package/dist/compat/url/standard-url.d.ts +2 -0
- package/dist/compat/url/standard-url.js +3189 -0
- package/dist/compat/url/unicode.d.ts +2 -0
- package/dist/compat/url/unicode.js +119 -0
- package/dist/compat/url/validation.d.ts +2 -0
- package/dist/compat/url/validation.js +9 -0
- package/dist/compat/url/web-url.d.ts +27 -0
- package/dist/compat/url/web-url.js +119 -0
- package/dist/compat/util/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/util/LICENSE-APACHE +177 -0
- package/dist/compat/util/additional.d.ts +11 -0
- package/dist/compat/util/additional.js +121 -0
- package/dist/compat/util/comparison-types.d.ts +16 -0
- package/dist/compat/util/comparison-types.js +50 -0
- package/dist/compat/util/comparisons.d.ts +1 -0
- package/dist/compat/util/comparisons.js +527 -0
- package/dist/compat/util/core.d.ts +18 -0
- package/dist/compat/util/core.js +265 -0
- package/dist/compat/util/debuglog.d.ts +1 -0
- package/dist/compat/util/debuglog.js +78 -0
- package/dist/compat/util/index.d.ts +35 -0
- package/dist/compat/util/index.js +77 -0
- package/dist/compat/util/inspect-binding.d.ts +13 -0
- package/dist/compat/util/inspect-binding.js +39 -0
- package/dist/compat/util/inspect-types.d.ts +13 -0
- package/dist/compat/util/inspect-types.js +30 -0
- package/dist/compat/util/inspect.d.ts +152 -0
- package/dist/compat/util/inspect.js +2503 -0
- package/dist/compat/util/mime.d.ts +24 -0
- package/dist/compat/util/mime.js +284 -0
- package/dist/compat/util/properties.d.ts +9 -0
- package/dist/compat/util/properties.js +76 -0
- package/dist/compat/v8/LICENSE-3RD-PARTY.md +6 -0
- package/dist/compat/v8/LICENSE-APACHE +177 -0
- package/dist/compat/v8/errors.d.ts +5 -0
- package/dist/compat/v8/errors.js +7 -0
- package/dist/compat/v8/index.d.ts +106 -0
- package/dist/compat/v8/index.js +280 -0
- package/dist/compat/vm/LICENSE-3RD-PARTY.md +39 -0
- package/dist/compat/vm/LICENSE-APACHE +177 -0
- package/dist/compat/vm/errors.d.ts +5 -0
- package/dist/compat/vm/errors.js +7 -0
- package/dist/compat/vm/index.d.ts +47 -0
- package/dist/compat/vm/index.js +231 -0
- package/dist/compat/vm/validation.d.ts +3 -0
- package/dist/compat/vm/validation.js +14 -0
- package/dist/compat/wasi/LICENSE-3RD-PARTY.md +8 -0
- package/dist/compat/wasi/LICENSE-APACHE +177 -0
- package/dist/compat/wasi/errors.d.ts +4 -0
- package/dist/compat/wasi/errors.js +6 -0
- package/dist/compat/wasi/index.d.ts +15 -0
- package/dist/compat/wasi/index.js +44 -0
- package/dist/compat/worker-threads/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/worker-threads/LICENSE-APACHE +177 -0
- package/dist/compat/worker-threads/errors.d.ts +4 -0
- package/dist/compat/worker-threads/errors.js +6 -0
- package/dist/compat/worker-threads/index.d.ts +71 -0
- package/dist/compat/worker-threads/index.js +138 -0
- package/dist/compat/worker-threads/message-channel.d.ts +18 -0
- package/dist/compat/worker-threads/message-channel.js +157 -0
- package/dist/configured.d.ts +3 -0
- package/dist/configured.js +4 -0
- package/dist/environment.d.ts +4 -0
- package/dist/environment.js +18 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +107 -0
- package/dist/ios.d.ts +2 -0
- package/dist/ios.js +1 -0
- package/dist/native-entry.d.ts +8 -0
- package/dist/native-entry.js +67 -0
- package/dist/shared/brotli/LICENSE-APACHE +201 -0
- package/dist/shared/brotli/LICENSE-MIT +9 -0
- package/dist/shared/brotli/NOTICE +3 -0
- package/dist/shared/brotli/index.d.ts +2 -0
- package/dist/shared/brotli/index.js +288 -0
- package/dist/shared/contracts/index.d.ts +42 -0
- package/dist/shared/contracts/index.js +88 -0
- package/dist/shared/contracts/testing.d.ts +22 -0
- package/dist/shared/contracts/testing.js +57 -0
- package/dist/shared/globals/index.d.ts +3 -0
- package/dist/shared/globals/index.js +87 -0
- package/dist/shared/globals/inject.d.ts +2 -0
- package/dist/shared/globals/inject.js +3 -0
- package/dist/shared/globals/install.d.ts +1 -0
- package/dist/shared/globals/install.js +15 -0
- package/dist/shared/globals/node-install.d.ts +1 -0
- package/dist/shared/globals/node-install.js +4 -0
- package/dist/shared/globals/platform.d.ts +104 -0
- package/dist/shared/globals/platform.js +37 -0
- package/dist/shared/globals/runtime.d.ts +6 -0
- package/dist/shared/globals/runtime.js +8 -0
- package/dist/shared/globals/symbols.d.ts +4 -0
- package/dist/shared/globals/symbols.js +35 -0
- package/dist/shared/globals/web.d.ts +4 -0
- package/dist/shared/globals/web.js +108 -0
- package/dist/shared/http-wire/LICENSE.llhttp +22 -0
- package/dist/shared/http-wire/LICENSE.undici +21 -0
- package/dist/shared/http-wire/NOTICE.md +14 -0
- package/dist/shared/http-wire/index.d.ts +27 -0
- package/dist/shared/http-wire/index.js +132 -0
- package/dist/shared/http-wire/wasm.d.ts +2 -0
- package/dist/shared/http-wire/wasm.js +2 -0
- package/dist/tooling/async.d.ts +7 -0
- package/dist/tooling/async.js +99 -0
- package/dist/tooling/build-isolation.d.ts +4 -0
- package/dist/tooling/build-isolation.js +34 -0
- package/dist/tooling/documents.d.ts +7 -0
- package/dist/tooling/documents.js +26 -0
- package/dist/tooling/esbuild.d.ts +15 -0
- package/dist/tooling/esbuild.js +193 -0
- package/dist/tooling/files.d.ts +2 -0
- package/dist/tooling/files.js +18 -0
- package/dist/tooling/opennext/build.d.ts +1 -0
- package/dist/tooling/opennext/build.js +121 -0
- package/dist/tooling/opennext/index.d.ts +3 -0
- package/dist/tooling/opennext/index.js +213 -0
- package/dist/tooling/opennext/plan.d.ts +9 -0
- package/dist/tooling/opennext/plan.js +36 -0
- package/dist/tooling/opennext/safety.d.ts +4 -0
- package/dist/tooling/opennext/safety.js +36 -0
- package/dist/tooling/route-permissions.d.ts +3 -0
- package/dist/tooling/route-permissions.js +15 -0
- package/dist/tooling/server-modules.d.ts +30 -0
- package/dist/tooling/server-modules.js +98 -0
- package/dist/tooling/server-only-html.d.ts +1 -0
- package/dist/tooling/server-only-html.js +66 -0
- package/dist/tooling/server-only.d.ts +6 -0
- package/dist/tooling/server-only.js +53 -0
- package/dist/tooling/server.d.ts +25 -0
- package/dist/tooling/server.js +981 -0
- package/dist/tooling/shared.d.ts +13 -0
- package/dist/tooling/shared.js +130 -0
- package/dist/tooling/vite.d.ts +18 -0
- package/dist/tooling/vite.js +448 -0
- package/dist/tooling/void/index.d.ts +3 -0
- package/dist/tooling/void/index.js +205 -0
- package/dist/tooling/void/plan.d.ts +17 -0
- package/dist/tooling/void/plan.js +288 -0
- package/native/android/build.gradle +68 -0
- package/native/android/consumer-rules.pro +2 -0
- package/native/android/src/main/AndroidManifest.xml +6 -0
- package/native/android/src/main/java/jp/rdlabo/workerscapacitor/WorkerSockets.java +202 -0
- package/native/android/src/main/java/jp/rdlabo/workerscapacitor/WorkersCapacitorPlugin.java +256 -0
- package/native/android/src/main/java/jp/rdlabo/workerscapacitor/WorkersNative.java +22 -0
- package/native/android/src/main/java/jp/rdlabo/workerscapacitor/WorkersNativeActivity.java +178 -0
- package/native/android/src/main/java/jp/rdlabo/workerscapacitor/WorkersNativeBridge.java +45 -0
- package/native/ios/DocumentBridge.swift +330 -0
- package/native/ios/NetworkBridge.swift +51 -0
- package/native/ios/SocketBridge.swift +180 -0
- package/native/ios/WorkersCapacitorPlugin.swift +152 -0
- package/native/ios-host/WorkersView.swift +194 -0
- package/package.json +154 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const pageScript = "\"use strict\";\n(() => {\n // src/browser/documents/body.ts\n var maxDocumentUpload = 8 * 1024 * 1024;\n async function readDocumentBody(request) {\n const reader = request.body?.getReader();\n if (!reader) return new ArrayBuffer(0);\n const chunks = [];\n let size = 0;\n const abort = () => {\n void reader.cancel(request.signal.reason).catch(() => {\n });\n };\n request.signal.addEventListener(\"abort\", abort, { once: true });\n try {\n request.signal.throwIfAborted();\n for (; ; ) {\n const next = await reader.read();\n request.signal.throwIfAborted();\n if (next.done) break;\n size += next.value.length;\n if (size > maxDocumentUpload)\n throw new RangeError(\"Document upload exceeds 8 MiB\");\n chunks.push(next.value);\n }\n const result = new Uint8Array(size);\n let offset = 0;\n for (const chunk of chunks) {\n result.set(chunk, offset);\n offset += chunk.length;\n }\n return result.buffer;\n } catch (error) {\n void reader.cancel(error).catch(() => {\n });\n throw error;\n } finally {\n request.signal.removeEventListener(\"abort\", abort);\n reader.releaseLock();\n }\n }\n function encodeDocumentBytes(bytes) {\n let binary = \"\";\n for (let i2 = 0; i2 < bytes.length; i2 += 8192)\n binary += String.fromCharCode(...bytes.subarray(i2, i2 + 8192));\n return btoa(binary);\n }\n\n // src/browser/documents/page-config.ts\n var documentConfig = globalThis.__workersCapacitorDocuments;\n function isDocumentURL(url) {\n return !documentConfig.assets.includes(url.pathname) && !url.pathname.startsWith(\"/_capacitor_\");\n }\n\n // src/browser/documents/form-body.ts\n function destination(form, button) {\n const method = (button?.getAttribute(\"formmethod\") ?? form.method).toLowerCase();\n const enctype = button?.getAttribute(\"formenctype\") ?? form.enctype;\n const target = button?.getAttribute(\"formtarget\") ?? form.target;\n const action = button?.getAttribute(\"formaction\") ?? form.getAttribute(\"action\");\n const url = new URL(action || location.href, document.baseURI);\n if (method !== \"post\" || enctype !== \"multipart/form-data\" || target && target !== \"_self\" || url.protocol !== location.protocol || url.host !== location.host || !isDocumentURL(url))\n return;\n return url;\n }\n async function navigate(form, button, url) {\n const request = new Request(url, {\n method: \"POST\",\n body: new FormData(form, button)\n });\n const bytes = new Uint8Array(await readDocumentBody(request));\n await window.webkit.messageHandlers.documentFetch.postMessage({\n formNavigate: {\n url: url.href,\n headers: Object.fromEntries(request.headers),\n body: encodeDocumentBytes(bytes)\n }\n });\n }\n window.addEventListener(\"submit\", (event) => {\n if (event.defaultPrevented || !(event.target instanceof HTMLFormElement))\n return;\n const url = destination(event.target, event.submitter);\n if (!url) return;\n event.preventDefault();\n void navigate(event.target, event.submitter, url).catch(\n (error) => window.reportError(error)\n );\n });\n var submit = HTMLFormElement.prototype.submit;\n HTMLFormElement.prototype.submit = function() {\n const url = destination(this, null);\n if (!url) return submit.call(this);\n void navigate(this, null, url).catch((error) => window.reportError(error));\n };\n\n // src/browser/documents/links.ts\n if (window === window.top)\n window.addEventListener(\"click\", (event) => {\n if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)\n return;\n const link = event.target instanceof Element ? event.target.closest(\"a[href]\") : null;\n if (!(link instanceof HTMLAnchorElement) || link.hasAttribute(\"download\"))\n return;\n const target = link.target || document.querySelector(\"base[target]\")?.getAttribute(\"target\");\n if (target && target.toLowerCase() !== \"_self\") return;\n const url = new URL(link.href);\n if (url.origin !== documentConfig.baseURL || url.username || url.password || url.protocol === location.protocol && url.host === location.host)\n return;\n event.preventDefault();\n location.assign(\n location.protocol + \"//\" + location.host + url.pathname + url.search + url.hash\n );\n });\n\n // src/shared/globals/platform.ts\n var nativeBlobConstructor = /* @__PURE__ */ Symbol.for(\n \"workers-capacitor/native-blob\"\n );\n var nativeFileConstructor = /* @__PURE__ */ Symbol.for(\n \"workers-capacitor/native-file\"\n );\n function original(value2, key2) {\n return value2[key2] ?? value2;\n }\n var platform = {\n Blob: original(globalThis.Blob, nativeBlobConstructor),\n File: original(globalThis.File, nativeFileConstructor),\n Request: globalThis.Request,\n Response: globalThis.Response,\n Headers: globalThis.Headers,\n fetch: globalThis.fetch.bind(globalThis),\n structuredClone: globalThis.structuredClone.bind(globalThis)\n };\n var nativeStreamsSymbol = /* @__PURE__ */ Symbol.for(\n \"workers-capacitor/native-streams\"\n );\n var streamConstructors = {\n ReadableStream: globalThis.ReadableStream,\n WritableStream: globalThis.WritableStream,\n TransformStream: globalThis.TransformStream,\n ByteLengthQueuingStrategy: globalThis.ByteLengthQueuingStrategy,\n CountQueuingStrategy: globalThis.CountQueuingStrategy,\n ReadableByteStreamController: globalThis.ReadableByteStreamController,\n ReadableStreamBYOBReader: globalThis.ReadableStreamBYOBReader,\n ReadableStreamBYOBRequest: globalThis.ReadableStreamBYOBRequest,\n ReadableStreamDefaultController: globalThis.ReadableStreamDefaultController,\n ReadableStreamDefaultReader: globalThis.ReadableStreamDefaultReader,\n TransformStreamDefaultController: globalThis.TransformStreamDefaultController,\n WritableStreamDefaultController: globalThis.WritableStreamDefaultController,\n WritableStreamDefaultWriter: globalThis.WritableStreamDefaultWriter,\n CompressionStream: globalThis.CompressionStream,\n DecompressionStream: globalThis.DecompressionStream,\n TextEncoderStream: globalThis.TextEncoderStream,\n TextDecoderStream: globalThis.TextDecoderStream\n };\n var nativeStreams = globalThis.ReadableStream[nativeStreamsSymbol] ?? streamConstructors;\n\n // src/compat/async-hooks/callbacks.ts\n var key = /* @__PURE__ */ Symbol.for(\"workers-capacitor/callback-binding\");\n var realm = globalThis;\n var state = realm[key] ?? { bindings: /* @__PURE__ */ new Set() };\n if (!realm[key]) Object.defineProperty(realm, key, { value: state });\n function bindCallback(callback) {\n let bound = callback;\n for (const bind of state.bindings) bound = bind(bound);\n return bound;\n }\n\n // src/compat/stream-web/context.ts\n function contextConstructor(Constructor, methods2) {\n let wrapped;\n wrapped = new Proxy(Constructor, {\n get(target, key2, receiver) {\n return key2 === nativeStreamsSymbol ? nativeStreams : Reflect.get(target, key2, receiver);\n },\n construct(target, args, newTarget) {\n const source = args[0];\n if (source !== null && (typeof source === \"object\" || typeof source === \"function\")) {\n const dictionary2 = new Proxy(source, {\n get(original2, key2) {\n const value2 = Reflect.get(original2, key2, original2);\n if (typeof key2 !== \"string\" || !methods2.includes(key2) || typeof value2 !== \"function\")\n return value2;\n const callback = bindCallback(value2);\n return function(...values) {\n return Reflect.apply(\n callback,\n this === dictionary2 ? original2 : this,\n values\n );\n };\n }\n });\n args = [dictionary2, ...args.slice(1)];\n }\n return Reflect.construct(\n target,\n args,\n newTarget === wrapped ? target : newTarget\n );\n }\n });\n return wrapped;\n }\n\n // node_modules/web-streams-polyfill/dist/ponyfill.mjs\n function e() {\n }\n function t(e2) {\n return \"object\" == typeof e2 && null !== e2 || \"function\" == typeof e2;\n }\n var r = e;\n function o(e2, t2) {\n try {\n Object.defineProperty(e2, \"name\", { value: t2, configurable: true });\n } catch (e3) {\n }\n }\n var n = Promise;\n var i = Promise.resolve.bind(n);\n var a = Promise.prototype.then;\n var s = Promise.reject.bind(n);\n var l = i;\n function u(e2) {\n return new n(e2);\n }\n function c(e2) {\n return u((t2) => t2(e2));\n }\n function d(e2) {\n return s(e2);\n }\n function f(e2, t2, r2) {\n return a.call(e2, t2, r2);\n }\n function h(e2, t2, o2) {\n f(f(e2, t2, o2), void 0, r);\n }\n function b(e2, t2) {\n h(e2, t2);\n }\n function _(e2, t2) {\n h(e2, void 0, t2);\n }\n function m(e2, t2, r2) {\n return f(e2, t2, r2);\n }\n function p(e2) {\n f(e2, void 0, r);\n }\n var y = (e2) => {\n if (\"function\" == typeof queueMicrotask) y = queueMicrotask;\n else {\n const e3 = c(void 0);\n y = (t2) => f(e3, t2);\n }\n return y(e2);\n };\n function S(e2, t2, r2) {\n if (\"function\" != typeof e2) throw new TypeError(\"Argument is not a function\");\n return Function.prototype.apply.call(e2, t2, r2);\n }\n function g(e2, t2, r2) {\n try {\n return c(S(e2, t2, r2));\n } catch (e3) {\n return d(e3);\n }\n }\n var v = class {\n constructor() {\n this._cursor = 0, this._size = 0, this._front = { _elements: [], _next: void 0 }, this._back = this._front, this._cursor = 0, this._size = 0;\n }\n get length() {\n return this._size;\n }\n push(e2) {\n const t2 = this._back;\n let r2 = t2;\n 16383 === t2._elements.length && (r2 = { _elements: [], _next: void 0 }), t2._elements.push(e2), r2 !== t2 && (this._back = r2, t2._next = r2), ++this._size;\n }\n shift() {\n const e2 = this._front;\n let t2 = e2;\n const r2 = this._cursor;\n let o2 = r2 + 1;\n const n2 = e2._elements, i2 = n2[r2];\n return 16384 === o2 && (t2 = e2._next, o2 = 0), --this._size, this._cursor = o2, e2 !== t2 && (this._front = t2), n2[r2] = void 0, i2;\n }\n forEach(e2) {\n let t2 = this._cursor, r2 = this._front, o2 = r2._elements;\n for (; !(t2 === o2.length && void 0 === r2._next || t2 === o2.length && (r2 = r2._next, o2 = r2._elements, t2 = 0, 0 === o2.length)); ) e2(o2[t2]), ++t2;\n }\n peek() {\n const e2 = this._front, t2 = this._cursor;\n return e2._elements[t2];\n }\n };\n var w = /* @__PURE__ */ Symbol(\"[[AbortSteps]]\");\n var R = /* @__PURE__ */ Symbol(\"[[ErrorSteps]]\");\n var T = /* @__PURE__ */ Symbol(\"[[CancelSteps]]\");\n var P = /* @__PURE__ */ Symbol(\"[[PullSteps]]\");\n var C = /* @__PURE__ */ Symbol(\"[[CanPullSyncSteps]]\");\n var q = /* @__PURE__ */ Symbol(\"[[ReleaseSteps]]\");\n function E(e2, t2) {\n e2._ownerReadableStream = t2, t2._reader = e2, \"readable\" === t2._state ? j(e2) : \"closed\" === t2._state ? (function(e3) {\n j(e3), z(e3);\n })(e2) : k(e2, t2._storedError);\n }\n function W(e2, t2) {\n return Mr(e2._ownerReadableStream, t2);\n }\n function O(e2) {\n const t2 = e2._ownerReadableStream;\n \"readable\" === t2._state ? A(e2, new TypeError(\"Reader was released and can no longer be used to monitor the stream's closedness\")) : (function(e3, t3) {\n k(e3, t3);\n })(e2, new TypeError(\"Reader was released and can no longer be used to monitor the stream's closedness\")), t2._readableStreamController[q](), t2._reader = void 0, e2._ownerReadableStream = void 0;\n }\n function B(e2) {\n return new TypeError(\"Cannot \" + e2 + \" a stream using a released reader\");\n }\n function j(e2) {\n e2._closedPromise = u((t2, r2) => {\n e2._closedPromise_resolve = t2, e2._closedPromise_reject = r2;\n });\n }\n function k(e2, t2) {\n j(e2), A(e2, t2);\n }\n function A(e2, t2) {\n void 0 !== e2._closedPromise_reject && (p(e2._closedPromise), e2._closedPromise_reject(t2), e2._closedPromise_resolve = void 0, e2._closedPromise_reject = void 0);\n }\n function z(e2) {\n void 0 !== e2._closedPromise_resolve && (e2._closedPromise_resolve(void 0), e2._closedPromise_resolve = void 0, e2._closedPromise_reject = void 0);\n }\n var D = Number.isFinite || function(e2) {\n return \"number\" == typeof e2 && isFinite(e2);\n };\n var F = Math.trunc || function(e2) {\n return e2 < 0 ? Math.ceil(e2) : Math.floor(e2);\n };\n function L(e2, t2) {\n if (void 0 !== e2 && (\"object\" != typeof (r2 = e2) && \"function\" != typeof r2)) throw new TypeError(`${t2} is not an object.`);\n var r2;\n }\n function I(e2, t2) {\n if (\"function\" != typeof e2) throw new TypeError(`${t2} is not a function.`);\n }\n function $(e2, t2) {\n if (!/* @__PURE__ */ (function(e3) {\n return \"object\" == typeof e3 && null !== e3 || \"function\" == typeof e3;\n })(e2)) throw new TypeError(`${t2} is not an object.`);\n }\n function M(e2, t2, r2) {\n if (void 0 === e2) throw new TypeError(`Parameter ${t2} is required in '${r2}'.`);\n }\n function Y(e2, t2, r2) {\n if (void 0 === e2) throw new TypeError(`${t2} is required in '${r2}'.`);\n }\n function x(e2) {\n return Number(e2);\n }\n function Q(e2) {\n return 0 === e2 ? 0 : e2;\n }\n function N(e2, t2) {\n const r2 = Number.MAX_SAFE_INTEGER;\n let o2 = Number(e2);\n if (o2 = Q(o2), !D(o2)) throw new TypeError(`${t2} is not a finite number`);\n if (o2 = (function(e3) {\n return Q(F(e3));\n })(o2), o2 < 0 || o2 > r2) throw new TypeError(`${t2} is outside the accepted range of 0 to ${r2}, inclusive`);\n return D(o2) && 0 !== o2 ? o2 : 0;\n }\n function H(e2, t2) {\n if (!Ir(e2)) throw new TypeError(`${t2} is not a ReadableStream.`);\n }\n function V(e2) {\n return new ReadableStreamDefaultReader(e2);\n }\n function U(e2, t2) {\n e2._reader._readRequests.push(t2);\n }\n function G(e2, t2, r2) {\n const o2 = e2._reader._readRequests.shift();\n r2 ? o2._closeSteps() : o2._chunkSteps(t2);\n }\n function X(e2) {\n return e2._reader._readRequests.length;\n }\n function J(e2) {\n const t2 = e2._reader;\n return void 0 !== t2 && !!ee(t2);\n }\n var ReadableStreamDefaultReader = class {\n constructor(e2) {\n if (M(e2, 1, \"ReadableStreamDefaultReader\"), H(e2, \"First parameter\"), $r(e2)) throw new TypeError(\"This stream has already been locked for exclusive reading by another reader\");\n E(this, e2), this._readRequests = new v();\n }\n get closed() {\n return ee(this) ? this._closedPromise : d(ne(\"closed\"));\n }\n cancel(e2 = void 0) {\n return ee(this) ? void 0 === this._ownerReadableStream ? d(B(\"cancel\")) : W(this, e2) : d(ne(\"cancel\"));\n }\n read() {\n if (!ee(this)) return d(ne(\"read\"));\n if (void 0 === this._ownerReadableStream) return d(B(\"read from\"));\n const e2 = re(this) ? new Z() : new K();\n return te(this, e2), e2._promise;\n }\n releaseLock() {\n if (!ee(this)) throw ne(\"releaseLock\");\n void 0 !== this._ownerReadableStream && (function(e2) {\n O(e2);\n const t2 = new TypeError(\"Reader was released\");\n oe(e2, t2);\n })(this);\n }\n };\n Object.defineProperties(ReadableStreamDefaultReader.prototype, { cancel: { enumerable: true }, read: { enumerable: true }, releaseLock: { enumerable: true }, closed: { enumerable: true } }), o(ReadableStreamDefaultReader.prototype.cancel, \"cancel\"), o(ReadableStreamDefaultReader.prototype.read, \"read\"), o(ReadableStreamDefaultReader.prototype.releaseLock, \"releaseLock\"), \"symbol\" == typeof Symbol.toStringTag && Object.defineProperty(ReadableStreamDefaultReader.prototype, Symbol.toStringTag, { value: \"ReadableStreamDefaultReader\", configurable: true });\n var K = class {\n constructor() {\n this._promise = u((e2, t2) => {\n this._resolvePromise = e2, this._rejectPromise = t2;\n });\n }\n _chunkSteps(e2) {\n this._resolvePromise({ value: e2, done: false });\n }\n _closeSteps() {\n this._resolvePromise({ value: void 0, done: true });\n }\n _errorSteps(e2) {\n this._rejectPromise(e2);\n }\n };\n var Z = class {\n constructor() {\n this._promise = void 0;\n }\n _chunkSteps(e2) {\n this._promise = l({ value: e2, done: false });\n }\n _closeSteps() {\n this._promise = l({ value: void 0, done: true });\n }\n _errorSteps(e2) {\n this._promise = d(e2);\n }\n };\n function ee(e2) {\n return !!t(e2) && (!!Object.prototype.hasOwnProperty.call(e2, \"_readRequests\") && e2 instanceof ReadableStreamDefaultReader);\n }\n function te(e2, t2) {\n const r2 = e2._ownerReadableStream;\n r2._disturbed = true, \"closed\" === r2._state ? t2._closeSteps() : \"errored\" === r2._state ? t2._errorSteps(r2._storedError) : r2._readableStreamController[P](t2);\n }\n function re(e2) {\n const t2 = e2._ownerReadableStream;\n return \"closed\" === t2._state || (\"errored\" === t2._state || t2._readableStreamController[C]());\n }\n function oe(e2, t2) {\n const r2 = e2._readRequests;\n e2._readRequests = new v(), r2.forEach((e3) => {\n e3._errorSteps(t2);\n });\n }\n function ne(e2) {\n return new TypeError(`ReadableStreamDefaultReader.prototype.${e2} can only be used on a ReadableStreamDefaultReader`);\n }\n var ie;\n var ae;\n var se;\n function le(e2) {\n return e2.slice();\n }\n function ue(e2, t2, r2, o2, n2) {\n new Uint8Array(e2).set(new Uint8Array(r2, o2, n2), t2);\n }\n var ce = (e2) => (ce = \"function\" == typeof e2.transfer ? (e3) => e3.transfer() : \"function\" == typeof structuredClone ? (e3) => structuredClone(e3, { transfer: [e3] }) : (e3) => e3, ce(e2));\n var de = (e2) => (de = \"boolean\" == typeof e2.detached ? (e3) => e3.detached : (e3) => 0 === e3.byteLength, de(e2));\n function fe(e2, t2, r2) {\n if (e2.slice) return e2.slice(t2, r2);\n const o2 = r2 - t2, n2 = new ArrayBuffer(o2);\n return ue(n2, 0, e2, t2, o2), n2;\n }\n function he(e2, t2) {\n const r2 = e2[t2];\n if (null != r2) {\n if (\"function\" != typeof r2) throw new TypeError(`${String(t2)} is not a function`);\n return r2;\n }\n }\n function be(e2) {\n try {\n const t2 = e2.done, r2 = e2.value;\n return f(l(r2), (e3) => ({ done: t2, value: e3 }));\n } catch (e3) {\n return d(e3);\n }\n }\n var _e = null !== (se = null !== (ie = Symbol.asyncIterator) && void 0 !== ie ? ie : null === (ae = Symbol.for) || void 0 === ae ? void 0 : ae.call(Symbol, \"Symbol.asyncIterator\")) && void 0 !== se ? se : \"@@asyncIterator\";\n function me(e2, r2 = \"sync\", o2) {\n if (void 0 === o2) if (\"async\" === r2) {\n if (void 0 === (o2 = he(e2, _e))) {\n return (function(e3) {\n const r3 = { next() {\n let t2;\n try {\n t2 = pe(e3);\n } catch (e4) {\n return d(e4);\n }\n return be(t2);\n }, return(r4) {\n let o3;\n try {\n const t2 = he(e3.iterator, \"return\");\n if (void 0 === t2) return c({ done: true, value: r4 });\n o3 = S(t2, e3.iterator, [r4]);\n } catch (e4) {\n return d(e4);\n }\n return t(o3) ? be(o3) : d(new TypeError(\"The iterator.return() method must return an object\"));\n } };\n return { iterator: r3, nextMethod: r3.next, done: false };\n })(me(e2, \"sync\", he(e2, Symbol.iterator)));\n }\n } else o2 = he(e2, Symbol.iterator);\n if (void 0 === o2) throw new TypeError(\"The object is not iterable\");\n const n2 = S(o2, e2, []);\n if (!t(n2)) throw new TypeError(\"The iterator method must return an object\");\n return { iterator: n2, nextMethod: n2.next, done: false };\n }\n function pe(e2) {\n const r2 = S(e2.nextMethod, e2.iterator, []);\n if (!t(r2)) throw new TypeError(\"The iterator.next() method must return an object\");\n return r2;\n }\n var ye = class {\n constructor(e2, t2) {\n this._ongoingPromise = void 0, this._isFinished = false, this._reader = e2, this._preventCancel = t2;\n }\n next() {\n const e2 = () => this._nextSteps();\n return this._ongoingPromise = this._ongoingPromise ? m(this._ongoingPromise, e2, e2) : e2(), this._ongoingPromise;\n }\n return(e2) {\n const t2 = () => this._returnSteps(e2);\n return this._ongoingPromise = this._ongoingPromise ? m(this._ongoingPromise, t2, t2) : t2(), this._ongoingPromise;\n }\n _nextSteps() {\n if (this._isFinished) return Promise.resolve({ value: void 0, done: true });\n const e2 = this._reader, t2 = new Se(this);\n return te(e2, t2), t2._promise;\n }\n _returnSteps(e2) {\n if (this._isFinished) return Promise.resolve({ value: e2, done: true });\n this._isFinished = true;\n const t2 = this._reader;\n if (!this._preventCancel) {\n const r2 = W(t2, e2);\n return O(t2), m(r2, () => ({ value: e2, done: true }));\n }\n return O(t2), c({ value: e2, done: true });\n }\n };\n var Se = class {\n constructor(e2) {\n this._iterator = e2, this._promise = u((e3, t2) => {\n this._resolvePromise = e3, this._rejectPromise = t2;\n });\n }\n _chunkSteps(e2) {\n this._iterator._ongoingPromise = void 0, y(() => this._resolvePromise({ value: e2, done: false }));\n }\n _closeSteps() {\n const e2 = this._iterator;\n e2._ongoingPromise = void 0, e2._isFinished = true, O(e2._reader), this._resolvePromise({ value: void 0, done: true });\n }\n _errorSteps(e2) {\n const t2 = this._iterator;\n t2._ongoingPromise = void 0, t2._isFinished = true, O(t2._reader), this._rejectPromise(e2);\n }\n };\n var ge = { next() {\n return ve(this) ? this._asyncIteratorImpl.next() : d(we(\"next\"));\n }, return(e2) {\n return ve(this) ? this._asyncIteratorImpl.return(e2) : d(we(\"return\"));\n }, [_e]() {\n return this;\n } };\n function ve(e2) {\n if (!t(e2)) return false;\n if (!Object.prototype.hasOwnProperty.call(e2, \"_asyncIteratorImpl\")) return false;\n try {\n return e2._asyncIteratorImpl instanceof ye;\n } catch (e3) {\n return false;\n }\n }\n function we(e2) {\n return new TypeError(`ReadableStreamAsyncIterator.${e2} can only be used on a ReadableSteamAsyncIterator`);\n }\n Object.defineProperty(ge, _e, { enumerable: false });\n var Re = Number.isNaN || function(e2) {\n return e2 != e2;\n };\n function Te(e2) {\n const t2 = fe(e2.buffer, e2.byteOffset, e2.byteOffset + e2.byteLength);\n return new Uint8Array(t2);\n }\n function Pe(e2) {\n const t2 = e2._queue.shift();\n return e2._queueTotalSize -= t2.size, e2._queueTotalSize < 0 && (e2._queueTotalSize = 0), t2.value;\n }\n function Ce(e2, t2, r2) {\n if (\"number\" != typeof (o2 = r2) || Re(o2) || o2 < 0 || r2 === 1 / 0) throw new RangeError(\"Size must be a finite, non-NaN, non-negative number.\");\n var o2;\n e2._queue.push({ value: t2, size: r2 }), e2._queueTotalSize += r2;\n }\n function qe(e2) {\n e2._queue = new v(), e2._queueTotalSize = 0;\n }\n function Ee(e2) {\n return e2 === DataView;\n }\n function We(e2) {\n return Ee(e2) ? 1 : e2.BYTES_PER_ELEMENT;\n }\n var ReadableStreamBYOBRequest = class {\n constructor() {\n throw new TypeError(\"Illegal constructor\");\n }\n get view() {\n if (!Be(this)) throw ot(\"view\");\n return this._view;\n }\n respond(e2) {\n if (!Be(this)) throw ot(\"respond\");\n if (M(e2, 1, \"respond\"), e2 = N(e2, \"First parameter\"), void 0 === this._associatedReadableByteStreamController) throw new TypeError(\"This BYOB request has been invalidated\");\n if (de(this._view.buffer)) throw new TypeError(\"The BYOB request's buffer has been detached and so cannot be used as a response\");\n et(this._associatedReadableByteStreamController, e2);\n }\n respondWithNewView(e2) {\n if (!Be(this)) throw ot(\"respondWithNewView\");\n if (M(e2, 1, \"respondWithNewView\"), !ArrayBuffer.isView(e2)) throw new TypeError(\"You can only respond with array buffer views\");\n if (void 0 === this._associatedReadableByteStreamController) throw new TypeError(\"This BYOB request has been invalidated\");\n if (de(e2.buffer)) throw new TypeError(\"The given view's buffer has been detached and so cannot be used as a response\");\n tt(this._associatedReadableByteStreamController, e2);\n }\n };\n Object.defineProperties(ReadableStreamBYOBRequest.prototype, { respond: { enumerable: true }, respondWithNewView: { enumerable: true }, view: { enumerable: true } }), o(ReadableStreamBYOBRequest.prototype.respond, \"respond\"), o(ReadableStreamBYOBRequest.prototype.respondWithNewView, \"respondWithNewView\"), \"symbol\" == typeof Symbol.toStringTag && Object.defineProperty(ReadableStreamBYOBRequest.prototype, Symbol.toStringTag, { value: \"ReadableStreamBYOBRequest\", configurable: true });\n var ReadableByteStreamController = class {\n constructor() {\n throw new TypeError(\"Illegal constructor\");\n }\n get byobRequest() {\n if (!Oe(this)) throw nt(\"byobRequest\");\n return Ke(this);\n }\n get desiredSize() {\n if (!Oe(this)) throw nt(\"desiredSize\");\n return Ze(this);\n }\n close() {\n if (!Oe(this)) throw nt(\"close\");\n if (this._closeRequested) throw new TypeError(\"The stream has already been closed; do not close it again!\");\n const e2 = this._controlledReadableByteStream._state;\n if (\"readable\" !== e2) throw new TypeError(`The stream (in ${e2} state) is not in the readable state and cannot be closed`);\n Ue(this);\n }\n enqueue(e2) {\n if (!Oe(this)) throw nt(\"enqueue\");\n if (M(e2, 1, \"enqueue\"), !ArrayBuffer.isView(e2)) throw new TypeError(\"chunk must be an array buffer view\");\n if (0 === e2.byteLength) throw new TypeError(\"chunk must have non-zero byteLength\");\n if (0 === e2.buffer.byteLength) throw new TypeError(\"chunk's buffer must have non-zero byteLength\");\n if (this._closeRequested) throw new TypeError(\"stream is closed or draining\");\n const t2 = this._controlledReadableByteStream._state;\n if (\"readable\" !== t2) throw new TypeError(`The stream (in ${t2} state) is not in the readable state and cannot be enqueued to`);\n Ge(this, e2);\n }\n error(e2 = void 0) {\n if (!Oe(this)) throw nt(\"error\");\n Xe(this, e2);\n }\n [T](e2) {\n ke(this), qe(this);\n const t2 = this._cancelAlgorithm(e2);\n return Ve(this), t2;\n }\n [P](e2) {\n const t2 = this._controlledReadableByteStream;\n if (this._queueTotalSize > 0) return void Je(this, e2);\n const r2 = this._autoAllocateChunkSize;\n if (void 0 !== r2) {\n let t3;\n try {\n t3 = new ArrayBuffer(r2);\n } catch (t4) {\n return void e2._errorSteps(t4);\n }\n const o2 = { buffer: t3, bufferByteLength: r2, byteOffset: 0, byteLength: r2, bytesFilled: 0, minimumFill: 1, elementSize: 1, viewConstructor: Uint8Array, readerType: \"default\" };\n this._pendingPullIntos.push(o2);\n }\n U(t2, e2), je(this);\n }\n [C]() {\n return this._queueTotalSize > 0;\n }\n [q]() {\n if (this._pendingPullIntos.length > 0) {\n const e2 = this._pendingPullIntos.peek();\n e2.readerType = \"none\", this._pendingPullIntos = new v(), this._pendingPullIntos.push(e2);\n }\n }\n };\n function Oe(e2) {\n return !!t(e2) && (!!Object.prototype.hasOwnProperty.call(e2, \"_controlledReadableByteStream\") && e2 instanceof ReadableByteStreamController);\n }\n function Be(e2) {\n return !!t(e2) && (!!Object.prototype.hasOwnProperty.call(e2, \"_associatedReadableByteStreamController\") && e2 instanceof ReadableStreamBYOBRequest);\n }\n function je(e2) {\n const t2 = (function(e3) {\n const t3 = e3._controlledReadableByteStream;\n if (\"readable\" !== t3._state) return false;\n if (e3._closeRequested) return false;\n if (!e3._started) return false;\n if (J(t3) && X(t3) > 0) return true;\n if (ut(t3) && lt(t3) > 0) return true;\n const r2 = Ze(e3);\n if (r2 > 0) return true;\n return false;\n })(e2);\n if (!t2) return;\n if (e2._pulling) return void (e2._pullAgain = true);\n e2._pulling = true;\n h(e2._pullAlgorithm(), () => (e2._pulling = false, e2._pullAgain && (e2._pullAgain = false, je(e2)), null), (t3) => (Xe(e2, t3), null));\n }\n function ke(e2) {\n xe(e2), e2._pendingPullIntos = new v();\n }\n function Ae(e2, t2) {\n let r2 = false;\n \"closed\" === e2._state && (r2 = true);\n const o2 = De(t2);\n \"default\" === t2.readerType ? G(e2, o2, r2) : (function(e3, t3, r3) {\n const o3 = e3._reader, n2 = o3._readIntoRequests.shift();\n r3 ? n2._closeSteps(t3) : n2._chunkSteps(t3);\n })(e2, o2, r2);\n }\n function ze(e2, t2) {\n for (let r2 = 0; r2 < t2.length; ++r2) Ae(e2, t2[r2]);\n }\n function De(e2) {\n const t2 = e2.bytesFilled, r2 = e2.elementSize;\n return new e2.viewConstructor(e2.buffer, e2.byteOffset, t2 / r2);\n }\n function Fe(e2, t2, r2, o2) {\n e2._queue.push({ buffer: t2, byteOffset: r2, byteLength: o2 }), e2._queueTotalSize += o2;\n }\n function Le(e2, t2, r2, o2) {\n let n2;\n try {\n n2 = fe(t2, r2, r2 + o2);\n } catch (t3) {\n throw Xe(e2, t3), t3;\n }\n Fe(e2, n2, 0, o2);\n }\n function Ie(e2, t2) {\n t2.bytesFilled > 0 && Le(e2, t2.buffer, t2.byteOffset, t2.bytesFilled), He(e2);\n }\n function $e(e2, t2) {\n const r2 = Math.min(e2._queueTotalSize, t2.byteLength - t2.bytesFilled), o2 = t2.bytesFilled + r2;\n let n2 = r2, i2 = false;\n const a2 = o2 - o2 % t2.elementSize;\n a2 >= t2.minimumFill && (n2 = a2 - t2.bytesFilled, i2 = true);\n const s2 = e2._queue;\n for (; n2 > 0; ) {\n const r3 = s2.peek(), o3 = Math.min(n2, r3.byteLength), i3 = t2.byteOffset + t2.bytesFilled;\n ue(t2.buffer, i3, r3.buffer, r3.byteOffset, o3), r3.byteLength === o3 ? s2.shift() : (r3.byteOffset += o3, r3.byteLength -= o3), e2._queueTotalSize -= o3, Me(e2, o3, t2), n2 -= o3;\n }\n return i2;\n }\n function Me(e2, t2, r2) {\n r2.bytesFilled += t2;\n }\n function Ye(e2) {\n 0 === e2._queueTotalSize && e2._closeRequested ? (Ve(e2), Yr(e2._controlledReadableByteStream)) : je(e2);\n }\n function xe(e2) {\n null !== e2._byobRequest && (e2._byobRequest._associatedReadableByteStreamController = void 0, e2._byobRequest._view = null, e2._byobRequest = null);\n }\n function Qe(e2) {\n const t2 = [];\n for (; e2._pendingPullIntos.length > 0 && 0 !== e2._queueTotalSize; ) {\n const r2 = e2._pendingPullIntos.peek();\n $e(e2, r2) && (He(e2), t2.push(r2));\n }\n return t2;\n }\n function Ne(e2, t2) {\n const r2 = e2._pendingPullIntos.peek();\n xe(e2);\n \"closed\" === e2._controlledReadableByteStream._state ? (function(e3, t3) {\n \"none\" === t3.readerType && He(e3);\n const r3 = e3._controlledReadableByteStream;\n if (ut(r3)) {\n const t4 = [];\n for (; t4.length < lt(r3); ) t4.push(He(e3));\n ze(r3, t4);\n }\n })(e2, r2) : (function(e3, t3, r3) {\n if (Me(0, t3, r3), \"none\" === r3.readerType) {\n Ie(e3, r3);\n const t4 = Qe(e3);\n return void ze(e3._controlledReadableByteStream, t4);\n }\n if (r3.bytesFilled < r3.minimumFill) return;\n He(e3);\n const o2 = r3.bytesFilled % r3.elementSize;\n if (o2 > 0) {\n const t4 = r3.byteOffset + r3.bytesFilled;\n Le(e3, r3.buffer, t4 - o2, o2);\n }\n r3.bytesFilled -= o2;\n const n2 = Qe(e3);\n Ae(e3._controlledReadableByteStream, r3), ze(e3._controlledReadableByteStream, n2);\n })(e2, t2, r2), je(e2);\n }\n function He(e2) {\n return e2._pendingPullIntos.shift();\n }\n function Ve(e2) {\n e2._pullAlgorithm = void 0, e2._cancelAlgorithm = void 0;\n }\n function Ue(e2) {\n const t2 = e2._controlledReadableByteStream;\n if (!e2._closeRequested && \"readable\" === t2._state) if (e2._queueTotalSize > 0) e2._closeRequested = true;\n else {\n if (e2._pendingPullIntos.length > 0) {\n const t3 = e2._pendingPullIntos.peek();\n if (t3.bytesFilled % t3.elementSize !== 0) {\n const t4 = new TypeError(\"Insufficient bytes to fill elements in the given buffer\");\n throw Xe(e2, t4), t4;\n }\n }\n Ve(e2), Yr(t2);\n }\n }\n function Ge(e2, t2) {\n const r2 = e2._controlledReadableByteStream;\n if (e2._closeRequested || \"readable\" !== r2._state) return;\n const { buffer: o2, byteOffset: n2, byteLength: i2 } = t2;\n if (de(o2)) throw new TypeError(\"chunk's buffer is detached and so cannot be enqueued\");\n const a2 = ce(o2);\n if (e2._pendingPullIntos.length > 0) {\n const t3 = e2._pendingPullIntos.peek();\n if (de(t3.buffer)) throw new TypeError(\"The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk\");\n xe(e2), t3.buffer = ce(t3.buffer), \"none\" === t3.readerType && Ie(e2, t3);\n }\n if (J(r2)) if ((function(e3) {\n const t3 = e3._controlledReadableByteStream._reader;\n for (; t3._readRequests.length > 0; ) {\n if (0 === e3._queueTotalSize) return;\n Je(e3, t3._readRequests.shift());\n }\n })(e2), 0 === X(r2)) Fe(e2, a2, n2, i2);\n else {\n e2._pendingPullIntos.length > 0 && He(e2);\n G(r2, new Uint8Array(a2, n2, i2), false);\n }\n else if (ut(r2)) {\n Fe(e2, a2, n2, i2);\n ze(r2, Qe(e2));\n } else Fe(e2, a2, n2, i2);\n je(e2);\n }\n function Xe(e2, t2) {\n const r2 = e2._controlledReadableByteStream;\n \"readable\" === r2._state && (ke(e2), qe(e2), Ve(e2), xr(r2, t2));\n }\n function Je(e2, t2) {\n const r2 = e2._queue.shift();\n e2._queueTotalSize -= r2.byteLength, Ye(e2);\n const o2 = new Uint8Array(r2.buffer, r2.byteOffset, r2.byteLength);\n t2._chunkSteps(o2);\n }\n function Ke(e2) {\n if (null === e2._byobRequest && e2._pendingPullIntos.length > 0) {\n const t2 = e2._pendingPullIntos.peek(), r2 = new Uint8Array(t2.buffer, t2.byteOffset + t2.bytesFilled, t2.byteLength - t2.bytesFilled), o2 = Object.create(ReadableStreamBYOBRequest.prototype);\n !(function(e3, t3, r3) {\n e3._associatedReadableByteStreamController = t3, e3._view = r3;\n })(o2, e2, r2), e2._byobRequest = o2;\n }\n return e2._byobRequest;\n }\n function Ze(e2) {\n const t2 = e2._controlledReadableByteStream._state;\n return \"errored\" === t2 ? null : \"closed\" === t2 ? 0 : e2._strategyHWM - e2._queueTotalSize;\n }\n function et(e2, t2) {\n const r2 = e2._pendingPullIntos.peek();\n if (\"closed\" === e2._controlledReadableByteStream._state) {\n if (0 !== t2) throw new TypeError(\"bytesWritten must be 0 when calling respond() on a closed stream\");\n } else {\n if (0 === t2) throw new TypeError(\"bytesWritten must be greater than 0 when calling respond() on a readable stream\");\n if (r2.bytesFilled + t2 > r2.byteLength) throw new RangeError(\"bytesWritten out of range\");\n }\n r2.buffer = ce(r2.buffer), Ne(e2, t2);\n }\n function tt(e2, t2) {\n const r2 = e2._pendingPullIntos.peek();\n if (\"closed\" === e2._controlledReadableByteStream._state) {\n if (0 !== t2.byteLength) throw new TypeError(\"The view's length must be 0 when calling respondWithNewView() on a closed stream\");\n } else if (0 === t2.byteLength) throw new TypeError(\"The view's length must be greater than 0 when calling respondWithNewView() on a readable stream\");\n if (r2.byteOffset + r2.bytesFilled !== t2.byteOffset) throw new RangeError(\"The region specified by view does not match byobRequest\");\n if (r2.bufferByteLength !== t2.buffer.byteLength) throw new RangeError(\"The buffer of view has different capacity than byobRequest\");\n if (r2.bytesFilled + t2.byteLength > r2.byteLength) throw new RangeError(\"The region specified by view is larger than byobRequest\");\n const o2 = t2.byteLength;\n r2.buffer = ce(t2.buffer), Ne(e2, o2);\n }\n function rt(e2, t2, r2, o2, n2, i2, a2) {\n t2._controlledReadableByteStream = e2, t2._pullAgain = false, t2._pulling = false, t2._byobRequest = null, t2._queue = t2._queueTotalSize = void 0, qe(t2), t2._closeRequested = false, t2._started = false, t2._strategyHWM = i2, t2._pullAlgorithm = o2, t2._cancelAlgorithm = n2, t2._autoAllocateChunkSize = a2, t2._pendingPullIntos = new v(), e2._readableStreamController = t2;\n h(c(r2()), () => (t2._started = true, je(t2), null), (e3) => (Xe(t2, e3), null));\n }\n function ot(e2) {\n return new TypeError(`ReadableStreamBYOBRequest.prototype.${e2} can only be used on a ReadableStreamBYOBRequest`);\n }\n function nt(e2) {\n return new TypeError(`ReadableByteStreamController.prototype.${e2} can only be used on a ReadableByteStreamController`);\n }\n function it(e2, t2) {\n if (\"byob\" !== (e2 = `${e2}`)) throw new TypeError(`${t2} '${e2}' is not a valid enumeration value for ReadableStreamReaderMode`);\n return e2;\n }\n function at(e2) {\n return new ReadableStreamBYOBReader(e2);\n }\n function st(e2, t2) {\n e2._reader._readIntoRequests.push(t2);\n }\n function lt(e2) {\n return e2._reader._readIntoRequests.length;\n }\n function ut(e2) {\n const t2 = e2._reader;\n return void 0 !== t2 && !!ft(t2);\n }\n Object.defineProperties(ReadableByteStreamController.prototype, { close: { enumerable: true }, enqueue: { enumerable: true }, error: { enumerable: true }, byobRequest: { enumerable: true }, desiredSize: { enumerable: true } }), o(ReadableByteStreamController.prototype.close, \"close\"), o(ReadableByteStreamController.prototype.enqueue, \"enqueue\"), o(ReadableByteStreamController.prototype.error, \"error\"), \"symbol\" == typeof Symbol.toStringTag && Object.defineProperty(ReadableByteStreamController.prototype, Symbol.toStringTag, { value: \"ReadableByteStreamController\", configurable: true });\n var ReadableStreamBYOBReader = class {\n constructor(e2) {\n if (M(e2, 1, \"ReadableStreamBYOBReader\"), H(e2, \"First parameter\"), $r(e2)) throw new TypeError(\"This stream has already been locked for exclusive reading by another reader\");\n if (!Oe(e2._readableStreamController)) throw new TypeError(\"Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source\");\n E(this, e2), this._readIntoRequests = new v();\n }\n get closed() {\n return ft(this) ? this._closedPromise : d(_t(\"closed\"));\n }\n cancel(e2 = void 0) {\n return ft(this) ? void 0 === this._ownerReadableStream ? d(B(\"cancel\")) : W(this, e2) : d(_t(\"cancel\"));\n }\n read(e2, t2 = {}) {\n if (!ft(this)) return d(_t(\"read\"));\n if (!ArrayBuffer.isView(e2)) return d(new TypeError(\"view must be an array buffer view\"));\n if (0 === e2.byteLength) return d(new TypeError(\"view must have non-zero byteLength\"));\n if (0 === e2.buffer.byteLength) return d(new TypeError(\"view's buffer must have non-zero byteLength\"));\n if (de(e2.buffer)) return d(new TypeError(\"view's buffer has been detached\"));\n let r2;\n try {\n r2 = (function(e3, t3) {\n var r3;\n return L(e3, t3), { min: N(null !== (r3 = null == e3 ? void 0 : e3.min) && void 0 !== r3 ? r3 : 1, `${t3} has member 'min' that`) };\n })(t2, \"options\");\n } catch (e3) {\n return d(e3);\n }\n const o2 = r2.min;\n if (0 === o2) return d(new TypeError(\"options.min must be greater than 0\"));\n if ((function(e3) {\n return Ee(e3.constructor);\n })(e2)) {\n if (o2 > e2.byteLength) return d(new RangeError(\"options.min must be less than or equal to view's byteLength\"));\n } else if (o2 > e2.length) return d(new RangeError(\"options.min must be less than or equal to view's length\"));\n if (void 0 === this._ownerReadableStream) return d(B(\"read from\"));\n const n2 = (function(e3, t3, r3) {\n const o3 = e3._ownerReadableStream;\n return \"errored\" === o3._state || (function(e4, t4, r4) {\n const o4 = e4._controlledReadableByteStream, n3 = We(t4.constructor), { byteLength: i2 } = t4, a2 = r4 * n3;\n return !(e4._pendingPullIntos.length > 0) && (\"closed\" === o4._state || e4._queueTotalSize >= a2);\n })(o3._readableStreamController, t3, r3);\n })(this, e2, o2) ? new dt() : new ct();\n return ht(this, e2, o2, n2), n2._promise;\n }\n releaseLock() {\n if (!ft(this)) throw _t(\"releaseLock\");\n void 0 !== this._ownerReadableStream && (function(e2) {\n O(e2);\n const t2 = new TypeError(\"Reader was released\");\n bt(e2, t2);\n })(this);\n }\n };\n Object.defineProperties(ReadableStreamBYOBReader.prototype, { cancel: { enumerable: true }, read: { enumerable: true }, releaseLock: { enumerable: true }, closed: { enumerable: true } }), o(ReadableStreamBYOBReader.prototype.cancel, \"cancel\"), o(ReadableStreamBYOBReader.prototype.read, \"read\"), o(ReadableStreamBYOBReader.prototype.releaseLock, \"releaseLock\"), \"symbol\" == typeof Symbol.toStringTag && Object.defineProperty(ReadableStreamBYOBReader.prototype, Symbol.toStringTag, { value: \"ReadableStreamBYOBReader\", configurable: true });\n var ct = class {\n constructor() {\n this._promise = u((e2, t2) => {\n this._resolvePromise = e2, this._rejectPromise = t2;\n });\n }\n _chunkSteps(e2) {\n this._resolvePromise({ value: e2, done: false });\n }\n _closeSteps(e2) {\n this._resolvePromise({ value: e2, done: true });\n }\n _errorSteps(e2) {\n this._rejectPromise(e2);\n }\n };\n var dt = class {\n constructor() {\n this._promise = void 0;\n }\n _chunkSteps(e2) {\n this._promise = l({ value: e2, done: false });\n }\n _closeSteps(e2) {\n this._promise = l({ value: e2, done: true });\n }\n _errorSteps(e2) {\n this._promise = d(e2);\n }\n };\n function ft(e2) {\n return !!t(e2) && (!!Object.prototype.hasOwnProperty.call(e2, \"_readIntoRequests\") && e2 instanceof ReadableStreamBYOBReader);\n }\n function ht(e2, t2, r2, o2) {\n const n2 = e2._ownerReadableStream;\n n2._disturbed = true, \"errored\" === n2._state ? o2._errorSteps(n2._storedError) : (function(e3, t3, r3, o3) {\n const n3 = e3._controlledReadableByteStream, i2 = t3.constructor, a2 = We(i2), { byteOffset: s2, byteLength: l2 } = t3, u2 = r3 * a2;\n let c2;\n try {\n c2 = ce(t3.buffer);\n } catch (e4) {\n return void o3._errorSteps(e4);\n }\n const d2 = { buffer: c2, bufferByteLength: c2.byteLength, byteOffset: s2, byteLength: l2, bytesFilled: 0, minimumFill: u2, elementSize: a2, viewConstructor: i2, readerType: \"byob\" };\n if (e3._pendingPullIntos.length > 0) return e3._pendingPullIntos.push(d2), void st(n3, o3);\n if (\"closed\" === n3._state) {\n const e4 = new i2(d2.buffer, d2.byteOffset, 0);\n return void o3._closeSteps(e4);\n }\n if (e3._queueTotalSize > 0) {\n if ($e(e3, d2)) {\n const t4 = De(d2);\n return Ye(e3), void o3._chunkSteps(t4);\n }\n if (e3._closeRequested) {\n const t4 = new TypeError(\"Insufficient bytes to fill elements in the given buffer\");\n return Xe(e3, t4), void o3._errorSteps(t4);\n }\n }\n e3._pendingPullIntos.push(d2), st(n3, o3), je(e3);\n })(n2._readableStreamController, t2, r2, o2);\n }\n function bt(e2, t2) {\n const r2 = e2._readIntoRequests;\n e2._readIntoRequests = new v(), r2.forEach((e3) => {\n e3._errorSteps(t2);\n });\n }\n function _t(e2) {\n return new TypeError(`ReadableStreamBYOBReader.prototype.${e2} can only be used on a ReadableStreamBYOBReader`);\n }\n function mt(e2, t2) {\n const { highWaterMark: r2 } = e2;\n if (void 0 === r2) return t2;\n if (Re(r2) || r2 < 0) throw new RangeError(\"Invalid highWaterMark\");\n return r2;\n }\n function pt(e2) {\n const { size: t2 } = e2;\n return t2 || (() => 1);\n }\n function yt(e2, t2) {\n L(e2, t2);\n const r2 = null == e2 ? void 0 : e2.highWaterMark, o2 = null == e2 ? void 0 : e2.size;\n return { highWaterMark: void 0 === r2 ? void 0 : x(r2), size: void 0 === o2 ? void 0 : St(o2, `${t2} has member 'size' that`) };\n }\n function St(e2, t2) {\n return I(e2, t2), (t3) => x(e2(t3));\n }\n function gt(e2, t2, r2) {\n return I(e2, r2), (r3) => g(e2, t2, [r3]);\n }\n function vt(e2, t2, r2) {\n return I(e2, r2), () => g(e2, t2, []);\n }\n function wt(e2, t2, r2) {\n return I(e2, r2), (r3) => S(e2, t2, [r3]);\n }\n function Rt(e2, t2, r2) {\n return I(e2, r2), (r3, o2) => g(e2, t2, [r3, o2]);\n }\n function Tt(e2, t2) {\n if (!qt(e2)) throw new TypeError(`${t2} is not a WritableStream.`);\n }\n var WritableStream = class {\n constructor(e2 = {}, t2 = {}) {\n void 0 === e2 ? e2 = null : $(e2, \"First parameter\");\n const r2 = yt(t2, \"Second parameter\"), o2 = (function(e3, t3) {\n L(e3, t3);\n const r3 = null == e3 ? void 0 : e3.abort, o3 = null == e3 ? void 0 : e3.close, n3 = null == e3 ? void 0 : e3.start, i2 = null == e3 ? void 0 : e3.type, a2 = null == e3 ? void 0 : e3.write;\n return { abort: void 0 === r3 ? void 0 : gt(r3, e3, `${t3} has member 'abort' that`), close: void 0 === o3 ? void 0 : vt(o3, e3, `${t3} has member 'close' that`), start: void 0 === n3 ? void 0 : wt(n3, e3, `${t3} has member 'start' that`), write: void 0 === a2 ? void 0 : Rt(a2, e3, `${t3} has member 'write' that`), type: i2 };\n })(e2, \"First parameter\");\n Ct(this);\n if (void 0 !== o2.type) throw new RangeError(\"Invalid type is specified\");\n const n2 = pt(r2);\n !(function(e3, t3, r3, o3) {\n const n3 = Object.create(WritableStreamDefaultController.prototype);\n let i2, a2, s2, l2;\n i2 = void 0 !== t3.start ? () => t3.start(n3) : () => {\n };\n a2 = void 0 !== t3.write ? (e4) => t3.write(e4, n3) : () => c(void 0);\n s2 = void 0 !== t3.close ? () => t3.close() : () => c(void 0);\n l2 = void 0 !== t3.abort ? (e4) => t3.abort(e4) : () => c(void 0);\n Nt(e3, n3, i2, a2, s2, l2, r3, o3);\n })(this, o2, mt(r2, 1), n2);\n }\n get locked() {\n if (!qt(this)) throw Kt(\"locked\");\n return Et(this);\n }\n abort(e2 = void 0) {\n return qt(this) ? Et(this) ? d(new TypeError(\"Cannot abort a stream that already has a writer\")) : Wt(this, e2) : d(Kt(\"abort\"));\n }\n close() {\n return qt(this) ? Et(this) ? d(new TypeError(\"Cannot close a stream that already has a writer\")) : At(this) ? d(new TypeError(\"Cannot close an already-closing stream\")) : Ot(this) : d(Kt(\"close\"));\n }\n getWriter() {\n if (!qt(this)) throw Kt(\"getWriter\");\n return Pt(this);\n }\n };\n function Pt(e2) {\n return new WritableStreamDefaultWriter(e2);\n }\n function Ct(e2) {\n e2._state = \"writable\", e2._storedError = void 0, e2._writer = void 0, e2._writableStreamController = void 0, e2._writeRequests = new v(), e2._inFlightWriteRequest = void 0, e2._closeRequest = void 0, e2._inFlightCloseRequest = void 0, e2._pendingAbortRequest = void 0, e2._backpressure = false;\n }\n function qt(e2) {\n return !!t(e2) && (!!Object.prototype.hasOwnProperty.call(e2, \"_writableStreamController\") && e2 instanceof WritableStream);\n }\n function Et(e2) {\n return void 0 !== e2._writer;\n }\n function Wt(e2, t2) {\n var r2;\n if (\"closed\" === e2._state || \"errored\" === e2._state) return c(void 0);\n e2._writableStreamController._abortReason = t2, null === (r2 = e2._writableStreamController._abortController) || void 0 === r2 || r2.abort(t2);\n const o2 = e2._state;\n if (\"closed\" === o2 || \"errored\" === o2) return c(void 0);\n if (void 0 !== e2._pendingAbortRequest) return e2._pendingAbortRequest._promise;\n let n2 = false;\n \"erroring\" === o2 && (n2 = true, t2 = void 0);\n const i2 = u((r3, o3) => {\n e2._pendingAbortRequest = { _promise: void 0, _resolve: r3, _reject: o3, _reason: t2, _wasAlreadyErroring: n2 };\n });\n return e2._pendingAbortRequest._promise = i2, n2 || jt(e2, t2), i2;\n }\n function Ot(e2) {\n const t2 = e2._state;\n if (\"closed\" === t2 || \"errored\" === t2) return d(new TypeError(`The stream (in ${t2} state) is not in the writable state and cannot be closed`));\n const r2 = u((t3, r3) => {\n const o3 = { _resolve: t3, _reject: r3 };\n e2._closeRequest = o3;\n }), o2 = e2._writer;\n var n2;\n return void 0 !== o2 && e2._backpressure && \"writable\" === t2 && cr(o2), Ce(n2 = e2._writableStreamController, xt, 0), Ut(n2), r2;\n }\n function Bt(e2, t2) {\n \"writable\" !== e2._state ? kt(e2) : jt(e2, t2);\n }\n function jt(e2, t2) {\n const r2 = e2._writableStreamController;\n e2._state = \"erroring\", e2._storedError = t2;\n const o2 = e2._writer;\n void 0 !== o2 && $t(o2, t2), !(function(e3) {\n if (void 0 === e3._inFlightWriteRequest && void 0 === e3._inFlightCloseRequest) return false;\n return true;\n })(e2) && r2._started && kt(e2);\n }\n function kt(e2) {\n e2._state = \"errored\", e2._writableStreamController[R]();\n const t2 = e2._storedError;\n if (e2._writeRequests.forEach((e3) => {\n e3._reject(t2);\n }), e2._writeRequests = new v(), void 0 === e2._pendingAbortRequest) return void zt(e2);\n const r2 = e2._pendingAbortRequest;\n if (e2._pendingAbortRequest = void 0, r2._wasAlreadyErroring) return r2._reject(t2), void zt(e2);\n h(e2._writableStreamController[w](r2._reason), () => (r2._resolve(), zt(e2), null), (t3) => (r2._reject(t3), zt(e2), null));\n }\n function At(e2) {\n return void 0 !== e2._closeRequest || void 0 !== e2._inFlightCloseRequest;\n }\n function zt(e2) {\n void 0 !== e2._closeRequest && (e2._closeRequest._reject(e2._storedError), e2._closeRequest = void 0);\n const t2 = e2._writer;\n void 0 !== t2 && nr(t2, e2._storedError);\n }\n function Dt(e2, t2) {\n const r2 = e2._writer;\n void 0 !== r2 && t2 !== e2._backpressure && (t2 ? (function(e3) {\n ar(e3);\n })(r2) : cr(r2)), e2._backpressure = t2;\n }\n Object.defineProperties(WritableStream.prototype, { abort: { enumerable: true }, close: { enumerable: true }, getWriter: { enumerable: true }, locked: { enumerable: true } }), o(WritableStream.prototype.abort, \"abort\"), o(WritableStream.prototype.close, \"close\"), o(WritableStream.prototype.getWriter, \"getWriter\"), \"symbol\" == typeof Symbol.toStringTag && Object.defineProperty(WritableStream.prototype, Symbol.toStringTag, { value: \"WritableStream\", configurable: true });\n var WritableStreamDefaultWriter = class {\n constructor(e2) {\n if (M(e2, 1, \"WritableStreamDefaultWriter\"), Tt(e2, \"First parameter\"), Et(e2)) throw new TypeError(\"This stream has already been locked for exclusive writing by another writer\");\n this._ownerWritableStream = e2, e2._writer = this;\n const t2 = e2._state;\n if (\"writable\" === t2) !At(e2) && e2._backpressure ? ar(this) : lr(this), rr(this);\n else if (\"erroring\" === t2) sr(this, e2._storedError), rr(this);\n else if (\"closed\" === t2) lr(this), rr(r2 = this), ir(r2);\n else {\n const t3 = e2._storedError;\n sr(this, t3), or(this, t3);\n }\n var r2;\n }\n get closed() {\n return Ft(this) ? this._closedPromise : d(er(\"closed\"));\n }\n get desiredSize() {\n if (!Ft(this)) throw er(\"desiredSize\");\n if (void 0 === this._ownerWritableStream) throw tr(\"desiredSize\");\n return (function(e2) {\n const t2 = e2._ownerWritableStream, r2 = t2._state;\n if (\"errored\" === r2 || \"erroring\" === r2) return null;\n if (\"closed\" === r2) return 0;\n return Vt(t2._writableStreamController);\n })(this);\n }\n get ready() {\n return Ft(this) ? this._readyPromise : d(er(\"ready\"));\n }\n abort(e2 = void 0) {\n return Ft(this) ? void 0 === this._ownerWritableStream ? d(tr(\"abort\")) : (function(e3, t2) {\n return Wt(e3._ownerWritableStream, t2);\n })(this, e2) : d(er(\"abort\"));\n }\n close() {\n if (!Ft(this)) return d(er(\"close\"));\n const e2 = this._ownerWritableStream;\n return void 0 === e2 ? d(tr(\"close\")) : At(e2) ? d(new TypeError(\"Cannot close an already-closing stream\")) : Lt(this);\n }\n releaseLock() {\n if (!Ft(this)) throw er(\"releaseLock\");\n void 0 !== this._ownerWritableStream && Mt(this);\n }\n write(e2 = void 0) {\n return Ft(this) ? void 0 === this._ownerWritableStream ? d(tr(\"write to\")) : Yt(this, e2) : d(er(\"write\"));\n }\n };\n function Ft(e2) {\n return !!t(e2) && (!!Object.prototype.hasOwnProperty.call(e2, \"_ownerWritableStream\") && e2 instanceof WritableStreamDefaultWriter);\n }\n function Lt(e2) {\n return Ot(e2._ownerWritableStream);\n }\n function It(e2, t2) {\n \"pending\" === e2._closedPromiseState ? nr(e2, t2) : (function(e3, t3) {\n or(e3, t3);\n })(e2, t2);\n }\n function $t(e2, t2) {\n \"pending\" === e2._readyPromiseState ? ur(e2, t2) : (function(e3, t3) {\n sr(e3, t3);\n })(e2, t2);\n }\n function Mt(e2) {\n const t2 = e2._ownerWritableStream, r2 = new TypeError(\"Writer was released and can no longer be used to monitor the stream's closedness\");\n $t(e2, r2), It(e2, r2), t2._writer = void 0, e2._ownerWritableStream = void 0;\n }\n function Yt(e2, t2) {\n const r2 = e2._ownerWritableStream, o2 = r2._writableStreamController, n2 = (function(e3, t3) {\n if (void 0 === e3._strategySizeAlgorithm) return 1;\n try {\n return e3._strategySizeAlgorithm(t3);\n } catch (t4) {\n return Gt(e3, t4), 1;\n }\n })(o2, t2);\n if (r2 !== e2._ownerWritableStream) return d(tr(\"write to\"));\n const i2 = r2._state;\n if (\"errored\" === i2) return d(r2._storedError);\n if (At(r2) || \"closed\" === i2) return d(new TypeError(\"The stream is closing or closed and cannot be written to\"));\n if (\"erroring\" === i2) return d(r2._storedError);\n const a2 = (function(e3) {\n return u((t3, r3) => {\n const o3 = { _resolve: t3, _reject: r3 };\n e3._writeRequests.push(o3);\n });\n })(r2);\n return (function(e3, t3, r3) {\n try {\n Ce(e3, t3, r3);\n } catch (t4) {\n return void Gt(e3, t4);\n }\n const o3 = e3._controlledWritableStream;\n if (!At(o3) && \"writable\" === o3._state) {\n Dt(o3, Xt(e3));\n }\n Ut(e3);\n })(o2, t2, n2), a2;\n }\n Object.defineProperties(WritableStreamDefaultWriter.prototype, { abort: { enumerable: true }, close: { enumerable: true }, releaseLock: { enumerable: true }, write: { enumerable: true }, closed: { enumerable: true }, desiredSize: { enumerable: true }, ready: { enumerable: true } }), o(WritableStreamDefaultWriter.prototype.abort, \"abort\"), o(WritableStreamDefaultWriter.prototype.close, \"close\"), o(WritableStreamDefaultWriter.prototype.releaseLock, \"releaseLock\"), o(WritableStreamDefaultWriter.prototype.write, \"write\"), \"symbol\" == typeof Symbol.toStringTag && Object.defineProperty(WritableStreamDefaultWriter.prototype, Symbol.toStringTag, { value: \"WritableStreamDefaultWriter\", configurable: true });\n var xt = {};\n var WritableStreamDefaultController = class {\n constructor() {\n throw new TypeError(\"Illegal constructor\");\n }\n get abortReason() {\n if (!Qt(this)) throw Zt(\"abortReason\");\n return this._abortReason;\n }\n get signal() {\n if (!Qt(this)) throw Zt(\"signal\");\n if (void 0 === this._abortController) throw new TypeError(\"WritableStreamDefaultController.prototype.signal is not supported\");\n return this._abortController.signal;\n }\n error(e2 = void 0) {\n if (!Qt(this)) throw Zt(\"error\");\n \"writable\" === this._controlledWritableStream._state && Jt(this, e2);\n }\n [w](e2) {\n const t2 = this._abortAlgorithm(e2);\n return Ht(this), t2;\n }\n [R]() {\n qe(this);\n }\n };\n function Qt(e2) {\n return !!t(e2) && (!!Object.prototype.hasOwnProperty.call(e2, \"_controlledWritableStream\") && e2 instanceof WritableStreamDefaultController);\n }\n function Nt(e2, t2, r2, o2, n2, i2, a2, s2) {\n t2._controlledWritableStream = e2, e2._writableStreamController = t2, t2._queue = void 0, t2._queueTotalSize = void 0, qe(t2), t2._abortReason = void 0, t2._abortController = (function() {\n if (\"function\" == typeof AbortController) return new AbortController();\n })(), t2._started = false, t2._strategySizeAlgorithm = s2, t2._strategyHWM = a2, t2._writeAlgorithm = o2, t2._closeAlgorithm = n2, t2._abortAlgorithm = i2;\n const l2 = Xt(t2);\n Dt(e2, l2);\n h(c(r2()), () => (t2._started = true, Ut(t2), null), (r3) => (t2._started = true, Bt(e2, r3), null));\n }\n function Ht(e2) {\n e2._writeAlgorithm = void 0, e2._closeAlgorithm = void 0, e2._abortAlgorithm = void 0, e2._strategySizeAlgorithm = void 0;\n }\n function Vt(e2) {\n return e2._strategyHWM - e2._queueTotalSize;\n }\n function Ut(e2) {\n const t2 = e2._controlledWritableStream;\n if (!e2._started) return;\n if (void 0 !== t2._inFlightWriteRequest) return;\n if (\"erroring\" === t2._state) return void kt(t2);\n if (0 === e2._queue.length) return;\n const r2 = e2._queue.peek().value;\n r2 === xt ? (function(e3) {\n const t3 = e3._controlledWritableStream;\n (function(e4) {\n e4._inFlightCloseRequest = e4._closeRequest, e4._closeRequest = void 0;\n })(t3), Pe(e3);\n const r3 = e3._closeAlgorithm();\n Ht(e3), h(r3, () => ((function(e4) {\n e4._inFlightCloseRequest._resolve(void 0), e4._inFlightCloseRequest = void 0, \"erroring\" === e4._state && (e4._storedError = void 0, void 0 !== e4._pendingAbortRequest && (e4._pendingAbortRequest._resolve(), e4._pendingAbortRequest = void 0)), e4._state = \"closed\";\n const t4 = e4._writer;\n void 0 !== t4 && ir(t4);\n })(t3), null), (e4) => ((function(e5, t4) {\n e5._inFlightCloseRequest._reject(t4), e5._inFlightCloseRequest = void 0, void 0 !== e5._pendingAbortRequest && (e5._pendingAbortRequest._reject(t4), e5._pendingAbortRequest = void 0), Bt(e5, t4);\n })(t3, e4), null));\n })(e2) : (function(e3, t3) {\n const r3 = e3._controlledWritableStream;\n !(function(e4) {\n e4._inFlightWriteRequest = e4._writeRequests.shift();\n })(r3);\n const o2 = e3._writeAlgorithm(t3);\n h(o2, () => {\n !(function(e4) {\n e4._inFlightWriteRequest._resolve(void 0), e4._inFlightWriteRequest = void 0;\n })(r3);\n const t4 = r3._state;\n if (Pe(e3), !At(r3) && \"writable\" === t4) {\n const t5 = Xt(e3);\n Dt(r3, t5);\n }\n return Ut(e3), null;\n }, (t4) => (\"writable\" === r3._state && Ht(e3), (function(e4, t5) {\n e4._inFlightWriteRequest._reject(t5), e4._inFlightWriteRequest = void 0, Bt(e4, t5);\n })(r3, t4), null));\n })(e2, r2);\n }\n function Gt(e2, t2) {\n \"writable\" === e2._controlledWritableStream._state && Jt(e2, t2);\n }\n function Xt(e2) {\n return Vt(e2) <= 0;\n }\n function Jt(e2, t2) {\n const r2 = e2._controlledWritableStream;\n Ht(e2), jt(r2, t2);\n }\n function Kt(e2) {\n return new TypeError(`WritableStream.prototype.${e2} can only be used on a WritableStream`);\n }\n function Zt(e2) {\n return new TypeError(`WritableStreamDefaultController.prototype.${e2} can only be used on a WritableStreamDefaultController`);\n }\n function er(e2) {\n return new TypeError(`WritableStreamDefaultWriter.prototype.${e2} can only be used on a WritableStreamDefaultWriter`);\n }\n function tr(e2) {\n return new TypeError(\"Cannot \" + e2 + \" a stream using a released writer\");\n }\n function rr(e2) {\n e2._closedPromise = u((t2, r2) => {\n e2._closedPromise_resolve = t2, e2._closedPromise_reject = r2, e2._closedPromiseState = \"pending\";\n });\n }\n function or(e2, t2) {\n rr(e2), nr(e2, t2);\n }\n function nr(e2, t2) {\n void 0 !== e2._closedPromise_reject && (p(e2._closedPromise), e2._closedPromise_reject(t2), e2._closedPromise_resolve = void 0, e2._closedPromise_reject = void 0, e2._closedPromiseState = \"rejected\");\n }\n function ir(e2) {\n void 0 !== e2._closedPromise_resolve && (e2._closedPromise_resolve(void 0), e2._closedPromise_resolve = void 0, e2._closedPromise_reject = void 0, e2._closedPromiseState = \"resolved\");\n }\n function ar(e2) {\n e2._readyPromise = u((t2, r2) => {\n e2._readyPromise_resolve = t2, e2._readyPromise_reject = r2;\n }), e2._readyPromiseState = \"pending\";\n }\n function sr(e2, t2) {\n ar(e2), ur(e2, t2);\n }\n function lr(e2) {\n ar(e2), cr(e2);\n }\n function ur(e2, t2) {\n void 0 !== e2._readyPromise_reject && (p(e2._readyPromise), e2._readyPromise_reject(t2), e2._readyPromise_resolve = void 0, e2._readyPromise_reject = void 0, e2._readyPromiseState = \"rejected\");\n }\n function cr(e2) {\n void 0 !== e2._readyPromise_resolve && (e2._readyPromise_resolve(void 0), e2._readyPromise_resolve = void 0, e2._readyPromise_reject = void 0, e2._readyPromiseState = \"fulfilled\");\n }\n Object.defineProperties(WritableStreamDefaultController.prototype, { abortReason: { enumerable: true }, signal: { enumerable: true }, error: { enumerable: true } }), \"symbol\" == typeof Symbol.toStringTag && Object.defineProperty(WritableStreamDefaultController.prototype, Symbol.toStringTag, { value: \"WritableStreamDefaultController\", configurable: true });\n var dr = \"undefined\" != typeof globalThis ? globalThis : \"undefined\" != typeof self ? self : \"undefined\" != typeof global ? global : void 0;\n var fr = (function() {\n const e2 = null == dr ? void 0 : dr.DOMException;\n return (function(e3) {\n if (\"function\" != typeof e3 && \"object\" != typeof e3) return false;\n if (\"DOMException\" !== e3.name) return false;\n try {\n return new e3(), true;\n } catch (e4) {\n return false;\n }\n })(e2) ? e2 : void 0;\n })() || (function() {\n const e2 = function(e3, t2) {\n this.message = e3 || \"\", this.name = t2 || \"Error\", Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);\n };\n return o(e2, \"DOMException\"), e2.prototype = Object.create(Error.prototype), Object.defineProperty(e2.prototype, \"constructor\", { value: e2, writable: true, configurable: true }), e2;\n })();\n function hr(e2, t2, r2, o2, n2, i2) {\n const a2 = V(e2), s2 = Pt(t2);\n e2._disturbed = true;\n const l2 = new br(s2), _2 = new mr(l2);\n return u((m2, y2) => {\n let S2;\n if (void 0 !== i2) {\n if (S2 = () => {\n const r3 = void 0 !== i2.reason ? i2.reason : new fr(\"Aborted\", \"AbortError\"), a3 = [];\n o2 || a3.push(() => \"writable\" === t2._state ? Wt(t2, r3) : c(void 0)), n2 || a3.push(() => \"readable\" === e2._state ? Mr(e2, r3) : c(void 0)), T2(() => Promise.all(a3.map((e3) => e3())), true, r3);\n }, i2.aborted) return void S2();\n i2.addEventListener(\"abort\", S2);\n }\n function g2() {\n for (; !l2._shuttingDown && !t2._backpressure && \"writable\" === t2._state && !At(t2) && \"readable\" === e2._state && re(a2); ) te(a2, _2);\n if (l2._shuttingDown) return c(true);\n if (t2._backpressure) return f(s2._readyPromise, g2);\n const r3 = new _r(l2);\n return te(a2, r3), r3._promise;\n }\n var v2, w2, R2;\n if (pr(e2, a2._closedPromise, (e3) => (o2 ? P2(true, e3) : T2(() => Wt(t2, e3), true, e3), null)), pr(t2, s2._closedPromise, (t3) => (n2 ? P2(true, t3) : T2(() => Mr(e2, t3), true, t3), null)), v2 = e2, w2 = a2._closedPromise, R2 = () => (r2 ? P2() : T2(() => (function(e3) {\n const t3 = e3._ownerWritableStream, r3 = t3._state;\n return At(t3) || \"closed\" === r3 ? c(void 0) : \"errored\" === r3 ? d(t3._storedError) : Lt(e3);\n })(s2)), null), \"closed\" === v2._state ? R2() : b(w2, R2), At(t2) || \"closed\" === t2._state) {\n const t3 = new TypeError(\"the destination writable stream closed before all data could be piped to it\");\n n2 ? P2(true, t3) : T2(() => Mr(e2, t3), true, t3);\n }\n function T2(e3, r3, o3) {\n function n3() {\n return h(e3(), () => C2(r3, o3), (e4) => C2(true, e4)), null;\n }\n l2._shuttingDown || (l2._shuttingDown = true, \"writable\" !== t2._state || At(t2) ? n3() : b(l2._waitForWritesToFinish(), n3));\n }\n function P2(e3, r3) {\n l2._shuttingDown || (l2._shuttingDown = true, \"writable\" !== t2._state || At(t2) ? C2(e3, r3) : b(l2._waitForWritesToFinish(), () => C2(e3, r3)));\n }\n function C2(e3, t3) {\n return Mt(s2), O(a2), void 0 !== i2 && i2.removeEventListener(\"abort\", S2), e3 ? y2(t3) : m2(void 0), null;\n }\n p(u((e3, t3) => {\n !(function r3(o3) {\n o3 ? e3() : f(g2(), r3, t3);\n })(false);\n }));\n });\n }\n var br = class {\n constructor(e2) {\n this._writer = e2, this._shuttingDown = false, this._currentWrite = c(void 0);\n }\n _waitForWritesToFinish() {\n const e2 = this._currentWrite;\n return f(this._currentWrite, () => e2 !== this._currentWrite ? this._waitForWritesToFinish() : void 0);\n }\n };\n var _r = class {\n constructor(e2) {\n this._state = e2, this._promise = u((e3, t2) => {\n this._resolvePromise = e3, this._rejectPromise = t2;\n });\n }\n _chunkSteps(t2) {\n this._state._currentWrite = f(Yt(this._state._writer, t2), void 0, e), this._resolvePromise(false);\n }\n _closeSteps() {\n this._resolvePromise(true);\n }\n _errorSteps(e2) {\n this._rejectPromise(e2);\n }\n };\n var mr = class {\n constructor(e2) {\n this._state = e2;\n }\n _chunkSteps(t2) {\n this._state._currentWrite = f(Yt(this._state._writer, t2), void 0, e);\n }\n _closeSteps() {\n }\n _errorSteps(e2) {\n }\n };\n function pr(e2, t2, r2) {\n \"errored\" === e2._state ? r2(e2._storedError) : _(t2, r2);\n }\n var ReadableStreamDefaultController = class {\n constructor() {\n throw new TypeError(\"Illegal constructor\");\n }\n get desiredSize() {\n if (!yr(this)) throw Er(\"desiredSize\");\n return Pr(this);\n }\n close() {\n if (!yr(this)) throw Er(\"close\");\n if (!Cr(this)) throw new TypeError(\"The stream is not in a state that permits close\");\n wr(this);\n }\n enqueue(e2 = void 0) {\n if (!yr(this)) throw Er(\"enqueue\");\n if (!Cr(this)) throw new TypeError(\"The stream is not in a state that permits enqueue\");\n return Rr(this, e2);\n }\n error(e2 = void 0) {\n if (!yr(this)) throw Er(\"error\");\n Tr(this, e2);\n }\n [T](e2) {\n qe(this);\n const t2 = this._cancelAlgorithm(e2);\n return vr(this), t2;\n }\n [P](e2) {\n const t2 = this._controlledReadableStream;\n if (this._queue.length > 0) {\n const r2 = Pe(this);\n this._closeRequested && 0 === this._queue.length ? (vr(this), Yr(t2)) : Sr(this), e2._chunkSteps(r2);\n } else U(t2, e2), Sr(this);\n }\n [C]() {\n return this._queue.length > 0;\n }\n [q]() {\n }\n };\n function yr(e2) {\n return !!t(e2) && (!!Object.prototype.hasOwnProperty.call(e2, \"_controlledReadableStream\") && e2 instanceof ReadableStreamDefaultController);\n }\n function Sr(e2) {\n if (!gr(e2)) return;\n if (e2._pulling) return void (e2._pullAgain = true);\n e2._pulling = true;\n h(e2._pullAlgorithm(), () => (e2._pulling = false, e2._pullAgain && (e2._pullAgain = false, Sr(e2)), null), (t2) => (Tr(e2, t2), null));\n }\n function gr(e2) {\n const t2 = e2._controlledReadableStream;\n if (!Cr(e2)) return false;\n if (!e2._started) return false;\n if ($r(t2) && X(t2) > 0) return true;\n return Pr(e2) > 0;\n }\n function vr(e2) {\n e2._pullAlgorithm = void 0, e2._cancelAlgorithm = void 0, e2._strategySizeAlgorithm = void 0;\n }\n function wr(e2) {\n if (!Cr(e2)) return;\n const t2 = e2._controlledReadableStream;\n e2._closeRequested = true, 0 === e2._queue.length && (vr(e2), Yr(t2));\n }\n function Rr(e2, t2) {\n if (!Cr(e2)) return;\n const r2 = e2._controlledReadableStream;\n if ($r(r2) && X(r2) > 0) G(r2, t2, false);\n else {\n let r3;\n try {\n r3 = e2._strategySizeAlgorithm(t2);\n } catch (t3) {\n throw Tr(e2, t3), t3;\n }\n try {\n Ce(e2, t2, r3);\n } catch (t3) {\n throw Tr(e2, t3), t3;\n }\n }\n Sr(e2);\n }\n function Tr(e2, t2) {\n const r2 = e2._controlledReadableStream;\n \"readable\" === r2._state && (qe(e2), vr(e2), xr(r2, t2));\n }\n function Pr(e2) {\n const t2 = e2._controlledReadableStream._state;\n return \"errored\" === t2 ? null : \"closed\" === t2 ? 0 : e2._strategyHWM - e2._queueTotalSize;\n }\n function Cr(e2) {\n const t2 = e2._controlledReadableStream._state;\n return !e2._closeRequested && \"readable\" === t2;\n }\n function qr(e2, t2, r2, o2, n2, i2, a2) {\n t2._controlledReadableStream = e2, t2._queue = void 0, t2._queueTotalSize = void 0, qe(t2), t2._started = false, t2._closeRequested = false, t2._pullAgain = false, t2._pulling = false, t2._strategySizeAlgorithm = a2, t2._strategyHWM = i2, t2._pullAlgorithm = o2, t2._cancelAlgorithm = n2, e2._readableStreamController = t2;\n h(c(r2()), () => (t2._started = true, Sr(t2), null), (e3) => (Tr(t2, e3), null));\n }\n function Er(e2) {\n return new TypeError(`ReadableStreamDefaultController.prototype.${e2} can only be used on a ReadableStreamDefaultController`);\n }\n function Wr(e2, t2) {\n return Oe(e2._readableStreamController) ? (function(e3) {\n let t3, r2, o2, n2, i2, a2 = V(e3), s2 = false, l2 = false, d2 = false, f2 = false, h2 = false;\n const b2 = u((e4) => {\n i2 = e4;\n });\n function m2(e4) {\n _(e4._closedPromise, (t4) => (e4 !== a2 || (Xe(o2._readableStreamController, t4), Xe(n2._readableStreamController, t4), f2 && h2 || i2(void 0)), null));\n }\n function p2() {\n ft(a2) && (O(a2), a2 = V(e3), m2(a2));\n te(a2, { _chunkSteps: (t4) => {\n y(() => {\n l2 = false, d2 = false;\n const r3 = t4;\n let a3 = t4;\n if (!f2 && !h2) try {\n a3 = Te(t4);\n } catch (t5) {\n return Xe(o2._readableStreamController, t5), Xe(n2._readableStreamController, t5), void i2(Mr(e3, t5));\n }\n f2 || Ge(o2._readableStreamController, r3), h2 || Ge(n2._readableStreamController, a3), s2 = false, l2 ? g2() : d2 && v2();\n });\n }, _closeSteps: () => {\n s2 = false, f2 || Ue(o2._readableStreamController), h2 || Ue(n2._readableStreamController), o2._readableStreamController._pendingPullIntos.length > 0 && et(o2._readableStreamController, 0), n2._readableStreamController._pendingPullIntos.length > 0 && et(n2._readableStreamController, 0), f2 && h2 || i2(void 0);\n }, _errorSteps: () => {\n s2 = false;\n } });\n }\n function S2(t4, r3) {\n ee(a2) && (O(a2), a2 = at(e3), m2(a2));\n const u2 = r3 ? n2 : o2, c2 = r3 ? o2 : n2;\n ht(a2, t4, 1, { _chunkSteps: (t5) => {\n y(() => {\n l2 = false, d2 = false;\n const o3 = r3 ? h2 : f2;\n if (r3 ? f2 : h2) o3 || tt(u2._readableStreamController, t5);\n else {\n let r4;\n try {\n r4 = Te(t5);\n } catch (t6) {\n return Xe(u2._readableStreamController, t6), Xe(c2._readableStreamController, t6), void i2(Mr(e3, t6));\n }\n o3 || tt(u2._readableStreamController, t5), Ge(c2._readableStreamController, r4);\n }\n s2 = false, l2 ? g2() : d2 && v2();\n });\n }, _closeSteps: (e4) => {\n s2 = false;\n const t5 = r3 ? h2 : f2, o3 = r3 ? f2 : h2;\n t5 || Ue(u2._readableStreamController), o3 || Ue(c2._readableStreamController), void 0 !== e4 && (t5 || tt(u2._readableStreamController, e4), !o3 && c2._readableStreamController._pendingPullIntos.length > 0 && et(c2._readableStreamController, 0)), t5 && o3 || i2(void 0);\n }, _errorSteps: () => {\n s2 = false;\n } });\n }\n function g2() {\n if (s2) return l2 = true, c(void 0);\n s2 = true;\n const e4 = Ke(o2._readableStreamController);\n return null === e4 ? p2() : S2(e4._view, false), c(void 0);\n }\n function v2() {\n if (s2) return d2 = true, c(void 0);\n s2 = true;\n const e4 = Ke(n2._readableStreamController);\n return null === e4 ? p2() : S2(e4._view, true), c(void 0);\n }\n function w2(o3) {\n if (f2 = true, t3 = o3, h2) {\n const o4 = le([t3, r2]), n3 = Mr(e3, o4);\n i2(n3);\n }\n return b2;\n }\n function R2(o3) {\n if (h2 = true, r2 = o3, f2) {\n const o4 = le([t3, r2]), n3 = Mr(e3, o4);\n i2(n3);\n }\n return b2;\n }\n function T2() {\n }\n return o2 = Fr(T2, g2, w2), n2 = Fr(T2, v2, R2), m2(a2), [o2, n2];\n })(e2) : (function(e3) {\n const t3 = V(e3);\n let r2, o2, n2, i2, a2, s2 = false, l2 = false, d2 = false, f2 = false;\n const h2 = u((e4) => {\n a2 = e4;\n });\n function b2() {\n if (s2) return l2 = true, c(void 0);\n s2 = true;\n return te(t3, { _chunkSteps: (e4) => {\n y(() => {\n l2 = false;\n const t4 = e4, r3 = e4;\n d2 || Rr(n2._readableStreamController, t4), f2 || Rr(i2._readableStreamController, r3), s2 = false, l2 && b2();\n });\n }, _closeSteps: () => {\n s2 = false, d2 || wr(n2._readableStreamController), f2 || wr(i2._readableStreamController), d2 && f2 || a2(void 0);\n }, _errorSteps: () => {\n s2 = false;\n } }), c(void 0);\n }\n function m2(t4) {\n if (d2 = true, r2 = t4, f2) {\n const t5 = le([r2, o2]), n3 = Mr(e3, t5);\n a2(n3);\n }\n return h2;\n }\n function p2(t4) {\n if (f2 = true, o2 = t4, d2) {\n const t5 = le([r2, o2]), n3 = Mr(e3, t5);\n a2(n3);\n }\n return h2;\n }\n function S2() {\n }\n return n2 = Dr(S2, b2, m2), i2 = Dr(S2, b2, p2), _(t3._closedPromise, (e4) => (Tr(n2._readableStreamController, e4), Tr(i2._readableStreamController, e4), d2 && f2 || a2(void 0), null)), [n2, i2];\n })(e2);\n }\n function Or(r2) {\n return t(o2 = r2) && void 0 !== o2.getReader ? (function(r3) {\n let o3;\n function n2() {\n let e2;\n try {\n e2 = r3.read();\n } catch (e3) {\n return d(e3);\n }\n return m(e2, (e3) => {\n if (!t(e3)) throw new TypeError(\"The promise returned by the reader.read() method must fulfill with an object\");\n if (e3.done) wr(o3._readableStreamController);\n else {\n const t2 = e3.value;\n Rr(o3._readableStreamController, t2);\n }\n });\n }\n function i2(e2) {\n try {\n return c(r3.cancel(e2));\n } catch (e3) {\n return d(e3);\n }\n }\n return o3 = Dr(e, n2, i2, 0), o3;\n })(r2.getReader()) : (function(r3) {\n let o3;\n const n2 = me(r3, \"async\");\n function i2() {\n let e2;\n try {\n e2 = pe(n2);\n } catch (e3) {\n return d(e3);\n }\n return m(c(e2), (e3) => {\n if (!t(e3)) throw new TypeError(\"The promise returned by the iterator.next() method must fulfill with an object\");\n if (e3.done) wr(o3._readableStreamController);\n else {\n const t2 = e3.value;\n Rr(o3._readableStreamController, t2);\n }\n });\n }\n function a2(e2) {\n const r4 = n2.iterator;\n let o4;\n try {\n o4 = he(r4, \"return\");\n } catch (e3) {\n return d(e3);\n }\n if (void 0 === o4) return c(void 0);\n return m(g(o4, r4, [e2]), (e3) => {\n if (!t(e3)) throw new TypeError(\"The promise returned by the iterator.return() method must fulfill with an object\");\n });\n }\n return o3 = Dr(e, i2, a2, 0), o3;\n })(r2);\n var o2;\n }\n function Br(e2, t2, r2) {\n return I(e2, r2), (r3) => g(e2, t2, [r3]);\n }\n function jr(e2, t2, r2) {\n return I(e2, r2), (r3) => g(e2, t2, [r3]);\n }\n function kr(e2, t2, r2) {\n return I(e2, r2), (r3) => S(e2, t2, [r3]);\n }\n function Ar(e2, t2) {\n if (\"bytes\" !== (e2 = `${e2}`)) throw new TypeError(`${t2} '${e2}' is not a valid enumeration value for ReadableStreamType`);\n return e2;\n }\n function zr(e2, t2) {\n L(e2, t2);\n const r2 = null == e2 ? void 0 : e2.preventAbort, o2 = null == e2 ? void 0 : e2.preventCancel, n2 = null == e2 ? void 0 : e2.preventClose, i2 = null == e2 ? void 0 : e2.signal;\n return void 0 !== i2 && (function(e3, t3) {\n if (!(function(e4) {\n if (\"object\" != typeof e4 || null === e4) return false;\n try {\n return \"boolean\" == typeof e4.aborted;\n } catch (e5) {\n return false;\n }\n })(e3)) throw new TypeError(`${t3} is not an AbortSignal.`);\n })(i2, `${t2} has member 'signal' that`), { preventAbort: Boolean(r2), preventCancel: Boolean(o2), preventClose: Boolean(n2), signal: i2 };\n }\n Object.defineProperties(ReadableStreamDefaultController.prototype, { close: { enumerable: true }, enqueue: { enumerable: true }, error: { enumerable: true }, desiredSize: { enumerable: true } }), o(ReadableStreamDefaultController.prototype.close, \"close\"), o(ReadableStreamDefaultController.prototype.enqueue, \"enqueue\"), o(ReadableStreamDefaultController.prototype.error, \"error\"), \"symbol\" == typeof Symbol.toStringTag && Object.defineProperty(ReadableStreamDefaultController.prototype, Symbol.toStringTag, { value: \"ReadableStreamDefaultController\", configurable: true });\n var ReadableStream2 = class {\n constructor(e2 = {}, t2 = {}) {\n void 0 === e2 ? e2 = null : $(e2, \"First parameter\");\n const r2 = yt(t2, \"Second parameter\"), o2 = (function(e3, t3) {\n L(e3, t3);\n const r3 = e3, o3 = null == r3 ? void 0 : r3.autoAllocateChunkSize, n2 = null == r3 ? void 0 : r3.cancel, i2 = null == r3 ? void 0 : r3.pull, a2 = null == r3 ? void 0 : r3.start, s2 = null == r3 ? void 0 : r3.type;\n return { autoAllocateChunkSize: void 0 === o3 ? void 0 : N(o3, `${t3} has member 'autoAllocateChunkSize' that`), cancel: void 0 === n2 ? void 0 : Br(n2, r3, `${t3} has member 'cancel' that`), pull: void 0 === i2 ? void 0 : jr(i2, r3, `${t3} has member 'pull' that`), start: void 0 === a2 ? void 0 : kr(a2, r3, `${t3} has member 'start' that`), type: void 0 === s2 ? void 0 : Ar(s2, `${t3} has member 'type' that`) };\n })(e2, \"First parameter\");\n if (Lr(this), \"bytes\" === o2.type) {\n if (void 0 !== r2.size) throw new RangeError(\"The strategy for a byte stream cannot have a size function\");\n !(function(e3, t3, r3) {\n const o3 = Object.create(ReadableByteStreamController.prototype);\n let n2, i2, a2;\n n2 = void 0 !== t3.start ? () => t3.start(o3) : () => {\n }, i2 = void 0 !== t3.pull ? () => t3.pull(o3) : () => c(void 0), a2 = void 0 !== t3.cancel ? (e4) => t3.cancel(e4) : () => c(void 0);\n const s2 = t3.autoAllocateChunkSize;\n if (0 === s2) throw new TypeError(\"autoAllocateChunkSize must be greater than 0\");\n rt(e3, o3, n2, i2, a2, r3, s2);\n })(this, o2, mt(r2, 0));\n } else {\n const e3 = pt(r2);\n !(function(e4, t3, r3, o3) {\n const n2 = Object.create(ReadableStreamDefaultController.prototype);\n let i2, a2, s2;\n i2 = void 0 !== t3.start ? () => t3.start(n2) : () => {\n }, a2 = void 0 !== t3.pull ? () => t3.pull(n2) : () => c(void 0), s2 = void 0 !== t3.cancel ? (e5) => t3.cancel(e5) : () => c(void 0), qr(e4, n2, i2, a2, s2, r3, o3);\n })(this, o2, mt(r2, 1), e3);\n }\n }\n get locked() {\n if (!Ir(this)) throw Qr(\"locked\");\n return $r(this);\n }\n cancel(e2 = void 0) {\n return Ir(this) ? $r(this) ? d(new TypeError(\"Cannot cancel a stream that already has a reader\")) : Mr(this, e2) : d(Qr(\"cancel\"));\n }\n getReader(e2 = void 0) {\n if (!Ir(this)) throw Qr(\"getReader\");\n return void 0 === (function(e3, t2) {\n L(e3, t2);\n const r2 = null == e3 ? void 0 : e3.mode;\n return { mode: void 0 === r2 ? void 0 : it(r2, `${t2} has member 'mode' that`) };\n })(e2, \"First parameter\").mode ? V(this) : at(this);\n }\n pipeThrough(e2, t2 = {}) {\n if (!Ir(this)) throw Qr(\"pipeThrough\");\n M(e2, 1, \"pipeThrough\");\n const r2 = (function(e3, t3) {\n L(e3, t3);\n const r3 = null == e3 ? void 0 : e3.readable;\n Y(r3, \"readable\", \"ReadableWritablePair\"), H(r3, `${t3} has member 'readable' that`);\n const o3 = null == e3 ? void 0 : e3.writable;\n return Y(o3, \"writable\", \"ReadableWritablePair\"), Tt(o3, `${t3} has member 'writable' that`), { readable: r3, writable: o3 };\n })(e2, \"First parameter\"), o2 = zr(t2, \"Second parameter\");\n if ($r(this)) throw new TypeError(\"ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream\");\n if (Et(r2.writable)) throw new TypeError(\"ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream\");\n return p(hr(this, r2.writable, o2.preventClose, o2.preventAbort, o2.preventCancel, o2.signal)), r2.readable;\n }\n pipeTo(e2, t2 = {}) {\n if (!Ir(this)) return d(Qr(\"pipeTo\"));\n if (void 0 === e2) return d(\"Parameter 1 is required in 'pipeTo'.\");\n if (!qt(e2)) return d(new TypeError(\"ReadableStream.prototype.pipeTo's first argument must be a WritableStream\"));\n let r2;\n try {\n r2 = zr(t2, \"Second parameter\");\n } catch (e3) {\n return d(e3);\n }\n return $r(this) ? d(new TypeError(\"ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream\")) : Et(e2) ? d(new TypeError(\"ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream\")) : hr(this, e2, r2.preventClose, r2.preventAbort, r2.preventCancel, r2.signal);\n }\n tee() {\n if (!Ir(this)) throw Qr(\"tee\");\n return le(Wr(this));\n }\n values(e2 = void 0) {\n if (!Ir(this)) throw Qr(\"values\");\n return (function(e3, t2) {\n const r2 = V(e3), o2 = new ye(r2, t2), n2 = Object.create(ge);\n return n2._asyncIteratorImpl = o2, n2;\n })(this, (function(e3, t2) {\n L(e3, t2);\n const r2 = null == e3 ? void 0 : e3.preventCancel;\n return { preventCancel: Boolean(r2) };\n })(e2, \"First parameter\").preventCancel);\n }\n [_e](e2) {\n return this.values(e2);\n }\n static from(e2) {\n return Or(e2);\n }\n };\n function Dr(e2, t2, r2, o2 = 1, n2 = () => 1) {\n const i2 = Object.create(ReadableStream2.prototype);\n Lr(i2);\n return qr(i2, Object.create(ReadableStreamDefaultController.prototype), e2, t2, r2, o2, n2), i2;\n }\n function Fr(e2, t2, r2) {\n const o2 = Object.create(ReadableStream2.prototype);\n Lr(o2);\n return rt(o2, Object.create(ReadableByteStreamController.prototype), e2, t2, r2, 0, void 0), o2;\n }\n function Lr(e2) {\n e2._state = \"readable\", e2._reader = void 0, e2._storedError = void 0, e2._disturbed = false;\n }\n function Ir(e2) {\n return !!t(e2) && (!!Object.prototype.hasOwnProperty.call(e2, \"_readableStreamController\") && e2 instanceof ReadableStream2);\n }\n function $r(e2) {\n return void 0 !== e2._reader;\n }\n function Mr(t2, r2) {\n if (t2._disturbed = true, \"closed\" === t2._state) return c(void 0);\n if (\"errored\" === t2._state) return d(t2._storedError);\n Yr(t2);\n const o2 = t2._reader;\n if (void 0 !== o2 && ft(o2)) {\n const e2 = o2._readIntoRequests;\n o2._readIntoRequests = new v(), e2.forEach((e3) => {\n e3._closeSteps(void 0);\n });\n }\n return m(t2._readableStreamController[T](r2), e);\n }\n function Yr(e2) {\n e2._state = \"closed\";\n const t2 = e2._reader;\n if (void 0 !== t2 && (z(t2), ee(t2))) {\n const e3 = t2._readRequests;\n t2._readRequests = new v(), e3.forEach((e4) => {\n e4._closeSteps();\n });\n }\n }\n function xr(e2, t2) {\n e2._state = \"errored\", e2._storedError = t2;\n const r2 = e2._reader;\n void 0 !== r2 && (A(r2, t2), ee(r2) ? oe(r2, t2) : bt(r2, t2));\n }\n function Qr(e2) {\n return new TypeError(`ReadableStream.prototype.${e2} can only be used on a ReadableStream`);\n }\n function Nr(e2, t2) {\n L(e2, t2);\n const r2 = null == e2 ? void 0 : e2.highWaterMark;\n return Y(r2, \"highWaterMark\", \"QueuingStrategyInit\"), { highWaterMark: x(r2) };\n }\n Object.defineProperties(ReadableStream2, { from: { enumerable: true } }), Object.defineProperties(ReadableStream2.prototype, { cancel: { enumerable: true }, getReader: { enumerable: true }, pipeThrough: { enumerable: true }, pipeTo: { enumerable: true }, tee: { enumerable: true }, values: { enumerable: true }, locked: { enumerable: true } }), o(ReadableStream2.from, \"from\"), o(ReadableStream2.prototype.cancel, \"cancel\"), o(ReadableStream2.prototype.getReader, \"getReader\"), o(ReadableStream2.prototype.pipeThrough, \"pipeThrough\"), o(ReadableStream2.prototype.pipeTo, \"pipeTo\"), o(ReadableStream2.prototype.tee, \"tee\"), o(ReadableStream2.prototype.values, \"values\"), \"symbol\" == typeof Symbol.toStringTag && Object.defineProperty(ReadableStream2.prototype, Symbol.toStringTag, { value: \"ReadableStream\", configurable: true }), Object.defineProperty(ReadableStream2.prototype, _e, { value: ReadableStream2.prototype.values, writable: true, configurable: true });\n var Hr = (e2) => e2.byteLength;\n o(Hr, \"size\");\n var ByteLengthQueuingStrategy = class {\n constructor(e2) {\n M(e2, 1, \"ByteLengthQueuingStrategy\"), e2 = Nr(e2, \"First parameter\"), this._byteLengthQueuingStrategyHighWaterMark = e2.highWaterMark;\n }\n get highWaterMark() {\n if (!Ur(this)) throw Vr(\"highWaterMark\");\n return this._byteLengthQueuingStrategyHighWaterMark;\n }\n get size() {\n if (!Ur(this)) throw Vr(\"size\");\n return Hr;\n }\n };\n function Vr(e2) {\n return new TypeError(`ByteLengthQueuingStrategy.prototype.${e2} can only be used on a ByteLengthQueuingStrategy`);\n }\n function Ur(e2) {\n return !!t(e2) && (!!Object.prototype.hasOwnProperty.call(e2, \"_byteLengthQueuingStrategyHighWaterMark\") && e2 instanceof ByteLengthQueuingStrategy);\n }\n Object.defineProperties(ByteLengthQueuingStrategy.prototype, { highWaterMark: { enumerable: true }, size: { enumerable: true } }), \"symbol\" == typeof Symbol.toStringTag && Object.defineProperty(ByteLengthQueuingStrategy.prototype, Symbol.toStringTag, { value: \"ByteLengthQueuingStrategy\", configurable: true });\n var Gr = () => 1;\n o(Gr, \"size\");\n var CountQueuingStrategy = class {\n constructor(e2) {\n M(e2, 1, \"CountQueuingStrategy\"), e2 = Nr(e2, \"First parameter\"), this._countQueuingStrategyHighWaterMark = e2.highWaterMark;\n }\n get highWaterMark() {\n if (!Jr(this)) throw Xr(\"highWaterMark\");\n return this._countQueuingStrategyHighWaterMark;\n }\n get size() {\n if (!Jr(this)) throw Xr(\"size\");\n return Gr;\n }\n };\n function Xr(e2) {\n return new TypeError(`CountQueuingStrategy.prototype.${e2} can only be used on a CountQueuingStrategy`);\n }\n function Jr(e2) {\n return !!t(e2) && (!!Object.prototype.hasOwnProperty.call(e2, \"_countQueuingStrategyHighWaterMark\") && e2 instanceof CountQueuingStrategy);\n }\n function Kr(e2, t2, r2) {\n return I(e2, r2), (r3) => g(e2, t2, [r3]);\n }\n function Zr(e2, t2, r2) {\n return I(e2, r2), (r3) => S(e2, t2, [r3]);\n }\n function eo(e2, t2, r2) {\n return I(e2, r2), (r3, o2) => g(e2, t2, [r3, o2]);\n }\n function to(e2, t2, r2) {\n return I(e2, r2), (r3) => g(e2, t2, [r3]);\n }\n Object.defineProperties(CountQueuingStrategy.prototype, { highWaterMark: { enumerable: true }, size: { enumerable: true } }), \"symbol\" == typeof Symbol.toStringTag && Object.defineProperty(CountQueuingStrategy.prototype, Symbol.toStringTag, { value: \"CountQueuingStrategy\", configurable: true });\n var TransformStream = class {\n constructor(e2 = {}, t2 = {}, r2 = {}) {\n void 0 === e2 && (e2 = null);\n const o2 = yt(t2, \"Second parameter\"), n2 = yt(r2, \"Third parameter\"), i2 = (function(e3, t3) {\n L(e3, t3);\n const r3 = null == e3 ? void 0 : e3.cancel, o3 = null == e3 ? void 0 : e3.flush, n3 = null == e3 ? void 0 : e3.readableType, i3 = null == e3 ? void 0 : e3.start, a3 = null == e3 ? void 0 : e3.transform, s3 = null == e3 ? void 0 : e3.writableType;\n return { cancel: void 0 === r3 ? void 0 : to(r3, e3, `${t3} has member 'cancel' that`), flush: void 0 === o3 ? void 0 : Kr(o3, e3, `${t3} has member 'flush' that`), readableType: n3, start: void 0 === i3 ? void 0 : Zr(i3, e3, `${t3} has member 'start' that`), transform: void 0 === a3 ? void 0 : eo(a3, e3, `${t3} has member 'transform' that`), writableType: s3 };\n })(e2, \"First parameter\");\n if (void 0 !== i2.readableType) throw new RangeError(\"Invalid readableType specified\");\n if (void 0 !== i2.writableType) throw new RangeError(\"Invalid writableType specified\");\n const a2 = mt(n2, 0), s2 = pt(n2), l2 = mt(o2, 1), f2 = pt(o2);\n let b2;\n !(function(e3, t3, r3, o3, n3, i3) {\n function a3() {\n return t3;\n }\n function s3(t4) {\n return (function(e4, t5) {\n const r4 = e4._transformStreamController;\n if (e4._backpressure) {\n return m(e4._backpressureChangePromise, () => {\n const o4 = e4._writable;\n if (\"erroring\" === o4._state) throw o4._storedError;\n return co(r4, t5);\n });\n }\n return co(r4, t5);\n })(e3, t4);\n }\n function l3(t4) {\n return (function(e4, t5) {\n const r4 = e4._transformStreamController;\n if (void 0 !== r4._finishPromise) return r4._finishPromise;\n const o4 = e4._readable;\n r4._finishPromise = u((e5, t6) => {\n r4._finishPromise_resolve = e5, r4._finishPromise_reject = t6;\n });\n const n4 = r4._cancelAlgorithm(t5);\n return lo(r4), h(n4, () => (\"errored\" === o4._state ? bo(r4, o4._storedError) : (Tr(o4._readableStreamController, t5), ho(r4)), null), (e5) => (Tr(o4._readableStreamController, e5), bo(r4, e5), null)), r4._finishPromise;\n })(e3, t4);\n }\n function c2() {\n return (function(e4) {\n const t4 = e4._transformStreamController;\n if (void 0 !== t4._finishPromise) return t4._finishPromise;\n const r4 = e4._readable;\n t4._finishPromise = u((e5, r5) => {\n t4._finishPromise_resolve = e5, t4._finishPromise_reject = r5;\n });\n const o4 = t4._flushAlgorithm();\n return lo(t4), h(o4, () => (\"errored\" === r4._state ? bo(t4, r4._storedError) : (wr(r4._readableStreamController), ho(t4)), null), (e5) => (Tr(r4._readableStreamController, e5), bo(t4, e5), null)), t4._finishPromise;\n })(e3);\n }\n function d2() {\n return (function(e4) {\n return ao(e4, false), e4._backpressureChangePromise;\n })(e3);\n }\n function f3(t4) {\n return (function(e4, t5) {\n const r4 = e4._transformStreamController;\n if (void 0 !== r4._finishPromise) return r4._finishPromise;\n const o4 = e4._writable;\n r4._finishPromise = u((e5, t6) => {\n r4._finishPromise_resolve = e5, r4._finishPromise_reject = t6;\n });\n const n4 = r4._cancelAlgorithm(t5);\n return lo(r4), h(n4, () => (\"errored\" === o4._state ? bo(r4, o4._storedError) : (Gt(o4._writableStreamController, t5), io(e4), ho(r4)), null), (t6) => (Gt(o4._writableStreamController, t6), io(e4), bo(r4, t6), null)), r4._finishPromise;\n })(e3, t4);\n }\n e3._writable = (function(e4, t4, r4, o4, n4 = 1, i4 = () => 1) {\n const a4 = Object.create(WritableStream.prototype);\n return Ct(a4), Nt(a4, Object.create(WritableStreamDefaultController.prototype), e4, t4, r4, o4, n4, i4), a4;\n })(a3, s3, c2, l3, r3, o3), e3._readable = Dr(a3, d2, f3, n3, i3), e3._backpressure = void 0, e3._backpressureChangePromise = void 0, e3._backpressureChangePromise_resolve = void 0, ao(e3, true), e3._transformStreamController = void 0;\n })(this, u((e3) => {\n b2 = e3;\n }), l2, f2, a2, s2), (function(e3, t3) {\n const r3 = Object.create(TransformStreamDefaultController.prototype);\n let o3, n3, i3;\n o3 = void 0 !== t3.transform ? (e4) => t3.transform(e4, r3) : (e4) => {\n try {\n return uo(r3, e4), c(void 0);\n } catch (e5) {\n return d(e5);\n }\n };\n n3 = void 0 !== t3.flush ? () => t3.flush(r3) : () => c(void 0);\n i3 = void 0 !== t3.cancel ? (e4) => t3.cancel(e4) : () => c(void 0);\n !(function(e4, t4, r4, o4, n4) {\n t4._controlledTransformStream = e4, e4._transformStreamController = t4, t4._transformAlgorithm = r4, t4._flushAlgorithm = o4, t4._cancelAlgorithm = n4, t4._finishPromise = void 0, t4._finishPromise_resolve = void 0, t4._finishPromise_reject = void 0;\n })(e3, r3, o3, n3, i3);\n })(this, i2), void 0 !== i2.start ? b2(i2.start(this._transformStreamController)) : b2(void 0);\n }\n get readable() {\n if (!ro(this)) throw _o(\"readable\");\n return this._readable;\n }\n get writable() {\n if (!ro(this)) throw _o(\"writable\");\n return this._writable;\n }\n };\n function ro(e2) {\n return !!t(e2) && (!!Object.prototype.hasOwnProperty.call(e2, \"_transformStreamController\") && e2 instanceof TransformStream);\n }\n function oo(e2, t2) {\n Tr(e2._readable._readableStreamController, t2), no(e2, t2);\n }\n function no(e2, t2) {\n lo(e2._transformStreamController), Gt(e2._writable._writableStreamController, t2), io(e2);\n }\n function io(e2) {\n e2._backpressure && ao(e2, false);\n }\n function ao(e2, t2) {\n void 0 !== e2._backpressureChangePromise && e2._backpressureChangePromise_resolve(), e2._backpressureChangePromise = u((t3) => {\n e2._backpressureChangePromise_resolve = t3;\n }), e2._backpressure = t2;\n }\n Object.defineProperties(TransformStream.prototype, { readable: { enumerable: true }, writable: { enumerable: true } }), \"symbol\" == typeof Symbol.toStringTag && Object.defineProperty(TransformStream.prototype, Symbol.toStringTag, { value: \"TransformStream\", configurable: true });\n var TransformStreamDefaultController = class {\n constructor() {\n throw new TypeError(\"Illegal constructor\");\n }\n get desiredSize() {\n if (!so(this)) throw fo(\"desiredSize\");\n return Pr(this._controlledTransformStream._readable._readableStreamController);\n }\n enqueue(e2 = void 0) {\n if (!so(this)) throw fo(\"enqueue\");\n uo(this, e2);\n }\n error(e2 = void 0) {\n if (!so(this)) throw fo(\"error\");\n var t2;\n t2 = e2, oo(this._controlledTransformStream, t2);\n }\n terminate() {\n if (!so(this)) throw fo(\"terminate\");\n !(function(e2) {\n const t2 = e2._controlledTransformStream;\n wr(t2._readable._readableStreamController);\n const r2 = new TypeError(\"TransformStream terminated\");\n no(t2, r2);\n })(this);\n }\n };\n function so(e2) {\n return !!t(e2) && (!!Object.prototype.hasOwnProperty.call(e2, \"_controlledTransformStream\") && e2 instanceof TransformStreamDefaultController);\n }\n function lo(e2) {\n e2._transformAlgorithm = void 0, e2._flushAlgorithm = void 0, e2._cancelAlgorithm = void 0;\n }\n function uo(e2, t2) {\n const r2 = e2._controlledTransformStream, o2 = r2._readable._readableStreamController;\n if (!Cr(o2)) throw new TypeError(\"Readable side is not in a state that permits enqueue\");\n try {\n Rr(o2, t2);\n } catch (e3) {\n throw no(r2, e3), r2._readable._storedError;\n }\n const n2 = (function(e3) {\n return !gr(e3);\n })(o2);\n n2 !== r2._backpressure && ao(r2, true);\n }\n function co(e2, t2) {\n return m(e2._transformAlgorithm(t2), void 0, (t3) => {\n throw oo(e2._controlledTransformStream, t3), t3;\n });\n }\n function fo(e2) {\n return new TypeError(`TransformStreamDefaultController.prototype.${e2} can only be used on a TransformStreamDefaultController`);\n }\n function ho(e2) {\n void 0 !== e2._finishPromise_resolve && (e2._finishPromise_resolve(), e2._finishPromise_resolve = void 0, e2._finishPromise_reject = void 0);\n }\n function bo(e2, t2) {\n void 0 !== e2._finishPromise_reject && (p(e2._finishPromise), e2._finishPromise_reject(t2), e2._finishPromise_resolve = void 0, e2._finishPromise_reject = void 0);\n }\n function _o(e2) {\n return new TypeError(`TransformStream.prototype.${e2} can only be used on a TransformStream`);\n }\n Object.defineProperties(TransformStreamDefaultController.prototype, { enqueue: { enumerable: true }, error: { enumerable: true }, terminate: { enumerable: true }, desiredSize: { enumerable: true } }), o(TransformStreamDefaultController.prototype.enqueue, \"enqueue\"), o(TransformStreamDefaultController.prototype.error, \"error\"), o(TransformStreamDefaultController.prototype.terminate, \"terminate\"), \"symbol\" == typeof Symbol.toStringTag && Object.defineProperty(TransformStreamDefaultController.prototype, Symbol.toStringTag, { value: \"TransformStreamDefaultController\", configurable: true });\n\n // src/compat/stream-web/runtime.ts\n var usesPonyfill = typeof nativeStreams.ReadableByteStreamController !== \"function\";\n var ReadableStream3 = contextConstructor(\n usesPonyfill ? ReadableStream2 : nativeStreams.ReadableStream,\n [\"start\", \"pull\", \"cancel\"]\n );\n var WritableStream2 = contextConstructor(\n usesPonyfill ? WritableStream : nativeStreams.WritableStream,\n [\"start\", \"write\", \"close\", \"abort\"]\n );\n var TransformStream2 = contextConstructor(\n usesPonyfill ? TransformStream : nativeStreams.TransformStream,\n [\"start\", \"transform\", \"flush\", \"cancel\"]\n );\n var ByteLengthQueuingStrategy2 = usesPonyfill ? ByteLengthQueuingStrategy : nativeStreams.ByteLengthQueuingStrategy;\n var CountQueuingStrategy2 = usesPonyfill ? CountQueuingStrategy : nativeStreams.CountQueuingStrategy;\n var ReadableByteStreamController2 = usesPonyfill ? ReadableByteStreamController : nativeStreams.ReadableByteStreamController;\n var ReadableStreamBYOBReader2 = usesPonyfill ? ReadableStreamBYOBReader : nativeStreams.ReadableStreamBYOBReader;\n var ReadableStreamBYOBRequest2 = usesPonyfill ? ReadableStreamBYOBRequest : nativeStreams.ReadableStreamBYOBRequest;\n var ReadableStreamDefaultController2 = usesPonyfill ? ReadableStreamDefaultController : nativeStreams.ReadableStreamDefaultController;\n var ReadableStreamDefaultReader2 = usesPonyfill ? ReadableStreamDefaultReader : nativeStreams.ReadableStreamDefaultReader;\n var TransformStreamDefaultController2 = usesPonyfill ? TransformStreamDefaultController : nativeStreams.TransformStreamDefaultController;\n var WritableStreamDefaultController2 = usesPonyfill ? WritableStreamDefaultController : nativeStreams.WritableStreamDefaultController;\n var WritableStreamDefaultWriter2 = usesPonyfill ? WritableStreamDefaultWriter : nativeStreams.WritableStreamDefaultWriter;\n function disturbed(stream) {\n const value2 = stream._disturbed;\n if (typeof value2 !== \"boolean\")\n throw new Error(\"Unknown stream disturbance state\");\n return value2;\n }\n\n // src/compat/stream-web/index.ts\n var CompressionStreamAdapter = class CompressionStream {\n #native;\n #readable;\n #writable;\n constructor(...args) {\n this.#native = new nativeStreams.CompressionStream(...args);\n this.#readable = readable(this.#native.readable);\n this.#writable = writable(this.#native.writable);\n }\n get readable() {\n return this.#readable;\n }\n get writable() {\n return this.#writable;\n }\n };\n var CompressionStream2 = usesPonyfill ? CompressionStreamAdapter : nativeStreams.CompressionStream;\n var DecompressionStreamAdapter = class DecompressionStream {\n #native;\n #readable;\n #writable;\n constructor(...args) {\n this.#native = new nativeStreams.DecompressionStream(...args);\n this.#readable = readable(this.#native.readable);\n this.#writable = writable(this.#native.writable);\n }\n get readable() {\n return this.#readable;\n }\n get writable() {\n return this.#writable;\n }\n };\n var DecompressionStream2 = usesPonyfill ? DecompressionStreamAdapter : nativeStreams.DecompressionStream;\n var TextEncoderStreamAdapter = class TextEncoderStream {\n #native;\n #readable;\n #writable;\n constructor(...args) {\n this.#native = new nativeStreams.TextEncoderStream(...args);\n this.#readable = readable(this.#native.readable);\n this.#writable = writable(this.#native.writable);\n }\n get readable() {\n return this.#readable;\n }\n get writable() {\n return this.#writable;\n }\n get encoding() {\n return this.#native.encoding;\n }\n };\n var TextEncoderStream2 = usesPonyfill ? TextEncoderStreamAdapter : nativeStreams.TextEncoderStream;\n var TextDecoderStreamAdapter = class TextDecoderStream {\n #native;\n #readable;\n #writable;\n constructor(...args) {\n this.#native = new nativeStreams.TextDecoderStream(...args);\n this.#readable = readable(this.#native.readable, false);\n this.#writable = writable(this.#native.writable);\n }\n get readable() {\n return this.#readable;\n }\n get writable() {\n return this.#writable;\n }\n get encoding() {\n return this.#native.encoding;\n }\n get fatal() {\n return this.#native.fatal;\n }\n get ignoreBOM() {\n return this.#native.ignoreBOM;\n }\n };\n var TextDecoderStream2 = usesPonyfill ? TextDecoderStreamAdapter : nativeStreams.TextDecoderStream;\n for (const [name2, Type] of Object.entries({\n CompressionStreamAdapter,\n DecompressionStreamAdapter,\n TextEncoderStreamAdapter,\n TextDecoderStreamAdapter\n })) {\n const tag = name2.replace(\"Adapter\", \"\");\n Object.defineProperty(Type, \"name\", { value: tag, configurable: true });\n Object.defineProperty(Type.prototype, Symbol.toStringTag, {\n value: tag,\n configurable: true\n });\n for (const key2 of Object.getOwnPropertyNames(Type.prototype))\n if (key2 !== \"constructor\")\n Object.defineProperty(Type.prototype, key2, {\n ...Object.getOwnPropertyDescriptor(Type.prototype, key2),\n enumerable: true\n });\n }\n\n // src/compat/stream-web/interop.ts\n function readable(source, byteStream = true) {\n if (!usesPonyfill || source instanceof ReadableStream3)\n return source;\n if (source.locked) throw new TypeError(\"ReadableStream is locked\");\n let reader;\n const release = () => {\n reader?.releaseLock();\n reader = void 0;\n };\n return new ReadableStream3(\n {\n type: byteStream ? \"bytes\" : void 0,\n async pull(controller) {\n try {\n reader ??= source.getReader();\n let result = await reader.read();\n while (!result.done && byteStream && result.value.byteLength === 0)\n result = await reader.read();\n if (result.done) {\n controller.close();\n controller.byobRequest?.respond(0);\n release();\n } else\n controller.enqueue(\n byteStream ? result.value.slice() : result.value\n );\n } catch (error) {\n controller.error(error);\n release();\n }\n },\n async cancel(reason) {\n try {\n await (reader ? reader.cancel(reason) : source.cancel(reason));\n } finally {\n release();\n }\n }\n },\n { highWaterMark: 0 }\n );\n }\n function writable(source) {\n if (!usesPonyfill || source instanceof WritableStream2)\n return source;\n const writer = source.getWriter();\n return new WritableStream2({\n write(chunk) {\n return writer.write(chunk);\n },\n async close() {\n try {\n await writer.close();\n } finally {\n writer.releaseLock();\n }\n },\n async abort(reason) {\n try {\n await writer.abort(reason);\n } finally {\n writer.releaseLock();\n }\n }\n });\n }\n\n // src/compat/buffer/blob.ts\n var NativeBlob = platform.Blob;\n var NativeFile = platform.File;\n var nativeSize = Object.getOwnPropertyDescriptor(\n NativeBlob.prototype,\n \"size\"\n ).get;\n var nativeType = Object.getOwnPropertyDescriptor(\n NativeBlob.prototype,\n \"type\"\n ).get;\n var nativeName = Object.getOwnPropertyDescriptor(\n NativeFile.prototype,\n \"name\"\n ).get;\n var nativeModified = Object.getOwnPropertyDescriptor(\n NativeFile.prototype,\n \"lastModified\"\n ).get;\n var types = /* @__PURE__ */ new WeakMap();\n var typeMetadata = /* @__PURE__ */ Symbol.for(\"workers-capacitor/blob-type\");\n var modified = /* @__PURE__ */ new WeakMap();\n var encoder = new TextEncoder();\n var decoder = new TextDecoder(\"utf-8\", { ignoreBOM: true });\n function wtf8(text2) {\n const bytes = encoder.encode(text2);\n let offset = 0;\n for (let i2 = 0; i2 < text2.length; i2++) {\n const c2 = text2.charCodeAt(i2);\n if (c2 >= 55296 && c2 <= 56319 && text2.charCodeAt(i2 + 1) >= 56320 && text2.charCodeAt(i2 + 1) <= 57343) {\n i2++;\n offset += 4;\n } else {\n if (c2 >= 55296 && c2 <= 57343) {\n bytes[offset] = 237;\n bytes[offset + 1] = 128 | c2 >> 6 & 63;\n bytes[offset + 2] = 128 | c2 & 63;\n }\n offset += c2 < 128 ? 1 : c2 < 2048 ? 2 : 3;\n }\n }\n return bytes;\n }\n var arrayBufferLength = Object.getOwnPropertyDescriptor(\n ArrayBuffer.prototype,\n \"byteLength\"\n ).get;\n var typedArray = Object.getPrototypeOf(Uint8Array.prototype);\n var getters = (prototype) => [\"buffer\", \"byteOffset\", \"byteLength\"].map(\n (key2) => Object.getOwnPropertyDescriptor(prototype, key2).get\n );\n var typedGetters = getters(typedArray);\n var dataGetters = getters(DataView.prototype);\n function isArrayBuffer(value2) {\n try {\n arrayBufferLength.call(value2);\n return true;\n } catch {\n return false;\n }\n }\n function parts(value2, name2) {\n if (value2 === void 0) return [];\n if (!Array.isArray(value2))\n throw new TypeError(\n `Failed to construct '${name2}': constructor parameter 1 is not of type 'Array'.`\n );\n const result = [];\n for (let i2 = 0; i2 < value2.length; i2++) {\n const part = value2[i2];\n result.push(\n part instanceof NativeBlob || ArrayBuffer.isView(part) || isArrayBuffer(part) ? part : wtf8(`${part}`)\n );\n }\n return result;\n }\n function snapshot(data) {\n return data.map((part) => {\n if (part instanceof NativeBlob) return part;\n try {\n if (ArrayBuffer.isView(part)) {\n let access = typedGetters;\n try {\n typedGetters[0].call(part);\n } catch {\n access = dataGetters;\n }\n return new Uint8Array(\n access[0].call(part),\n access[1].call(part),\n access[2].call(part)\n ).slice();\n }\n return new Uint8Array(part).slice();\n } catch {\n return new Uint8Array();\n }\n });\n }\n function endings(value2) {\n if (value2.endings !== void 0)\n throw new Error(\"The 'endings' field on 'Options' is not implemented.\");\n }\n function type(value2) {\n if (value2 === void 0) return \"\";\n const text2 = `${value2}`;\n return /[^\\x20-\\x7f]/.test(text2) ? \"\" : text2.toLowerCase();\n }\n function options(value2, name2, position) {\n if (value2 !== void 0 && value2 !== null && typeof value2 !== \"object\" && typeof value2 !== \"function\")\n throw new TypeError(\n `Failed to construct '${name2}': constructor parameter ${position} is not of type 'Options'.`\n );\n return value2 ?? {};\n }\n function index(value2) {\n if (value2 === void 0) return void 0;\n const number = +value2;\n if (!Number.isFinite(number)) return 0;\n const truncated = Math.trunc(number);\n if (truncated < -2147483648 || truncated > 2147483647)\n throw new TypeError(\n \"Value out of range. Must be between -2147483648 and 2147483647 (inclusive).\"\n );\n return truncated;\n }\n var Blob2 = class _Blob extends NativeBlob {\n constructor(bits, init) {\n const data = parts(bits, \"Blob\"), settings = options(init, \"Blob\", 2), mime = type(settings.type);\n endings(settings);\n super(snapshot(data), { type: mime });\n types.set(this, mime);\n }\n static [Symbol.hasInstance](value2) {\n if (this !== _Blob)\n return Function.prototype[Symbol.hasInstance].call(this, value2);\n try {\n nativeSize.call(value2);\n return true;\n } catch {\n return false;\n }\n }\n get type() {\n return types.get(this) ?? nativeType.call(this);\n }\n stream() {\n return readable(NativeBlob.prototype.stream.call(this));\n }\n async text() {\n return decoder.decode(await NativeBlob.prototype.arrayBuffer.call(this));\n }\n async bytes() {\n return new Uint8Array(await NativeBlob.prototype.arrayBuffer.call(this));\n }\n slice(start, end, contentType) {\n const from = index(start), to2 = index(end), mime = type(contentType);\n const value2 = NativeBlob.prototype.slice.call(this, from, to2, mime);\n Object.setPrototypeOf(value2, _Blob.prototype);\n types.set(value2, mime);\n return value2;\n }\n };\n var File = class _File extends Blob2 {\n constructor(bits, name2, init) {\n super();\n if (arguments.length < 2)\n throw new TypeError(\n \"Failed to construct 'File': constructor parameter 2 is not of type 'string'.\"\n );\n const data = parts(bits, \"File\"), filename = decoder.decode(wtf8(`${name2}`)), settings = options(init, \"File\", 3);\n const mime = type(settings.type), lastModified = settings.lastModified, date = lastModified === void 0 ? Date.now() : +lastModified;\n endings(settings);\n const value2 = Reflect.construct(\n NativeFile,\n [snapshot(data), filename, { type: mime }],\n new.target\n );\n types.set(value2, mime);\n modified.set(value2, Number.isNaN(date) ? 0 : date);\n return value2;\n }\n static [Symbol.hasInstance](value2) {\n if (this !== _File)\n return Function.prototype[Symbol.hasInstance].call(this, value2);\n try {\n nativeName.call(value2);\n return true;\n } catch {\n return false;\n }\n }\n get name() {\n return nativeName.call(this);\n }\n get lastModified() {\n return modified.get(this) ?? nativeModified.call(this);\n }\n };\n Object.defineProperty(Blob2.prototype, typeMetadata, {\n value() {\n return types.get(this) ?? nativeType.call(this);\n }\n });\n Object.defineProperty(Blob2, nativeBlobConstructor, { value: NativeBlob });\n Object.defineProperty(File, nativeFileConstructor, { value: NativeFile });\n Object.defineProperty(Blob2, \"length\", { value: 0 });\n Object.defineProperty(File, \"length\", { value: 0 });\n Object.defineProperty(File.prototype, Symbol.toStringTag, {\n value: \"File\",\n configurable: true\n });\n\n // src/browser/body/stream-body.ts\n var StreamBody = class _StreamBody {\n #body;\n headers;\n constructor(body) {\n if (body instanceof ReadableStream3) {\n if (body.locked || disturbed(body))\n throw new TypeError(\"Body has already been used.\");\n this.#body = body;\n this.headers = new platform.Headers();\n } else {\n const response = new platform.Response(body);\n this.#body = response.body && readable(response.body);\n this.headers = response.headers;\n }\n }\n get body() {\n return this.#body;\n }\n get bodyUsed() {\n return this.#body !== null && disturbed(this.#body);\n }\n clone() {\n if (this.bodyUsed || this.#body?.locked)\n throw new TypeError(\"Body has already been used.\");\n const clone = new _StreamBody(null);\n clone.headers = new platform.Headers(this.headers);\n if (this.#body) [this.#body, clone.#body] = this.#body.tee();\n return clone;\n }\n async arrayBuffer() {\n if (this.bodyUsed || this.#body?.locked)\n throw new TypeError(\"Body has already been used.\");\n if (!this.#body) return new ArrayBuffer(0);\n const reader = this.#body.getReader();\n const chunks = [];\n let length = 0;\n try {\n while (true) {\n const { value: value2, done } = await reader.read();\n if (done) break;\n if (!(value2 instanceof Uint8Array))\n throw new TypeError(\"ReadableStream did not return bytes\");\n const copy = value2.slice();\n chunks.push(copy);\n length += copy.byteLength;\n }\n } finally {\n reader.releaseLock();\n }\n const bytes = new Uint8Array(length);\n let offset = 0;\n for (const chunk of chunks) {\n bytes.set(chunk, offset);\n offset += chunk.byteLength;\n }\n return bytes.buffer;\n }\n async blob() {\n const blob = await new platform.Response(await this.arrayBuffer(), {\n headers: this.headers\n }).blob();\n return Object.setPrototypeOf(blob, Blob2.prototype);\n }\n async formData() {\n const data = await new platform.Response(await this.arrayBuffer(), {\n headers: this.headers\n }).formData();\n for (const value2 of data.values())\n if (typeof value2 !== \"string\")\n Object.setPrototypeOf(value2, File.prototype);\n return data;\n }\n };\n\n // src/browser/body/index.ts\n var PlatformResponse = usesPonyfill ? StreamBody : platform.Response;\n function cloneValue(value2) {\n if (value2 === void 0) return void 0;\n if (value2 === null || typeof value2 !== \"object\" && typeof value2 !== \"function\")\n throw new TypeError(\"cf must be an object\");\n const copy = JSON.parse(JSON.stringify(value2));\n if (copy === null || typeof copy !== \"object\")\n throw new Error(\"Cloned cf must be an object\");\n return copy;\n }\n function dictionary(value2) {\n if (value2 == null) return {};\n if (typeof value2 !== \"object\" && typeof value2 !== \"function\")\n throw new TypeError(\"Expected an object\");\n return value2;\n }\n function webString(value2) {\n if (typeof value2 === \"symbol\")\n throw new TypeError(\"Cannot convert a Symbol to a string\");\n return String(value2);\n }\n var bodies = /* @__PURE__ */ new WeakMap();\n function state2(body) {\n const value2 = bodies.get(body);\n if (!value2) throw new TypeError(\"Illegal invocation\");\n return value2;\n }\n function hasBody(body) {\n return state2(body).response.body !== null;\n }\n function cloneBody(body) {\n return state2(body).response.clone().body;\n }\n function moveBody(body) {\n const original2 = state2(body).response;\n if (original2.bodyUsed || original2.body?.locked)\n throw new TypeError(\"Body has already been used.\");\n return original2.body?.pipeThrough(new TransformStream2()) ?? null;\n }\n function inheritBodySource(target, source) {\n state2(target).rewindable = state2(source).rewindable;\n }\n function setBodyHeaders(body, headers) {\n state2(body).headers = headers;\n }\n var Body = class {\n constructor(body, headers) {\n bodies.set(this, {\n response: new PlatformResponse(body),\n headers,\n rewindable: !(body instanceof ReadableStream3) && !(body instanceof nativeStreams.ReadableStream)\n });\n const contentType = state2(this).response.headers.get(\"content-type\");\n if (contentType && !headers.has(\"content-type\"))\n headers.set(\"content-type\", contentType);\n }\n get body() {\n return state2(this).response.body;\n }\n get bodyUsed() {\n return state2(this).response.bodyUsed;\n }\n arrayBuffer() {\n return state2(this).response.arrayBuffer();\n }\n async bytes() {\n return new Uint8Array(await state2(this).response.arrayBuffer());\n }\n async #text() {\n return new TextDecoder().decode(await state2(this).response.arrayBuffer());\n }\n text() {\n return this.#text();\n }\n async json() {\n return JSON.parse(await this.#text());\n }\n #updateContentType() {\n const type2 = state2(this).headers.get(\"content-type\");\n if (type2 === null) state2(this).response.headers.delete(\"content-type\");\n else state2(this).response.headers.set(\"content-type\", type2);\n }\n async formData() {\n this.#updateContentType();\n return state2(this).response.formData();\n }\n async blob() {\n this.#updateContentType();\n return state2(this).response.blob();\n }\n };\n for (const key2 of Object.getOwnPropertyNames(Body.prototype))\n if (key2 !== \"constructor\")\n Object.defineProperty(Body.prototype, key2, { enumerable: true });\n\n // src/browser/headers/index.ts\n var immutable = /* @__PURE__ */ new WeakSet();\n function immutableHeaders(headers) {\n immutable.add(headers);\n return headers;\n }\n function cloneHeaders(headers) {\n const copy = new Headers2(headers);\n return immutable.has(headers) ? immutableHeaders(copy) : copy;\n }\n function writable2(headers) {\n if (immutable.has(headers))\n throw new TypeError(\"Can't modify immutable headers.\");\n }\n var invalidName = /[\\x00-\\x20\\x7f()<>@,;:\\\\\"/\\[\\]?={}]/;\n function string(value2) {\n if (typeof value2 === \"symbol\")\n throw new TypeError(\"Cannot convert a Symbol value to a string\");\n return String(value2);\n }\n function utf8(input) {\n const bytes = [];\n for (const character of input) {\n const code = character.codePointAt(0);\n if (code < 128) bytes.push(code);\n else if (code < 2048) bytes.push(192 | code >> 6, 128 | code & 63);\n else if (code < 65536)\n bytes.push(\n 224 | code >> 12,\n 128 | code >> 6 & 63,\n 128 | code & 63\n );\n else\n bytes.push(\n 240 | code >> 18,\n 128 | code >> 12 & 63,\n 128 | code >> 6 & 63,\n 128 | code & 63\n );\n }\n return bytes;\n }\n var decoder2 = new TextDecoder(\"utf-8\", { ignoreBOM: true });\n function display(key2) {\n return decoder2.decode(Uint8Array.from(key2, (c2) => c2.charCodeAt(0)));\n }\n function name(input) {\n const text2 = string(input);\n if (invalidName.test(text2)) throw new TypeError(\"Invalid header name.\");\n const bytes = utf8(text2);\n for (let start = 0; start < bytes.length; start += 8) {\n let word = 0n;\n const length = Math.min(8, bytes.length - start);\n for (let i2 = 0; i2 < length; i2++)\n word |= BigInt(bytes[start + i2]) << BigInt(i2 * 8);\n word ^= ((word + 0x3f3f3f3f3f3f3f3fn ^ word + 0x2525252525252525n) & 0x8080808080808080n) >> 2n;\n for (let i2 = 0; i2 < length; i2++)\n bytes[start + i2] = Number(word >> BigInt(i2 * 8) & 255n);\n }\n return bytes.map((byte) => String.fromCharCode(byte)).join(\"\");\n }\n function required(actual, count, method) {\n if (actual < count)\n throw new TypeError(\n `Failed to execute '${method}' on 'Headers': parameter ${actual + 1} is not of type 'string'.`\n );\n }\n function value(input) {\n const result = string(input).replace(/^[\\t\\n\\r ]+|[\\t\\n\\r ]+$/g, \"\");\n if (/[\\0\\r\\n]/.test(result)) throw new TypeError(\"Invalid header value.\");\n return result.replace(\n /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]/g,\n \"\\uFFFD\\uFFFD\\uFFFD\"\n );\n }\n var Headers2 = class {\n #fields = /* @__PURE__ */ new Map();\n constructor(init = void 0) {\n if (init === void 0) return;\n if (init === null || typeof init !== \"object\" && typeof init !== \"function\")\n throw new TypeError(\n \"Failed to construct 'Headers': constructor parameter 1 is not of type 'Headers or Sequence or object'.\"\n );\n if (#fields in init) {\n this.#fields = new Map(\n [...init.#fields].map(([key2, values]) => [key2, [...values]])\n );\n return;\n }\n const iterator = init[Symbol.iterator];\n if (iterator != null) {\n if (typeof iterator !== \"function\")\n throw new TypeError(\"Invalid iterator.\");\n const iterable = { [Symbol.iterator]: () => iterator.call(init) };\n for (const item of iterable) {\n if (item === null || typeof item !== \"object\" && typeof item !== \"function\" || !(Symbol.iterator in item))\n throw new TypeError(\"Each header must be a sequence.\");\n const pair = [...item];\n if (pair.length !== 2)\n throw new TypeError(\n \"To initialize a Headers object from a sequence, each inner sequence must have exactly two elements.\"\n );\n this.#append(pair[0], pair[1]);\n }\n } else {\n for (const key2 of Object.keys(init))\n this.#append(key2, init[key2]);\n }\n }\n append(key2, item) {\n required(arguments.length, 2, \"append\");\n writable2(this);\n this.#append(key2, item);\n }\n #append(key2, item) {\n const normalized = name(key2);\n const content = value(item);\n const list = this.#fields.get(normalized);\n if (list) list.push(content);\n else this.#fields.set(normalized, [content]);\n }\n set(key2, item) {\n required(arguments.length, 2, \"set\");\n writable2(this);\n this.#fields.set(name(key2), [value(item)]);\n }\n get(key2) {\n required(arguments.length, 1, \"get\");\n return this.#fields.get(name(key2))?.join(\", \") ?? null;\n }\n has(key2) {\n required(arguments.length, 1, \"has\");\n return this.#fields.has(name(key2));\n }\n delete(key2) {\n required(arguments.length, 1, \"delete\");\n writable2(this);\n this.#fields.delete(name(key2));\n }\n getAll(key2) {\n required(arguments.length, 1, \"getAll\");\n if (string(key2).toLowerCase() !== \"set-cookie\")\n throw new TypeError(\n 'getAll() can only be used with the header name \"Set-Cookie\".'\n );\n return [...this.#fields.get(\"set-cookie\") ?? []];\n }\n getSetCookie() {\n return [...this.#fields.get(\"set-cookie\") ?? []];\n }\n #entries() {\n return [...this.#fields.keys()].sort().flatMap((key2) => {\n const entries = this.#fields.get(key2);\n return key2 === \"set-cookie\" ? entries.map((item) => [display(key2), item]) : [[display(key2), entries.join(\", \")]];\n });\n }\n entries() {\n return this.#entries()[Symbol.iterator]();\n }\n keys() {\n return this.#entries().map(([key2]) => key2)[Symbol.iterator]();\n }\n values() {\n return this.#entries().map(([, item]) => item)[Symbol.iterator]();\n }\n forEach(callback, thisArg) {\n if (typeof callback !== \"function\")\n throw new TypeError(\"The callback must be a function.\");\n for (const [key2, item] of this.#entries())\n callback.call(thisArg, item, key2, this);\n }\n [Symbol.iterator]() {\n return this.#entries()[Symbol.iterator]();\n }\n };\n Object.defineProperty(Headers2, \"name\", {\n value: \"Headers\",\n configurable: true\n });\n for (const key2 of Object.getOwnPropertyNames(Headers2.prototype)) {\n if (key2 !== \"constructor\")\n Object.defineProperty(Headers2.prototype, key2, { enumerable: true });\n }\n Object.defineProperty(Headers2.prototype, Symbol.toStringTag, {\n value: \"Headers\",\n configurable: true,\n writable: true\n });\n\n // src/browser/request/index.ts\n var methods = new Set(\n \"ACL CHECKOUT COPY DELETE GET HEAD LOCK MERGE MKACTIVITY MKCOL MOVE NOTIFY OPTIONS PATCH POST PROPFIND PROPPATCH PURGE PUT QUERY REPORT SEARCH SUBSCRIBE TRACE UNLOCK UNSUBSCRIBE\".split(\n \" \"\n )\n );\n var structuredCloneRequestSnapshot;\n var encodings = /* @__PURE__ */ new WeakMap();\n function requestEncoding(request) {\n return encodings.get(request);\n }\n var Request2 = class _Request extends Body {\n #url;\n #method;\n #headers;\n #redirect;\n #signal;\n #thisSignal;\n #cf;\n #fetcher;\n #cache;\n static {\n structuredCloneRequestSnapshot = (request) => ({\n url: request.#url,\n method: request.#method,\n headers: request.#headers,\n redirect: request.#redirect,\n signal: request.#signal,\n cf: request.#cf,\n fetcher: request.#fetcher,\n cache: request.#cache,\n hasBody: hasBody(request),\n encodeResponseBody: requestEncoding(request)\n });\n }\n constructor(input, init = {}) {\n init = dictionary(init);\n if (init instanceof _Request) {\n init = {\n method: init.method,\n headers: init.headers,\n body: init.body,\n redirect: init.redirect,\n signal: init.signal,\n cache: init.cache,\n cf: init.cf,\n fetcher: init.fetcher,\n encodeResponseBody: requestEncoding(init)\n };\n }\n if (arguments.length === 0)\n throw new TypeError(\"Request requires an input.\");\n let nativeSource;\n if (input instanceof platform.Request) {\n const native = input;\n if (init.body === void 0) nativeSource = native;\n const body2 = init.body !== void 0 ? init.body : native.body;\n init = {\n method: native.method,\n headers: [...native.headers],\n redirect: native.redirect,\n signal: native.signal,\n cache: native.cache === \"no-cache\" || native.cache === \"no-store\" ? native.cache : void 0,\n ...init,\n body: body2\n };\n input = native.url;\n }\n const original2 = input instanceof _Request ? input : void 0;\n const url = original2 ? original2.url : new URL(webString(input)).href;\n const method = String(\n init.method ?? original2?.method ?? \"GET\"\n ).toUpperCase();\n if (!methods.has(method))\n throw new TypeError(`Invalid HTTP method string: ${init.method}`);\n if (init.integrity !== void 0 && String(init.integrity) !== \"\")\n throw new TypeError(\n \"Subrequest integrity checking is not implemented. The integrity option must be either undefined or an empty string.\"\n );\n const redirect = String(\n init.redirect ?? original2?.redirect ?? \"follow\"\n ).toLowerCase();\n if (redirect !== \"follow\" && redirect !== \"manual\")\n throw new TypeError(\n \"Invalid redirect value, must be one of follow or manual.\"\n );\n const cache = init.cache ?? original2?.cache;\n if (cache !== void 0 && cache !== \"no-store\" && cache !== \"no-cache\")\n throw new TypeError(`Unsupported cache mode: ${cache}`);\n if (init.encodeResponseBody !== void 0 && ![\"automatic\", \"manual\"].includes(init.encodeResponseBody))\n throw new TypeError(\n `encodeResponseBody: unexpected value: ${init.encodeResponseBody}`\n );\n const signal = init.signal === void 0 ? original2 ? original2.#signal : void 0 : init.signal;\n if (signal != null && !(signal instanceof AbortSignal))\n throw new TypeError(\"signal must be an AbortSignal\");\n const cf = cloneValue(init.cf === void 0 ? original2?.cf : init.cf);\n const headers = new Headers2(init.headers ?? original2?.headers);\n let body = init.body !== void 0 ? init.body : original2 ? original2.body : void 0;\n if (body != null && (method === \"GET\" || method === \"HEAD\"))\n throw new TypeError(\n \"Request with a GET or HEAD method cannot have a body.\"\n );\n if (nativeSource?.body) body = new platform.Request(nativeSource).body;\n else if (original2 && init.body === void 0) body = moveBody(original2);\n super(body, headers);\n if (original2 && init.body === void 0) inheritBodySource(this, original2);\n encodings.set(this, init.encodeResponseBody ?? \"automatic\");\n this.#url = url;\n this.#method = method;\n this.#headers = headers;\n this.#redirect = redirect;\n this.#signal = signal ?? void 0;\n this.#cf = cf;\n this.#fetcher = init.fetcher === void 0 ? original2?.fetcher ?? null : init.fetcher;\n this.#cache = cache;\n }\n get url() {\n return this.#url;\n }\n get method() {\n return this.#method;\n }\n get headers() {\n return this.#headers;\n }\n get redirect() {\n return this.#redirect;\n }\n get signal() {\n return this.#signal ?? (this.#thisSignal ??= new AbortController().signal);\n }\n get cf() {\n return this.#cf;\n }\n get fetcher() {\n return this.#fetcher;\n }\n get cache() {\n return this.#cache;\n }\n get integrity() {\n return \"\";\n }\n get keepalive() {\n return false;\n }\n clone() {\n const copy = new _Request(this.url, {\n method: this.method,\n headers: this.headers,\n redirect: this.redirect,\n signal: this.#signal,\n cf: this.cf,\n fetcher: this.fetcher,\n cache: this.cache,\n body: cloneBody(this),\n encodeResponseBody: requestEncoding(this)\n });\n inheritBodySource(copy, this);\n return copy;\n }\n };\n Object.defineProperty(Request2, \"name\", {\n value: \"Request\",\n configurable: true\n });\n Object.defineProperty(Request2, \"length\", { value: 1, configurable: true });\n Object.defineProperty(Request2.prototype, Symbol.toStringTag, {\n value: \"Request\",\n writable: true,\n configurable: true\n });\n for (const key2 of Object.getOwnPropertyNames(Request2.prototype))\n if (key2 !== \"constructor\")\n Object.defineProperty(Request2.prototype, key2, { enumerable: true });\n\n // src/browser/response/status.ts\n var text = {\n \"0\": \"\",\n \"100\": \"Continue\",\n \"101\": \"Switching Protocols\",\n \"102\": \"Processing\",\n \"103\": \"Early Hints\",\n \"200\": \"OK\",\n \"201\": \"Created\",\n \"202\": \"Accepted\",\n \"203\": \"Non-Authoritative Information\",\n \"204\": \"No Content\",\n \"205\": \"Reset Content\",\n \"206\": \"Partial Content\",\n \"207\": \"Multi-Status\",\n \"208\": \"Already Reported\",\n \"226\": \"IM Used\",\n \"300\": \"Multiple Choices\",\n \"301\": \"Moved Permanently\",\n \"302\": \"Found\",\n \"303\": \"See Other\",\n \"304\": \"Not Modified\",\n \"305\": \"Use Proxy\",\n \"307\": \"Temporary Redirect\",\n \"308\": \"Permanent Redirect\",\n \"400\": \"Bad Request\",\n \"401\": \"Unauthorized\",\n \"402\": \"Payment Required\",\n \"403\": \"Forbidden\",\n \"404\": \"Not Found\",\n \"405\": \"Method Not Allowed\",\n \"406\": \"Not Acceptable\",\n \"407\": \"Proxy Authentication Required\",\n \"408\": \"Request Timeout\",\n \"409\": \"Conflict\",\n \"410\": \"Gone\",\n \"411\": \"Length Required\",\n \"412\": \"Precondition Failed\",\n \"413\": \"Payload Too Large\",\n \"414\": \"URI Too Long\",\n \"415\": \"Unsupported Media Type\",\n \"416\": \"Range Not Satisfiable\",\n \"417\": \"Expectation Failed\",\n \"418\": \"I'm a teapot\",\n \"421\": \"Misdirected Request\",\n \"422\": \"Unprocessable Entity\",\n \"423\": \"Locked\",\n \"424\": \"Failed Dependency\",\n \"426\": \"Upgrade Required\",\n \"428\": \"Precondition Required\",\n \"429\": \"Too Many Requests\",\n \"431\": \"Request Header Fields Too Large\",\n \"451\": \"Unavailable For Legal Reasons\",\n \"500\": \"Internal Server Error\",\n \"501\": \"Not Implemented\",\n \"502\": \"Bad Gateway\",\n \"503\": \"Service Unavailable\",\n \"504\": \"Gateway Timeout\",\n \"505\": \"HTTP Version Not Supported\",\n \"506\": \"Variant Also Negotiates\",\n \"507\": \"Insufficient Storage\",\n \"508\": \"Loop Detected\",\n \"510\": \"Not Extended\",\n \"511\": \"Network Authentication Required\"\n };\n function statusText(status) {\n return text[status] ?? (status < 300 ? \"Successful\" : status < 400 ? \"Redirection\" : status < 500 ? \"Client Error\" : \"Server Error\");\n }\n\n // src/browser/response/index.ts\n var encoding = /* @__PURE__ */ new WeakMap();\n function responseEncoding(response) {\n return encoding.get(response);\n }\n var structuredCloneResponseSnapshot;\n var restoreStructuredCloneResponse;\n var networkResponse;\n var Response2 = class _Response extends Body {\n #status;\n #statusText;\n #headers;\n #cf;\n #webSocket;\n #url = \"\";\n #redirected = false;\n static {\n networkResponse = (body, init, url, redirected) => {\n const response = new _Response(body, init);\n response.#url = url;\n response.#redirected = redirected;\n immutableHeaders(response.#headers);\n return response;\n };\n structuredCloneResponseSnapshot = (response) => ({\n status: response.#status,\n statusText: response.#statusText,\n headers: response.#headers,\n cf: response.#cf,\n webSocket: response.#webSocket,\n encodeBody: encoding.get(response),\n url: response.#url,\n redirected: response.#redirected,\n type: response.type,\n hasBody: hasBody(response)\n });\n restoreStructuredCloneResponse = (snapshot2) => {\n if (snapshot2.hasBody || snapshot2.webSocket)\n throw new DOMException(\"Response is not cloneable\", \"DataCloneError\");\n const response = snapshot2.type === \"error\" ? _Response.error() : new _Response(null, {\n status: snapshot2.status,\n statusText: snapshot2.statusText,\n encodeBody: snapshot2.encodeBody\n });\n response.#headers = snapshot2.headers;\n setBodyHeaders(response, snapshot2.headers);\n response.#cf = snapshot2.cf;\n response.#url = snapshot2.url;\n response.#redirected = snapshot2.redirected;\n encoding.set(response, snapshot2.encodeBody);\n return response;\n };\n }\n constructor(body = null, init = {}) {\n init = dictionary(init);\n const status = init.status === void 0 ? 200 : Math.trunc(Number(init.status));\n const webSocket = init.webSocket ?? null;\n if (webSocket !== null && !(webSocket instanceof WebSocket))\n throw new TypeError(\"webSocket must be a WebSocket\");\n if (webSocket === null ? !(status >= 200 && status <= 599) : status !== 101)\n throw new RangeError(\n webSocket === null ? \"Responses may only be constructed with status codes in the range 200 to 599, inclusive.\" : \"Responses with a WebSocket must have status code 101.\"\n );\n const text2 = init.statusText === void 0 ? statusText(status) : webString(init.statusText);\n if (/[\\x00-\\x1f]/.test(text2)) throw new TypeError(\"Invalid statusText\");\n const bodyEncoding = init instanceof _Response ? encoding.get(init) : init.encodeBody ?? \"automatic\";\n if (bodyEncoding !== \"automatic\" && bodyEncoding !== \"manual\")\n throw new TypeError(`encodeBody: unexpected value: ${bodyEncoding}`);\n const headers = new Headers2(init.headers);\n if ([101, 204, 205, 304].includes(status) && body != null) {\n const length = typeof body === \"string\" ? body.length : body instanceof ArrayBuffer || ArrayBuffer.isView(body) ? body.byteLength : body instanceof Blob ? body.size : -1;\n if (length !== 0)\n throw new TypeError(\n \"Response with null body status (101, 204, 205, or 304) cannot have a body.\"\n );\n body = null;\n }\n super(body, headers);\n this.#status = status;\n this.#statusText = text2;\n this.#headers = headers;\n this.#cf = cloneValue(init.cf);\n this.#webSocket = webSocket;\n encoding.set(this, bodyEncoding);\n }\n get status() {\n return this.#status;\n }\n get statusText() {\n return this.#statusText;\n }\n get headers() {\n return this.#headers;\n }\n get ok() {\n return this.#status >= 200 && this.#status < 300;\n }\n get redirected() {\n return this.#redirected;\n }\n get url() {\n return this.#url;\n }\n get webSocket() {\n return this.#webSocket;\n }\n get cf() {\n return this.#cf;\n }\n get type() {\n return this.#status === 0 ? \"error\" : \"default\";\n }\n clone() {\n if (this.#webSocket)\n throw new TypeError(\"Cannot clone a response to a WebSocket handshake.\");\n const body = cloneBody(this);\n const copy = this.#status === 0 ? _Response.error() : new _Response(body, {\n status: this.status,\n statusText: this.statusText,\n headers: this.headers,\n cf: this.cf,\n encodeBody: encoding.get(this)\n });\n copy.#headers = cloneHeaders(this.#headers);\n setBodyHeaders(copy, copy.#headers);\n copy.#url = this.#url;\n copy.#redirected = this.#redirected;\n return copy;\n }\n static error() {\n const response = new _Response();\n response.#status = 0;\n response.#statusText = \"\";\n return response;\n }\n static redirect(url, status = 302) {\n status = Math.trunc(Number(status));\n if (![301, 302, 303, 307, 308].includes(status))\n throw new RangeError(\"Invalid redirect status code.\");\n const response = new _Response(null, {\n status,\n headers: { location: new URL(webString(url)).href }\n });\n immutableHeaders(response.#headers);\n return response;\n }\n static json(value2, init = {}) {\n init = dictionary(init);\n const body = JSON.stringify(value2) ?? \"undefined\";\n const headers = new Headers2(init.headers);\n if (!headers.has(\"content-type\"))\n headers.set(\"content-type\", \"application/json\");\n return new _Response(\n body,\n init instanceof _Response ? {\n status: init.status,\n statusText: init.statusText,\n cf: init.cf,\n webSocket: init.webSocket,\n encodeBody: responseEncoding(init),\n headers\n } : { ...init, headers }\n );\n }\n };\n Object.defineProperty(Response2, \"name\", {\n value: \"Response\",\n configurable: true\n });\n Object.defineProperty(Response2.prototype, Symbol.toStringTag, {\n value: \"Response\",\n writable: true,\n configurable: true\n });\n for (const key2 of Object.getOwnPropertyNames(Response2.prototype))\n if (key2 !== \"constructor\")\n Object.defineProperty(Response2.prototype, key2, { enumerable: true });\n\n // src/browser/fetch/interop.ts\n function isRequest(input) {\n return input instanceof Request2 || input instanceof platform.Request;\n }\n function isResponse(input) {\n return input instanceof Response2 || input instanceof platform.Response;\n }\n\n // src/cloudflare/workers/runtime.ts\n var FetchRuntime = class {\n constructor(options2) {\n this.options = options2;\n const base = new URL(options2.baseURL);\n if (![\"http:\", \"https:\"].includes(base.protocol) || base.username || base.password || base.search || base.hash) {\n throw new TypeError(\n \"baseURL must be an HTTP(S) URL without credentials, query or fragment.\"\n );\n }\n this.base = base;\n this.boundary = base.pathname.replace(/\\/+$/, \"\");\n this.original = globalThis.fetch;\n this.localURL = globalThis.location ? new URL(globalThis.location.href) : void 0;\n this.env = options2.env ?? {};\n }\n options;\n base;\n boundary;\n localURL;\n original;\n env;\n pending = /* @__PURE__ */ new Set();\n disposed = false;\n disposal = void 0;\n ready = Promise.resolve();\n close() {\n }\n externalFetch(input, init, _url) {\n return this.original.call(globalThis, input, init);\n }\n /** Bound function; creating a runtime does not patch global fetch. */\n fetch = async (input, init) => {\n const inputIsRequest = isRequest(input);\n const address = inputIsRequest ? input.url : String(input);\n const url = new URL(\n address,\n globalThis.document?.baseURI ?? globalThis.location?.href ?? this.base.href\n );\n const matchesPath = !this.boundary || url.pathname === this.boundary || url.pathname.startsWith(`${this.boundary}/`);\n const isLocal = this.localURL && url.protocol === this.localURL.protocol && url.host === this.localURL.host;\n if (!matchesPath || url.origin !== this.base.origin && !isLocal) {\n return this.externalFetch(input, init, url);\n }\n if (url.username || url.password)\n throw new TypeError(\"Request URL must not contain credentials.\");\n const target = new URL(this.base.origin);\n target.pathname = url.pathname;\n target.search = url.search;\n const request = inputIsRequest ? new Request2(\n target,\n new Request2(\n input,\n init\n )\n ) : new Request2(\n target,\n init\n );\n request.signal.throwIfAborted();\n const ctx = {\n props: {},\n passThroughOnException() {\n throw new Error(\n \"passThroughOnException is unsupported for local execution.\"\n );\n },\n waitUntil: (promise) => {\n const tracked = Promise.resolve(promise).then(\n () => {\n },\n (error) => {\n try {\n (this.options.onBackgroundError ?? console.error)(error);\n } catch (reportError) {\n console.error(reportError);\n }\n }\n );\n this.pending.add(tracked);\n void tracked.finally(() => this.pending.delete(tracked));\n }\n };\n let abort;\n const cancelled = new Promise((_resolve, reject) => {\n abort = () => reject(request.signal.reason);\n request.signal.addEventListener(\"abort\", abort, { once: true });\n });\n let response;\n try {\n response = await Promise.race([\n Promise.resolve().then(() => {\n request.signal.throwIfAborted();\n return this.dispatch(request, this.env, ctx);\n }),\n cancelled\n ]);\n } finally {\n request.signal.removeEventListener(\"abort\", abort);\n }\n if (!isResponse(response))\n throw new TypeError(\"worker.fetch must return a Response.\");\n if (response.type === \"error\")\n throw new TypeError(\"worker.fetch returned a network error response.\");\n if (response.bodyUsed || response.body?.locked)\n throw new TypeError(\"worker.fetch returned an unusable response body.\");\n if (request.method === \"HEAD\" && response.body) {\n void response.body.cancel().catch(() => {\n });\n return new Response(null, response);\n }\n return response;\n };\n async drain() {\n while (this.pending.size) await Promise.all([...this.pending]);\n }\n dispose() {\n if (this.disposed) return this.disposal;\n this.disposal = this.close();\n this.disposed = true;\n return this.disposal;\n }\n };\n\n // src/browser/documents/page.ts\n var nativeFetch = globalThis.fetch;\n var host = window;\n var PageFetch = class extends FetchRuntime {\n async dispatch(request) {\n const bytes = [\"GET\", \"HEAD\"].includes(request.method) ? void 0 : new Uint8Array(await readDocumentBody(request));\n const encoded = bytes ? encodeDocumentBytes(bytes) : void 0;\n const result = await host.webkit.messageHandlers.documentFetch.postMessage({\n url: request.url,\n stream: true,\n method: request.method,\n headers: Object.fromEntries(request.headers),\n ...encoded === void 0 ? {} : { body: encoded }\n });\n if (result.error) throw new TypeError(result.error);\n const streamId = result.streamId;\n const post = (action) => host.webkit.messageHandlers.documentFetch.postMessage({\n action,\n streamId\n });\n let controller;\n const abort = () => {\n controller?.error(request.signal.reason);\n void post(\"cancel\").catch(() => {\n });\n request.signal.removeEventListener(\"abort\", abort);\n };\n if (streamId && request.signal.aborted) {\n await post(\"cancel\");\n request.signal.throwIfAborted();\n }\n const body = streamId ? new ReadableStream(\n {\n start(value2) {\n controller = value2;\n request.signal.addEventListener(\"abort\", abort, { once: true });\n },\n async pull(value2) {\n try {\n const next = await post(\"pull\");\n if (request.signal.aborted) return;\n if (next.error) throw new Error(next.error);\n if (next.done) {\n request.signal.removeEventListener(\"abort\", abort);\n value2.close();\n } else\n value2.enqueue(\n Uint8Array.from(atob(next.body), (c2) => c2.charCodeAt(0))\n );\n } catch (error) {\n request.signal.removeEventListener(\"abort\", abort);\n value2.error(error);\n void post(\"cancel\").catch(() => {\n });\n }\n },\n async cancel() {\n request.signal.removeEventListener(\"abort\", abort);\n await post(\"cancel\");\n }\n },\n { highWaterMark: 0 }\n ) : null;\n return new Response([204, 205, 304].includes(result.status) ? null : body, {\n status: result.status,\n headers: result.headers\n });\n }\n };\n var runtime = new PageFetch({ baseURL: documentConfig.baseURL });\n function metadata(response, url, redirected, type2) {\n const clone = response.clone.bind(response);\n Object.defineProperties(response, {\n url: { value: url },\n redirected: { value: redirected },\n type: { value: type2 },\n clone: { value: () => metadata(clone(), url, redirected, type2) }\n });\n return response;\n }\n globalThis.fetch = async (input, init) => {\n const url = new URL(\n input instanceof Request ? input.url : String(input),\n document.baseURI\n );\n if (url.protocol !== location.protocol || url.host !== location.host || !isDocumentURL(url))\n return nativeFetch.call(globalThis, input, init);\n let request = input instanceof Request ? new Request(input, init) : new Request(url, init);\n let current = url;\n for (let redirects = 0; ; redirects++) {\n const response = await runtime.fetch(request.clone());\n if (![301, 302, 303, 307, 308].includes(response.status))\n return metadata(response, current.href, redirects > 0, \"basic\");\n if (request.redirect === \"error\") {\n await response.body?.cancel();\n throw new TypeError(\"Redirect disallowed\");\n }\n if (request.redirect === \"manual\") {\n await response.body?.cancel();\n return metadata(Response.error(), current.href, false, \"opaqueredirect\");\n }\n const locationHeader = response.headers.get(\"location\");\n if (!locationHeader)\n return metadata(response, current.href, redirects > 0, \"basic\");\n await response.body?.cancel();\n if (redirects >= 20) throw new TypeError(\"Too many redirects\");\n const target = new URL(\n locationHeader,\n documentConfig.baseURL + current.pathname + current.search\n );\n if (target.origin !== documentConfig.baseURL || target.username || target.password)\n throw new TypeError(\"External redirects are outside this experiment\");\n current = new URL(\n location.protocol + \"//\" + location.host + target.pathname + target.search + target.hash\n );\n const becomesGET = [301, 302].includes(response.status) && request.method === \"POST\" || response.status === 303 && ![\"GET\", \"HEAD\"].includes(request.method);\n const headers = new Headers(request.headers);\n if (becomesGET)\n for (const name2 of [\n \"content-type\",\n \"content-length\",\n \"content-encoding\",\n \"content-language\",\n \"content-location\"\n ])\n headers.delete(name2);\n request = new Request(current, {\n method: becomesGET ? \"GET\" : request.method,\n headers,\n body: becomesGET || [\"GET\", \"HEAD\"].includes(request.method) ? void 0 : await readDocumentBody(request),\n signal: request.signal,\n redirect: request.redirect\n });\n }\n };\n})();\n/*! Bundled license information:\n\nweb-streams-polyfill/dist/ponyfill.mjs:\n (**\n * @license\n * web-streams-polyfill v4.3.0\n * Copyright 2026 Mattias Buelens, Diwank Singh Tomer and other contributors.\n * This code is released under the MIT license.\n * SPDX-License-Identifier: MIT\n *)\n*/\n";
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { readDocumentBody, encodeDocumentBytes } from "./body.js";
|
|
2
|
+
import "./form-body.js";
|
|
3
|
+
import "./links.js";
|
|
4
|
+
import { documentConfig, isDocumentURL } from "./page-config.js";
|
|
5
|
+
import { FetchRuntime } from "../../cloudflare/workers/runtime.js";
|
|
6
|
+
// Experiment only: keep native document navigation, but carry fetch bytes and
|
|
7
|
+
// redirect policy through a script-message bridge before WebKit serializes them.
|
|
8
|
+
const nativeFetch = globalThis.fetch;
|
|
9
|
+
const host = window;
|
|
10
|
+
class PageFetch extends FetchRuntime {
|
|
11
|
+
async dispatch(request) {
|
|
12
|
+
const bytes = ["GET", "HEAD"].includes(request.method)
|
|
13
|
+
? undefined
|
|
14
|
+
: new Uint8Array(await readDocumentBody(request));
|
|
15
|
+
const encoded = bytes ? encodeDocumentBytes(bytes) : undefined;
|
|
16
|
+
const result = await host.webkit.messageHandlers.documentFetch.postMessage({
|
|
17
|
+
url: request.url,
|
|
18
|
+
stream: true,
|
|
19
|
+
method: request.method,
|
|
20
|
+
headers: Object.fromEntries(request.headers),
|
|
21
|
+
...(encoded === undefined ? {} : { body: encoded }),
|
|
22
|
+
});
|
|
23
|
+
if (result.error)
|
|
24
|
+
throw new TypeError(result.error);
|
|
25
|
+
const streamId = result.streamId;
|
|
26
|
+
const post = (action) => host.webkit.messageHandlers.documentFetch.postMessage({
|
|
27
|
+
action,
|
|
28
|
+
streamId,
|
|
29
|
+
});
|
|
30
|
+
let controller;
|
|
31
|
+
const abort = () => {
|
|
32
|
+
controller?.error(request.signal.reason);
|
|
33
|
+
void post("cancel").catch(() => { });
|
|
34
|
+
request.signal.removeEventListener("abort", abort);
|
|
35
|
+
};
|
|
36
|
+
if (streamId && request.signal.aborted) {
|
|
37
|
+
await post("cancel");
|
|
38
|
+
request.signal.throwIfAborted();
|
|
39
|
+
}
|
|
40
|
+
const body = streamId
|
|
41
|
+
? new ReadableStream({
|
|
42
|
+
start(value) {
|
|
43
|
+
controller = value;
|
|
44
|
+
request.signal.addEventListener("abort", abort, { once: true });
|
|
45
|
+
},
|
|
46
|
+
async pull(value) {
|
|
47
|
+
try {
|
|
48
|
+
const next = await post("pull");
|
|
49
|
+
if (request.signal.aborted)
|
|
50
|
+
return;
|
|
51
|
+
if (next.error)
|
|
52
|
+
throw new Error(next.error);
|
|
53
|
+
if (next.done) {
|
|
54
|
+
request.signal.removeEventListener("abort", abort);
|
|
55
|
+
value.close();
|
|
56
|
+
}
|
|
57
|
+
else
|
|
58
|
+
value.enqueue(Uint8Array.from(atob(next.body), (c) => c.charCodeAt(0)));
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
request.signal.removeEventListener("abort", abort);
|
|
62
|
+
value.error(error);
|
|
63
|
+
void post("cancel").catch(() => { });
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
async cancel() {
|
|
67
|
+
request.signal.removeEventListener("abort", abort);
|
|
68
|
+
await post("cancel");
|
|
69
|
+
},
|
|
70
|
+
}, { highWaterMark: 0 })
|
|
71
|
+
: null;
|
|
72
|
+
return new Response([204, 205, 304].includes(result.status) ? null : body, {
|
|
73
|
+
status: result.status,
|
|
74
|
+
headers: result.headers,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const runtime = new PageFetch({ baseURL: documentConfig.baseURL });
|
|
79
|
+
// These own properties model the observable metadata, not browser-internal
|
|
80
|
+
// Response slots. clone() must preserve it too. This is not a full Fetch shim.
|
|
81
|
+
function metadata(response, url, redirected, type) {
|
|
82
|
+
const clone = response.clone.bind(response);
|
|
83
|
+
Object.defineProperties(response, {
|
|
84
|
+
url: { value: url },
|
|
85
|
+
redirected: { value: redirected },
|
|
86
|
+
type: { value: type },
|
|
87
|
+
clone: { value: () => metadata(clone(), url, redirected, type) },
|
|
88
|
+
});
|
|
89
|
+
return response;
|
|
90
|
+
}
|
|
91
|
+
globalThis.fetch = async (input, init) => {
|
|
92
|
+
const url = new URL(input instanceof Request ? input.url : String(input), document.baseURI);
|
|
93
|
+
if (url.protocol !== location.protocol ||
|
|
94
|
+
url.host !== location.host ||
|
|
95
|
+
!isDocumentURL(url))
|
|
96
|
+
return nativeFetch.call(globalThis, input, init);
|
|
97
|
+
let request = input instanceof Request
|
|
98
|
+
? new Request(input, init)
|
|
99
|
+
: new Request(url, init);
|
|
100
|
+
let current = url;
|
|
101
|
+
for (let redirects = 0;; redirects++) {
|
|
102
|
+
const response = await runtime.fetch(request.clone());
|
|
103
|
+
if (![301, 302, 303, 307, 308].includes(response.status))
|
|
104
|
+
return metadata(response, current.href, redirects > 0, "basic");
|
|
105
|
+
if (request.redirect === "error") {
|
|
106
|
+
await response.body?.cancel();
|
|
107
|
+
throw new TypeError("Redirect disallowed");
|
|
108
|
+
}
|
|
109
|
+
if (request.redirect === "manual") {
|
|
110
|
+
await response.body?.cancel();
|
|
111
|
+
return metadata(Response.error(), current.href, false, "opaqueredirect");
|
|
112
|
+
}
|
|
113
|
+
const locationHeader = response.headers.get("location");
|
|
114
|
+
if (!locationHeader)
|
|
115
|
+
return metadata(response, current.href, redirects > 0, "basic");
|
|
116
|
+
await response.body?.cancel();
|
|
117
|
+
if (redirects >= 20)
|
|
118
|
+
throw new TypeError("Too many redirects");
|
|
119
|
+
// Worker absolute URLs refer to the same local application.
|
|
120
|
+
const target = new URL(locationHeader, documentConfig.baseURL + current.pathname + current.search);
|
|
121
|
+
if (target.origin !== documentConfig.baseURL ||
|
|
122
|
+
target.username ||
|
|
123
|
+
target.password)
|
|
124
|
+
throw new TypeError("External redirects are outside this experiment");
|
|
125
|
+
current = new URL(location.protocol +
|
|
126
|
+
"//" +
|
|
127
|
+
location.host +
|
|
128
|
+
target.pathname +
|
|
129
|
+
target.search +
|
|
130
|
+
target.hash);
|
|
131
|
+
const becomesGET = ([301, 302].includes(response.status) && request.method === "POST") ||
|
|
132
|
+
(response.status === 303 && !["GET", "HEAD"].includes(request.method));
|
|
133
|
+
const headers = new Headers(request.headers);
|
|
134
|
+
if (becomesGET)
|
|
135
|
+
for (const name of [
|
|
136
|
+
"content-type",
|
|
137
|
+
"content-length",
|
|
138
|
+
"content-encoding",
|
|
139
|
+
"content-language",
|
|
140
|
+
"content-location",
|
|
141
|
+
])
|
|
142
|
+
headers.delete(name);
|
|
143
|
+
request = new Request(current, {
|
|
144
|
+
method: becomesGET ? "GET" : request.method,
|
|
145
|
+
headers,
|
|
146
|
+
body: becomesGET || ["GET", "HEAD"].includes(request.method)
|
|
147
|
+
? undefined
|
|
148
|
+
: await readDocumentBody(request),
|
|
149
|
+
signal: request.signal,
|
|
150
|
+
redirect: request.redirect,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function isDocumentWorker(worker: ServiceWorker | null): boolean;
|
|
2
|
+
export declare function enableDocumentWorker(): Promise<void>;
|
|
3
|
+
/** Only touch our own transport; the application may have its own SW. */
|
|
4
|
+
export declare function stopDocumentWorker(): Promise<void>;
|
|
5
|
+
export declare function registerDocumentWorker(baseURL: string): Promise<ServiceWorkerRegistration>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const scriptPath = "/workers-capacitor-sw.js";
|
|
2
|
+
const disableMessage = "workers-capacitor:disable-documents";
|
|
3
|
+
export function isDocumentWorker(worker) {
|
|
4
|
+
if (!worker)
|
|
5
|
+
return false;
|
|
6
|
+
const url = new URL(worker.scriptURL);
|
|
7
|
+
return url.origin === location.origin && url.pathname === scriptPath;
|
|
8
|
+
}
|
|
9
|
+
async function notify(worker, message) {
|
|
10
|
+
return new Promise((resolve) => {
|
|
11
|
+
const channel = new MessageChannel();
|
|
12
|
+
const finish = (ok) => {
|
|
13
|
+
clearTimeout(timer);
|
|
14
|
+
channel.port1.close();
|
|
15
|
+
resolve(ok);
|
|
16
|
+
};
|
|
17
|
+
const timer = setTimeout(() => finish(false), 2000);
|
|
18
|
+
channel.port1.onmessage = () => finish(true);
|
|
19
|
+
try {
|
|
20
|
+
worker.postMessage(message, [channel.port2]);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
channel.port2.close();
|
|
24
|
+
finish(false);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export async function enableDocumentWorker() {
|
|
29
|
+
const controller = navigator.serviceWorker.controller;
|
|
30
|
+
if (!isDocumentWorker(controller) ||
|
|
31
|
+
!(await notify(controller, "workers-capacitor:enable-documents")))
|
|
32
|
+
throw new Error("Document Service Worker did not acknowledge startup");
|
|
33
|
+
}
|
|
34
|
+
/** Only touch our own transport; the application may have its own SW. */
|
|
35
|
+
export async function stopDocumentWorker() {
|
|
36
|
+
if (!globalThis.navigator?.serviceWorker)
|
|
37
|
+
return;
|
|
38
|
+
const container = navigator.serviceWorker;
|
|
39
|
+
const registrations = (await container.getRegistrations()).filter((entry) => {
|
|
40
|
+
const workers = [entry.active, entry.waiting, entry.installing].filter((worker) => worker !== null);
|
|
41
|
+
return workers.length > 0 && workers.every(isDocumentWorker);
|
|
42
|
+
});
|
|
43
|
+
const workers = new Set(registrations.flatMap((entry) => [
|
|
44
|
+
entry.active,
|
|
45
|
+
entry.waiting,
|
|
46
|
+
entry.installing,
|
|
47
|
+
]));
|
|
48
|
+
if (isDocumentWorker(container.controller))
|
|
49
|
+
workers.add(container.controller);
|
|
50
|
+
// Unregister alone leaves already controlled documents intercepted. Disable
|
|
51
|
+
// dispatch and wait for acknowledgement before completing cleanup.
|
|
52
|
+
const acknowledged = new Set();
|
|
53
|
+
try {
|
|
54
|
+
await Promise.all([...workers].filter(isDocumentWorker).map(async (worker) => {
|
|
55
|
+
if (await notify(worker, disableMessage))
|
|
56
|
+
acknowledged.add(worker);
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
await Promise.all(registrations.map((entry) => entry.unregister()));
|
|
61
|
+
}
|
|
62
|
+
// Versions predating the disable protocol cannot release an existing client.
|
|
63
|
+
// A fresh document after unregistering drops their controller.
|
|
64
|
+
const controller = container.controller;
|
|
65
|
+
if (isDocumentWorker(controller) && !acknowledged.has(controller))
|
|
66
|
+
location.reload();
|
|
67
|
+
}
|
|
68
|
+
export async function registerDocumentWorker(baseURL) {
|
|
69
|
+
const container = navigator.serviceWorker;
|
|
70
|
+
const registration = await container.getRegistration("/");
|
|
71
|
+
if (registration &&
|
|
72
|
+
[registration.active, registration.waiting, registration.installing].some((worker) => worker && !isDocumentWorker(worker)))
|
|
73
|
+
throw new Error("Document rendering conflicts with an application Service Worker");
|
|
74
|
+
return container.register(scriptPath + "?baseURL=" + encodeURIComponent(baseURL));
|
|
75
|
+
}
|