alink-cli 0.7.2 → 0.7.4
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/README.md +3 -6
- package/bin/agentlink-account.js +133 -0
- package/bin/agentlink.js +95 -12
- package/dist/Config-Bj2ZPCsP.mjs +1221 -0
- package/dist/Config-Bj2ZPCsP.mjs.map +1 -0
- package/dist/NodeHttpServer-BGJlR_Kf.mjs +826 -0
- package/dist/NodeHttpServer-BGJlR_Kf.mjs.map +1 -0
- package/dist/NodeServices-DDZTiw5K.mjs +1984 -0
- package/dist/NodeServices-DDZTiw5K.mjs.map +1 -0
- package/dist/NodeSocket-08w4osAf.mjs +11198 -0
- package/dist/NodeSocket-08w4osAf.mjs.map +1 -0
- package/dist/NodeSqliteClient-Byu521pt.mjs +578 -0
- package/dist/NodeSqliteClient-Byu521pt.mjs.map +1 -0
- package/dist/Schema-B3i-HrZQ.mjs +40423 -0
- package/dist/Schema-B3i-HrZQ.mjs.map +1 -0
- package/dist/SqlClient-DcM69ZvI.mjs +1554 -0
- package/dist/SqlClient-DcM69ZvI.mjs.map +1 -0
- package/dist/bin.mjs +47577 -26766
- package/dist/bin.mjs.map +1 -1
- package/package.json +4 -3
- package/dist/NodeSqliteClient-BUlNQAY0.mjs +0 -191
- package/dist/NodeSqliteClient-BUlNQAY0.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeSocket-08w4osAf.mjs","names":["TypeId","Proto","Equal.symbol","Equivalence","Hash.symbol","Hash.array","make","fromInput","Arr.fromIterable","Schema.link","Schema.Array","Schema.Tuple","Schema.String","SchemaTransformation.transform","empty","setAll","Arr.appendAll","toString","TypeId","Predicate.hasProperty","Data.TaggedError","Proto","Inspectable.NodeInspectSymbol","empty","raw","Uint8Array","uint8Array","encoder","text","jsonUnsafe","Effect.try","SchemaParser.encodeUnknownEffect","Schema.toCodecJson","Effect.mapError","Effect.flatMap","urlParams","UrlParams.toString","UrlParams.fromInput","FormData","stream","TypeId","Proto","Redactable.symbolRedactable","Context.get","Redactable.redact","Equal.symbol","Hash.symbol","Hash.structure","Inspectable.NodeInspectSymbol","Inspectable.BaseProto","make","empty","set","merge","Redacted.make","Context.Service","Option.match","layer","Effect.sync","TypeId","Predicate.hasProperty","Data.Error","Data.TaggedError","Proto","Inspectable.BaseProto","Record.map","Duration.seconds","empty","Record.isEmptyRecord","Result.fail","Result.succeed","Duration.isFinite","Duration.fromInputUnsafe","set","Result.map","Record.set","Duration.toSeconds","TypeId","Data.TaggedError","Schema.ErrorClass","Data.TaggedError","make","Result.try","TypeId","Proto","Inspectable.BaseProto","redact","makeWith","empty","UrlParams.empty","Headers.empty","HttpBody.empty","make","modify","get","setHeaders","setBody","setHeader","Headers.set","Headers.setAll","UrlParams.fromInput","Option.fromNullishOr","UrlParams.setAll","UrlParams.appendAll","Option.some","Headers.remove","Effect.map","HttpBody.json","HttpBody.formData","TypeId","Schema.decodeEffect","Schema.toCodecJson","Effect.flatMap","Effect.runSync","redact","TypeId","filterStatusOk","Effect.succeed","Effect.fail","Error.HttpClientError","Error.StatusCodeError","Inspectable.Class","HttpIncomingMessage.TypeId","HttpIncomingMessage.inspect","Headers.fromInput","Cookies.fromSetCookie","Option.none","Stream.fromReadableStream","Error.DecodeError","Stream.fail","Error.EmptyBodyError","Effect.flatMap","Effect.try","Effect.tryPromise","Effect.cached","Effect.runSync","Effect.map","UrlParams.fromInput","TypeId","Headers.fromInput","Headers.fromRecordUnsafe","Headers.merge","Cookies.empty","Headers.empty","Body.uint8Array","Body.text","Body.jsonSchema","Effect.map","Body.jsonUnsafe","UrlParams.toString","UrlParams.fromInput","Body.raw","Body.stream","Effect.flatMap","Headers.set","Headers.remove","Headers.setAll","Cookies.merge","Inspectable.Class","HttpIncomingMessage.TypeId","HttpClientResponse.TypeId","HttpIncomingMessage.inspect","Option.none","Stream.empty","Stream.mapError","Stream.succeed","Stream.fromReadableStream","isReadableStream","Stream.unwrap","Effect.try","HttpClientError.HttpClientError","HttpClientError.DecodeError","Effect.succeed","Stream.mkUint8Array","Effect.tryPromise","textDecoder","Effect.contextWith","Stream.toReadableStreamWith","Proto","ErrorReporter.ignore","redact","Body.empty","Effect.map","Response.setHeaders","Context.Service","make","FileSystem.FileSystem","Etag.Generator","internal.wrapCompression","Effect.fnUntraced","Headers.set","Headers.fromInput","Headers.empty","Etag.toString","Option.isSome","Effect.map","Headers.merge","Headers.fromRecordUnsafe","Response.isHttpServerResponse","Effect.succeed","Effect.orDie","Effect.catchCause","Schema.isSchemaError","Cause.isNoSuchElementError","TypeId","Data.TaggedError","Respondable.symbol","ErrorReporter.ignore","Effect.succeed","Response.empty","Context.Service","Cause.StackTrace","Respondable.toResponseOrElse","Response.isHttpServerResponse","Respondable.toResponseOrElseDefect","Cause.fromReasons","Effect.mapEager","Cause.makeDieReason","Option.some","Option.none","TypeId","Predicate.hasProperty","Proto","Iterable.empty","makeUnsafe","make","Effect.acquireRelease","Effect.sync","Deferred.makeUnsafe","Effect.suspend","Effect.void","Fiber.interruptAll","Deferred.into","Cause.filterInterruptors","Exit.isFailure","Cause.hasInterruptsOnly","Effect.runFork","Effect.interrupt","Effect.isEffect","Effect.withFiber","Effect.runForkWith","Effect.succeed","Effect.map","Effect.context","Deferred.await","Effect.whileLoop","Fiber.await","Iterable.headUnsafe","TypeId","make","Predicate.hasProperty","Schema.ErrorClass","Schema.Int","Schema.String","Result.succeed","Result.fail","Schema.TaggedErrorClass","WebSocket","Context.Service","Effect.acquireRelease","Effect.succeed","Effect.map","Effect.sync","Effect.withFiber","Latch.makeUnsafe","Effect.scopedWith","Effect.fnUntraced","FiberSet.make","Scope.provide","Effect.provideService","FiberSet.runtime","Effect.flatMap","Effect.promise","Effect.isEffect","Effect.void","Effect.fail","Deferred.makeUnsafe","Deferred.await","Effect.timeoutOrElse","Effect.raceFirst","FiberSet.join","Effect.catchFilter","Effect.updateContext","Context.merge","Effect.ensuring","State","make","make","defaultIsFile","CT.parse","make","HP.make","Search.make","decodeField","make","internal.make","internal.defaultIsFile","internal.decodeField","TypeId","Data.Error","Data.TaggedError","ErrorReporter.ignore","HttpServerRespondable.symbol","Effect.succeed","HttpServerResponse.empty","Schema.String","Effect.withFiber","Context.get","UndefinedOr.map","IncomingMessage.MaxBodySize","MP.defaultIsFile","Channel.fromTransform","Effect.map","Option.none","MP.make","MP.decodeField","Channel.fromPull","Effect.suspend","Arr.isReadonlyArrayNonEmpty","Cause.done","Effect.flatMap","Option.some","Exit.fail","Option.isNone","Cause.Done","Effect.void","Effect.catchCause","Pull.isDoneCause","Exit.failCause","Option.isSome","Inspectable.Class","Stream.fromChannel","Effect.mapError","FileSystem.FileSystem","Stream.run","Channel.runFold","Effect.gen","Path.Path","Stream.runForEach","Effect.catchTag","Effect.fail","map","FileSystem.Size","Context.makeUnsafe","TypeId","Context.Service","Schema.decodeUnknownEffect","Effect.flatMap","Inspectable.Class","HttpIncomingMessage.TypeId","HttpIncomingMessage.inspect","Option.none","Headers.fromInput","Cookies.parseHeader","Stream.fromReadableStream","Stream.fail","Effect.runSync","Effect.cached","Effect.tryPromise","Effect.try","UrlParams.fromInput","Multipart.toPersisted","Stream.pipeThroughChannel","Stream.mapError","Multipart.makeChannel","Effect.fail","Stream.empty","Stream.succeed","Effect.succeed","Stream.mkUint8Array","Effect.map","Stream.fromIterable","Multipart.TypeId","Option.some","Headers.fromRecordUnsafe","Option.match","Option.isSome","Option.none","Option.some","Tracer.externalSpan","appendPreResponseHandlerUnsafe","Effect.flatMap","make","Effect.withFiber","Context.getUnsafe","TracerDisabledWhen","SpanNameGenerator","Effect.withLogSpan","Effect.flatMap","Effect.exit","Effect.andThen","Effect.annotateLogs","Effect.log","Option.getOrElse","internalEffect.makeSpanUnsafe","Option.getOrUndefined","TraceContext.fromHeaders","Context.add","Effect.onExitPrimitive","Exit.isFailure","Option.isSome","Exit.failCause","Exit.succeed","Request.toURL","Headers.CurrentRedactedNames","Headers.redact","Headers.fromRecordUnsafe","Effect.succeed","Response.setHeaders","Response.empty","compressionInternal.defaultCompressible","Response.removeHeader","compressionInternal.negotiate","compressionInternal.varyAcceptEncoding","Response.setHeader","Effect.flatMapEager","Fiber.getCurrent","Context.getUnsafe","Effect.succeed","Effect.failCause","Effect.matchCauseEffect","Effect.mapEager","Effect.void","Effect.matchCauseEffectEager","Response.empty","Request.HttpServerRequest","Effect.uninterruptible","Effect.withFiber","Scope.makeUnsafe","Context.add","Scope.Scope","Effect.onExitPrimitive","Scope.closeUnsafe","preResponseHandler.appendPreResponseHandlerUnsafe","MutableRef.make","make","Effect.sync","MutableRef.set","HttpClientResponse.filterStatusOk","Inspectable.BaseProto","HttpClientRequest.make","make","Effect.flatMap","Effect.withFiber","Url.make","Option.getOrUndefined","Result.isFailure","Effect.fail","Error.HttpClientError","Error.InvalidUrlError","Tracer.DisablePropagation","Effect.uninterruptibleMask","Effect.matchCauseEffect","Effect.succeed","Cause.hasInterrupts","Effect.failCause","Effect.useSpan","Headers.CurrentRedactedNames","Headers.redact","HttpClientRequest.setHeaders","TraceContext.toHeaders","Effect.withParentSpan","Effect.map","Schedule.isSchedule","Schedule.passthrough","Effect.repeat","Effect.retry","Predicate.or","Layer.effect","Effect.contextWith","effect","Effect.updateContext","Context.merge","HttpClientResponse.TypeId","HttpIncomingMessage.TypeId","Effect.suspend","Effect.onInterrupt","Effect.sync","Stream.suspend","Stream.ensuring","Inspectable.NodeInspectSymbol","Cause.isTimeoutError","Error.isHttpClientError","Context.Service","Effect.isEffect","Layer.effectDiscard","Effect.flatMap","Effect.log","Layer.provideMerge","HttpClient.HttpClient","Effect.die","HttpClient.mapRequest","ClientRequest.prependUrl","Context.Service","Headers.merge","Headers.fromInput","Headers.remove","Effect.map","Effect.tryPromise","HttpClientError.HttpClientError","HttpClientError.TransportError","HttpClientResponse.fromWeb","Effect.flatMap","Stream.toReadableStreamEffect","types","standardTypes","otherTypes","Mime","EventEmitter","http","URL","createHash","Duplex","Socket.WebSocketConstructor"],"sources":["../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/UndefinedOr.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpMethod.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/UrlParams.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpBody.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/Headers.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/Etag.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/ErrorReporter.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/Cookies.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpClientError.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/Url.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpClientRequest.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpIncomingMessage.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpClientResponse.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpServerResponse.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/internal/compression.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpPlatform.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpServerRespondable.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpServerError.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/FiberSet.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/socket/Socket.js","../../../node_modules/.pnpm/multipasta@0.2.8/node_modules/multipasta/dist/esm/internal/contentType.js","../../../node_modules/.pnpm/multipasta@0.2.8/node_modules/multipasta/dist/esm/internal/headers.js","../../../node_modules/.pnpm/multipasta@0.2.8/node_modules/multipasta/dist/esm/internal/search.js","../../../node_modules/.pnpm/multipasta@0.2.8/node_modules/multipasta/dist/esm/internal/multipart.js","../../../node_modules/.pnpm/multipasta@0.2.8/node_modules/multipasta/dist/esm/index.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/Multipart.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpServerRequest.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpTraceContext.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/internal/preResponseHandler.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpMiddleware.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpEffect.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/Ref.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpClient.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpServer.js","../../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/FetchHttpClient.js","../../../node_modules/.pnpm/mime@4.1.0/node_modules/mime/dist/types/other.js","../../../node_modules/.pnpm/mime@4.1.0/node_modules/mime/dist/types/standard.js","../../../node_modules/.pnpm/mime@4.1.0/node_modules/mime/dist/src/Mime.js","../../../node_modules/.pnpm/mime@4.1.0/node_modules/mime/dist/src/index.js","../../../node_modules/.pnpm/@effect+platform-node@4.0.0-beta.103_bufferutil@4.1.0_effect@4.0.0-beta.103_patch_hash=_7eec308fcf6351488fccaf9a0edac255/node_modules/@effect/platform-node/dist/Mime.js","../../../node_modules/.pnpm/ws@8.21.2_bufferutil@4.1.0_utf-8-validate@6.0.6/node_modules/ws/lib/constants.js","../../../node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/node-gyp-build.js","../../../node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/index.js","../../../node_modules/.pnpm/bufferutil@4.1.0/node_modules/bufferutil/fallback.js","../../../node_modules/.pnpm/bufferutil@4.1.0/node_modules/bufferutil/index.js","../../../node_modules/.pnpm/ws@8.21.2_bufferutil@4.1.0_utf-8-validate@6.0.6/node_modules/ws/lib/buffer-util.js","../../../node_modules/.pnpm/ws@8.21.2_bufferutil@4.1.0_utf-8-validate@6.0.6/node_modules/ws/lib/limiter.js","../../../node_modules/.pnpm/ws@8.21.2_bufferutil@4.1.0_utf-8-validate@6.0.6/node_modules/ws/lib/permessage-deflate.js","../../../node_modules/.pnpm/utf-8-validate@6.0.6/node_modules/utf-8-validate/fallback.js","../../../node_modules/.pnpm/utf-8-validate@6.0.6/node_modules/utf-8-validate/index.js","../../../node_modules/.pnpm/ws@8.21.2_bufferutil@4.1.0_utf-8-validate@6.0.6/node_modules/ws/lib/validation.js","../../../node_modules/.pnpm/ws@8.21.2_bufferutil@4.1.0_utf-8-validate@6.0.6/node_modules/ws/lib/receiver.js","../../../node_modules/.pnpm/ws@8.21.2_bufferutil@4.1.0_utf-8-validate@6.0.6/node_modules/ws/lib/sender.js","../../../node_modules/.pnpm/ws@8.21.2_bufferutil@4.1.0_utf-8-validate@6.0.6/node_modules/ws/lib/event-target.js","../../../node_modules/.pnpm/ws@8.21.2_bufferutil@4.1.0_utf-8-validate@6.0.6/node_modules/ws/lib/extension.js","../../../node_modules/.pnpm/ws@8.21.2_bufferutil@4.1.0_utf-8-validate@6.0.6/node_modules/ws/lib/websocket.js","../../../node_modules/.pnpm/ws@8.21.2_bufferutil@4.1.0_utf-8-validate@6.0.6/node_modules/ws/lib/stream.js","../../../node_modules/.pnpm/ws@8.21.2_bufferutil@4.1.0_utf-8-validate@6.0.6/node_modules/ws/lib/subprotocol.js","../../../node_modules/.pnpm/ws@8.21.2_bufferutil@4.1.0_utf-8-validate@6.0.6/node_modules/ws/lib/websocket-server.js","../../../node_modules/.pnpm/ws@8.21.2_bufferutil@4.1.0_utf-8-validate@6.0.6/node_modules/ws/wrapper.mjs","../../../node_modules/.pnpm/@effect+platform-node@4.0.0-beta.103_bufferutil@4.1.0_effect@4.0.0-beta.103_patch_hash=_7eec308fcf6351488fccaf9a0edac255/node_modules/@effect/platform-node/dist/NodeSocket.js"],"sourcesContent":["/**\n * Works with values that may be `undefined`.\n *\n * Use this module for plain TypeScript values of type `A | undefined` when\n * `undefined` is the only absence marker. It is a small alternative to wrapping\n * values in `Option` when your data already uses `undefined` to mean \"no\n * value\". The module includes helpers for mapping defined values, matching both\n * cases, throwing when a value is missing, adapting throwing functions, and\n * building reducers or combiners.\n *\n * @since 4.0.0\n */\nimport * as Combiner from \"./Combiner.js\";\nimport { dual } from \"./Function.js\";\nimport * as Reducer from \"./Reducer.js\";\n/**\n * Maps a defined value with `f`, or returns `undefined` unchanged.\n *\n * **When to use**\n *\n * Use to apply a pure transformation to an `A | undefined` value while\n * preserving `undefined` as absence.\n *\n * @see {@link match} when you need to handle the `undefined` case explicitly\n *\n * @category mapping\n * @since 4.0.0\n */\nexport const map = /*#__PURE__*/dual(2, (self, f) => self === undefined ? undefined : f(self));\n/**\n * Pattern matches on an `A | undefined` value, running `onDefined` when the\n * value is present or evaluating `onUndefined` when the value is `undefined`.\n *\n * **When to use**\n *\n * Use when you need to turn an `A | undefined` into a non-optional result by\n * handling both the defined and undefined branches in one expression.\n *\n * @see {@link map} for transforming defined values while preserving `undefined`\n * @see {@link getOrThrowWith} for throwing when the value is `undefined` instead of returning a fallback branch\n *\n * @category pattern matching\n * @since 4.0.0\n */\nexport const match = /*#__PURE__*/dual(2, (self, {\n onDefined,\n onUndefined\n}) => self === undefined ? onUndefined() : onDefined(self));\n/**\n * Returns the defined value, or throws the value produced by `onUndefined`\n * when the input is `undefined`.\n *\n * **When to use**\n *\n * Use when you need fail-fast unwrapping of an `A | undefined` value and want\n * to provide the thrown error for the undefined case.\n *\n * **Details**\n *\n * Defined values are returned unchanged. When the input is `undefined`,\n * `onUndefined` is called and its result is thrown.\n *\n * @see {@link getOrThrow} for the default-error sibling\n * @see {@link match} for handling defined and undefined cases without throwing\n *\n * @category getters\n * @since 4.0.0\n */\nexport const getOrThrowWith = /*#__PURE__*/dual(2, (self, onUndefined) => {\n if (self !== undefined) {\n return self;\n }\n throw onUndefined();\n});\n/**\n * Returns the defined value, or throws a default `Error` when the input is\n * `undefined`.\n *\n * **When to use**\n *\n * Use when you need to unwrap a value that should already be defined and a\n * generic missing-value `Error` is acceptable.\n *\n * **Details**\n *\n * Defined inputs are returned unchanged. `undefined` throws\n * `new Error(\"getOrThrow called on a undefined\")`.\n *\n * @see {@link getOrThrowWith} for the sibling that lets callers choose the thrown value\n * @see {@link match} for handling defined and undefined cases without throwing\n *\n * @category getters\n * @since 4.0.0\n */\nexport const getOrThrow = /*#__PURE__*/getOrThrowWith(() => new Error(\"getOrThrow called on a undefined\"));\n/**\n * Converts a throwing function into one that returns successful results\n * unchanged and returns `undefined` when the function throws.\n *\n * **When to use**\n *\n * Use to adapt exception-throwing functions when `undefined` is the absence\n * value you want to return for failures.\n *\n * **Gotchas**\n *\n * Thrown values are discarded. If the wrapped function can successfully return\n * `undefined`, that success is indistinguishable from a thrown failure.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const liftThrowable = f => (...a) => {\n try {\n return f(...a);\n } catch {\n return undefined;\n }\n};\n/**\n * Creates a `Reducer` for `UndefinedOr<A>` that prioritizes the first non-`undefined`\n * value and combines values when both operands are present.\n *\n * **When to use**\n *\n * Use when you need to reduce values that may be `undefined`, keeping the\n * first defined value as a fallback and combining only when both operands are\n * defined.\n *\n * **Details**\n *\n * Combining `undefined` with `undefined` returns `undefined`. Combining a\n * defined value with `undefined` keeps the defined value, so the first defined\n * value wins when only one side is present. When both values are defined, they\n * are combined with `combiner.combine`. The reducer's initial value is\n * `undefined`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function makeReducer(combiner) {\n return Reducer.make((self, that) => {\n if (self === undefined) return that;\n if (that === undefined) return self;\n return combiner.combine(self, that);\n }, undefined);\n}\n/**\n * Creates a `Combiner` for `A | undefined` that combines values only when both\n * operands are defined.\n *\n * **When to use**\n *\n * Use to lift a `Combiner` so any `undefined` operand makes the combined result\n * `undefined`.\n *\n * **Details**\n *\n * - `undefined` combined with any value returns `undefined`\n * - Any value combined with `undefined` returns `undefined`\n * - `a` combined with `b` returns `combiner.combine(a, b)`\n *\n * @see {@link makeReducerFailFast} if you have a `Reducer` and want to lift it\n * to `UndefinedOr` values.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function makeCombinerFailFast(combiner) {\n return Combiner.make((self, that) => {\n if (self === undefined || that === undefined) return undefined;\n return combiner.combine(self, that);\n });\n}\n/**\n * Creates a `Reducer` for `A | undefined` by wrapping an existing reducer with\n * fail-fast semantics.\n *\n * **When to use**\n *\n * Use to wrap an existing `Reducer` so any `undefined` value aborts the entire\n * reduction result.\n *\n * **Details**\n *\n * - Initial value is the wrapped reducer's `initialValue`\n * - Combining two defined values delegates to the wrapped reducer\n * - If the accumulator or next value is `undefined`, the reduction returns `undefined`\n *\n * @see {@link makeCombinerFailFast} if you only have a `Combiner` and want to\n * lift it to `UndefinedOr` values.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function makeReducerFailFast(reducer) {\n const combine = makeCombinerFailFast(reducer).combine;\n const initialValue = reducer.initialValue;\n return Reducer.make(combine, initialValue, collection => {\n let out = initialValue;\n for (const value of collection) {\n out = combine(out, value);\n if (out === undefined) return out;\n }\n return out;\n });\n}\n//# sourceMappingURL=UndefinedOr.js.map","/**\n * Defines supported HTTP method names for the unstable HTTP modules.\n *\n * Values are uppercase string literals such as `\"GET\"` and `\"POST\"`, matching\n * the method tokens used by HTTP requests and routes. This module also includes\n * helpers for checking whether a method can carry a request body and whether an\n * unknown value is one of the supported methods.\n *\n * @since 4.0.0\n */\n/**\n * Returns `true` when a method can carry a request body and narrows it to `HttpMethod.WithBody`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const hasBody = method => method !== \"GET\" && method !== \"HEAD\" && method !== \"OPTIONS\" && method !== \"TRACE\";\n/**\n * Provides a readonly set containing every supported `HttpMethod` literal.\n *\n * **When to use**\n *\n * Use when you need to iterate over or test membership against every supported\n * HTTP method literal.\n *\n * @category constants\n * @since 4.0.0\n */\nexport const all = /*#__PURE__*/new Set([\"GET\", \"POST\", \"PUT\", \"DELETE\", \"PATCH\", \"HEAD\", \"OPTIONS\", \"TRACE\"]);\n/**\n * Provides tuples mapping each supported HTTP method to its short\n * request-constructor name.\n *\n * **When to use**\n *\n * Use when you need the mapping from supported HTTP method literals to their\n * short request-constructor names.\n *\n * @category constants\n * @since 4.0.0\n */\nexport const allShort = [[\"GET\", \"get\"], [\"POST\", \"post\"], [\"PUT\", \"put\"], [\"DELETE\", \"del\"], [\"PATCH\", \"patch\"], [\"HEAD\", \"head\"], [\"OPTIONS\", \"options\"], [\"TRACE\", \"trace\"]];\n/**\n * Checks whether a value is a `HttpMethod`.\n *\n * **Example** (Checking HTTP method values)\n *\n * ```ts import.meta.vitest\n * import { HttpMethod } from \"effect/unstable/http\"\n *\n * HttpMethod.isHttpMethod(\"GET\") // => true\n * HttpMethod.isHttpMethod(\"get\") // => false\n * HttpMethod.isHttpMethod(1) // => false\n * ```\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpMethod = u => all.has(u);\n//# sourceMappingURL=HttpMethod.js.map","/**\n * Models URL query parameters as ordered string pairs.\n *\n * `UrlParams` is used for HTTP client query strings, URL-encoded form bodies,\n * and server-side decoding. Values can be built from records, iterables, or\n * native `URLSearchParams`, then updated, serialized, converted to a `URL`, or\n * decoded with schemas.\n *\n * @since 4.0.0\n */\nimport * as Arr from \"../../Array.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Equal from \"../../Equal.js\";\nimport * as Equ from \"../../Equivalence.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Hash from \"../../Hash.js\";\nimport { PipeInspectableProto } from \"../../internal/core.js\";\nimport * as InternalRecord from \"../../internal/record.js\";\nimport * as Option from \"../../Option.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as SchemaIssue from \"../../SchemaIssue.js\";\nimport * as SchemaTransformation from \"../../SchemaTransformation.js\";\nimport * as Tuple from \"../../Tuple.js\";\nconst TypeId = \"~effect/http/UrlParams\";\n/**\n * Returns `true` when a value is a `UrlParams` instance.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isUrlParams = u => hasProperty(u, TypeId);\nconst Proto = {\n ...PipeInspectableProto,\n [TypeId]: TypeId,\n [Symbol.iterator]() {\n return this.params[Symbol.iterator]();\n },\n toJSON() {\n return {\n _id: \"UrlParams\",\n params: Object.fromEntries(this.params)\n };\n },\n [Equal.symbol](that) {\n return Equivalence(this, that);\n },\n [Hash.symbol]() {\n return Hash.array(this.params.flat());\n }\n};\n/**\n * Creates `UrlParams` from ordered string key-value pairs.\n *\n * **Details**\n *\n * The input pairs are used as-is and are not coerced or normalized.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = params => {\n const self = Object.create(Proto);\n self.params = params;\n return self;\n};\n/**\n * Creates `UrlParams` from a supported input shape.\n *\n * **Details**\n *\n * Primitive values are converted to strings, arrays produce repeated parameters,\n * nested records use bracket notation, and `undefined` values are omitted.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromInput = input => {\n if (isUrlParams(input)) {\n return input;\n }\n const parsed = fromInputNested(input);\n const out = [];\n for (let i = 0; i < parsed.length; i++) {\n if (Array.isArray(parsed[i][0])) {\n const [keys, value] = parsed[i];\n out.push([`${keys[0]}[${keys.slice(1).join(\"][\")}]`, value]);\n } else {\n out.push(parsed[i]);\n }\n }\n return make(out);\n};\nconst fromInputNested = input => {\n const entries = typeof input[Symbol.iterator] === \"function\" ? Arr.fromIterable(input) : Object.entries(input);\n const out = [];\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n if (value[i] !== undefined) {\n out.push([key, String(value[i])]);\n }\n }\n } else if (typeof value === \"object\") {\n const nested = fromInputNested(value);\n for (const [k, v] of nested) {\n out.push([[key, ...(typeof k === \"string\" ? [k] : k)], v]);\n }\n } else if (value !== undefined) {\n out.push([key, String(value)]);\n }\n }\n return out;\n};\n/**\n * Provides an order-sensitive `Equivalence` instance for `UrlParams`.\n *\n * **Details**\n *\n * Two values are equivalent when they contain the same key-value pairs in the same\n * order.\n *\n * @category instances\n * @since 4.0.0\n */\nexport const Equivalence = /*#__PURE__*/Equ.make((a, b) => arrayEquivalence(a.params, b.params));\nconst arrayEquivalence = /*#__PURE__*/Arr.makeEquivalence(/*#__PURE__*/Tuple.makeEquivalence([/*#__PURE__*/Equ.strictEqual(), /*#__PURE__*/Equ.strictEqual()]));\n/**\n * Schema for `UrlParams`.\n *\n * **Details**\n *\n * The encoded representation is an array of string key-value tuples.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const UrlParamsSchema = /*#__PURE__*/Schema.declare(isUrlParams, {\n representation: {\n id: \"effect/http/UrlParams\",\n payload: null\n },\n toCode: () => ({\n runtime: \"UrlParams.UrlParamsSchema\",\n Type: \"UrlParams.UrlParams\",\n importDeclarations: [`import * as UrlParams from \"effect/unstable/http/UrlParams\"`]\n }),\n expected: \"UrlParams\",\n toEquivalence: () => Equivalence,\n toCodec: () => Schema.link()(Schema.Array(Schema.Tuple([Schema.String, Schema.String])), SchemaTransformation.transform({\n decode: make,\n encode: self => self.params\n }))\n});\n/**\n * An empty `UrlParams` value.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/make([]);\n/**\n * Returns all values for a query parameter key in insertion order.\n *\n * **Details**\n *\n * Returns an empty array when the key is absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getAll = /*#__PURE__*/dual(2, (self, key) => Arr.reduce(self.params, [], (acc, [k, value]) => {\n if (k === key) {\n acc.push(value);\n }\n return acc;\n}));\n/**\n * Returns the first value for a query parameter key safely.\n *\n * **When to use**\n *\n * Use when duplicate query parameters are ordered and the first occurrence has\n * precedence.\n *\n * **Details**\n *\n * Returns `Option.none` when the key is absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getFirst = /*#__PURE__*/dual(2, (self, key) => Arr.findFirst(self.params, ([k]) => k === key).pipe(Option.map(([, value]) => value)));\n/**\n * Returns the last value for a query parameter key safely.\n *\n * **When to use**\n *\n * Use when duplicate query parameters are ordered and the last occurrence has\n * precedence.\n *\n * **Details**\n *\n * Returns `Option.none` when the key is absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getLast = /*#__PURE__*/dual(2, (self, key) => Arr.findLast(self.params, ([k]) => k === key).pipe(Option.map(([, value]) => value)));\n/**\n * Sets a query parameter to a single value.\n *\n * **Details**\n *\n * Existing values for the same key are removed, and the new value is appended to\n * the end.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const set = /*#__PURE__*/dual(3, (self, key, value) => make(Arr.append(Arr.filter(self.params, ([k]) => k !== key), [key, String(value)])));\n/**\n * Transforms the underlying ordered key-value pairs of `UrlParams`.\n *\n * **Details**\n *\n * The result is wrapped in a new `UrlParams` value.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const transform = /*#__PURE__*/dual(2, (self, f) => make(f(self.params)));\n/**\n * Sets multiple query parameters from input.\n *\n * **Details**\n *\n * Keys present in the input replace existing values for those keys, while\n * unmentioned existing parameters are preserved.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAll = /*#__PURE__*/dual(2, (self, input) => {\n const out = fromInput(input);\n const params = out.params;\n const keys = new Set();\n for (let i = 0; i < params.length; i++) {\n keys.add(params[i][0]);\n }\n for (let i = 0; i < self.params.length; i++) {\n if (keys.has(self.params[i][0])) continue;\n params.push(self.params[i]);\n }\n return out;\n});\n/**\n * Appends a query parameter value without removing existing values for the key.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const append = /*#__PURE__*/dual(3, (self, key, value) => make(Arr.append(self.params, [key, String(value)])));\n/**\n * Appends all query parameters produced from the supplied input.\n *\n * **Details**\n *\n * Existing parameters are preserved.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const appendAll = /*#__PURE__*/dual(2, (self, input) => transform(self, Arr.appendAll(fromInput(input).params)));\n/**\n * Removes all query parameter values for the specified key.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const remove = /*#__PURE__*/dual(2, (self, key) => transform(self, Arr.filter(([k]) => k !== key)));\n/**\n * Serializes `UrlParams` to a URL query string without a leading question mark.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toString = input => new URLSearchParams(fromInput(input).params).toString();\n/**\n * Builds a `Record` containing all the key-value pairs in the given `UrlParams`\n * as `string` (if only one value for a key) or a `NonEmptyArray<string>`\n * (when more than one value for a key)\n *\n * **Example** (Converting parameters to a record)\n *\n * ```ts import.meta.vitest\n * import { UrlParams } from \"effect/unstable/http\"\n *\n * const urlParams = UrlParams.fromInput({\n * a: 1,\n * b: true,\n * c: \"string\",\n * e: [1, 2, 3]\n * })\n * UrlParams.toRecord(urlParams) // => { a: \"1\", b: \"true\", c: \"string\", e: [\"1\", \"2\", \"3\"] }\n * ```\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toRecord = self => {\n const out = {};\n for (const [k, value] of self.params) {\n if (!Object.hasOwn(out, k)) {\n InternalRecord.assignProperty(out, k, value);\n } else {\n const current = out[k];\n if (typeof current === \"string\") {\n InternalRecord.assignProperty(out, k, [current, value]);\n } else {\n current.push(value);\n }\n }\n }\n return out;\n};\n/**\n * Builds a readonly record from `UrlParams`.\n *\n * **Details**\n *\n * Keys with one value map to a string, and keys with multiple values map to a\n * non-empty readonly array of strings.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toReadonlyRecord = toRecord;\n/**\n * Extracts a JSON value from the first occurrence of the given `field` in the\n * `UrlParams`.\n *\n * **Example** (Decoding JSON parameter fields)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n * import { UrlParams } from \"effect/unstable/http\"\n *\n * const extractFoo = UrlParams.schemaJsonField(\"foo\").pipe(\n * Schema.decodeTo(Schema.Struct({\n * some: Schema.String,\n * number: Schema.Number\n * }))\n * )\n *\n * const decoded = Schema.decodeSync(extractFoo)(UrlParams.fromInput({\n * foo: `{\"some\":\"bar\",\"number\":42}`,\n * baz: \"qux\"\n * }))\n * const result = [decoded.some, decoded.number] // => [\"bar\", 42]\n * ```\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaJsonField = field => UrlParamsSchema.pipe(Schema.decodeTo(Schema.UnknownFromJsonString, SchemaTransformation.transformOrFail({\n decode: params => Option.match(getFirst(params, field), {\n onNone: () => Effect.fail(new SchemaIssue.Pointer([field], new SchemaIssue.MissingKey(undefined))),\n onSome: Effect.succeed\n }),\n encode: value => Effect.succeed(make([[field, value]]))\n})));\n/**\n * Schema that decodes `UrlParams` into a record of key-value pairs.\n *\n * **Details**\n *\n * Keys with one value decode to a string, and keys with multiple values decode to\n * a non-empty readonly array of strings.\n *\n * **Example** (Decoding URL parameters to a record)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n * import { UrlParams } from \"effect/unstable/http\"\n *\n * const toStruct = UrlParams.schemaRecord.pipe(\n * Schema.decodeTo(Schema.Struct({\n * some: Schema.String,\n * number: Schema.FiniteFromString\n * }))\n * )\n *\n * const decoded = Schema.decodeSync(toStruct)(UrlParams.fromInput({\n * some: \"value\",\n * number: 42\n * }))\n * const result = [decoded.some, decoded.number] // => [\"value\", 42]\n * ```\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaRecord = /*#__PURE__*/UrlParamsSchema.pipe(/*#__PURE__*/Schema.decodeTo(/*#__PURE__*/Schema.Record(Schema.String, /*#__PURE__*/Schema.Union([Schema.String, /*#__PURE__*/Schema.NonEmptyArray(Schema.String)])), /*#__PURE__*/SchemaTransformation.transform({\n decode: toReadonlyRecord,\n encode: fromInput\n})));\n//# sourceMappingURL=UrlParams.js.map","/**\n * Describes HTTP request and response bodies before they reach a platform\n * adapter.\n *\n * `HttpBody` is the shared body representation used by the HTTP modules. Each\n * variant stores the payload together with metadata that can be known before\n * sending it, such as `contentType` and `contentLength`. This module includes\n * body constructors for common payload shapes, support for schema-encoded JSON\n * bodies, streaming and file-backed bodies, and the error type used when body\n * construction fails.\n *\n * @since 4.0.0\n */\nimport * as Data from \"../../Data.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as FileSystem from \"../../FileSystem.js\";\nimport { format } from \"../../Formatter.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as SchemaParser from \"../../SchemaParser.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nconst TypeId = \"~effect/http/HttpBody\";\n/**\n * Returns `true` if the provided value is an `HttpBody`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpBody = u => Predicate.hasProperty(u, TypeId);\nconst HttpBodyErrorTypeId = \"~effect/http/HttpBody/HttpBodyError\";\n/**\n * Error produced while constructing an HTTP body from JSON or schema-encoded input.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class HttpBodyError extends /*#__PURE__*/Data.TaggedError(\"HttpBodyError\") {\n /**\n * Marks this value as an HTTP body error for runtime guards.\n *\n * @since 4.0.0\n */\n [HttpBodyErrorTypeId] = HttpBodyErrorTypeId;\n}\nclass Proto {\n [TypeId];\n constructor() {\n this[TypeId] = TypeId;\n }\n [Inspectable.NodeInspectSymbol]() {\n return this.toJSON();\n }\n toString() {\n return format(this, {\n ignoreToString: true\n });\n }\n}\n/**\n * HTTP body variant representing the absence of request content.\n *\n * @category models\n * @since 4.0.0\n */\nexport class Empty extends Proto {\n _tag = \"Empty\";\n toJSON() {\n return {\n _id: \"effect/HttpBody\",\n _tag: \"Empty\"\n };\n }\n}\n/**\n * Provides the singleton empty HTTP body.\n *\n * **When to use**\n *\n * Use when you need an HTTP body value that represents no body content.\n *\n * @category constants\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/new Empty();\n/**\n * HTTP body variant containing an arbitrary runtime body value with optional content metadata.\n *\n * @category models\n * @since 4.0.0\n */\nexport class Raw extends Proto {\n _tag = \"Raw\";\n body;\n contentType;\n contentLength;\n constructor(body, contentType, contentLength) {\n super();\n this.body = body;\n this.contentType = contentType;\n this.contentLength = contentLength;\n }\n toJSON() {\n return {\n _id: \"effect/HttpBody\",\n _tag: \"Raw\",\n body: this.body,\n contentType: this.contentType,\n contentLength: this.contentLength\n };\n }\n}\n/**\n * Creates a raw HTTP body from an arbitrary value and optional `contentType` and `contentLength` metadata.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const raw = (body, options) => new Raw(body, options?.contentType, options?.contentLength);\n/**\n * HTTP body variant backed by a `Uint8Array`.\n *\n * **Details**\n *\n * It stores the bytes, content type, and byte length.\n *\n * @category models\n * @since 4.0.0\n */\nexport class Uint8Array extends Proto {\n _tag = \"Uint8Array\";\n body;\n contentType;\n contentLength;\n constructor(body, contentType, contentLength) {\n super();\n this.body = body;\n this.contentType = contentType;\n this.contentLength = contentLength;\n }\n toJSON() {\n const toString = this.contentType.startsWith(\"text/\") || this.contentType.endsWith(\"json\");\n return {\n _id: \"effect/HttpBody\",\n _tag: \"Uint8Array\",\n body: toString ? new TextDecoder().decode(this.body) : `Uint8Array(${this.body.length})`,\n contentType: this.contentType,\n contentLength: this.contentLength\n };\n }\n}\n/**\n * Creates a byte-array HTTP body.\n *\n * **Details**\n *\n * The content type defaults to `application/octet-stream`, and the content length is the byte array length.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const uint8Array = (body, contentType) => new Uint8Array(body, contentType ?? \"application/octet-stream\", body.length);\nconst encoder = /*#__PURE__*/new TextEncoder();\n/**\n * Creates a UTF-8 encoded text HTTP body.\n *\n * **Details**\n *\n * The content type defaults to `text/plain`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const text = (body, contentType) => uint8Array(encoder.encode(body), contentType ?? \"text/plain\");\n/**\n * Creates a JSON HTTP body using `JSON.stringify`, throwing if serialization fails.\n *\n * **Details**\n *\n * The content type defaults to `application/json`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const jsonUnsafe = (body, contentType) => text(JSON.stringify(body), contentType ?? \"application/json\");\n/**\n * Creates a JSON HTTP body in an `Effect`.\n *\n * **Details**\n *\n * `JSON.stringify` failures are captured as `HttpBodyError` values, and the content type defaults to `application/json`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const json = (body, contentType) => Effect.try({\n try: () => text(JSON.stringify(body), contentType ?? \"application/json\"),\n catch: cause => new HttpBodyError({\n reason: {\n _tag: \"JsonError\"\n },\n cause\n })\n});\n/**\n * Creates a JSON body constructor that first encodes values with the schema's JSON codec.\n *\n * **Details**\n *\n * Schema encoding issues and JSON serialization failures are returned as `HttpBodyError` values.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const jsonSchema = (schema, options) => {\n const encode = SchemaParser.encodeUnknownEffect(Schema.toCodecJson(schema));\n return (body, contentType) => encode(body, options).pipe(Effect.mapError(issue => new HttpBodyError({\n reason: {\n _tag: \"SchemaError\",\n issue\n },\n cause: issue\n })), Effect.flatMap(body => json(body, contentType)));\n};\n/**\n * Creates an `application/x-www-form-urlencoded` HTTP body from `UrlParams`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const urlParams = (urlParams, contentType) => text(UrlParams.toString(UrlParams.fromInput(urlParams)), contentType ?? \"application/x-www-form-urlencoded\");\n/**\n * HTTP body variant backed by Web `FormData`.\n *\n * **Details**\n *\n * The content type and content length are left unset so the runtime can supply multipart boundaries.\n *\n * @category models\n * @since 4.0.0\n */\nexport class FormData extends Proto {\n _tag = \"FormData\";\n contentType = undefined;\n contentLength = undefined;\n formData;\n constructor(formData) {\n super();\n this.formData = formData;\n }\n toJSON() {\n return {\n _id: \"effect/HttpBody\",\n _tag: \"FormData\",\n formData: this.formData\n };\n }\n}\n/**\n * Wraps a Web `FormData` value as an HTTP body.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const formData = body => new FormData(body);\nconst appendFormDataValue = (formData, key, value) => {\n if (value == null) {\n return;\n }\n if (typeof value === \"object\") {\n formData.append(key, value);\n return;\n }\n formData.append(key, String(value));\n};\n/**\n * Creates a `FormData` HTTP body from a record.\n *\n * **Details**\n *\n * Array fields append each item under the same key; primitive values are stringified, `File` and `Blob` values are appended directly, and nullish values are skipped.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const formDataRecord = entries => {\n const data = new globalThis.FormData();\n for (const [key, value] of Object.entries(entries)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n appendFormDataValue(data, key, item);\n }\n } else {\n appendFormDataValue(data, key, value);\n }\n }\n return formData(data);\n};\n/**\n * HTTP body variant backed by a stream of `Uint8Array` chunks.\n *\n * @category models\n * @since 4.0.0\n */\nexport class Stream extends Proto {\n _tag = \"Stream\";\n stream;\n contentType;\n contentLength;\n constructor(stream, contentType, contentLength) {\n super();\n this.stream = stream;\n this.contentType = contentType;\n this.contentLength = contentLength;\n }\n toJSON() {\n return {\n _id: \"effect/HttpBody\",\n _tag: \"Stream\",\n contentType: this.contentType,\n contentLength: this.contentLength\n };\n }\n}\n/**\n * Creates a streaming HTTP body from a stream of byte chunks.\n *\n * **Details**\n *\n * The content type defaults to `application/octet-stream`; content length is optional.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const stream = (body, contentType, contentLength) => new Stream(body, contentType ?? \"application/octet-stream\", contentLength);\nconst fileContentLength = (size, options) => {\n const available = Math.max(0, Number(size) - Number(options?.offset ?? 0));\n return options?.bytesToRead === undefined ? available : Math.min(available, Math.max(0, Number(options.bytesToRead)));\n};\n/**\n * Creates a streaming HTTP body for a file path.\n *\n * **Details**\n *\n * The effect requires `FileSystem`, stats the file to set the selected content length, and can fail with\n * `PlatformError`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const file = (path, options) => Effect.flatMap(FileSystem.FileSystem, fs => Effect.map(fs.stat(path), info => stream(fs.stream(path, options), options?.contentType, fileContentLength(info.size, options))));\n/**\n * Creates a streaming HTTP body for a file path using already-known file information.\n *\n * **Details**\n *\n * The effect requires `FileSystem`, uses the provided file size to determine the selected content length, and can\n * fail with `PlatformError`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileFromInfo = (path, info, options) => Effect.map(FileSystem.FileSystem, fs => stream(fs.stream(path, options), options?.contentType, fileContentLength(info.size, options)));\n//# sourceMappingURL=HttpBody.js.map","/**\n * Models HTTP headers for the unstable HTTP client and server modules.\n *\n * `Headers` values are immutable maps keyed by lowercase header name. This\n * module converts common header inputs into that shape, provides helpers for\n * reading and updating header values, and redacts configured sensitive headers\n * when values are inspected.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Equal from \"../../Equal.js\";\nimport * as Equ from \"../../Equivalence.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Hash from \"../../Hash.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Record from \"../../Record.js\";\nimport * as Redactable from \"../../Redactable.js\";\nimport * as Redacted from \"../../Redacted.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as SchemaTransformation from \"../../SchemaTransformation.js\";\n/**\n * Runtime type identifier for `Headers` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = /*#__PURE__*/Symbol.for(\"~effect/http/Headers\");\n/**\n * Returns `true` if the provided value is a `Headers` value.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHeaders = u => Predicate.hasProperty(u, TypeId);\n// the properties are folded into the initializer (rather than a separate\n// `Object.defineProperties(Proto, ...)` statement) so the whole definition\n// is pure-annotated by the build and tree-shakable.\nconst Proto = /*#__PURE__*/Object.defineProperties(/*#__PURE__*/Object.create(null), {\n [TypeId]: {\n value: TypeId\n },\n [Redactable.symbolRedactable]: {\n value(context) {\n return redact(this, Context.get(context, CurrentRedactedNames));\n }\n },\n toJSON: {\n value() {\n return Redactable.redact(this);\n }\n },\n [Equal.symbol]: {\n value(that) {\n return Equivalence(this, that);\n }\n },\n [Hash.symbol]: {\n value() {\n return Hash.structure(this);\n }\n },\n toString: {\n value: Inspectable.BaseProto.toString\n },\n [Inspectable.NodeInspectSymbol]: {\n value: Inspectable.BaseProto[Inspectable.NodeInspectSymbol]\n }\n});\nconst make = input => Object.assign(Object.create(Proto), input);\n/**\n * Provides an `Equivalence` instance that compares `Headers` by header names\n * and string values.\n *\n * @category instances\n * @since 4.0.0\n */\nexport const Equivalence = /*#__PURE__*/Record.makeEquivalence(/*#__PURE__*/Equ.strictEqual());\n/**\n * Schema for `Headers` values encoded as records of string header values.\n *\n * **Details**\n *\n * Decoding normalizes header names through `fromInput`; encoding returns a plain record.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const HeadersSchema = /*#__PURE__*/Schema.declare(isHeaders, {\n representation: {\n id: \"effect/http/Headers\",\n payload: null\n },\n toCode: () => ({\n runtime: \"Headers.HeadersSchema\",\n Type: \"Headers.Headers\",\n importDeclarations: [`import * as Headers from \"effect/unstable/http/Headers\"`]\n }),\n expected: \"Headers\",\n toEquivalence: () => Equivalence,\n toCodec: () => Schema.link()(Schema.Record(Schema.String, Schema.String), SchemaTransformation.transform({\n decode: input => fromInput(input),\n encode: headers => ({\n ...headers\n })\n }))\n});\n/**\n * An empty `Headers` collection.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/Object.create(Proto);\n/**\n * Creates `Headers` from a record or iterable of header entries.\n *\n * **Details**\n *\n * Header names are normalized to lowercase. Array values in record input are joined with `\", \"`, and `undefined` values are omitted.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromInput = input => {\n if (input === undefined) {\n return empty;\n } else if (Symbol.iterator in input) {\n const out = Object.create(Proto);\n for (const [k, v] of input) {\n out[k.toLowerCase()] = v;\n }\n return out;\n }\n const out = Object.create(Proto);\n for (const [k, v] of Object.entries(input)) {\n if (Array.isArray(v)) {\n out[k.toLowerCase()] = v.join(\", \");\n } else if (v !== undefined) {\n out[k.toLowerCase()] = v;\n }\n }\n return out;\n};\n/**\n * Treats an existing record as `Headers` unsafely.\n *\n * **Gotchas**\n *\n * This mutates the record's prototype and does not normalize header names; callers must provide the expected lowercase keys.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromRecordUnsafe = input => Object.setPrototypeOf(input, Proto);\n/**\n * Returns `true` when a header with the given name is present.\n *\n * **Details**\n *\n * The lookup lowercases the provided header name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const has = /*#__PURE__*/dual(2, (self, key) => key.toLowerCase() in self);\n/**\n * Gets a header value by name safely.\n *\n * **Details**\n *\n * The lookup lowercases the provided header name and returns `Option.none()` when absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/dual(2, (self, key) => Option.fromUndefinedOr(self[key.toLowerCase()]));\n/**\n * Returns a new `Headers` collection with the given header set.\n *\n * **Details**\n *\n * The header name is normalized to lowercase.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const set = /*#__PURE__*/dual(3, (self, key, value) => {\n const out = make(self);\n out[key.toLowerCase()] = value;\n return out;\n});\n/**\n * Returns a new `Headers` collection with all provided headers set.\n *\n * **Details**\n *\n * Input headers are normalized with `fromInput` and override existing headers with the same lowercase name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAll = /*#__PURE__*/dual(2, (self, headers) => make({\n ...self,\n ...fromInput(headers)\n}));\n/**\n * Returns a new `Headers` collection containing headers from both collections.\n *\n * **Details**\n *\n * Headers from the second collection override headers from the first collection with the same name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const merge = /*#__PURE__*/dual(2, (self, headers) => {\n const out = make(self);\n Object.assign(out, headers);\n return out;\n});\n/**\n * Returns a new `Headers` collection with the named header removed.\n *\n * **Details**\n *\n * The provided header name is normalized to lowercase before removal.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const remove = /*#__PURE__*/dual(2, (self, key) => {\n const out = make(self);\n delete out[key.toLowerCase()];\n return out;\n});\n/**\n * Returns a new `Headers` collection with each named header removed.\n *\n * **Details**\n *\n * Each provided header name is normalized to lowercase before removal.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const removeMany = /*#__PURE__*/dual(2, (self, keys) => {\n const out = make(self);\n for (const key of keys) {\n delete out[key.toLowerCase()];\n }\n return out;\n});\n/**\n * Returns a plain record with selected header values wrapped in `Redacted`.\n *\n * **Details**\n *\n * String keys are normalized to lowercase before matching; regular expressions are tested against the stored header names.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const redact = /*#__PURE__*/dual(2, (self, key) => {\n const out = {\n ...self\n };\n const modify = key => {\n if (typeof key === \"string\") {\n const k = key.toLowerCase();\n if (k in self) {\n out[k] = Redacted.make(self[k]);\n }\n } else {\n for (const name in self) {\n if (key.test(name)) {\n out[name] = Redacted.make(self[name]);\n }\n }\n }\n };\n if (Array.isArray(key)) {\n for (let i = 0; i < key.length; i++) {\n modify(key[i]);\n }\n } else {\n modify(key);\n }\n return out;\n});\n/**\n * Context reference listing header names or patterns that should be redacted when `Headers` are inspected or rendered.\n *\n * **Details**\n *\n * Defaults include `authorization`, `cookie`, `set-cookie`, and `x-api-key`.\n *\n * @category services\n * @since 4.0.0\n */\nexport const CurrentRedactedNames = /*#__PURE__*/Context.Reference(\"effect/Headers/CurrentRedactedNames\", {\n defaultValue: () => [\"authorization\", \"cookie\", \"set-cookie\", \"x-api-key\"]\n});\n//# sourceMappingURL=Headers.js.map","/**\n * HTTP entity tag values and metadata-based generator layers.\n *\n * ETags are validators for a specific representation of a resource. Servers put\n * them in `ETag` response headers so clients and intermediaries can revalidate\n * cached content with `If-None-Match`, or protect writes with preconditions such\n * as `If-Match`.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\n/**\n * Formats an `Etag` as an HTTP header value, including quotes and the `W/` prefix for weak tags.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toString = self => {\n switch (self._tag) {\n case \"Weak\":\n return `W/\"${self.value}\"`;\n case \"Strong\":\n return `\"${self.value}\"`;\n }\n};\n/**\n * Service for generating ETags from filesystem file information or Web `File`-like metadata.\n *\n * @category services\n * @since 4.0.0\n */\nexport class Generator extends /*#__PURE__*/Context.Service()(\"effect/http/Etag/Generator\") {}\nconst fromFileInfo = info => {\n const mtime = Option.match(info.mtime, {\n onNone: () => \"0\",\n onSome: mtime => mtime.getTime().toString(16)\n });\n return `${info.size.toString(16)}-${mtime}`;\n};\nconst fromFileWeb = file => {\n return `${file.size.toString(16)}-${file.lastModified.toString(16)}`;\n};\n/**\n * Layer that provides a `Generator` which produces strong ETags from file size\n * and modification time metadata.\n *\n * **When to use**\n *\n * Use when you need the `Generator` service to produce strong ETags and file\n * size plus modification time reliably change for every byte-level change.\n *\n * **Gotchas**\n *\n * This layer marks metadata-derived tags as strong. If the underlying storage\n * can update file contents without changing the recorded size or modification\n * time, those tags can stop representing byte-for-byte identity.\n *\n * @see {@link layerWeak} for weak metadata-derived ETags when byte-for-byte identity is not required\n * @see {@link Generator} for the service provided by this layer\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.succeed(Generator)({\n fromFileInfo(info) {\n return Effect.sync(() => ({\n _tag: \"Strong\",\n value: fromFileInfo(info)\n }));\n },\n fromFileWeb(file) {\n return Effect.sync(() => ({\n _tag: \"Strong\",\n value: fromFileWeb(file)\n }));\n }\n});\n/**\n * Layer that provides a `Generator` which produces weak ETags from file size and modification time metadata.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWeak = /*#__PURE__*/Layer.succeed(Generator)({\n fromFileInfo(info) {\n return Effect.sync(() => ({\n _tag: \"Weak\",\n value: fromFileInfo(info)\n }));\n },\n fromFileWeb(file) {\n return Effect.sync(() => ({\n _tag: \"Weak\",\n value: fromFileWeb(file)\n }));\n }\n});\n//# sourceMappingURL=Etag.js.map","import * as Effect from \"./Effect.js\";\nimport * as effect from \"./internal/effect.js\";\nimport * as references from \"./internal/references.js\";\nimport * as Layer from \"./Layer.js\";\nimport * as LogLevel from \"./LogLevel.js\";\n/**\n * Runtime type identifier attached to `ErrorReporter` values.\n *\n * **Details**\n *\n * This marker is part of the runtime representation of `ErrorReporter`\n * implementations. Most code should create reporters with `make` and register\n * them with `layer`.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/ErrorReporter\";\n/**\n * Creates an `ErrorReporter` from a callback.\n *\n * **When to use**\n *\n * Use to define how reported failures are forwarded to a logging, monitoring,\n * or error-tracking backend.\n *\n * **Details**\n *\n * The returned reporter automatically deduplicates causes and individual\n * errors (the same object is never reported twice), skips interruptions,\n * and resolves the `ignore`, `severity`, and `attributes` annotations on\n * each error before invoking your callback.\n *\n * **Example** (Forwarding errors to a callback)\n *\n * ```ts import.meta.vitest\n * import { Effect, ErrorReporter } from \"effect\"\n *\n * const reports: Array<{ message: string; severity: string; attributes: object }> = []\n * const reporter = ErrorReporter.make(({ error, severity, attributes }) => {\n * reports.push({ message: error.message, severity, attributes })\n * })\n *\n * const program = Effect.fail(new Error(\"boom\")).pipe(\n * Effect.withErrorReporting,\n * Effect.provide(ErrorReporter.layer([reporter])),\n * Effect.exit\n * )\n *\n * await Effect.runPromise(program)\n * reports // => [{ message: \"boom\", severity: \"Info\", attributes: {} }]\n * ```\n *\n * @see {@link layer} for registering reporters in the environment\n * @see {@link report} for manually reporting a `Cause`\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = report => {\n const reported = new WeakSet();\n return {\n [TypeId]: TypeId,\n report(options) {\n if (reported.has(options.cause)) return;\n reported.add(options.cause);\n for (let i = 0; i < options.cause.reasons.length; i++) {\n const reason = options.cause.reasons[i];\n if (reason._tag === \"Interrupt\") continue;\n const original = reason._tag === \"Fail\" ? reason.error : reason.defect;\n const isObject = typeof original === \"object\" && original !== null;\n if (isObject) {\n if (reported.has(original)) continue;\n reported.add(original);\n }\n if (isIgnored(original)) continue;\n const pretty = effect.causePrettyError(original, reason.annotations);\n report({\n ...options,\n error: pretty,\n severity: isObject ? getSeverity(original) : \"Info\",\n attributes: isObject ? getAttributes(original) : emptyAttributes\n });\n }\n }\n };\n};\n/**\n * Context reference that holds the set of active error reporters for the\n * current fiber. Defaults to an empty set (no reporting).\n *\n * **When to use**\n *\n * Use when you need to read or replace the current set of error reporters\n * directly.\n *\n * @category services\n * @since 4.0.0\n */\nexport const CurrentErrorReporters = references.CurrentErrorReporters;\n/**\n * Creates a `Layer` that registers one or more `ErrorReporter`s.\n *\n * **When to use**\n *\n * Use to provide one or more error reporters to effects that perform error\n * reporting.\n *\n * **Details**\n *\n * Reporters can be plain `ErrorReporter` values or effectful\n * `Effect<ErrorReporter>` values that are resolved when the layer is built. By\n * default the provided reporters **replace** any previously registered\n * reporters. Set `mergeWithExisting: true` to add them alongside existing ones.\n *\n * **Example** (Providing error reporters)\n *\n * ```ts import.meta.vitest\n * import { Effect, ErrorReporter } from \"effect\"\n *\n * const reports: Array<string> = []\n * const firstReporter = ErrorReporter.make(({ error, severity }) => {\n * reports.push(`[${severity}] ${error.message}`)\n * })\n * const secondReporter = ErrorReporter.make(({ error, severity }) => {\n * reports.push(`${severity}: ${error.message}`)\n * })\n *\n * // Replace all existing reporters\n * const ReporterLive = ErrorReporter.layer([\n * firstReporter,\n * secondReporter\n * ])\n *\n * // Add to existing reporters instead of replacing\n * const ReporterMerged = ErrorReporter.layer(\n * [secondReporter],\n * { mergeWithExisting: true }\n * )\n *\n * const program = Effect.fail(\"boom\").pipe(\n * Effect.withErrorReporting,\n * Effect.provide(ReporterLive),\n * Effect.exit\n * )\n *\n * await Effect.runPromise(program)\n * reports // => [\"[Info] boom\", \"Info: boom\"]\n * ```\n *\n * @see {@link make} for creating an `ErrorReporter` from a callback\n * @see {@link CurrentErrorReporters} for low-level access to the current reporters\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = (reporters, options) => Layer.effect(CurrentErrorReporters, Effect.withFiber(Effect.fnUntraced(function* (fiber) {\n const currentReporters = new Set(options?.mergeWithExisting === true ? fiber.getRef(references.CurrentErrorReporters) : []);\n for (const reporter of reporters) {\n currentReporters.add(Effect.isEffect(reporter) ? yield* reporter : reporter);\n }\n return currentReporters;\n})));\n/**\n * Runs all registered error reporters on the current fiber for a `Cause`.\n *\n * **When to use**\n *\n * Use to report a failure for observability without failing the current fiber.\n *\n * **Example** (Reporting a cause manually)\n *\n * ```ts import.meta.vitest\n * import { Cause, Effect, ErrorReporter } from \"effect\"\n *\n * const messages: Array<string> = []\n * const program = Effect.gen(function*() {\n * const cause = Cause.fail(\"something went wrong\")\n * yield* ErrorReporter.report(cause)\n * return \"fallback value\"\n * })\n *\n * const reporter = ErrorReporter.make(({ error }) => messages.push(error.message))\n * const output = await Effect.runPromise(\n * Effect.provide(program, ErrorReporter.layer([reporter]))\n * )\n * messages // => [\"something went wrong\"]\n * output // => \"fallback value\"\n * ```\n *\n * @category logging\n * @since 4.0.0\n */\nexport const report = cause => Effect.withFiber(fiber => {\n effect.reportCauseUnsafe(fiber, cause);\n return Effect.void;\n});\n/**\n * Defines the runtime property key used to mark an object error as ignored by error\n * reporting.\n *\n * **When to use**\n *\n * Use to suppress reporting for expected object errors, such as HTTP 404\n * responses.\n *\n * **Details**\n *\n * Set `error[ErrorReporter.ignore]` to `true` to prevent the error from being\n * forwarded to reporters. This is useful for expected failures such as HTTP 404\n * responses.\n *\n * **Example** (Marking errors as ignored)\n *\n * ```ts import.meta.vitest\n * import { Data, ErrorReporter } from \"effect\"\n *\n * class NotFoundError extends Data.TaggedError(\"NotFoundError\")<{}> {\n * readonly [ErrorReporter.ignore] = true\n * }\n *\n * ErrorReporter.isIgnored(new NotFoundError()) // => true\n * ```\n *\n * @see {@link isIgnored} for checking whether a value carries this annotation\n * @see {@link Reportable} for the annotation contract recognized on object\n * errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const ignore = \"~effect/ErrorReporter/ignore\";\n/**\n * Returns `true` if the given value has the `ErrorReporter.ignore` annotation\n * set to `true`.\n *\n * **When to use**\n *\n * Use to check whether an error value is annotated to be skipped before\n * forwarding it to error reporting code.\n *\n * @see {@link ignore} for the annotation key this predicate reads\n *\n * @category predicates\n * @since 4.0.0\n */\nexport const isIgnored = u => typeof u === \"object\" && u !== null && ignore in u && u[ignore] === true;\n/**\n * Defines the runtime property key used to override the severity level of an object error.\n *\n * **When to use**\n *\n * Use to annotate object errors with the severity reporter callbacks should\n * receive.\n *\n * **Details**\n *\n * Set `error[ErrorReporter.severity]` to a valid `LogLevel.Severity` value.\n * Missing or invalid values fall back to `\"Info\"`.\n *\n * **Example** (Setting error severity annotations)\n *\n * ```ts import.meta.vitest\n * import { Data, ErrorReporter } from \"effect\"\n *\n * class DeprecationWarning extends Data.TaggedError(\"DeprecationWarning\")<{}> {\n * readonly [ErrorReporter.severity] = \"Warn\" as const\n * }\n *\n * ErrorReporter.getSeverity(new DeprecationWarning()) // => \"Warn\"\n * ```\n *\n * @see {@link getSeverity} for reading the severity stored under this key\n * @see {@link Reportable} for the annotation contract recognized on object\n * errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const severity = \"~effect/ErrorReporter/severity\";\n/**\n * Reads the `ErrorReporter.severity` annotation from an error object,\n * falling back to `\"Info\"` when the annotation is unset or invalid.\n *\n * **When to use**\n *\n * Use to inspect the severity that reporter callbacks will receive for an\n * object error.\n *\n * @see {@link severity} for the annotation key used to override severity\n * @see {@link Reportable} for the annotation properties recognized on object errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const getSeverity = error => {\n if (severity in error && LogLevel.values.includes(error[severity])) {\n return error[severity];\n }\n return \"Info\";\n};\n/**\n * Defines the runtime property key used to attach extra key/value metadata to an object\n * error report.\n *\n * **When to use**\n *\n * Use to attach domain metadata to object errors so reporter callbacks receive\n * it with the reported failure.\n *\n * **Details**\n *\n * Set `error[ErrorReporter.attributes]` to a record of metadata that should be\n * forwarded to reporters alongside the error.\n *\n * **Example** (Setting error attributes)\n *\n * ```ts import.meta.vitest\n * import { Data, ErrorReporter } from \"effect\"\n *\n * class PaymentError extends Data.TaggedError(\"PaymentError\")<{\n * readonly orderId: string\n * }> {\n * readonly [ErrorReporter.attributes] = {\n * orderId: this.orderId\n * }\n * }\n *\n * ErrorReporter.getAttributes(new PaymentError({ orderId: \"order-123\" })) // => { orderId: \"order-123\" }\n * ```\n *\n * @see {@link ignore} for suppressing reports for expected object errors\n * @see {@link severity} for overriding reporter severity\n * @see {@link getAttributes} for reading the metadata stored under this key\n * @see {@link Reportable} for the annotation contract recognized on object\n * errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const attributes = \"~effect/ErrorReporter/attributes\";\n/**\n * Reads the `ErrorReporter.attributes` annotation from an error object,\n * returning an empty record when unset.\n *\n * **When to use**\n *\n * Use to inspect the attributes that reporter callbacks will receive for an\n * object error.\n *\n * **Details**\n *\n * Returns the value stored under `ErrorReporter.attributes`, or the module's\n * shared empty record when the annotation is absent.\n *\n * **Gotchas**\n *\n * The annotation value is returned as-is; this helper does not validate or\n * clone it.\n *\n * @see {@link attributes} for the annotation key used to attach metadata\n * @see {@link Reportable} for the annotation properties recognized on object errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const getAttributes = error => {\n return attributes in error ? error[attributes] : emptyAttributes;\n};\nconst emptyAttributes = {};\n//# sourceMappingURL=ErrorReporter.js.map","/**\n * Models HTTP cookies and cookie collections for requests and responses.\n *\n * A `Cookie` stores a name, value, encoded value, and standard cookie\n * attributes. A `Cookies` value is an immutable collection keyed by cookie\n * name. This module parses request `Cookie` headers, builds response\n * `Set-Cookie` headers, and provides helpers for adding, removing, merging, and\n * expiring cookies.\n *\n * @since 4.0.0\n */\nimport * as Data from \"../../Data.js\";\nimport * as Duration from \"../../Duration.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as InternalRecord from \"../../internal/record.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Record from \"../../Record.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as SchemaTransformation from \"../../SchemaTransformation.js\";\nconst TypeId = \"~effect/http/Cookies\";\n/**\n * Returns `true` when a value is a `Cookies` collection.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isCookies = u => Predicate.hasProperty(u, TypeId);\n/**\n * Schema for `Cookies` collections.\n *\n * **Details**\n *\n * JSON encoding uses `Set-Cookie` header strings, while isomorphic encoding uses\n * a readonly record of cookie values.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const CookiesSchema = /*#__PURE__*/Schema.declare(isCookies, {\n representation: {\n id: \"effect/http/Cookies\",\n payload: null\n },\n toCode: () => ({\n runtime: \"Cookies.CookiesSchema\",\n Type: \"Cookies.Cookies\",\n importDeclarations: [`import * as Cookies from \"effect/unstable/http/Cookies\"`]\n }),\n expected: \"Cookies\",\n toCodecJson: () => Schema.link()(Schema.Array(Schema.String), SchemaTransformation.transform({\n decode: input => fromSetCookie(input),\n encode: cookies => toSetCookieHeaders(cookies)\n })),\n toCodecIso: () => Schema.link()(Schema.Record(Schema.String, CookieSchema), SchemaTransformation.transform({\n decode: input => fromReadonlyRecord(input),\n encode: cookies => cookies.cookies\n }))\n});\nconst CookieTypeId = \"~effect/http/Cookies/Cookie\";\n/**\n * Returns `true` when a value is a `Cookie`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isCookie = u => Predicate.hasProperty(u, CookieTypeId);\n/**\n * Schema for `Cookie` values.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const CookieSchema = /*#__PURE__*/Schema.declare(isCookie, {\n representation: {\n id: \"effect/http/Cookie\",\n payload: null\n },\n toCode: () => ({\n runtime: \"Cookies.CookieSchema\",\n Type: \"Cookies.Cookie\",\n importDeclarations: [`import * as Cookies from \"effect/unstable/http/Cookies\"`]\n }),\n expected: \"Cookie\"\n});\nconst CookieErrorTypeId = \"~effect/http/Cookies/CookieError\";\n/**\n * Error reason describing why cookie construction failed, such as invalid name,\n * value, domain, path, or infinite max-age.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class CookiesErrorReason extends Data.Error {}\n/**\n * Error returned when a cookie name, value, domain, path, or max-age option is invalid.\n *\n * **Details**\n *\n * Inspect `reason` to determine the specific validation failure.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class CookiesError extends /*#__PURE__*/Data.TaggedError(\"CookieError\") {\n /**\n * Creates a cookie error from a reason tag and optional cause.\n *\n * @since 4.0.0\n */\n static fromReason(reason, cause) {\n return new CookiesError({\n reason: new CookiesErrorReason({\n _tag: reason,\n cause\n })\n });\n }\n /**\n * Marks this value as a cookie validation error for runtime guards.\n *\n * @since 4.0.0\n */\n [CookieErrorTypeId] = CookieErrorTypeId;\n /**\n * Uses the concrete cookie error reason as the public message.\n *\n * @since 4.0.0\n */\n get message() {\n return this.reason._tag;\n }\n}\nconst Proto = {\n [TypeId]: TypeId,\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"effect/Cookies\",\n cookies: Record.map(this.cookies, cookie => cookie.toJSON())\n };\n },\n pipe() {\n return pipeArguments(this, arguments);\n }\n};\n/**\n * Creates a `Cookies` collection from an existing readonly record of cookies keyed by cookie name.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromReadonlyRecord = cookies => {\n const self = Object.create(Proto);\n self.cookies = cookies;\n return self;\n};\n/**\n * Create a Cookies object from an Iterable\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromIterable = cookies => {\n const record = {};\n for (const cookie of cookies) {\n InternalRecord.assignProperty(record, cookie.name, cookie);\n }\n return fromReadonlyRecord(record);\n};\n/**\n * Create a Cookies object from a set of Set-Cookie headers\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromSetCookie = headers => {\n const arrayHeaders = typeof headers === \"string\" ? [headers] : headers;\n const cookies = [];\n for (const header of arrayHeaders) {\n const cookie = parseSetCookie(header.trim());\n if (cookie) {\n cookies.push(cookie);\n }\n }\n return fromIterable(cookies);\n};\nfunction parseSetCookie(header) {\n const parts = header.split(\";\").map(_ => _.trim()).filter(_ => _ !== \"\");\n if (parts.length === 0) {\n return undefined;\n }\n const firstEqual = parts[0].indexOf(\"=\");\n if (firstEqual === -1) {\n return undefined;\n }\n const name = parts[0].slice(0, firstEqual);\n if (!fieldContentRegExp.test(name)) {\n return undefined;\n }\n const valueEncoded = parts[0].slice(firstEqual + 1);\n const value = tryDecodeURIComponent(valueEncoded);\n if (parts.length === 1) {\n return Object.assign(Object.create(CookieProto), {\n name,\n value,\n valueEncoded\n });\n }\n const options = {};\n for (let i = 1; i < parts.length; i++) {\n const part = parts[i];\n const equalIndex = part.indexOf(\"=\");\n const key = equalIndex === -1 ? part : part.slice(0, equalIndex).trim();\n const value = equalIndex === -1 ? undefined : part.slice(equalIndex + 1).trim();\n switch (key.toLowerCase()) {\n case \"domain\":\n {\n if (value === undefined) {\n break;\n }\n const domain = value.trim().replace(/^\\./, \"\");\n if (domain) {\n options.domain = domain;\n }\n break;\n }\n case \"expires\":\n {\n if (value === undefined) {\n break;\n }\n const date = new Date(value);\n if (!isNaN(date.getTime())) {\n options.expires = date;\n }\n break;\n }\n case \"max-age\":\n {\n if (value === undefined) {\n break;\n }\n const maxAge = parseInt(value, 10);\n if (!isNaN(maxAge)) {\n options.maxAge = Duration.seconds(maxAge);\n }\n break;\n }\n case \"path\":\n {\n if (value === undefined) {\n break;\n }\n if (value[0] === \"/\") {\n options.path = value;\n }\n break;\n }\n case \"priority\":\n {\n if (value === undefined) {\n break;\n }\n switch (value.toLowerCase()) {\n case \"low\":\n options.priority = \"low\";\n break;\n case \"medium\":\n options.priority = \"medium\";\n break;\n case \"high\":\n options.priority = \"high\";\n break;\n }\n break;\n }\n case \"httponly\":\n {\n options.httpOnly = true;\n break;\n }\n case \"secure\":\n {\n options.secure = true;\n break;\n }\n case \"partitioned\":\n {\n options.partitioned = true;\n break;\n }\n case \"samesite\":\n {\n if (value === undefined) {\n break;\n }\n switch (value.toLowerCase()) {\n case \"lax\":\n options.sameSite = \"lax\";\n break;\n case \"strict\":\n options.sameSite = \"strict\";\n break;\n case \"none\":\n options.sameSite = \"none\";\n break;\n }\n break;\n }\n }\n }\n return Object.assign(Object.create(CookieProto), {\n name,\n value,\n valueEncoded,\n options: Object.keys(options).length > 0 ? options : undefined\n });\n}\n/**\n * An empty Cookies object\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/fromIterable([]);\n/**\n * Returns `true` when the `Cookies` collection contains no cookies.\n *\n * @category predicates\n * @since 4.0.0\n */\nexport const isEmpty = self => Record.isEmptyRecord(self.cookies);\n// oxlint-disable-next-line no-control-regex\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\nconst cookieNameRegExp = /^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/;\n// oxlint-disable-next-line no-control-regex\nconst cookieDomainRegExp = /^[\\u0009\\u0020-\\u003a\\u003c-\\u007e\\u0080-\\u00ff]+$/;\nconst cookiePathRegExp = /^[\\u0020-\\u003a\\u003c-\\u007e]+$/;\nconst CookieProto = {\n [CookieTypeId]: CookieTypeId,\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"effect/Cookies/Cookie\",\n name: this.name,\n value: this.value,\n options: this.options\n };\n }\n};\n/**\n * Creates a cookie, validating the name, encoded value, domain, path, and finite `maxAge`.\n *\n * **Details**\n *\n * Returns a `CookiesError` in the `Result` failure channel when validation fails.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function makeCookie(name, value, options) {\n const encodedValue = encodeURIComponent(value);\n const error = validateCookie(name, encodedValue, options);\n if (error !== undefined) {\n return Result.fail(error);\n }\n return Result.succeed(Object.assign(Object.create(CookieProto), {\n name,\n value,\n valueEncoded: encodedValue,\n options\n }));\n}\nfunction validateCookie(name, encodedValue, options) {\n if (!cookieNameRegExp.test(name)) {\n return CookiesError.fromReason(\"InvalidCookieName\");\n }\n if (encodedValue && !fieldContentRegExp.test(encodedValue)) {\n return CookiesError.fromReason(\"InvalidCookieValue\");\n }\n if (options?.domain !== undefined && !cookieDomainRegExp.test(options.domain)) {\n return CookiesError.fromReason(\"InvalidCookieDomain\");\n }\n if (options?.path !== undefined && !cookiePathRegExp.test(options.path)) {\n return CookiesError.fromReason(\"InvalidCookiePath\");\n }\n if (options?.maxAge !== undefined && !Duration.isFinite(Duration.fromInputUnsafe(options.maxAge))) {\n return CookiesError.fromReason(\"CookieInfinityMaxAge\");\n }\n}\n/**\n * Create a new cookie, throwing an error if invalid\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeCookieUnsafe = (name, value, options) => Result.getOrThrow(makeCookie(name, value, options));\n/**\n * Adds a cookie to a Cookies object\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookie = /*#__PURE__*/dual(2, (self, cookie) => fromReadonlyRecord(Record.set(self.cookies, cookie.name, cookie)));\n/**\n * Adds multiple cookies to a Cookies object\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAllCookie = /*#__PURE__*/dual(2, (self, cookies) => {\n const record = {\n ...self.cookies\n };\n for (const cookie of cookies) {\n InternalRecord.assignProperty(record, cookie.name, cookie);\n }\n return fromReadonlyRecord(record);\n});\n/**\n * Combines two Cookies objects, removing duplicates from the first\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const merge = /*#__PURE__*/dual(2, (self, that) => fromReadonlyRecord({\n ...self.cookies,\n ...that.cookies\n}));\n/**\n * Removes a cookie by name\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const remove = /*#__PURE__*/dual(2, (self, name) => fromReadonlyRecord(Record.remove(self.cookies, name)));\n/**\n * Gets a cookie from a Cookies object safely.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name) => Option.fromUndefinedOr(Object.hasOwn(self.cookies, name) ? self.cookies[name] : undefined));\n/**\n * Gets the decoded value of a cookie by name safely.\n *\n * **Details**\n *\n * Returns `Option.none()` when the cookie is not present.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getValue = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name) => Option.map(get(self, name), cookie => cookie.value));\n/**\n * Creates and adds a cookie safely by name and value.\n *\n * **Details**\n *\n * The cookie fields are validated first; invalid input returns a `CookiesError` in the `Result` failure channel.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const set = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, value, options) => Result.map(makeCookie(name, value, options), cookie => fromReadonlyRecord(Record.set(self.cookies, name, cookie))));\n/**\n * Creates and adds a cookie by name and value, throwing if the cookie fields are invalid.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setUnsafe = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, value, options) => fromReadonlyRecord(Record.set(self.cookies, name, makeCookieUnsafe(name, value, options))));\n/**\n * Adds an expired cookie safely with an empty value, `Max-Age=0`, and an epoch `Expires` value.\n *\n * **Details**\n *\n * Returns a `CookiesError` in the `Result` failure channel when the name or options are invalid.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const expireCookie = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, options) => set(self, name, \"\", {\n ...options,\n maxAge: 0,\n expires: new Date(0)\n}));\n/**\n * Adds an expired cookie to a Cookies object, throwing an error if invalid\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const expireCookieUnsafe = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, options) => setUnsafe(self, name, \"\", {\n ...options,\n maxAge: 0,\n expires: new Date(0)\n}));\n/**\n * Creates and adds multiple cookies safely from name/value/options tuples.\n *\n * **Details**\n *\n * If any tuple is invalid, returns the first `CookiesError` and leaves the original collection unchanged.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAll = /*#__PURE__*/dual(2, (self, cookies) => {\n const record = {\n ...self.cookies\n };\n for (const [name, value, options] of cookies) {\n const result = makeCookie(name, value, options);\n if (Result.isFailure(result)) {\n return result;\n }\n InternalRecord.assignProperty(record, name, result.success);\n }\n return Result.succeed(fromReadonlyRecord(record));\n});\n/**\n * Adds multiple cookies to a Cookies object, throwing an error if invalid\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAllUnsafe = /*#__PURE__*/dual(2, (self, cookies) => Result.getOrThrow(setAll(self, cookies)));\n/**\n * Serializes a cookie into a string.\n *\n * **Details**\n *\n * Adapted from https://github.com/fastify/fastify-cookie under MIT License\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function serializeCookie(self) {\n const error = validateCookie(self.name, self.valueEncoded, self.options);\n if (error !== undefined) {\n throw error;\n }\n let str = self.name + \"=\" + self.valueEncoded;\n if (self.options === undefined) {\n return str;\n }\n const options = self.options;\n if (options.maxAge !== undefined) {\n const maxAge = Duration.toSeconds(Duration.fromInputUnsafe(options.maxAge));\n str += \"; Max-Age=\" + Math.trunc(maxAge);\n }\n if (options.domain !== undefined) {\n str += \"; Domain=\" + options.domain;\n }\n if (options.path !== undefined) {\n str += \"; Path=\" + options.path;\n }\n if (options.priority !== undefined) {\n switch (options.priority) {\n case \"low\":\n str += \"; Priority=Low\";\n break;\n case \"medium\":\n str += \"; Priority=Medium\";\n break;\n case \"high\":\n str += \"; Priority=High\";\n break;\n }\n }\n if (options.expires !== undefined) {\n str += \"; Expires=\" + options.expires.toUTCString();\n }\n if (options.httpOnly) {\n str += \"; HttpOnly\";\n }\n if (options.secure) {\n str += \"; Secure\";\n }\n // Draft implementation to support Chrome from 2024-Q1 forward.\n // See https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1\n if (options.partitioned) {\n str += \"; Partitioned\";\n }\n if (options.sameSite !== undefined) {\n switch (options.sameSite) {\n case \"lax\":\n str += \"; SameSite=Lax\";\n break;\n case \"strict\":\n str += \"; SameSite=Strict\";\n break;\n case \"none\":\n str += \"; SameSite=None\";\n break;\n }\n }\n return str;\n}\n/**\n * Serializes a `Cookies` object into a Cookie header.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toCookieHeader = self => Object.values(self.cookies).map(cookie => `${cookie.name}=${cookie.valueEncoded}`).join(\"; \");\n/**\n * Converts a `Cookies` collection to a record of decoded cookie values keyed by cookie name.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toRecord = self => {\n const record = {};\n const cookies = Object.values(self.cookies);\n for (let index = 0; index < cookies.length; index++) {\n const cookie = cookies[index];\n InternalRecord.assignProperty(record, cookie.name, cookie.value);\n }\n return record;\n};\n/**\n * Schema for transforming `Cookies` into records of decoded string values keyed\n * by cookie name.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaRecord = /*#__PURE__*/CookiesSchema.pipe(/*#__PURE__*/Schema.decodeTo(/*#__PURE__*/Schema.Record(Schema.String, Schema.String), /*#__PURE__*/SchemaTransformation.transform({\n decode: toRecord,\n encode: self => fromIterable(Object.entries(self).map(([name, value]) => makeCookieUnsafe(name, value)))\n})));\n/**\n * Serializes a `Cookies` collection into an array of `Set-Cookie` header values.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toSetCookieHeaders = self => Object.values(self.cookies).map(serializeCookie);\n/**\n * Parses a cookie header into a record of key-value pairs\n *\n * **Details**\n *\n * Adapted from https://github.com/fastify/fastify-cookie under MIT License\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function parseHeader(header) {\n const result = {};\n const strLen = header.length;\n let pos = 0;\n let terminatorPos = 0;\n while (true) {\n if (terminatorPos === strLen) break;\n terminatorPos = header.indexOf(\";\", pos);\n if (terminatorPos === -1) terminatorPos = strLen; // This is the last pair\n let eqIdx = header.indexOf(\"=\", pos);\n if (eqIdx === -1) break; // No key-value pairs left\n if (eqIdx > terminatorPos) {\n // Malformed key-value pair\n pos = terminatorPos + 1;\n continue;\n }\n const key = header.substring(pos, eqIdx++).trim();\n if (!Object.hasOwn(result, key)) {\n const val = header.charCodeAt(eqIdx) === 0x22 ? header.substring(eqIdx + 1, terminatorPos - 1).trim() : header.substring(eqIdx, terminatorPos).trim();\n InternalRecord.assignProperty(result, key, !(val.indexOf(\"%\") === -1) ? tryDecodeURIComponent(val) : val);\n }\n pos = terminatorPos + 1;\n }\n return result;\n}\nconst tryDecodeURIComponent = str => {\n try {\n return decodeURIComponent(str);\n // oxlint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (_) {\n return str;\n }\n};\n//# sourceMappingURL=Cookies.js.map","/**\n * Typed failure model for Effect HTTP client operations.\n *\n * HTTP clients wrap request construction, transport, status-code validation, and\n * response decoding failures in `HttpClientError`. The wrapper keeps the failed\n * request and the specific failure reason together, so callers can handle client\n * failures uniformly while still matching on the reason `_tag` for retry\n * policy, logging, metrics, and user-facing messages.\n *\n * @since 4.0.0\n */\nimport * as Data from \"../../Data.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as Schema from \"../../Schema.js\";\nconst TypeId = \"~effect/http/HttpClientError\";\n/**\n * Returns `true` when a value is an `HttpClientError`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpClientError = u => hasProperty(u, TypeId);\n/**\n * Error wrapper for HTTP client failures, exposing the failed request and the optional response through its `reason`.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class HttpClientError extends /*#__PURE__*/Data.TaggedError(\"HttpClientError\") {\n constructor(props) {\n if (\"cause\" in props.reason) {\n super({\n ...props,\n cause: props.reason.cause\n });\n } else {\n super(props);\n }\n }\n /**\n * Marks this value as an HTTP client error for runtime guards.\n *\n * @since 4.0.0\n */\n [TypeId] = TypeId;\n /**\n * HTTP request associated with the client failure.\n *\n * @since 4.0.0\n */\n get request() {\n return this.reason.request;\n }\n /**\n * HTTP response associated with the client failure, when one was received.\n *\n * @since 4.0.0\n */\n get response() {\n return \"response\" in this.reason ? this.reason.response : undefined;\n }\n get message() {\n return this.reason.message;\n }\n}\nconst formatReason = tag => tag.endsWith(\"Error\") ? tag.slice(0, -5) : tag;\nconst formatMessage = (reason, description, info) => description ? `${reason}: ${description} (${info})` : `${reason} error (${info})`;\n/**\n * Error describing transport-level failures that occur while sending an HTTP request.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class TransportError extends /*#__PURE__*/Data.TaggedError(\"TransportError\") {\n /**\n * Formats the request method and URL for transport error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the transport error message from the optional description and request details.\n *\n * @since 4.0.0\n */\n get message() {\n return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);\n }\n}\n/**\n * Error describing failures while encoding an HTTP request body.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class EncodeError extends /*#__PURE__*/Data.TaggedError(\"EncodeError\") {\n /**\n * Formats the request method and URL for request encoding error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the request encoding error message from the optional description and request details.\n *\n * @since 4.0.0\n */\n get message() {\n return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);\n }\n}\n/**\n * Error describing failures while constructing a URL from an HTTP client request.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class InvalidUrlError extends /*#__PURE__*/Data.TaggedError(\"InvalidUrlError\") {\n /**\n * Formats the request method and URL for invalid URL error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the invalid URL error message from the optional description and request details.\n *\n * @since 4.0.0\n */\n get message() {\n return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);\n }\n}\n/**\n * Response error for HTTP responses rejected because of their status code.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class StatusCodeError extends /*#__PURE__*/Data.TaggedError(\"StatusCodeError\") {\n /**\n * Formats the request method and URL for status code error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the status code error message from the response status, optional description, and request details.\n *\n * @since 4.0.0\n */\n get message() {\n const info = `${this.response.status} ${this.methodAndUrl}`;\n return formatMessage(formatReason(this._tag), this.description, info);\n }\n}\n/**\n * Response error for failures while decoding an HTTP response body.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class DecodeError extends /*#__PURE__*/Data.TaggedError(\"DecodeError\") {\n /**\n * Formats the request method and URL for response decoding error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the response decoding error message from the response status, optional description, and request details.\n *\n * @since 4.0.0\n */\n get message() {\n const info = `${this.response.status} ${this.methodAndUrl}`;\n return formatMessage(formatReason(this._tag), this.description, info);\n }\n}\n/**\n * Response error for operations that expected a response body but received an empty body.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class EmptyBodyError extends /*#__PURE__*/Data.TaggedError(\"EmptyBodyError\") {\n /**\n * Formats the request method and URL for empty response body error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the empty body error message from the response status, optional description, and request details.\n *\n * @since 4.0.0\n */\n get message() {\n const info = `${this.response.status} ${this.methodAndUrl}`;\n return formatMessage(formatReason(this._tag), this.description, info);\n }\n}\n/**\n * Schema for serializable HTTP client errors, preserving the specific error kind\n * and cause.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport class HttpClientErrorSchema extends /*#__PURE__*/Schema.ErrorClass(TypeId)({\n _tag: /*#__PURE__*/Schema.tag(\"HttpError\"),\n kind: /*#__PURE__*/Schema.Literals([\"EncodeError\", \"DecodeError\", \"TransportError\", \"InvalidUrlError\", \"StatusCodeError\", \"EmptyBodyError\"]),\n cause: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Defect())\n}) {\n /**\n * Builds the serializable schema representation for an HTTP client error.\n *\n * @since 4.0.0\n */\n static fromHttpClientError(error) {\n return new HttpClientErrorSchema({\n _tag: \"HttpError\",\n kind: error.reason._tag,\n cause: error.reason\n });\n }\n}\n//# sourceMappingURL=HttpClientError.js.map","/**\n * Parses and edits platform `URL` values.\n *\n * The HTTP modules use the standard `URL` object as their URL representation.\n * This module adds safe parsing and helpers that return updated copies when\n * changing credentials, host, path, protocol, query, or hash parts. Query\n * strings can also be read or updated through `UrlParams`.\n *\n * @since 4.0.0\n */\nimport * as Cause from \"../../Cause.js\";\nimport * as Data from \"../../Data.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Redacted from \"../../Redacted.js\";\nimport * as Result from \"../../Result.js\";\nimport * as UrlParams from \"./UrlParams.js\";\n/**\n * Error returned when constructing a `URL` fails.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class UrlError extends /*#__PURE__*/Data.TaggedError(\"UrlError\") {}\n/**\n * Creates a `URL` safely by appending `UrlParams` and an optional hash to a URL string.\n *\n * **Details**\n *\n * Returns a `Result` that fails with `UrlError` if the URL cannot be constructed.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = (url, params, hash) => Result.try({\n try: () => {\n const urlInstance = new URL(url, baseUrl());\n for (let i = 0; i < params.params.length; i++) {\n const [key, value] = params.params[i];\n if (value !== undefined) {\n urlInstance.searchParams.append(key, value);\n }\n }\n if (hash !== undefined) {\n urlInstance.hash = hash;\n }\n return urlInstance;\n },\n catch: cause => new UrlError({\n cause\n })\n});\nconst baseUrl = () => {\n if (\"location\" in globalThis && globalThis.location !== undefined && globalThis.location.origin !== undefined && globalThis.location.pathname !== undefined) {\n return location.origin + location.pathname;\n }\n return undefined;\n};\n/**\n * Parses a URL string safely into a `URL` object, returning a `Result` type for\n * error handling.\n *\n * **Details**\n *\n * This function converts a string into a `URL` object, enabling safe URL\n * parsing with built-in error handling. If the string is invalid or fails to\n * parse, this function does not throw an error; instead, it wraps the error in\n * a `IllegalArgumentError` and returns it as the `Failure` value of an\n * `Result`. The `Success` value contains the successfully parsed `URL`.\n *\n * An optional `base` parameter can be provided to resolve relative URLs. If\n * specified, the function interprets the input `url` as relative to this\n * `base`. This is especially useful when dealing with URLs that might not be\n * fully qualified.\n *\n * **Example** (Parsing absolute and relative URLs)\n *\n * ```ts import.meta.vitest\n * import { Result } from \"effect\"\n * import { Url } from \"effect/unstable/http\"\n *\n * // Parse an absolute URL\n * //\n * // ┌─── Result<URL, IllegalArgumentError>\n * // ▼\n * const parsed = Url.fromString(\"https://example.com/path\")\n *\n * Result.map(parsed, (url) => url.toString()) // => Result.succeed(\"https://example.com/path\")\n *\n * // Parse a relative URL with a base\n * const relativeParsed = Url.fromString(\"/relative-path\", \"https://example.com\")\n *\n * Result.map(relativeParsed, (url) => url.toString()) // => Result.succeed(\"https://example.com/relative-path\")\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromString = (url, base) => Result.try({\n try: () => new URL(url, base),\n catch: () => new Cause.IllegalArgumentError(`Invalid URL: \"${url}\"${base !== undefined ? ` with base \"${base}\"` : \"\"}`)\n});\n/**\n * Updates a cloned `URL` with a callback, allowing multiple changes at once.\n *\n * **Example** (Mutating URL credentials)\n *\n * ```ts import.meta.vitest\n * import { Url } from \"effect/unstable/http\"\n *\n * const myUrl = new URL(\"https://example.com\")\n *\n * const mutatedUrl = Url.mutate(myUrl, (url) => {\n * url.username = \"user\"\n * url.password = \"pass\"\n * })\n *\n * mutatedUrl.toString() // => \"https://user:pass@example.com/\"\n * ```\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const mutate = /*#__PURE__*/dual(2, (self, f) => {\n const copy = new URL(self);\n f(copy);\n return copy;\n});\n/** @internal */\nconst immutableURLSetter = property => dual(2, (url, value) => mutate(url, url => {\n url[property] = value;\n}));\n/**\n * Updates the hash fragment of the URL.\n *\n * @category setters\n * @since 4.0.0\n */\nexport const setHash = /*#__PURE__*/immutableURLSetter(\"hash\");\n/**\n * Updates the host (domain and port) of the URL.\n *\n * @category setters\n * @since 4.0.0\n */\nexport const setHost = /*#__PURE__*/immutableURLSetter(\"host\");\n/**\n * Updates the domain of the URL without modifying the port.\n *\n * @category setters\n * @since 4.0.0\n */\nexport const setHostname = /*#__PURE__*/immutableURLSetter(\"hostname\");\n/**\n * Replaces the entire URL string.\n *\n * @category setters\n * @since 4.0.0\n */\nexport const setHref = /*#__PURE__*/immutableURLSetter(\"href\");\n/**\n * Updates the password used for authentication.\n *\n * @category setters\n * @since 4.0.0\n */\nexport const setPassword = /*#__PURE__*/dual(2, (url, password) => mutate(url, url => {\n url.password = typeof password === \"string\" ? password : Redacted.value(password);\n}));\n/**\n * Updates the path of the URL.\n *\n * @category setters\n * @since 4.0.0\n */\nexport const setPathname = /*#__PURE__*/immutableURLSetter(\"pathname\");\n/**\n * Updates the port of the URL.\n *\n * @category setters\n * @since 4.0.0\n */\nexport const setPort = /*#__PURE__*/immutableURLSetter(\"port\");\n/**\n * Updates the protocol (e.g., `http`, `https`).\n *\n * @category setters\n * @since 4.0.0\n */\nexport const setProtocol = /*#__PURE__*/immutableURLSetter(\"protocol\");\n/**\n * Updates the query string of the URL.\n *\n * @category setters\n * @since 4.0.0\n */\nexport const setSearch = /*#__PURE__*/immutableURLSetter(\"search\");\n/**\n * Updates the username used for authentication.\n *\n * @category setters\n * @since 4.0.0\n */\nexport const setUsername = /*#__PURE__*/immutableURLSetter(\"username\");\n/**\n * Updates the query parameters of a URL.\n *\n * **Details**\n *\n * This function allows you to set or replace the query parameters of a `URL`\n * object using the provided `UrlParams`. It creates a new `URL` object with the\n * updated parameters, leaving the original object unchanged.\n *\n * **Example** (Replacing query parameters)\n *\n * ```ts import.meta.vitest\n * import { Url, UrlParams } from \"effect/unstable/http\"\n *\n * const myUrl = new URL(\"https://example.com?foo=bar\")\n *\n * // Write parameters\n * const updatedUrl = Url.setUrlParams(\n * myUrl,\n * UrlParams.fromInput([[\"key\", \"value\"]])\n * )\n *\n * updatedUrl.toString() // => \"https://example.com/?key=value\"\n * ```\n *\n * @category setters\n * @since 4.0.0\n */\nexport const setUrlParams = /*#__PURE__*/dual(2, (url, urlParams) => mutate(url, url => {\n url.search = UrlParams.toString(UrlParams.fromInput(urlParams));\n}));\n/**\n * Retrieves the query parameters from a URL.\n *\n * **Details**\n *\n * This function extracts the query parameters from a `URL` object and returns\n * them as `UrlParams`. The resulting structure can be easily manipulated or\n * inspected.\n *\n * **Example** (Reading query parameters)\n *\n * ```ts import.meta.vitest\n * import { Url, UrlParams } from \"effect/unstable/http\"\n *\n * const myUrl = new URL(\"https://example.com?foo=bar\")\n *\n * // Read parameters\n * const params = Url.urlParams(myUrl)\n *\n * UrlParams.toString(params) // => \"foo=bar\"\n * ```\n *\n * @category getters\n * @since 4.0.0\n */\nexport const urlParams = url => UrlParams.fromInput(url.searchParams);\n/**\n * Reads the query parameters of a URL, modifies them, and updates the URL.\n *\n * **Details**\n *\n * This function provides a functional way to interact with query parameters by\n * reading the current parameters, applying a transformation function, and then\n * writing the updated parameters back to the URL. It returns a new `URL` object\n * with the modified parameters, ensuring immutability.\n *\n * **Example** (Modifying query parameters)\n *\n * ```ts import.meta.vitest\n * import { Url, UrlParams } from \"effect/unstable/http\"\n *\n * const myUrl = new URL(\"https://example.com?foo=bar\")\n *\n * const changedUrl = Url.modifyUrlParams(myUrl, UrlParams.append(\"key\", \"value\"))\n *\n * changedUrl.toString() // => \"https://example.com/?foo=bar&key=value\"\n * ```\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const modifyUrlParams = /*#__PURE__*/dual(2, (url, f) => mutate(url, url => {\n const params = f(UrlParams.fromInput(url.searchParams));\n url.search = UrlParams.toString(params);\n}));\n//# sourceMappingURL=Url.js.map","/**\n * Describes immutable outgoing HTTP client requests.\n *\n * `HttpClientRequest` is the request model shared by Effect HTTP clients and\n * platform adapters. A request stores its method, URL, query parameters, hash,\n * headers, and body as structured data. This module includes constructors,\n * helpers for updating requests, body encoders for common payloads, and\n * conversions to and from Web `Request` values.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport { stringOrRedacted } from \"../../internal/redacted.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport { redact } from \"../../Redactable.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as HttpBody from \"./HttpBody.js\";\nimport { hasBody } from \"./HttpMethod.js\";\nimport * as Url from \"./Url.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nconst TypeId = \"~effect/http/HttpClientRequest\";\n/**\n * Returns `true` when a value is an `HttpClientRequest`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpClientRequest = u => hasProperty(u, TypeId);\nconst Proto = {\n [TypeId]: TypeId,\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"HttpClientRequest\",\n method: this.method,\n url: this.url,\n urlParams: this.urlParams,\n hash: this.hash,\n headers: redact(this.headers),\n body: this.body.toJSON()\n };\n },\n pipe() {\n return pipeArguments(this, arguments);\n }\n};\n/**\n * Constructs an `HttpClientRequest` from fully normalized request components.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function makeWith(method, url, urlParams, hash, headers, body) {\n const self = Object.create(Proto);\n self.method = method;\n self.url = url;\n self.urlParams = urlParams;\n self.hash = hash;\n self.headers = headers;\n self.body = body;\n return self;\n}\n/**\n * An empty `GET` request with no URL, query parameters, hash, headers, or body.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/makeWith(\"GET\", \"\", UrlParams.empty, /*#__PURE__*/Option.none(), Headers.empty, HttpBody.empty);\n/**\n * Creates a request constructor for the specified HTTP method.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = method => (url, options) => modify(empty, {\n method,\n url,\n ...(options ?? undefined)\n});\n/**\n * Creates a `GET` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/make(\"GET\");\n/**\n * Creates a `POST` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const post = /*#__PURE__*/make(\"POST\");\n/**\n * Creates a `PATCH` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const patch = /*#__PURE__*/make(\"PATCH\");\n/**\n * Creates a `PUT` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const put = /*#__PURE__*/make(\"PUT\");\nconst del = /*#__PURE__*/make(\"DELETE\");\nexport {\n/**\n * Creates a `DELETE` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\ndel as delete };\n/**\n * Creates a `HEAD` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const head = /*#__PURE__*/make(\"HEAD\");\n/**\n * Creates an `OPTIONS` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const options = /*#__PURE__*/make(\"OPTIONS\");\n/**\n * Creates a `TRACE` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const trace = /*#__PURE__*/make(\"TRACE\");\n/**\n * Applies request options to an `HttpClientRequest`, returning a new request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const modify = /*#__PURE__*/dual(2, (self, options) => {\n let result = self;\n if (options.method) {\n result = setMethod(result, options.method);\n }\n if (options.url) {\n result = setUrl(result, options.url);\n }\n if (options.headers) {\n result = setHeaders(result, options.headers);\n }\n if (options.urlParams) {\n result = setUrlParams(result, options.urlParams);\n }\n if (options.hash) {\n result = setHash(result, options.hash);\n }\n if (options.body) {\n result = setBody(result, options.body);\n }\n if (options.accept) {\n result = accept(result, options.accept);\n }\n if (options.acceptJson) {\n result = acceptJson(result);\n }\n return result;\n});\n/**\n * Sets the HTTP method on a request, returning a new request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setMethod = /*#__PURE__*/dual(2, (self, method) => makeWith(method, self.url, self.urlParams, self.hash, self.headers, self.body));\n/**\n * Sets a single request header, replacing any existing value for that header.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHeader = /*#__PURE__*/dual(3, (self, key, value) => makeWith(self.method, self.url, self.urlParams, self.hash, Headers.set(self.headers, key, value), self.body));\n/**\n * Sets multiple request headers from an input collection, replacing existing values with matching names.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHeaders = /*#__PURE__*/dual(2, (self, input) => makeWith(self.method, self.url, self.urlParams, self.hash, Headers.setAll(self.headers, input), self.body));\n/**\n * Transforms the request headers with the provided function, returning a new request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const updateHeaders = /*#__PURE__*/dual(2, (self, f) => makeWith(self.method, self.url, self.urlParams, self.hash, f(self.headers), self.body));\n/**\n * Removes a single request header by name, returning a new request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const removeHeader = /*#__PURE__*/dual(2, (self, key) => updateHeaders(self, Headers.remove(key)));\n/**\n * Sets the `Authorization` header using HTTP Basic authentication credentials.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const basicAuth = /*#__PURE__*/dual(3, (self, username, password) => setHeader(self, \"Authorization\", `Basic ${btoa(`${stringOrRedacted(username)}:${stringOrRedacted(password)}`)}`));\n/**\n * Sets the `Authorization` header using a bearer token.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bearerToken = /*#__PURE__*/dual(2, (self, token) => setHeader(self, \"Authorization\", `Bearer ${stringOrRedacted(token)}`));\n/**\n * Sets the `Accept` header to the specified media type.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const accept = /*#__PURE__*/dual(2, (self, mediaType) => setHeader(self, \"Accept\", mediaType));\n/**\n * Sets the `Accept` header to `application/json`.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const acceptJson = /*#__PURE__*/accept(\"application/json\");\n/**\n * Sets the request URL. When given a `URL`, its search parameters and hash are extracted into the request's structured fields.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setUrl = /*#__PURE__*/dual(2, (self, url) => {\n if (typeof url === \"string\") {\n return makeWith(self.method, url, self.urlParams, self.hash, self.headers, self.body);\n }\n const clone = new URL(url.toString());\n const urlParams = UrlParams.fromInput(clone.searchParams);\n const hash = Option.fromNullishOr(clone.hash === \"\" ? undefined : clone.hash.slice(1));\n clone.search = \"\";\n clone.hash = \"\";\n return makeWith(self.method, clone.toString(), urlParams, hash, self.headers, self.body);\n});\n/**\n * Prepends a URL segment to the request URL, inserting or trimming one slash as needed.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const prependUrl = /*#__PURE__*/dual(2, (self, path) => {\n if (path === \"\") return self;\n return makeWith(self.method, joinSegments(path, self.url), self.urlParams, self.hash, self.headers, self.body);\n});\n/**\n * Appends a URL segment to the request URL, inserting or trimming one slash as needed.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const appendUrl = /*#__PURE__*/dual(2, (self, path) => {\n if (path === \"\") return self;\n return makeWith(self.method, joinSegments(self.url, path), self.urlParams, self.hash, self.headers, self.body);\n});\nconst joinSegments = (first, second) => {\n const endsWithSlash = first.endsWith(\"/\");\n const startsWithSlash = second.startsWith(\"/\");\n const needsTrim = endsWithSlash && startsWithSlash;\n const needsSlash = !endsWithSlash && !startsWithSlash;\n return needsTrim ? first + second.slice(1) : needsSlash ? first + \"/\" + second : first + second;\n};\n/**\n * Updates the request URL by applying a function to the current URL string.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const updateUrl = /*#__PURE__*/dual(2, (self, f) => makeWith(self.method, f(self.url), self.urlParams, self.hash, self.headers, self.body));\n/**\n * Sets one query parameter, replacing existing values for that parameter name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setUrlParam = /*#__PURE__*/dual(3, (self, key, value) => makeWith(self.method, self.url, UrlParams.set(self.urlParams, key, value), self.hash, self.headers, self.body));\n/**\n * Sets query parameters from an input collection, replacing existing values for matching names.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setUrlParams = /*#__PURE__*/dual(2, (self, input) => makeWith(self.method, self.url, UrlParams.setAll(self.urlParams, input), self.hash, self.headers, self.body));\n/**\n * Appends one query parameter value without removing existing values for the same name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const appendUrlParam = /*#__PURE__*/dual(3, (self, key, value) => makeWith(self.method, self.url, UrlParams.append(self.urlParams, key, value), self.hash, self.headers, self.body));\n/**\n * Appends query parameters from an input collection without removing existing values for matching names.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const appendUrlParams = /*#__PURE__*/dual(2, (self, input) => makeWith(self.method, self.url, UrlParams.appendAll(self.urlParams, input), self.hash, self.headers, self.body));\n/**\n * Sets the URL fragment on a request without the leading `#`.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHash = /*#__PURE__*/dual(2, (self, hash) => makeWith(self.method, self.url, self.urlParams, Option.some(hash), self.headers, self.body));\n/**\n * Removes the URL fragment from a request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const removeHash = self => makeWith(self.method, self.url, self.urlParams, Option.none(), self.headers, self.body);\n/**\n * Sets the request body and updates `Content-Type` and `Content-Length` headers from the body metadata when available.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setBody = /*#__PURE__*/dual(2, (self, body) => {\n let headers = self.headers;\n if (body._tag === \"Empty\" || body._tag === \"FormData\") {\n headers = Headers.remove(Headers.remove(headers, \"Content-Type\"), \"Content-length\");\n } else {\n if (body.contentType) {\n headers = Headers.set(headers, \"content-type\", body.contentType);\n }\n if (body.contentLength !== undefined) {\n headers = Headers.set(headers, \"content-length\", body.contentLength.toString());\n } else {\n headers = Headers.remove(headers, \"content-length\");\n }\n }\n return makeWith(self.method, self.url, self.urlParams, self.hash, headers, body);\n});\n/**\n * Sets a `Uint8Array` request body with an optional content type.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyUint8Array = /*#__PURE__*/dual(args => isHttpClientRequest(args[0]), (self, body, contentType) => setBody(self, HttpBody.uint8Array(body, contentType)));\n/**\n * Sets a text request body with an optional content type.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyText = /*#__PURE__*/dual(args => isHttpClientRequest(args[0]), (self, body, contentType) => setBody(self, HttpBody.text(body, contentType)));\n/**\n * Encodes a value as a JSON request body and sets it on the request, failing with `HttpBodyError` if encoding fails.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyJson = /*#__PURE__*/dual(2, (self, body) => Effect.map(HttpBody.json(body), body => setBody(self, body)));\n/**\n * Sets a JSON request body using unsafe JSON encoding.\n *\n * **When to use**\n *\n * Use when the request body is known to be JSON-serializable and a synchronous\n * `HttpClientRequest` result is needed.\n *\n * **Gotchas**\n *\n * JSON encoding may throw instead of failing in the Effect error channel.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyJsonUnsafe = /*#__PURE__*/dual(2, (self, body) => setBody(self, HttpBody.jsonUnsafe(body)));\n/**\n * Creates a schema-based JSON body encoder that sets the encoded value on a request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const schemaBodyJson = (schema, options) => {\n const encode = HttpBody.jsonSchema(schema, options);\n return dual(2, (self, body) => Effect.map(encode(body), body => setBody(self, body)));\n};\n/**\n * Sets an `application/x-www-form-urlencoded` request body from URL parameter input.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyUrlParams = /*#__PURE__*/dual(2, (self, input) => setBody(self, HttpBody.urlParams(UrlParams.fromInput(input))));\n/**\n * Sets a `FormData` request body.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyFormData = /*#__PURE__*/dual(2, (self, body) => setBody(self, HttpBody.formData(body)));\n/**\n * Creates a `FormData` request body from record-style entries and sets it on the request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyFormDataRecord = /*#__PURE__*/dual(2, (self, entries) => setBody(self, HttpBody.formDataRecord(entries)));\n/**\n * Sets a streaming `Uint8Array` request body with optional content type and content length metadata.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyStream = /*#__PURE__*/dual(args => isHttpClientRequest(args[0]), (self, body, options) => setBody(self, HttpBody.stream(body, options?.contentType, options?.contentLength)));\n/**\n * Creates a file-backed request body from a filesystem path and sets it on the request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyFile = /*#__PURE__*/dual(args => isHttpClientRequest(args[0]), (self, path, options) => Effect.map(HttpBody.file(path, options), body => setBody(self, body)));\n/**\n * Builds a `URL` from the request URL, query parameters, and hash, returning `Option.none()` if the URL is invalid.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport function toUrl(self) {\n const r = Url.make(self.url, self.urlParams, Option.getOrUndefined(self.hash));\n if (Result.isSuccess(r)) {\n return Option.some(r.success);\n }\n return Option.none();\n}\n/**\n * Converts a Web `Request` into an `HttpClientRequest`, preserving method, URL, headers, and supported request bodies.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromWeb = request => {\n const method = request.method.toUpperCase();\n return modify(empty, {\n method,\n url: new URL(request.url),\n headers: request.headers,\n body: fromWebBody(request, method)\n });\n};\nconst fromWebBody = (request, method) => {\n if (!hasBody(method) || request.body === null) {\n return HttpBody.empty;\n }\n return HttpBody.raw(request.body, {\n contentType: request.headers.get(\"content-type\") ?? undefined,\n contentLength: parseContentLength(request.headers.get(\"content-length\"))\n });\n};\nconst parseContentLength = contentLength => {\n if (contentLength === null) {\n return undefined;\n }\n const parsed = Number.parseInt(contentLength, 10);\n return Number.isNaN(parsed) ? undefined : parsed;\n};\n/**\n * Converts an `HttpClientRequest` safely to a Web `Request` as a `Result`, failing when the request URL is invalid.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebResult = (self, options) => {\n const url = Url.make(self.url, self.urlParams, Option.getOrUndefined(self.hash));\n if (Result.isFailure(url)) {\n return Result.fail(url.failure);\n }\n const requestInit = {\n method: self.method,\n headers: self.headers\n };\n if (options?.signal) {\n requestInit.signal = options.signal;\n }\n if (hasBody(self.method)) {\n switch (self.body._tag) {\n case \"Empty\":\n {\n break;\n }\n case \"Raw\":\n {\n requestInit.body = self.body.body;\n if (isReadableStream(self.body.body)) {\n ;\n requestInit.duplex = \"half\";\n }\n break;\n }\n case \"Uint8Array\":\n {\n requestInit.body = self.body.body;\n break;\n }\n case \"FormData\":\n {\n requestInit.body = self.body.formData;\n break;\n }\n case \"Stream\":\n {\n requestInit.body = Stream.toReadableStreamWith(self.body.stream, options?.context ?? Context.empty());\n requestInit.duplex = \"half\";\n break;\n }\n }\n }\n return Result.try({\n try: () => new Request(url.success, requestInit),\n catch: cause => new Url.UrlError({\n cause\n })\n });\n};\nconst isReadableStream = u => typeof ReadableStream !== \"undefined\" && u instanceof ReadableStream;\n/**\n * Converts an `HttpClientRequest` to a Web `Request`, failing with `UrlError` when the request URL is invalid.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWeb = (self, options) => Effect.contextWith(context => Effect.fromResult(toWebResult(self, {\n context: context,\n signal: options?.signal\n})));\n//# sourceMappingURL=HttpClientRequest.js.map","/**\n * Common model for incoming HTTP messages.\n *\n * `HttpIncomingMessage` is used by server requests and client responses to\n * expose headers, an optional remote address, and body accessors. This module\n * provides decoders for JSON bodies, URL-encoded bodies, and headers, plus the\n * shared body-size setting and inspection helper used by request and response\n * implementations.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport { redact } from \"../../Redactable.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as UrlParams from \"./UrlParams.js\";\n/**\n * Type identifier for `HttpIncomingMessage` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/http/HttpIncomingMessage\";\n/**\n * Returns `true` when a value is an `HttpIncomingMessage`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpIncomingMessage = u => hasProperty(u, TypeId);\n/**\n * Creates a decoder that reads an incoming message's JSON body and decodes it with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyJson = (schema, options) => {\n const decode = Schema.decodeEffect(Schema.toCodecJson(schema));\n return self => Effect.flatMap(self.json, u => decode(u, options));\n};\n/**\n * Creates a decoder that reads an incoming message's URL-encoded body parameters and decodes them with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyUrlParams = (schema, options) => {\n const decode = UrlParams.schemaRecord.pipe(Schema.decodeTo(schema), Schema.decodeEffect);\n return self => Effect.flatMap(self.urlParamsBody, u => decode(u, options));\n};\n/**\n * Creates a decoder that validates and decodes an incoming message's headers with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaHeaders = (schema, options) => {\n const decode = Schema.decodeUnknownEffect(schema);\n return self => decode(self.headers, options);\n};\n/**\n * Context reference for the optional maximum size allowed when reading an incoming message body.\n *\n * @category references\n * @since 4.0.0\n */\nexport const MaxBodySize = /*#__PURE__*/Context.Reference(\"effect/http/HttpIncomingMessage/MaxBodySize\", {\n defaultValue: () => undefined\n});\n/**\n * Builds an inspectable object for an incoming message, redacting headers and including a synchronously readable JSON or text body when available.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const inspect = (self, that) => {\n const contentType = self.headers[\"content-type\"] ?? \"\";\n let body;\n if (contentType.includes(\"application/json\")) {\n try {\n body = Effect.runSync(self.json);\n // oxlint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (_) {\n //\n }\n } else if (contentType.includes(\"text/\") || contentType.includes(\"urlencoded\")) {\n try {\n body = Effect.runSync(self.text);\n // oxlint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (_) {\n //\n }\n }\n const obj = {\n ...that,\n headers: redact(self.headers),\n remoteAddress: self.remoteAddress\n };\n if (body !== undefined) {\n obj.body = body;\n }\n return obj;\n};\n//# sourceMappingURL=HttpIncomingMessage.js.map","/**\n * Represents responses returned by the Effect HTTP client.\n *\n * An `HttpClientResponse` keeps the original request together with the response\n * status, headers, cookies, and body accessors from the shared incoming-message\n * model. This module includes constructors, schema-based decoders, helpers for\n * streaming response bodies, and utilities for matching or filtering by HTTP\n * status.\n *\n * @since 4.0.0\n */\nimport * as Effect from \"../../Effect.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Cookies from \"./Cookies.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as Error from \"./HttpClientError.js\";\nimport * as HttpIncomingMessage from \"./HttpIncomingMessage.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nexport {\n/**\n * Creates a decoder that reads a response JSON body and decodes it with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nschemaBodyJson,\n/**\n * Creates a decoder that reads response URL-encoded body parameters and decodes them with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nschemaBodyUrlParams,\n/**\n * Creates a decoder that validates and decodes response headers with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nschemaHeaders } from \"./HttpIncomingMessage.js\";\n/**\n * Type identifier for `HttpClientResponse` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/http/HttpClientResponse\";\n/**\n * Wraps a Web `Response` and its original `HttpClientRequest` as an `HttpClientResponse`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromWeb = (request, source) => new WebHttpClientResponse(request, source);\n/**\n * Creates a decoder for a response's status, headers, and JSON body using the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaJson = (schema, options) => {\n const decode = Schema.decodeEffect(Schema.toCodecJson(schema).annotate({\n options\n }));\n return self => Effect.flatMap(self.json, body => decode({\n status: self.status,\n headers: self.headers,\n body\n }));\n};\n/**\n * Creates a decoder for a response's status and headers without reading a response body.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaNoBody = (schema, options) => {\n const decode = Schema.decodeEffect(schema.annotate({\n options\n }));\n return self => decode({\n status: self.status,\n headers: self.headers\n });\n};\n/**\n * Converts an effect producing an `HttpClientResponse` into a stream of response body bytes.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const stream = effect => Stream.unwrap(Effect.map(effect, self => self.stream));\n/**\n * Pattern matches on a response status, checking exact status handlers before status-class handlers and `orElse`.\n *\n * @category pattern matching\n * @since 4.0.0\n */\nexport const matchStatus = /*#__PURE__*/dual(2, (self, cases) => {\n const status = self.status;\n if (cases[status]) {\n return cases[status](self);\n } else if (status >= 200 && status < 300 && cases[\"2xx\"]) {\n return cases[\"2xx\"](self);\n } else if (status >= 300 && status < 400 && cases[\"3xx\"]) {\n return cases[\"3xx\"](self);\n } else if (status >= 400 && status < 500 && cases[\"4xx\"]) {\n return cases[\"4xx\"](self);\n } else if (status >= 500 && status < 600 && cases[\"5xx\"]) {\n return cases[\"5xx\"](self);\n }\n return cases.orElse(self);\n});\n/**\n * Succeeds with the response when its status satisfies the predicate, otherwise fails with `HttpClientError`.\n *\n * @category filtering\n * @since 4.0.0\n */\nexport const filterStatus = /*#__PURE__*/dual(2, (self, f) => Effect.suspend(() => f(self.status) ? Effect.succeed(self) : Effect.fail(new Error.HttpClientError({\n reason: new Error.StatusCodeError({\n response: self,\n request: self.request,\n description: \"invalid status code\"\n })\n}))));\n/**\n * Succeeds with the response only when its status is in the 2xx range, otherwise fails with `HttpClientError`.\n *\n * @category filtering\n * @since 4.0.0\n */\nexport const filterStatusOk = self => self.status >= 200 && self.status < 300 ? Effect.succeed(self) : Effect.fail(new Error.HttpClientError({\n reason: new Error.StatusCodeError({\n response: self,\n request: self.request,\n description: \"non 2xx status code\"\n })\n}));\n// -----------------------------------------------------------------------------\n// internal\n// -----------------------------------------------------------------------------\nclass WebHttpClientResponse extends Inspectable.Class {\n [HttpIncomingMessage.TypeId];\n [TypeId];\n request;\n source;\n constructor(request, source) {\n super();\n this.request = request;\n this.source = source;\n this[HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n this[TypeId] = TypeId;\n }\n toJSON() {\n return HttpIncomingMessage.inspect(this, {\n _id: \"HttpClientResponse\",\n request: this.request.toJSON(),\n status: this.status\n });\n }\n get status() {\n return this.source.status;\n }\n get headers() {\n return Headers.fromInput(this.source.headers);\n }\n cachedCookies;\n get cookies() {\n if (this.cachedCookies) {\n return this.cachedCookies;\n }\n return this.cachedCookies = Cookies.fromSetCookie(this.source.headers.getSetCookie());\n }\n get remoteAddress() {\n return Option.none();\n }\n get stream() {\n return this.source.body ? Stream.fromReadableStream({\n evaluate: () => this.source.body,\n onError: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }) : Stream.fail(new Error.HttpClientError({\n reason: new Error.EmptyBodyError({\n request: this.request,\n response: this,\n description: \"can not create stream from empty body\"\n })\n }));\n }\n get json() {\n return Effect.flatMap(this.text, text => Effect.try({\n try: () => text === \"\" ? null : JSON.parse(text),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }));\n }\n textBody;\n get text() {\n if (this.textBody) {\n return this.textBody;\n }\n this.textBody = Effect.tryPromise({\n try: () => this.source.text(),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }).pipe(Effect.cached, Effect.runSync);\n this.arrayBufferBody = Effect.map(this.textBody, _ => new TextEncoder().encode(_).buffer);\n return this.textBody;\n }\n get urlParamsBody() {\n return Effect.flatMap(this.text, _ => Effect.try({\n try: () => UrlParams.fromInput(new URLSearchParams(_)),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }));\n }\n formDataBody;\n get formData() {\n return this.formDataBody ??= Effect.tryPromise({\n try: () => this.source.formData(),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }).pipe(Effect.cached, Effect.runSync);\n }\n arrayBufferBody;\n get arrayBuffer() {\n if (this.arrayBufferBody) {\n return this.arrayBufferBody;\n }\n this.arrayBufferBody = Effect.tryPromise({\n try: () => this.source.arrayBuffer(),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }).pipe(Effect.cached, Effect.runSync);\n this.textBody = Effect.map(this.arrayBufferBody, _ => new TextDecoder().decode(_));\n return this.arrayBufferBody;\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n}\n//# sourceMappingURL=HttpClientResponse.js.map","/**\n * Describes immutable responses returned by Effect HTTP handlers.\n *\n * An `HttpServerResponse` stores the status, optional status text, headers,\n * cookies, and body that the server runtime later turns into a platform\n * response such as a Web `Response`. This module includes constructors for\n * common response bodies, helpers for updating response data, file response\n * support through `HttpPlatform`, and conversions to or from Web and Effect\n * HTTP client responses.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as ErrorReporter from \"../../ErrorReporter.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport { PipeInspectableProto } from \"../../internal/core.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport { redact } from \"../../Redactable.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Cookies from \"./Cookies.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as Body from \"./HttpBody.js\";\nimport * as HttpClientError from \"./HttpClientError.js\";\nimport * as HttpClientRequest from \"./HttpClientRequest.js\";\nimport * as HttpClientResponse from \"./HttpClientResponse.js\";\nimport * as HttpIncomingMessage from \"./HttpIncomingMessage.js\";\nimport * as Template from \"./Template.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nconst TypeId = \"~effect/http/HttpServerResponse\";\n/**\n * Returns `true` when the supplied value is an `HttpServerResponse`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpServerResponse = u => hasProperty(u, TypeId);\n/**\n * Creates an empty HTTP response.\n *\n * **Details**\n *\n * The default status is `204`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = options => makeResponse({\n status: options?.status ?? 204,\n statusText: options?.statusText,\n headers: options?.headers ? Headers.fromInput(options.headers) : undefined,\n cookies: options?.cookies\n});\n/**\n * Creates a redirect response with a `Location` header.\n *\n * **Details**\n *\n * The default status is `302`; custom headers are merged with the generated\n * `Location` header.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const redirect = (location, options) => {\n const headers = Headers.fromRecordUnsafe({\n location: location.toString()\n });\n return makeResponse({\n status: options?.status ?? 302,\n statusText: options?.statusText,\n headers: options?.headers ? Headers.merge(headers, Headers.fromInput(options.headers)) : headers,\n cookies: options?.cookies ?? Cookies.empty\n });\n};\n/**\n * Creates an HTTP response whose body is a `Uint8Array`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const uint8Array = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies ?? Cookies.empty,\n body: Body.uint8Array(body, getContentType(options, headers))\n });\n};\nconst getContentType = (options, headers) => {\n if (options?.contentType) {\n return options.contentType;\n } else if (options?.headers) {\n return headers[\"content-type\"];\n }\n};\n/**\n * Creates an HTTP response whose body is a string.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const text = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies ?? Cookies.empty,\n body: Body.text(body, getContentType(options, headers))\n });\n};\n/**\n * Creates an HTML response with the `text/html` content type.\n *\n * **Details**\n *\n * Passing a string returns a response directly. Using it as a template tag returns\n * an effect so interpolated values can be rendered with their required services\n * and errors.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const html = (strings, ...args) => {\n if (typeof strings === \"string\") {\n return text(strings, {\n contentType: \"text/html\"\n });\n }\n return Effect.map(Template.make(strings, ...args), _ => text(_, {\n contentType: \"text/html\"\n }));\n};\n/**\n * Creates a streaming HTML response from a template.\n *\n * **Details**\n *\n * The template is encoded as a byte stream and can use streaming interpolated\n * values from the current context.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const htmlStream = (strings, ...args) => Effect.map(Effect.context(), context => stream(Stream.provideContext(Stream.encodeText(Template.stream(strings, ...args)), context), {\n contentType: \"text/html\"\n}));\n/**\n * Creates a JSON HTTP response.\n *\n * **Details**\n *\n * The body is serialized with `JSON.stringify`; serialization errors are captured\n * as `HttpBodyError` failures.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const json = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return Effect.map(Body.json(body, getContentType(options, headers)), body => makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body\n }));\n};\n/**\n * Creates a JSON response constructor backed by a schema encoder.\n *\n * **Details**\n *\n * The returned function encodes the value with the supplied schema before\n * serializing it as JSON, and can fail with `HttpBodyError` if schema encoding or\n * JSON serialization fails.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const schemaJson = (schema, options) => {\n const encode = Body.jsonSchema(schema, options);\n return (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return Effect.map(encode(body, getContentType(options, headers)), body => makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body\n }));\n };\n};\n/**\n * Creates a JSON HTTP response synchronously.\n *\n * **When to use**\n *\n * Use when the response body is known to be JSON-serializable and you need a\n * synchronous `HttpServerResponse`.\n *\n * **Gotchas**\n *\n * Unlike `json`, serialization errors from `JSON.stringify` are not captured in\n * `Effect`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const jsonUnsafe = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body: Body.jsonUnsafe(body, getContentType(options, headers))\n });\n};\n/**\n * Creates a response from URL parameters using the\n * `application/x-www-form-urlencoded` content type by default.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const urlParams = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body: Body.text(UrlParams.toString(UrlParams.fromInput(body)), getContentType(options, headers) ?? \"application/x-www-form-urlencoded\")\n });\n};\n/**\n * Creates a response with a raw body value.\n *\n * **When to use**\n *\n * Use when you want to pass through a body value already understood by the\n * underlying runtime, such as a Web `Response`, `Blob`, or `ReadableStream`,\n * for later platform conversion.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const raw = (body, options) => makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers: options?.headers && Headers.fromInput(options.headers),\n cookies: options?.cookies,\n body: Body.raw(body, {\n contentType: options?.contentType,\n contentLength: options?.contentLength\n })\n});\n/**\n * Creates a response whose body is a Web `FormData` value.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const formData = (body, options) => makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers: options?.headers && Headers.fromInput(options.headers),\n cookies: options?.cookies,\n body: Body.formData(body)\n});\n/**\n * Creates a streaming response from a stream of byte chunks.\n *\n * **Details**\n *\n * Optional response metadata can supply the status, headers, content type, and\n * content length.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const stream = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body: Body.stream(body, getContentType(options, headers), options?.contentLength)\n });\n};\nconst HttpPlatformKey = /*#__PURE__*/Context.Service(\"effect/http/HttpPlatform\");\n/**\n * Creates a streamed file response for a file system path.\n *\n * **Details**\n *\n * The effect requires `HttpPlatform`, can fail with a platform error, and supports\n * options for status, headers, offset, and byte range.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const file = (path, options) => Effect.flatMap(HttpPlatformKey, platform => platform.fileResponse(path, options));\n/**\n * Creates a streamed file response for a Web `File`-like value.\n *\n * **Details**\n *\n * The effect requires `HttpPlatform` and supports options for status, headers,\n * offset, and byte range.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileWeb = (file, options) => Effect.flatMap(HttpPlatformKey, platform => platform.fileWebResponse(file, options));\n/**\n * Returns a response with the specified header set to the supplied value.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHeader = /*#__PURE__*/dual(3, (self, key, value) => makeResponse({\n ...self,\n headers: Headers.set(self.headers, key, value)\n}));\n/**\n * Returns a response with the specified header removed.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const removeHeader = /*#__PURE__*/dual(2, (self, key) => makeResponse({\n ...self,\n headers: Headers.remove(self.headers, key)\n}));\n/**\n * Returns a response with all supplied headers set on the existing header map.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHeaders = /*#__PURE__*/dual(2, (self, input) => makeResponse({\n ...self,\n headers: Headers.setAll(self.headers, input)\n}));\n/**\n * Returns a response with the cookie of the specified name removed.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const removeCookie = /*#__PURE__*/dual(2, (self, name) => makeResponse({\n ...self,\n cookies: Cookies.remove(self.cookies, name)\n}));\n/**\n * Returns a response with its cookie collection replaced by the supplied cookies.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const replaceCookies = /*#__PURE__*/dual(2, (self, cookies) => makeResponse({\n ...self,\n cookies\n}));\n/**\n * Sets a cookie on the response.\n *\n * **Details**\n *\n * The effect fails with `CookiesError` if the cookie name, value, or options are\n * invalid.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookie = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, name, value, options) => Effect.map(Effect.fromResult(Cookies.set(self.cookies, name, value, options)), cookies => makeResponse({\n ...self,\n cookies\n})));\n/**\n * Sets an expired cookie on an `HttpServerResponse`.\n *\n * **Details**\n *\n * Returns an effect because cookie encoding can fail. The original response is not\n * mutated; the effect succeeds with a response containing the updated cookie set.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const expireCookie = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, name, options) => Effect.map(Effect.fromResult(Cookies.expireCookie(self.cookies, name, options)), cookies => makeResponse({\n ...self,\n cookies\n})));\n/**\n * Sets a cookie on an `HttpServerResponse`, throwing if the cookie cannot be\n * encoded.\n *\n * **When to use**\n *\n * Use when you need to set one trusted cookie and want encoding failures to\n * throw instead of being represented as `CookiesError` failures.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookieUnsafe = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, name, value, options) => makeResponse({\n ...self,\n cookies: Cookies.setUnsafe(self.cookies, name, value, options)\n}));\n/**\n * Sets an expired cookie on an `HttpServerResponse`, throwing if the expiration cookie\n * cannot be encoded.\n *\n * **When to use**\n *\n * Use when you need to expire one trusted cookie and want encoding failures to\n * throw instead of being represented as `CookiesError` failures.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const expireCookieUnsafe = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, name, options) => makeResponse({\n ...self,\n cookies: Cookies.expireCookieUnsafe(self.cookies, name, options)\n}));\n/**\n * Updates the cookies attached to an `HttpServerResponse` using the supplied\n * function.\n *\n * **Details**\n *\n * The original response is not mutated; a new response is returned with the\n * callback result as its cookie collection.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const updateCookies = /*#__PURE__*/dual(2, (self, f) => makeResponse({\n ...self,\n cookies: f(self.cookies)\n}));\n/**\n * Merges additional cookies into the cookies attached to an\n * `HttpServerResponse`.\n *\n * **Details**\n *\n * The original response is not mutated; a new response is returned with the merged\n * cookie collection.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const mergeCookies = /*#__PURE__*/dual(2, (self, cookies) => makeResponse({\n ...self,\n cookies: Cookies.merge(self.cookies, cookies)\n}));\n/**\n * Sets multiple cookies on an `HttpServerResponse`.\n *\n * **Details**\n *\n * Each input entry contains a cookie name, value, and optional cookie options. The\n * returned effect fails with `CookiesError` if any cookie cannot be encoded.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookies = /*#__PURE__*/dual(2, (self, cookies) => Effect.map(Effect.fromResult(Cookies.setAll(self.cookies, cookies)), cookies => makeResponse({\n ...self,\n cookies\n})));\n/**\n * Sets multiple cookies on an `HttpServerResponse`, throwing if any cookie cannot\n * be encoded.\n *\n * **When to use**\n *\n * Use when you need to set multiple trusted cookies and want encoding failures\n * to throw instead of being represented as `CookiesError` failures.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookiesUnsafe = /*#__PURE__*/dual(2, (self, cookies) => makeResponse({\n ...self,\n cookies: Cookies.setAllUnsafe(self.cookies, cookies)\n}));\n/**\n * Replaces the body of an `HttpServerResponse`.\n *\n * **Details**\n *\n * When the body carries a content type or content length, the returned response\n * includes the corresponding headers.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setBody = /*#__PURE__*/dual(2, (self, body) => makeResponse({\n ...self,\n body\n}));\n/**\n * Sets the HTTP status code of an `HttpServerResponse`.\n *\n * **Details**\n *\n * When `statusText` is omitted, the existing status text is preserved.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setStatus = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, status, statusText) => makeResponse({\n ...self,\n status,\n statusText: statusText ?? self.statusText\n}));\n/**\n * Converts an `HttpServerResponse` to a Web `Response`.\n *\n * **Details**\n *\n * Cookies are appended as `Set-Cookie` headers. Stream bodies are converted using\n * the supplied context, and `withoutBody` can be used for responses such as HEAD\n * responses.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWeb = (response, options) => {\n const headers = new globalThis.Headers(response.headers);\n if (!Cookies.isEmpty(response.cookies)) {\n const toAdd = Cookies.toSetCookieHeaders(response.cookies);\n for (const header of toAdd) {\n headers.append(\"set-cookie\", header);\n }\n }\n if (options?.withoutBody) {\n return new Response(undefined, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n const body = response.body;\n switch (body._tag) {\n case \"Empty\":\n {\n return new Response(undefined, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n case \"Uint8Array\":\n case \"Raw\":\n {\n if (body.body instanceof Response) {\n for (const [key, value] of headers) {\n body.body.headers.set(key, value);\n }\n return body.body;\n }\n return new Response(body.body, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n case \"FormData\":\n {\n return new Response(body.formData, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n case \"Stream\":\n {\n return new Response(Stream.toReadableStreamWith(body.stream, options?.context ?? Context.empty()), {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n }\n};\n/**\n * Wraps an `HttpServerResponse` as an `HttpClientResponse`.\n *\n * **Details**\n *\n * An optional request can be supplied for client-response metadata and decode\n * errors.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toClientResponse = (response, options) => new ServerHttpClientResponse(options?.request ?? HttpClientRequest.empty, response);\nclass ServerHttpClientResponse extends Inspectable.Class {\n [HttpIncomingMessage.TypeId];\n [HttpClientResponse.TypeId];\n request;\n response;\n constructor(request, response) {\n super();\n this.request = request;\n this.response = response;\n this[HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n this[HttpClientResponse.TypeId] = HttpClientResponse.TypeId;\n }\n toJSON() {\n return HttpIncomingMessage.inspect(this, {\n _id: \"HttpClientResponse\",\n request: this.request.toJSON(),\n status: this.status\n });\n }\n get status() {\n return this.response.status;\n }\n cachedHeaders;\n get headers() {\n return this.cachedHeaders ??= this.response.body._tag === \"FormData\" ? Headers.merge(this.response.headers, Headers.fromInput(this.getFormDataResponse().headers)) : this.response.headers;\n }\n get cookies() {\n return this.response.cookies;\n }\n get remoteAddress() {\n return Option.none();\n }\n get stream() {\n const body = this.response.body;\n switch (body._tag) {\n case \"Empty\":\n {\n return Stream.empty;\n }\n case \"Stream\":\n {\n return Stream.mapError(body.stream, cause => this.decodeError(cause));\n }\n case \"Uint8Array\":\n {\n return Stream.succeed(body.body);\n }\n case \"Raw\":\n {\n const rawBody = body.body;\n if (rawBody instanceof Response) {\n return rawBody.body ? Stream.fromReadableStream({\n evaluate: () => rawBody.body,\n onError: cause => this.decodeError(cause)\n }) : Stream.empty;\n }\n if (isReadableStream(rawBody)) {\n return Stream.fromReadableStream({\n evaluate: () => rawBody,\n onError: cause => this.decodeError(cause)\n });\n }\n if (rawBody instanceof Blob) {\n return Stream.fromReadableStream({\n evaluate: () => rawBody.stream(),\n onError: cause => this.decodeError(cause)\n });\n }\n return Stream.unwrap(Effect.map(this.bytes, Stream.succeed));\n }\n case \"FormData\":\n {\n const response = this.getFormDataResponse();\n return Stream.fromReadableStream({\n evaluate: () => response.body,\n onError: cause => this.decodeError(cause)\n });\n }\n }\n }\n get json() {\n return Effect.flatMap(this.text, text => Effect.try({\n try: () => text === \"\" ? null : JSON.parse(text),\n catch: cause => new HttpClientError.HttpClientError({\n reason: new HttpClientError.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }));\n }\n get bytes() {\n const body = this.response.body;\n switch (body._tag) {\n case \"Empty\":\n {\n return Effect.succeed(new Uint8Array(0));\n }\n case \"Uint8Array\":\n {\n return Effect.succeed(body.body);\n }\n case \"Stream\":\n {\n return Stream.mkUint8Array(this.stream);\n }\n case \"Raw\":\n {\n const rawBody = body.body;\n if (rawBody instanceof Response) {\n return Effect.tryPromise({\n try: () => rawBody.arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => this.decodeError(cause)\n });\n }\n return Effect.tryPromise({\n try: () => new Response(rawBody).arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => this.decodeError(cause)\n });\n }\n case \"FormData\":\n {\n return Effect.tryPromise({\n try: () => new Response(body.formData).arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => this.decodeError(cause)\n });\n }\n }\n }\n get text() {\n return Effect.map(this.bytes, bytes => textDecoder.decode(bytes));\n }\n get urlParamsBody() {\n return Effect.flatMap(this.text, _ => Effect.try({\n try: () => UrlParams.fromInput(new URLSearchParams(_)),\n catch: cause => new HttpClientError.HttpClientError({\n reason: new HttpClientError.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }));\n }\n get formData() {\n const body = this.response.body;\n if (body._tag === \"FormData\") {\n return Effect.succeed(body.formData);\n }\n return Effect.contextWith(context => {\n const readableStream = Stream.toReadableStreamWith(this.stream, context);\n return Effect.tryPromise({\n try: () => new Response(readableStream, {\n headers: this.headers\n }).formData(),\n catch: cause => this.decodeError(cause)\n });\n });\n }\n get arrayBuffer() {\n return Effect.map(this.bytes, bytes => bytes.slice().buffer);\n }\n decodeError(cause) {\n return new HttpClientError.HttpClientError({\n reason: new HttpClientError.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n });\n }\n formDataResponse;\n getFormDataResponse() {\n return this.formDataResponse ??= new Response(this.response.body.formData);\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n}\nconst textDecoder = /*#__PURE__*/new TextDecoder();\n/**\n * Converts an `HttpClientResponse` to an `HttpServerResponse`.\n *\n * **Details**\n *\n * The response body is streamed from the client response. `Set-Cookie` headers are\n * removed from the header map and represented in the response cookie collection.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromClientResponse = response => {\n const headers = Headers.remove(response.headers, \"set-cookie\");\n return makeResponse({\n status: response.status,\n headers,\n cookies: response.cookies,\n body: Body.stream(Stream.catchIf(response.stream, isEmptyBodyError, () => Stream.empty), Option.getOrUndefined(Headers.get(headers, \"content-type\")), getContentLength(headers))\n });\n};\nconst isReadableStream = u => typeof ReadableStream !== \"undefined\" && u instanceof ReadableStream;\nconst isEmptyBodyError = error => HttpClientError.isHttpClientError(error) && error.reason._tag === \"EmptyBodyError\";\nconst getContentLength = headers => {\n const contentLength = Option.getOrUndefined(Headers.get(headers, \"content-length\"));\n if (contentLength === undefined) {\n return undefined;\n }\n const parsed = Number(contentLength);\n return Number.isFinite(parsed) && parsed >= 0 ? parsed : undefined;\n};\nconst Proto = {\n ...PipeInspectableProto,\n [TypeId]: TypeId,\n [ErrorReporter.ignore]: true,\n toJSON() {\n return {\n _id: \"HttpServerResponse\",\n status: this.status,\n statusText: this.statusText,\n headers: redact(this.headers),\n cookies: this.cookies.toJSON(),\n body: this.body.toJSON()\n };\n }\n};\nconst makeResponse = options => {\n const self = Object.create(Proto);\n self.status = options.status;\n self.statusText = options.statusText;\n self.cookies = options.cookies ?? Cookies.empty;\n self.body = options.body ?? Body.empty;\n if (self.body._tag !== \"Empty\" && (self.body.contentType || self.body.contentLength)) {\n const newHeaders = Headers.fromRecordUnsafe({\n ...options.headers\n });\n if (self.body.contentType) {\n newHeaders[\"content-type\"] = self.body.contentType;\n }\n if (self.body.contentLength) {\n newHeaders[\"content-length\"] = self.body.contentLength.toString();\n }\n self.headers = newHeaders;\n } else {\n self.headers = options.headers ?? Headers.empty;\n }\n return self;\n};\n/**\n * Converts a Web `Response` to an `HttpServerResponse`.\n *\n * **Details**\n *\n * `Set-Cookie` headers are parsed into the response cookie collection and removed\n * from the header map. A present Web body is exposed as a stream body.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromWeb = response => {\n const headers = new globalThis.Headers(response.headers);\n const setCookieHeaders = headers.getSetCookie();\n headers.delete(\"set-cookie\");\n let self = empty({\n status: response.status,\n statusText: response.statusText,\n headers: headers,\n cookies: Cookies.fromSetCookie(setCookieHeaders)\n });\n if (response.body) {\n const contentType = response.headers.get(\"content-type\");\n self = setBody(self, Body.stream(Stream.fromReadableStream({\n evaluate: () => response.body,\n onError: e => e\n }), contentType ?? undefined));\n }\n return self;\n};\n//# sourceMappingURL=HttpServerResponse.js.map","import * as Effect from \"../../../Effect.js\";\nimport { identity } from \"../../../Function.js\";\nimport * as Stream from \"../../../Stream.js\";\nimport * as HttpBody from \"../HttpBody.js\";\nimport * as Response from \"../HttpServerResponse.js\";\n/** @internal */\nexport const varyAcceptEncoding = headers => {\n const vary = headers[\"vary\"];\n if (vary === undefined) {\n return \"Accept-Encoding\";\n }\n const members = vary.split(\",\").map(member => member.trim().toLowerCase());\n return members.includes(\"*\") || members.includes(\"accept-encoding\") ? undefined : `${vary}, Accept-Encoding`;\n};\n/** @internal */\nexport const wrapCompression = impl => ({\n algorithms: impl.algorithms,\n compressResponse(response, algorithm, options) {\n return Effect.map(impl.compressResponse(response, algorithm, options), compressed => {\n if (compressed === response) {\n return response;\n }\n const headers = {\n \"content-encoding\": algorithm\n };\n const vary = varyAcceptEncoding(compressed.headers);\n if (vary !== undefined) {\n headers[\"vary\"] = vary;\n }\n const etag = compressed.headers[\"etag\"];\n if (etag !== undefined && !etag.startsWith(\"W/\")) {\n headers[\"etag\"] = `W/${etag}`;\n }\n return Response.setHeaders(compressed, headers);\n });\n }\n});\n/** @internal */\nexport const compressionTransformWeb = format => stream => stream.pipeThrough(new CompressionStream(format));\n/** @internal */\nexport const setBodyWithoutLength = (response, body) => Response.removeHeader(Response.setBody(response, body), \"content-length\");\n/** @internal */\nexport const makeCompressionWeb = options => ({\n algorithms: new Set(options.algorithms),\n compressResponse(response, algorithm, opts) {\n const body = response.body;\n switch (body._tag) {\n case \"Uint8Array\":\n {\n const data = body.body;\n return Effect.succeed(streamBody(response, () => options.transform(algorithm, opts)(singleChunkStream(data)), body.contentType));\n }\n case \"Stream\":\n {\n const stream = body.stream;\n return Effect.succeed(streamBody(response, () => options.transform(algorithm, opts)(Stream.toReadableStream(stream)), body.contentType));\n }\n case \"Raw\":\n {\n const readable = rawReadableStream(body.body);\n if (readable === undefined) {\n return Effect.succeed(response);\n }\n return Effect.succeed(setBodyWithoutLength(response, HttpBody.raw(options.transform(algorithm, opts)(readable), {\n contentType: body.contentType\n })));\n }\n default:\n {\n return Effect.succeed(response);\n }\n }\n }\n});\nconst streamBody = (response, evaluate, contentType) => setBodyWithoutLength(response, HttpBody.stream(Stream.fromReadableStream({\n evaluate,\n onError: identity\n}), contentType));\nconst singleChunkStream = data => new ReadableStream({\n start(controller) {\n controller.enqueue(data);\n controller.close();\n }\n});\nconst rawReadableStream = raw => {\n if (typeof ReadableStream !== \"undefined\" && raw instanceof ReadableStream) {\n return raw;\n } else if (raw instanceof globalThis.Response) {\n return raw.body ?? undefined;\n }\n return new globalThis.Response(raw).body ?? undefined;\n};\n/** @internal */\nexport const compressionWeb = /*#__PURE__*/makeCompressionWeb({\n algorithms: [\"gzip\", \"deflate\"],\n transform: algorithm => compressionTransformWeb(algorithm)\n});\n/** @internal */\nexport const defaultCompressible = contentType => {\n const semi = contentType.indexOf(\";\");\n const type = (semi === -1 ? contentType : contentType.slice(0, semi)).trim().toLowerCase();\n if (type.startsWith(\"text/\")) {\n return true;\n }\n switch (type) {\n case \"application/json\":\n case \"application/javascript\":\n case \"application/xml\":\n case \"image/svg+xml\":\n case \"application/wasm\":\n {\n return true;\n }\n }\n return type.endsWith(\"+json\") || type.endsWith(\"+xml\");\n};\nconst acceptMember = /^([a-z0-9!#$%&'*+.^_`|~-]+)(?:;q=(0(?:\\.[0-9]{0,3})?|1(?:\\.0{0,3})?))?$/;\n/** @internal */\nexport const parseAcceptEncoding = header => {\n const trimmed = header.trim();\n if (trimmed === \"\") {\n return undefined;\n }\n const accepted = new Map();\n for (const part of trimmed.split(\",\")) {\n const member = part.trim().toLowerCase().replace(/[ \\t]*;[ \\t]*/g, \";\");\n const match = acceptMember.exec(member);\n if (match === null) {\n return undefined;\n }\n accepted.set(match[1], match[2] === undefined ? 1 : Number(match[2]));\n }\n return accepted;\n};\n/** @internal */\nexport const negotiate = (header, preferred, supported) => {\n if (header === undefined) {\n return undefined;\n }\n const accepted = parseAcceptEncoding(header);\n if (accepted === undefined) {\n return undefined;\n }\n for (const algorithm of preferred) {\n if (!supported.has(algorithm)) {\n continue;\n }\n const quality = accepted.get(algorithm) ?? accepted.get(\"*\");\n if (quality !== undefined && quality > 0) {\n return algorithm;\n }\n }\n return undefined;\n};\n//# sourceMappingURL=compression.js.map","/**\n * Platform-specific support for serving files as HTTP server responses.\n *\n * `HttpPlatform` is the boundary between the portable HTTP response model and\n * the runtime that knows how to stream bytes from the host platform. Server\n * code uses this service when it needs to return local files, static assets,\n * downloads, byte ranges, or Web `File`-like values without constructing the\n * response body by hand.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as FileSystem from \"../../FileSystem.js\";\nimport { identity } from \"../../Function.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Etag from \"./Etag.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as Response from \"./HttpServerResponse.js\";\nimport * as internal from \"./internal/compression.js\";\n/**\n * Service for platform-specific HTTP response helpers, including file-backed server responses.\n *\n * @category services\n * @since 4.0.0\n */\nexport class HttpPlatform extends /*#__PURE__*/Context.Service()(\"effect/http/HttpPlatform\") {}\n/**\n * Creates an `HttpPlatform` service from platform-specific file response constructors, using `FileSystem` and `Etag.Generator`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = /*#__PURE__*/Effect.fnUntraced(function* (impl) {\n const fs = yield* FileSystem.FileSystem;\n const etagGen = yield* Etag.Generator;\n return HttpPlatform.of({\n platform: impl.platform,\n compression: internal.wrapCompression(impl.compression),\n fileResponse: Effect.fnUntraced(function* (path, options) {\n const info = yield* fs.stat(path);\n const etag = yield* etagGen.fromFileInfo(info);\n const start = Number(options?.offset ?? 0);\n const end = options?.bytesToRead !== undefined ? start + Number(options.bytesToRead) : undefined;\n const headers = Headers.set(options?.headers ? Headers.fromInput(options.headers) : Headers.empty, \"etag\", Etag.toString(etag));\n if (Option.isSome(info.mtime)) {\n ;\n headers[\"last-modified\"] = info.mtime.value.toUTCString();\n }\n const contentLength = end !== undefined ? end - start : Number(info.size) - start;\n return impl.fileResponse(path, options?.status ?? 200, options?.statusText, headers, start, end, contentLength);\n }),\n fileWebResponse(file, options) {\n return Effect.map(etagGen.fromFileWeb(file), etag => {\n const headers = Headers.merge(options?.headers ? Headers.fromInput(options.headers) : Headers.empty, Headers.fromRecordUnsafe({\n etag: Etag.toString(etag),\n \"last-modified\": new Date(file.lastModified).toUTCString()\n }));\n return impl.fileWebResponse(file, options?.status ?? 200, options?.statusText, headers, options);\n });\n }\n });\n});\n/**\n * Provides the default `HttpPlatform` implementation for serving file paths and\n * `File`-like values as streamed HTTP responses.\n *\n * **Details**\n *\n * The layer uses the `FileSystem` and weak ETag services to add file metadata\n * headers such as `etag` and `last-modified`.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.effect(HttpPlatform)(Effect.flatMap(FileSystem.FileSystem, fs => make({\n platform: \"web\",\n compression: internal.compressionWeb,\n fileResponse(path, status, statusText, headers, start, end, contentLength) {\n return Response.stream(fs.stream(path, {\n offset: start,\n bytesToRead: end !== undefined ? end - start : undefined\n }), {\n contentLength,\n headers,\n status,\n statusText\n });\n },\n fileWebResponse(file, status, statusText, headers, _options) {\n return Response.stream(Stream.fromReadableStream({\n evaluate: () => file.stream(),\n onError: identity\n }), {\n headers,\n status,\n statusText\n });\n }\n}))).pipe(/*#__PURE__*/Layer.provide(Etag.layerWeak));\n/**\n * Creates a compression body transform backed by the Web `CompressionStream`\n * API, for use with `makeCompressionWeb`.\n *\n * **Details**\n *\n * The format string is passed through to the runtime, so runtime-specific\n * formats such as Bun's `\"brotli\"` and `\"zstd\"` are usable. `CompressionStream`\n * has no compression level knob, so `CompressionOptions.level` does not apply.\n *\n * @category compression\n * @since 4.0.0\n */\nexport const compressionTransformWeb = internal.compressionTransformWeb;\n/**\n * Creates a `Compression` implementation from Web `ReadableStream`\n * transforms.\n *\n * **Details**\n *\n * All supported bodies are transformed as streams. The `Content-Length`\n * header is dropped in every case.\n *\n * @category compression\n * @since 4.0.0\n */\nexport const makeCompressionWeb = internal.makeCompressionWeb;\n//# sourceMappingURL=HttpPlatform.js.map","/**\n * Converts supported values into HTTP server responses.\n *\n * Server-side errors and helper values can implement `Respondable` when they\n * know which status, headers, cookies, or body should be sent to the client.\n * This module detects those values and converts them to `HttpServerResponse`\n * values, with fallback handling for schema errors and missing values.\n *\n * @since 4.0.0\n */\nimport * as Cause from \"../../Cause.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Response from \"./HttpServerResponse.js\";\n/**\n * Protocol key used by values that can render themselves as\n * `HttpServerResponse` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const symbol = \"~effect/http/HttpServerRespondable\";\n/**\n * Returns `true` when the supplied value implements the `Respondable` protocol.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isRespondable = u => hasProperty(u, symbol);\nconst badRequest = /*#__PURE__*/Response.empty({\n status: 400\n});\nconst notFound = /*#__PURE__*/Response.empty({\n status: 404\n});\n/**\n * Converts a `Respondable` value into an `HttpServerResponse`.\n *\n * **Details**\n *\n * If the value is already an HTTP server response it is returned directly; errors\n * from the response conversion are converted to defects.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const toResponse = self => {\n if (Response.isHttpServerResponse(self)) {\n return Effect.succeed(self);\n }\n return Effect.orDie(self[symbol]());\n};\n/**\n * Attempts to convert an unknown value into an `HttpServerResponse`, falling back\n * to the supplied response when no conversion is available.\n *\n * **Details**\n *\n * `HttpServerResponse` and `Respondable` values are used directly, schema errors\n * become `400` responses, and no-such-element errors become `404` responses.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const toResponseOrElse = (u, orElse) => {\n if (Response.isHttpServerResponse(u)) {\n return Effect.succeed(u);\n } else if (isRespondable(u)) {\n return Effect.catchCause(u[symbol](), () => Effect.succeed(orElse));\n // add support for some commmon types\n } else if (Schema.isSchemaError(u)) {\n return Effect.succeed(badRequest);\n } else if (Cause.isNoSuchElementError(u)) {\n return Effect.succeed(notFound);\n }\n return Effect.succeed(orElse);\n};\n/**\n * Attempts to convert an unknown defect into an `HttpServerResponse`, falling\n * back to the supplied response when no conversion is available.\n *\n * **Details**\n *\n * Only `HttpServerResponse` and `Respondable` values receive special handling.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const toResponseOrElseDefect = (u, orElse) => {\n if (Response.isHttpServerResponse(u)) {\n return Effect.succeed(u);\n } else if (isRespondable(u)) {\n return Effect.catchCause(u[symbol](), () => Effect.succeed(orElse));\n }\n return Effect.succeed(orElse);\n};\n//# sourceMappingURL=HttpServerRespondable.js.map","/**\n * Describes failures raised while handling HTTP server requests.\n *\n * `HttpServerError` covers failures that happen while accepting a request,\n * matching a route, running a handler, or building and sending a response.\n * Request-scoped failures keep the request that caused them, and response\n * failures keep the response being produced. This module also includes helpers\n * for turning failed causes or exits into HTTP responses and an annotation for\n * interrupts caused by client aborts.\n *\n * @since 4.0.0\n */\nimport * as Cause from \"../../Cause.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Data from \"../../Data.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as ErrorReporter from \"../../ErrorReporter.js\";\nimport { constUndefined } from \"../../Function.js\";\nimport * as Option from \"../../Option.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as Respondable from \"./HttpServerRespondable.js\";\nimport * as Response from \"./HttpServerResponse.js\";\nconst TypeId = \"~effect/http/HttpServerError\";\n/**\n * Tagged error for failures that occur while handling an HTTP server request.\n *\n * **Details**\n *\n * It wraps a `HttpServerErrorReason`, exposes the associated request and optional\n * response, and can be converted to an HTTP response through the `Respondable`\n * protocol.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class HttpServerError extends /*#__PURE__*/Data.TaggedError(\"HttpServerError\") {\n constructor(props) {\n if (\"cause\" in props.reason) {\n super({\n ...props,\n cause: props.reason.cause\n });\n } else {\n super(props);\n }\n }\n [TypeId] = TypeId;\n stack = `${this.name}: ${this.message}`;\n get request() {\n return this.reason.request;\n }\n get response() {\n return \"response\" in this.reason ? this.reason.response : undefined;\n }\n [Respondable.symbol]() {\n return this.reason[Respondable.symbol]();\n }\n get [ErrorReporter.ignore]() {\n return this.reason[ErrorReporter.ignore] ?? false;\n }\n get message() {\n return this.reason.message;\n }\n}\n/**\n * Error describing a failure to parse or read an incoming request.\n *\n * **Details**\n *\n * When converted to a response it produces an empty `400` response.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class RequestParseError extends /*#__PURE__*/Data.TaggedError(\"RequestParseError\") {\n /**\n * Converts the request error into a `400 Bad Request` response.\n *\n * @since 4.0.0\n */\n [Respondable.symbol]() {\n return Effect.succeed(Response.empty({\n status: 400\n }));\n }\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n get message() {\n return formatRequestMessage(this._tag, this.description, this.methodAndUrl);\n }\n}\n/**\n * Error indicating that no route matched the incoming request.\n *\n * **Details**\n *\n * When converted to a response it produces an empty `404` response, and it is\n * ignored by the error reporter.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class RouteNotFound extends /*#__PURE__*/Data.TaggedError(\"RouteNotFound\") {\n [Respondable.symbol]() {\n return Effect.succeed(Response.empty({\n status: 404\n }));\n }\n [ErrorReporter.ignore] = true;\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n get message() {\n return formatRequestMessage(this._tag, this.description, this.methodAndUrl);\n }\n}\n/**\n * Error describing an unexpected server-side failure while handling a request.\n *\n * **Details**\n *\n * When converted to a response it produces an empty `500` response.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class InternalError extends /*#__PURE__*/Data.TaggedError(\"InternalError\") {\n /**\n * Converts the server error into a `500 Internal Server Error` response.\n *\n * @since 4.0.0\n */\n [Respondable.symbol]() {\n return Effect.succeed(Response.empty({\n status: 500\n }));\n }\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n get message() {\n return formatRequestMessage(this._tag, this.description, this.methodAndUrl);\n }\n}\n/**\n * Returns `true` when the supplied value is an `HttpServerError`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpServerError = u => hasProperty(u, TypeId);\n/**\n * Error describing a failure related to an HTTP response.\n *\n * **Details**\n *\n * It carries the request and response involved in the failure. When converted to\n * a response it produces an empty `500` response.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class ResponseError extends /*#__PURE__*/Data.TaggedError(\"ResponseError\") {\n [Respondable.symbol]() {\n return Effect.succeed(Response.empty({\n status: 500\n }));\n }\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n get message() {\n const info = `${this._tag} (${this.response.status} ${this.methodAndUrl})`;\n return this.description ? `${info}: ${this.description}` : info;\n }\n}\n/**\n * Error wrapping a low-level failure from the HTTP server implementation.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class ServeError extends /*#__PURE__*/Data.TaggedError(\"ServeError\") {}\n/**\n * Context annotation used to mark an interrupt as caused by the client aborting\n * the request.\n *\n * **Details**\n *\n * `causeResponse` uses this annotation to map a pure client abort to a `499`\n * response instead of a server abort response.\n *\n * @category services\n * @since 4.0.0\n */\nexport class ClientAbort extends /*#__PURE__*/Context.Service()(\"effect/http/HttpServerError/ClientAbort\") {\n static annotation = /*#__PURE__*/this.context(true).pipe(/*#__PURE__*/Context.add(Cause.StackTrace, {\n name: \"ClientAbort\",\n stack: constUndefined,\n parent: undefined\n }));\n}\nconst formatRequestMessage = (reason, description, info) => {\n const prefix = `${reason} (${info})`;\n return description ? `${prefix}: ${description}` : prefix;\n};\n/**\n * Converts a failed handler cause into the HTTP response that should be sent and\n * the cause that should be reported.\n *\n * **Details**\n *\n * Respondable failures and defects can choose their own response, defects that\n * are already `HttpServerResponse` values are used directly, and pure interrupts\n * produce either `499` for client aborts or `503` for server aborts.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const causeResponse = cause => {\n let response;\n let effect = succeedInternalServerError;\n const failures = [];\n let interrupts = [];\n let isClientInterrupt = false;\n for (let i = 0; i < cause.reasons.length; i++) {\n const reason = cause.reasons[i];\n switch (reason._tag) {\n case \"Fail\":\n {\n effect = Respondable.toResponseOrElse(reason.error, internalServerError);\n failures.push(reason);\n break;\n }\n case \"Die\":\n {\n if (Response.isHttpServerResponse(reason.defect)) {\n response = reason.defect;\n } else {\n effect = Respondable.toResponseOrElseDefect(reason.defect, internalServerError);\n failures.push(reason);\n }\n break;\n }\n case \"Interrupt\":\n {\n isClientInterrupt = reason.annotations.has(ClientAbort.key);\n if (failures.length > 0) break;\n interrupts.push(reason);\n break;\n }\n }\n }\n if (response) {\n return Effect.succeed([response, Cause.fromReasons(failures)]);\n } else if (interrupts.length > 0 && failures.length === 0) {\n failures.push(...interrupts);\n effect = isClientInterrupt ? clientAbortError : serverAbortError;\n }\n return Effect.mapEager(effect, response => {\n failures.push(Cause.makeDieReason(response));\n return [response, Cause.fromReasons(failures)];\n });\n};\n/**\n * Derives an HTTP response from a failed handler cause synchronously.\n *\n * **Details**\n *\n * If the cause contains a defect that is already an `HttpServerResponse`, that\n * response is used and removed from the remaining cause. Otherwise the response\n * defaults to `500`.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const causeResponseStripped = cause => {\n let response;\n const failures = cause.reasons.filter(f => {\n if (f._tag === \"Die\" && Response.isHttpServerResponse(f.defect)) {\n response = f.defect;\n return false;\n }\n return true;\n });\n return [response ?? internalServerError, failures.length > 0 ? Option.some(Cause.fromReasons(failures)) : Option.none()];\n};\nconst internalServerError = /*#__PURE__*/Response.empty({\n status: 500\n});\nconst succeedInternalServerError = /*#__PURE__*/Effect.succeed(internalServerError);\nconst clientAbortError = /*#__PURE__*/Effect.succeed(/*#__PURE__*/Response.empty({\n status: 499\n}));\nconst serverAbortError = /*#__PURE__*/Effect.succeed(/*#__PURE__*/Response.empty({\n status: 503\n}));\n/**\n * Extracts the response from a successful handler exit, or derives a response\n * from the failure cause.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const exitResponse = exit => {\n if (exit._tag === \"Success\") {\n return exit.value;\n }\n return causeResponseStripped(exit.cause)[0];\n};\n//# sourceMappingURL=HttpServerError.js.map","/**\n * Manages many fibers together inside one scope.\n *\n * A `FiberSet<A, E>` tracks running fibers, removes each fiber when it\n * completes, and interrupts all still-running fibers when the owning scope\n * closes. This module includes scoped runtime constructors plus helpers for\n * adding, clearing, running, counting, joining, and waiting for managed fibers.\n *\n * @since 2.0.0\n */\nimport * as Cause from \"./Cause.js\";\nimport * as Deferred from \"./Deferred.js\";\nimport * as Effect from \"./Effect.js\";\nimport * as Exit from \"./Exit.js\";\nimport * as Fiber from \"./Fiber.js\";\nimport * as Filter from \"./Filter.js\";\nimport { constVoid, dual } from \"./Function.js\";\nimport { PipeInspectableProto } from \"./internal/core.js\";\nimport * as Iterable from \"./Iterable.js\";\nimport * as Predicate from \"./Predicate.js\";\nconst TypeId = \"~effect/FiberSet\";\n/**\n * Checks whether a value is a FiberSet.\n *\n * **Example** (Checking if a value is a FiberSet)\n *\n * ```ts import.meta.vitest\n * import { Effect, FiberSet } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const set = yield* FiberSet.make()\n *\n * return [FiberSet.isFiberSet(set), FiberSet.isFiberSet({})]\n * })\n *\n * const actual = await Effect.runPromise(Effect.scoped(program))\n * actual // => [true, false]\n * ```\n *\n * @category guards\n * @since 2.0.0\n */\nexport const isFiberSet = u => Predicate.hasProperty(u, TypeId);\nconst Proto = {\n [TypeId]: TypeId,\n [Symbol.iterator]() {\n if (this.state._tag === \"Closed\") {\n return Iterable.empty();\n }\n return this.state.backing[Symbol.iterator]();\n },\n ...PipeInspectableProto,\n toJSON() {\n return {\n _id: \"FiberMap\",\n state: this.state\n };\n }\n};\nconst makeUnsafe = (backing, deferred) => {\n const self = Object.create(Proto);\n self.state = {\n _tag: \"Open\",\n backing\n };\n self.deferred = deferred;\n return self;\n};\n/**\n * Creates a scoped `FiberSet` for storing fibers.\n *\n * **Details**\n *\n * When the associated Scope is closed, all fibers in the set will be\n * interrupted. You can add fibers to the set using `FiberSet.add` or\n * `FiberSet.run`, and the fibers will be automatically removed from the\n * FiberSet when they complete.\n *\n * **Example** (Creating a scoped FiberSet)\n *\n * ```ts import.meta.vitest\n * import { Effect, FiberSet } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const set = yield* FiberSet.make()\n *\n * // run some effects and add the fibers to the set\n * yield* FiberSet.run(set, Effect.never)\n * yield* FiberSet.run(set, Effect.never)\n *\n * yield* Effect.yieldNow\n * return yield* FiberSet.size(set)\n * }).pipe(\n * Effect.scoped // The fibers will be interrupted when the scope is closed\n * )\n *\n * const actual = await Effect.runPromise(program)\n * actual // => 2\n * ```\n *\n * @category constructors\n * @since 2.0.0\n */\nexport const make = () => Effect.acquireRelease(Effect.sync(() => makeUnsafe(new Set(), Deferred.makeUnsafe())), set => Effect.suspend(() => {\n const state = set.state;\n if (state._tag === \"Closed\") return Effect.void;\n set.state = {\n _tag: \"Closed\"\n };\n const fibers = state.backing;\n return Fiber.interruptAll(fibers).pipe(Deferred.into(set.deferred));\n}));\n/**\n * Creates a scoped run function that forks effects into a new `FiberSet`.\n *\n * **Details**\n *\n * Each call returns the forked fiber and adds it to the set. Managed fibers are\n * removed when they complete and are interrupted when the set's scope closes.\n *\n * **Example** (Creating a scoped runtime)\n *\n * ```ts import.meta.vitest\n * import { Effect, Fiber, FiberSet } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const runFork = yield* FiberSet.makeRuntime()\n *\n * // Fork effects using the runtime\n * const fiber1 = runFork(Effect.succeed(\"hello\"))\n * const fiber2 = runFork(Effect.succeed(\"world\"))\n *\n * return [yield* Fiber.join(fiber1), yield* Fiber.join(fiber2)]\n * })\n *\n * const actual = await Effect.runPromise(Effect.scoped(program))\n * actual // => [\"hello\", \"world\"]\n * ```\n *\n * @category constructors\n * @since 2.0.0\n */\nexport const makeRuntime = () => Effect.flatMap(make(), self => runtime(self)());\n/**\n * Creates a scoped run function that forks effects into a new `FiberSet` and\n * returns a `Promise` for each effect result.\n *\n * **When to use**\n *\n * Use when many scoped fibers should be tracked as a set while exposing each\n * result through Promise-based APIs.\n *\n * **Details**\n *\n * Managed fibers are removed when they complete and are interrupted when the\n * set's scope closes. Each Promise resolves with the effect's success value or\n * rejects with the squashed failure cause.\n *\n * **Example** (Creating a promise runtime)\n *\n * ```ts import.meta.vitest\n * import { Effect, FiberSet } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const runPromise = yield* FiberSet.makeRuntimePromise()\n *\n * // Run effects as promises\n * const promise1 = runPromise(Effect.succeed(\"hello\"))\n * const promise2 = runPromise(Effect.succeed(\"world\"))\n *\n * return [yield* Effect.promise(() => promise1), yield* Effect.promise(() => promise2)]\n * })\n *\n * const actual = await Effect.runPromise(Effect.scoped(program))\n * actual // => [\"hello\", \"world\"]\n * ```\n *\n * @category constructors\n * @since 3.13.0\n */\nexport const makeRuntimePromise = () => Effect.flatMap(make(), self => runtimePromise(self)());\nconst internalFiberId = -1;\nconst isInternalInterruption = /*#__PURE__*/Filter.toPredicate(/*#__PURE__*/Filter.compose(Cause.filterInterruptors, /*#__PURE__*/Filter.has(internalFiberId)));\n/**\n * Adds an existing fiber to the `FiberSet` using a synchronous, unsafe\n * mutation.\n *\n * **When to use**\n *\n * Use when an already forked fiber must be registered immediately and\n * synchronous interruption on a closed set is acceptable.\n *\n * **Details**\n *\n * When the fiber completes, it is removed from the set. If the set is already\n * closed, the supplied fiber is interrupted immediately. Non-interruption\n * failures are recorded for `FiberSet.join`.\n *\n * **Example** (Adding a fiber unsafely)\n *\n * ```ts import.meta.vitest\n * import { Effect, FiberSet } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const set = yield* FiberSet.make()\n * const fiber = yield* Effect.forkChild(Effect.never)\n *\n * // Unsafe add - doesn't return an Effect\n * FiberSet.addUnsafe(set, fiber)\n *\n * // The fiber is now managed by the set\n * return yield* FiberSet.size(set)\n * })\n *\n * const actual = await Effect.runPromise(Effect.scoped(program))\n * actual // => 1\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const addUnsafe = /*#__PURE__*/dual(args => isFiberSet(args[0]), (self, fiber, options) => {\n if (self.state._tag === \"Closed\") {\n fiber.interruptUnsafe(internalFiberId);\n return;\n } else if (self.state.backing.has(fiber)) {\n return;\n }\n self.state.backing.add(fiber);\n fiber.addObserver(exit => {\n if (self.state._tag === \"Closed\") {\n return;\n }\n self.state.backing.delete(fiber);\n if (Exit.isFailure(exit) && (options?.propagateInterruption === true ? !isInternalInterruption(exit.cause) : !Cause.hasInterruptsOnly(exit.cause))) {\n Deferred.doneUnsafe(self.deferred, exit);\n }\n });\n});\n/**\n * Adds a fiber to the FiberSet. When the fiber completes, it will be removed.\n *\n * **Example** (Adding a fiber)\n *\n * ```ts import.meta.vitest\n * import { Effect, FiberSet } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const set = yield* FiberSet.make()\n * const fiber = yield* Effect.forkChild(Effect.never)\n *\n * // Add the fiber to the set\n * yield* FiberSet.add(set, fiber)\n *\n * // The fiber is now managed by the set\n * return yield* FiberSet.size(set)\n * })\n *\n * const actual = await Effect.runPromise(Effect.scoped(program))\n * actual // => 1\n * ```\n *\n * @category combinators\n * @since 2.0.0\n */\nexport const add = /*#__PURE__*/dual(args => isFiberSet(args[0]), (self, fiber, options) => Effect.sync(() => addUnsafe(self, fiber, options)));\n/**\n * Interrupts all fibers in the `FiberSet` and clears the set.\n *\n * **Example** (Clearing all fibers)\n *\n * ```ts import.meta.vitest\n * import { Effect, FiberSet } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const set = yield* FiberSet.make()\n *\n * // Add some fibers\n * yield* FiberSet.run(set, Effect.never)\n * yield* FiberSet.run(set, Effect.never)\n *\n * const sizeBefore = yield* FiberSet.size(set)\n *\n * // Clear all fibers\n * yield* FiberSet.clear(set)\n *\n * return [sizeBefore, yield* FiberSet.size(set)]\n * })\n *\n * const actual = await Effect.runPromise(Effect.scoped(program))\n * actual // => [2, 0]\n * ```\n *\n * @category combinators\n * @since 2.0.0\n */\nexport const clear = self => Effect.suspend(() => {\n if (self.state._tag === \"Closed\") {\n return Effect.void;\n }\n return Fiber.interruptAllAs(self.state.backing, internalFiberId);\n});\nconst constInterruptedFiber = /*#__PURE__*/function () {\n let fiber = undefined;\n return () => {\n if (fiber === undefined) {\n fiber = Effect.runFork(Effect.interrupt);\n }\n return fiber;\n };\n}();\n/**\n * Forks an Effect and add the forked fiber to the FiberSet.\n * When the fiber completes, it will be removed from the FiberSet.\n *\n * **Example** (Forking effects into a set)\n *\n * ```ts import.meta.vitest\n * import { Effect, Fiber, FiberSet } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const set = yield* FiberSet.make()\n *\n * // Fork and add to set\n * const fiber1 = yield* FiberSet.run(set, Effect.succeed(\"hello\"))\n * const fiber2 = yield* FiberSet.run(set, Effect.succeed(\"world\"))\n *\n * // Get results\n * return [yield* Fiber.join(fiber1), yield* Fiber.join(fiber2)]\n * })\n *\n * const actual = await Effect.runPromise(Effect.scoped(program))\n * actual // => [\"hello\", \"world\"]\n * ```\n *\n * @category combinators\n * @since 2.0.0\n */\nexport const run = function () {\n const self = arguments[0];\n if (!Effect.isEffect(arguments[1])) {\n const options = arguments[1];\n return effect => runImpl(self, effect, options);\n }\n return runImpl(self, arguments[1], arguments[2]);\n};\nconst runImpl = (self, effect, options) => Effect.withFiber(parent => {\n if (self.state._tag === \"Closed\") {\n return Effect.sync(constInterruptedFiber);\n }\n const fiber = Effect.runForkWith(parent.context)(effect);\n addUnsafe(self, fiber, options);\n return Effect.succeed(fiber);\n});\n/**\n * Captures a `Runtime` and uses it to fork effects into the `FiberSet`.\n *\n * **Example** (Capturing a runtime)\n *\n * ```ts import.meta.vitest\n * import { Context, Effect, Fiber, FiberSet } from \"effect\"\n *\n * class Users extends Context.Service<Users, {\n * readonly getAll: Effect.Effect<Array<unknown>>\n * }>()(\"Users\") {}\n *\n * const program = Effect.gen(function*() {\n * const set = yield* FiberSet.make()\n * const run = yield* FiberSet.runtime(set)<Users>()\n *\n * // run some effects and add the fibers to the set\n * const fiber = run(Effect.andThen(Users, (_) => _.getAll))\n * return (yield* Fiber.join(fiber)).length\n * }).pipe(\n * Effect.scoped // The fibers will be interrupted when the scope is closed\n * )\n *\n * const actual = await Effect.runPromise(Effect.provideService(program, Users, {\n * getAll: Effect.succeed([])\n * }))\n * actual // => 0\n * ```\n *\n * @category combinators\n * @since 2.0.0\n */\nexport const runtime = self => () => Effect.map(Effect.context(), services => {\n const runFork = Effect.runForkWith(services);\n return (effect, options) => {\n if (self.state._tag === \"Closed\") {\n return constInterruptedFiber();\n }\n const fiber = runFork(effect, options);\n addUnsafe(self, fiber, options);\n return fiber;\n };\n});\n/**\n * Captures a `Runtime` and returns a Promise-based runner that forks effects\n * into the `FiberSet`.\n *\n * **When to use**\n *\n * Use when you need to bridge effects to `Promise` values while still tracking\n * their fibers in a `FiberSet`.\n *\n * **Details**\n *\n * The returned run function returns a `Promise` for each effect result.\n *\n * **Example** (Running effects as promises)\n *\n * ```ts import.meta.vitest\n * import { Effect, FiberSet } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const set = yield* FiberSet.make()\n * const runPromise = yield* FiberSet.runtimePromise(set)()\n *\n * // Run effects as promises\n * const promise1 = runPromise(Effect.succeed(\"hello\"))\n * const promise2 = runPromise(Effect.succeed(\"world\"))\n *\n * return [yield* Effect.promise(() => promise1), yield* Effect.promise(() => promise2)]\n * })\n *\n * const actual = await Effect.runPromise(Effect.scoped(program))\n * actual // => [\"hello\", \"world\"]\n * ```\n *\n * @see {@link runtime} for a runner that returns the forked `Fiber`\n *\n * @category combinators\n * @since 3.13.0\n */\nexport const runtimePromise = self => () => Effect.map(runtime(self)(), runFork => (effect, options) => new Promise((resolve, reject) => runFork(effect, options).addObserver(exit => {\n if (Exit.isSuccess(exit)) {\n resolve(exit.value);\n } else {\n reject(Cause.squash(exit.cause));\n }\n})));\n/**\n * Gets the number of fibers currently in the FiberSet.\n *\n * **Example** (Checking the set size)\n *\n * ```ts import.meta.vitest\n * import { Effect, FiberSet } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const set = yield* FiberSet.make()\n *\n * const sizeBefore = yield* FiberSet.size(set)\n *\n * // Add some fibers\n * yield* FiberSet.run(set, Effect.never)\n * yield* FiberSet.run(set, Effect.never)\n *\n * return [sizeBefore, yield* FiberSet.size(set)]\n * })\n *\n * const actual = await Effect.runPromise(Effect.scoped(program))\n * actual // => [0, 2]\n * ```\n *\n * @category combinators\n * @since 2.0.0\n */\nexport const size = self => Effect.sync(() => self.state._tag === \"Closed\" ? 0 : self.state.backing.size);\n/**\n * Joins all fibers in the FiberSet. If any fiber in the set terminates with a failure,\n * the returned Effect will terminate with the first failure that occurred.\n *\n * **Example** (Joining failing fibers)\n *\n * ```ts import.meta.vitest\n * import { Effect, Exit, FiberSet } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const set = yield* FiberSet.make()\n * yield* FiberSet.add(set, Effect.runFork(Effect.fail(\"error\")))\n *\n * // parent fiber will fail with \"error\"\n * yield* FiberSet.join(set)\n * })\n *\n * const actual = await Effect.runPromise(Effect.exit(Effect.scoped(program)))\n * actual // => Exit.fail(\"error\")\n * ```\n *\n * @category combinators\n * @since 2.0.0\n */\nexport const join = self => Deferred.await(self.deferred);\n/**\n * Waits until the fiber set is empty.\n *\n * **Example** (Waiting for an empty set)\n *\n * ```ts import.meta.vitest\n * import { Effect, FiberSet } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const set = yield* FiberSet.make()\n *\n * yield* FiberSet.run(set, Effect.yieldNow)\n * yield* FiberSet.run(set, Effect.yieldNow)\n *\n * // Wait for all fibers to complete\n * yield* FiberSet.awaitEmpty(set)\n *\n * return yield* FiberSet.size(set)\n * })\n *\n * const actual = await Effect.runPromise(Effect.scoped(program))\n * actual // => 0\n * ```\n *\n * @category combinators\n * @since 3.13.0\n */\nexport const awaitEmpty = self => Effect.whileLoop({\n while: () => self.state._tag === \"Open\" && self.state.backing.size > 0,\n body: () => Fiber.await(Iterable.headUnsafe(self)),\n step: constVoid\n});\n//# sourceMappingURL=FiberSet.js.map","import * as Channel from \"../../Channel.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Deferred from \"../../Deferred.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Exit from \"../../Exit.js\";\nimport * as FiberSet from \"../../FiberSet.js\";\nimport { constVoid, dual, flow } from \"../../Function.js\";\nimport * as Latch from \"../../Latch.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Pull from \"../../Pull.js\";\nimport * as Queue from \"../../Queue.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Scope from \"../../Scope.js\";\n/**\n * Runtime type identifier attached to `Socket` services.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/socket/Socket\";\n/**\n * Returns `true` when a value is a `Socket`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isSocket = u => Predicate.hasProperty(u, TypeId);\n/**\n * Service tag for bidirectional socket transports.\n *\n * **When to use**\n *\n * Use to access or provide the socket implementation used by programs that\n * read and write frames through the Effect environment.\n *\n * @category services\n * @since 4.0.0\n */\nexport const Socket = /*#__PURE__*/Context.Service(\"effect/socket/Socket\");\n/**\n * Constructs a `Socket` from a raw read loop and scoped writer, deriving binary\n * and string read loops when they are not provided.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = options => Socket.of({\n [TypeId]: TypeId,\n runRaw: options.runRaw,\n run: options.run ?? ((handler, opts) => options.runRaw(data => typeof data === \"string\" ? handler(encoder.encode(data)) : data instanceof Uint8Array ? handler(data) : handler(new Uint8Array(data)), opts)),\n runString: options.runString ?? (options.run ? (handler, opts) => options.run(data => handler(decoder.decode(data)), opts) : (handler, opts) => options.runRaw(data => typeof data === \"string\" ? handler(data) : data instanceof Uint8Array ? handler(decoder.decode(data)) : handler(decoder.decode(new Uint8Array(data))), opts)),\n writer: options.writer\n});\nconst encoder = /*#__PURE__*/new TextEncoder();\nconst decoder = /*#__PURE__*/new TextDecoder();\nconst CloseEventTypeId = \"~effect/socket/Socket/CloseEvent\";\n/**\n * Represents a socket close event value carrying a close code and optional\n * reason.\n *\n * @category models\n * @since 4.0.0\n */\nexport class CloseEvent {\n /**\n * Marks this value as a socket close event for runtime guards.\n *\n * @since 4.0.0\n */\n [CloseEventTypeId];\n code;\n reason;\n constructor(code = 1000, reason) {\n this[CloseEventTypeId] = CloseEventTypeId;\n this.code = code;\n this.reason = reason;\n }\n /**\n * Formats the close code and optional reason for display.\n *\n * @since 4.0.0\n */\n toString() {\n return this.reason ? `${this.code}: ${this.reason}` : `${this.code}`;\n }\n}\n/**\n * Returns `true` when a value is a `CloseEvent`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isCloseEvent = u => Predicate.hasProperty(u, CloseEventTypeId);\n/**\n * Runtime type identifier attached to `SocketError` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const SocketErrorTypeId = \"~effect/socket/Socket/SocketError\";\n/**\n * Returns `true` when a value is a `SocketError`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isSocketError = u => Predicate.hasProperty(u, SocketErrorTypeId);\n/**\n * Typed error for failures that occur while reading from a socket.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketReadError extends /*#__PURE__*/Schema.ErrorClass(\"effect/socket/Socket/SocketReadError\")({\n _tag: /*#__PURE__*/Schema.tag(\"SocketReadError\"),\n cause: /*#__PURE__*/Schema.Defect()\n}) {\n /**\n * Default message used for socket read failures.\n *\n * @since 4.0.0\n */\n message = `An error occurred during Read`;\n}\n/**\n * Typed error for failures that occur while writing to a socket.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketWriteError extends /*#__PURE__*/Schema.ErrorClass(\"effect/socket/Socket/SocketWriteError\")({\n _tag: /*#__PURE__*/Schema.tag(\"SocketWriteError\"),\n cause: /*#__PURE__*/Schema.Defect()\n}) {\n /**\n * Default message used for socket write failures.\n *\n * @since 4.0.0\n */\n message = `An error occurred during Write`;\n}\n/**\n * Typed error for failures that occur while opening a socket, including\n * unknown open failures and open timeouts.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketOpenError extends /*#__PURE__*/Schema.ErrorClass(\"effect/socket/Socket/SocketOpenError\")({\n _tag: /*#__PURE__*/Schema.tag(\"SocketOpenError\"),\n kind: /*#__PURE__*/Schema.Literals([\"Unknown\", \"Timeout\"]),\n cause: /*#__PURE__*/Schema.Defect()\n}) {\n /**\n * Formats timeout and unknown open failures for display.\n *\n * @since 4.0.0\n */\n get message() {\n return this.kind === \"Timeout\" ? `timeout waiting for \"open\"` : `An error occurred during Open`;\n }\n}\n/**\n * Typed error for a socket close event, carrying the close code and optional\n * close reason.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketCloseError extends /*#__PURE__*/Schema.ErrorClass(\"effect/socket/Socket/SocketCloseError\")({\n _tag: /*#__PURE__*/Schema.tag(\"SocketCloseError\"),\n code: Schema.Int,\n closeReason: /*#__PURE__*/Schema.optional(Schema.String)\n}) {\n /**\n * Separates clean socket close errors from errors that should remain failures.\n *\n * @since 4.0.0\n */\n static filterClean(isClean) {\n return function (u) {\n return SocketError.is(u) && u.reason._tag === \"SocketCloseError\" && isClean(u.reason.code) ? Result.succeed(u.reason) : Result.fail(u);\n };\n }\n get message() {\n if (this.closeReason) {\n return `${this.code}: ${this.closeReason}`;\n }\n return `${this.code}`;\n }\n}\n/**\n * Schema for all socket-specific error reasons.\n *\n * @category errors\n * @since 4.0.0\n */\nexport const SocketErrorReason = /*#__PURE__*/Schema.Union([SocketReadError, SocketWriteError, SocketOpenError, SocketCloseError]);\n/**\n * Tagged error that wraps socket read, write, open, and close failures while\n * preserving the underlying reason.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketError extends /*#__PURE__*/Schema.TaggedErrorClass(SocketErrorTypeId)(\"SocketError\", {\n _tag: /*#__PURE__*/Schema.tag(\"SocketError\"),\n reason: SocketErrorReason\n}) {\n // @effect-diagnostics-next-line overriddenSchemaConstructor:off\n constructor(props) {\n if (\"cause\" in props.reason) {\n super({\n ...props,\n cause: props.reason.cause\n });\n } else {\n super(props);\n }\n }\n /**\n * Marks this value as a socket error wrapper for runtime guards.\n *\n * @since 4.0.0\n */\n [SocketErrorTypeId] = SocketErrorTypeId;\n /**\n * Returns `true` when the value is a `SocketError`.\n *\n * @since 4.0.0\n */\n static is(u) {\n return isSocketError(u);\n }\n message = this.reason.message;\n}\n/**\n * Converts a `Socket` into a bidirectional `Channel`, mapping incoming string\n * or binary frames and writing outgoing frame batches to the socket.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toChannelMap = (self, f) => Channel.fromTransform(Effect.fnUntraced(function* (upstream, scope) {\n const queue = yield* Queue.make();\n const writeScope = yield* Scope.fork(scope);\n const write = yield* Scope.provide(self.writer, writeScope);\n let chunk;\n let index = 0;\n const writeChunk = Effect.whileLoop({\n while: () => index < chunk.length,\n body: () => write(chunk[index++]),\n step: constVoid\n });\n yield* upstream.pipe(Effect.flatMap(arr => {\n if (arr.length === 1) return write(arr[0]);\n chunk = arr;\n index = 0;\n return writeChunk;\n }), Effect.forever({\n disableYield: true\n }), Effect.catchCauseFilter(Pull.filterNoDone, cause => Queue.failCause(queue, cause)), Effect.ensuring(Scope.close(writeScope, Exit.void)), Effect.forkIn(scope));\n yield* self.runRaw(data => {\n Queue.offerUnsafe(queue, f(data));\n }).pipe(Queue.into(queue), Effect.forkIn(scope));\n // @effect-diagnostics-next-line returnEffectInGen:off\n return Queue.takeAll(queue);\n}));\n/**\n * Converts a `Socket` into a binary `Channel`, encoding incoming string frames\n * as UTF-8 bytes.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toChannel = self => {\n const encoder = new TextEncoder();\n return toChannelMap(self, data => typeof data === \"string\" ? encoder.encode(data) : data);\n};\n/**\n * Converts a `Socket` into a string `Channel`, decoding binary frames with the\n * optional text encoding.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toChannelString = /*#__PURE__*/dual(args => isSocket(args[0]), (self, encoding) => {\n const decoder = new TextDecoder(encoding);\n return toChannelMap(self, data => typeof data === \"string\" ? data : decoder.decode(data));\n});\n/**\n * Creates a `Socket` to binary `Channel` adapter with a fixed upstream error\n * type.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toChannelWith = () => self => toChannel(self);\n/**\n * Creates a binary socket `Channel` from the `Socket` service in the\n * environment.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeChannel = () => Channel.unwrap(Effect.map(Socket, toChannelWith()));\n/**\n * Default close-code classifier that treats every socket close code as an\n * error.\n *\n * @category predicates\n * @since 4.0.0\n */\nexport const defaultCloseCodeIsError = _code => true;\n/**\n * Context service for the active `WebSocket` instance available while a\n * WebSocket-backed socket run is handling events.\n *\n * @category services\n * @since 4.0.0\n */\nexport class WebSocket extends /*#__PURE__*/Context.Service()(\"~effect/socket/Socket/WebSocket\") {}\n/**\n * Context service for constructing `WebSocket` instances from a URL and\n * optional protocols.\n *\n * @category services\n * @since 4.0.0\n */\nexport class WebSocketConstructor extends /*#__PURE__*/Context.Service()(\"@effect/platform/Socket/WebSocketConstructor\") {}\n/**\n * Layer that provides `WebSocketConstructor` using `globalThis.WebSocket`.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWebSocketConstructorGlobal = /*#__PURE__*/Layer.succeed(WebSocketConstructor)((url, protocols) => new globalThis.WebSocket(url, protocols));\n/**\n * Creates a `Socket` backed by a `WebSocketConstructor`, acquiring the\n * WebSocket for each run and using the close-code classifier to decide which\n * closes fail the run.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeWebSocket = (url, options) => WebSocketConstructor.use(makeWs => fromWebSocket(Effect.acquireRelease((typeof url === \"string\" ? Effect.succeed(url) : url).pipe(Effect.map(url => makeWs(url, options?.protocols))), ws => Effect.sync(() => ws.close(1000))), options));\n/**\n * Builds a `Socket` from a scoped WebSocket acquisition effect, waiting for the\n * socket to open, dispatching message handlers in fibers, and translating\n * open, read, and close events into `SocketError` values.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromWebSocket = (acquire, options) => Effect.withFiber(fiber => {\n let currentWS;\n let initial = true;\n const latch = Latch.makeUnsafe(false);\n const acquireContext = fiber.context;\n const closeCodeIsError = options?.closeCodeIsError ?? defaultCloseCodeIsError;\n const runRaw = (handler, opts) => Effect.scopedWith(Effect.fnUntraced(function* (scope) {\n const fiberSet = yield* FiberSet.make().pipe(Scope.provide(scope));\n const ws = yield* Scope.provide(acquire, scope);\n const run = yield* Effect.provideService(FiberSet.runtime(fiberSet)(), WebSocket, ws);\n let open = false;\n function onMessage(event) {\n if (event.data instanceof Blob) {\n const effect = Effect.flatMap(Effect.promise(() => event.data.arrayBuffer()), buffer => {\n const result = handler(new Uint8Array(buffer));\n return Effect.isEffect(result) ? result : Effect.void;\n });\n return run(effect);\n }\n const result = handler(event.data instanceof ArrayBuffer ? new Uint8Array(event.data) : event.data);\n if (Effect.isEffect(result)) {\n run(result);\n }\n }\n function onError(cause) {\n ws.removeEventListener(\"message\", onMessage);\n ws.removeEventListener(\"close\", onClose);\n Deferred.doneUnsafe(fiberSet.deferred, Effect.fail(new SocketError({\n reason: open ? new SocketReadError({\n cause\n }) : new SocketOpenError({\n kind: \"Unknown\",\n cause\n })\n })));\n }\n function onClose(event) {\n const code = typeof event.code === \"number\" ? event.code : 1001;\n ws.removeEventListener(\"message\", onMessage);\n ws.removeEventListener(\"error\", onError);\n Deferred.doneUnsafe(fiberSet.deferred, Effect.fail(new SocketError({\n reason: new SocketCloseError({\n code,\n closeReason: event.reason\n })\n })));\n }\n ws.addEventListener(\"close\", onClose, {\n once: true\n });\n ws.addEventListener(\"error\", onError, {\n once: true\n });\n ws.addEventListener(\"message\", onMessage);\n if (ws.readyState !== 1) {\n const openDeferred = Deferred.makeUnsafe();\n ws.addEventListener(\"open\", () => {\n open = true;\n Deferred.doneUnsafe(openDeferred, Effect.void);\n }, {\n once: true\n });\n yield* Deferred.await(openDeferred).pipe(Effect.timeoutOrElse({\n duration: options?.openTimeout ?? 10000,\n orElse: () => Effect.fail(new SocketError({\n reason: new SocketOpenError({\n kind: \"Timeout\",\n cause: new Error(\"timeout waiting for \\\"open\\\"\")\n })\n }))\n }), Effect.raceFirst(FiberSet.join(fiberSet)));\n }\n open = true;\n currentWS = ws;\n latch.openUnsafe();\n if (initial && options?.onInitialRun) {\n initial = false;\n for (const event of options.onInitialRun(ws)) onMessage(event);\n }\n if (opts?.onOpen) yield* opts.onOpen;\n return yield* Effect.catchFilter(FiberSet.join(fiberSet), SocketCloseError.filterClean(_ => !closeCodeIsError(_)), () => Effect.void);\n })).pipe(Effect.updateContext(input => Context.merge(acquireContext, input)), Effect.ensuring(Effect.sync(() => {\n latch.closeUnsafe();\n currentWS = undefined;\n })));\n const write = chunk => latch.whenOpen(Effect.sync(() => {\n const ws = currentWS;\n if (isCloseEvent(chunk)) {\n ws.close(chunk.code, chunk.reason);\n } else {\n ws.send(chunk);\n }\n }));\n const writer = Effect.succeed(write);\n return Effect.succeed(make({\n runRaw,\n writer\n }));\n});\n/**\n * Creates a binary `Channel` backed by a WebSocket URL, requiring a\n * `WebSocketConstructor` service.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeWebSocketChannel = (url, options) => Channel.unwrap(Effect.map(makeWebSocket(url, options), toChannelWith()));\n/**\n * Layer that provides a `Socket` service backed by a WebSocket URL or URL\n * effect.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWebSocket = /*#__PURE__*/flow(makeWebSocket, /*#__PURE__*/Layer.effect(Socket));\n/**\n * Context reference for socket send queue capacity, defaulting to `16`.\n *\n * @category services\n * @since 4.0.0\n */\nexport const SendQueueCapacity = /*#__PURE__*/Context.Reference(\"~effect/socket/Socket/SendQueueCapacity\", {\n defaultValue: () => 16\n});\n/**\n * Builds a `Socket` from a scoped `InputTransformStream`, reading incoming\n * chunks through socket handlers and writing outgoing chunks to the writable\n * stream, encoding strings as UTF-8 and using close-code classification for\n * `CloseEvent` values.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromTransformStream = (acquire, options) => Effect.withFiber(fiber => {\n const latch = Latch.makeUnsafe(false);\n let currentStream;\n const acquireServices = fiber.context;\n const closeCodeIsError = options?.closeCodeIsError ?? defaultCloseCodeIsError;\n const runRaw = (handler, opts) => Effect.scopedWith(Effect.fnUntraced(function* (scope) {\n const stream = yield* Scope.provide(acquire, scope);\n const reader = stream.readable.getReader();\n yield* Scope.addFinalizer(scope, Effect.promise(() => reader.cancel()));\n const fiberSet = yield* FiberSet.make().pipe(Scope.provide(scope));\n const runFork = yield* FiberSet.runtime(fiberSet)();\n yield* Effect.tryPromise({\n try: async () => {\n while (true) {\n const {\n done,\n value\n } = await reader.read();\n if (done) {\n throw new SocketError({\n reason: new SocketCloseError({\n code: 1000\n })\n });\n }\n const result = handler(value);\n if (Effect.isEffect(result)) {\n runFork(result);\n }\n }\n },\n catch: cause => isSocketError(cause) ? cause : new SocketError({\n reason: new SocketReadError({\n cause\n })\n })\n }).pipe(FiberSet.run(fiberSet));\n currentStream = {\n stream,\n fiberSet\n };\n yield* latch.open;\n if (opts?.onOpen) yield* opts.onOpen;\n return yield* Effect.catchFilter(FiberSet.join(fiberSet), SocketCloseError.filterClean(_ => !closeCodeIsError(_)), () => Effect.void);\n })).pipe(_ => _, Effect.updateContext(input => Context.merge(acquireServices, input)), Effect.ensuring(Effect.sync(() => {\n latch.closeUnsafe();\n currentStream = undefined;\n })));\n const writers = new WeakMap();\n const getWriter = stream => {\n let writer = writers.get(stream);\n if (!writer) {\n writer = stream.writable.getWriter();\n writers.set(stream, writer);\n }\n return writer;\n };\n const write = chunk => latch.whenOpen(Effect.suspend(() => {\n const {\n fiberSet,\n stream\n } = currentStream;\n if (isCloseEvent(chunk)) {\n return Deferred.fail(fiberSet.deferred, new SocketError({\n reason: new SocketCloseError({\n code: chunk.code,\n closeReason: chunk.reason\n })\n }));\n }\n return Effect.promise(() => getWriter(stream).write(typeof chunk === \"string\" ? encoder.encode(chunk) : chunk));\n }));\n const writer = Effect.acquireRelease(Effect.succeed(write), () => Effect.promise(async () => {\n if (!currentStream) return;\n await getWriter(currentStream.stream).close();\n }));\n return Effect.succeed(make({\n runRaw,\n writer\n }));\n});\n//# sourceMappingURL=Socket.js.map","// taken from https://github.com/fastify/fast-content-type-parse\n// under the MIT license\n/**\n * RegExp to match *( \";\" parameter ) in RFC 7231 sec 3.1.1.1\n *\n * parameter = token \"=\" ( token / quoted-string )\n * token = 1*tchar\n * tchar = \"!\" / \"#\" / \"$\" / \"%\" / \"&\" / \"'\" / \"*\"\n * / \"+\" / \"-\" / \".\" / \"^\" / \"_\" / \"`\" / \"|\" / \"~\"\n * / DIGIT / ALPHA\n * ; any VCHAR, except delimiters\n * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE\n * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text\n * obs-text = %x80-FF\n * quoted-pair = \"\\\" ( HTAB / SP / VCHAR / obs-text )\n */\nconst paramRE = /; *([!#$%&'*+.^\\w`|~-]+)=(\"(?:[\\v\\u0020\\u0021\\u0023-\\u005b\\u005d-\\u007e\\u0080-\\u00ff]|\\\\[\\v\\u0020-\\u00ff])*\"|[!#$%&'*+.^\\w`|~-]+) */gu;\n/**\n * RegExp to match quoted-pair in RFC 7230 sec 3.2.6\n *\n * quoted-pair = \"\\\" ( HTAB / SP / VCHAR / obs-text )\n * obs-text = %x80-FF\n */\nconst quotedPairRE = /\\\\([\\v\\u0020-\\u00ff])/gu;\n/**\n * RegExp to match type in RFC 7231 sec 3.1.1.1\n *\n * media-type = type \"/\" subtype\n * type = token\n * subtype = token\n */\nconst mediaTypeRE = /^[!#$%&'*+.^\\w|~-]+\\/[!#$%&'*+.^\\w|~-]+$/u;\nconst mediaTypeRENoSlash = /^[!#$%&'*+.^\\w|~-]+$/u;\n// default ContentType to prevent repeated object creation\nconst defaultContentType = {\n value: \"\",\n parameters: /*#__PURE__*/Object.create(null)\n};\nexport function parse(header, withoutSlash = false) {\n if (typeof header !== \"string\") {\n return defaultContentType;\n }\n let index = header.indexOf(\";\");\n const type = index !== -1 ? header.slice(0, index).trim() : header.trim();\n const mediaRE = withoutSlash ? mediaTypeRENoSlash : mediaTypeRE;\n if (mediaRE.test(type) === false) {\n return defaultContentType;\n }\n const result = {\n value: type.toLowerCase(),\n parameters: Object.create(null)\n };\n // parse parameters\n if (index === -1) {\n return result;\n }\n let key;\n let match;\n let value;\n paramRE.lastIndex = index;\n while (match = paramRE.exec(header)) {\n if (match.index !== index) {\n return defaultContentType;\n }\n index += match[0].length;\n key = match[1].toLowerCase();\n value = match[2];\n if (value[0] === '\"') {\n // remove quotes and escapes\n value = value.slice(1, value.length - 1);\n !withoutSlash && quotedPairRE.test(value) && (value = value.replace(quotedPairRE, \"$1\"));\n }\n result.parameters[key] = value;\n }\n if (index !== header.length) {\n return defaultContentType;\n }\n return result;\n}\n//# sourceMappingURL=contentType.js.map","const constMaxPairs = 100;\nconst constMaxSize = 16 * 1024;\nvar State;\n(function (State) {\n State[State[\"key\"] = 0] = \"key\";\n State[State[\"whitespace\"] = 1] = \"whitespace\";\n State[State[\"value\"] = 2] = \"value\";\n})(State || (State = {}));\nconst constContinue = {\n _tag: \"Continue\"\n};\nconst constNameChars = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1];\nconst constValueChars = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];\nexport function make() {\n const decoder = new TextDecoder();\n const state = {\n state: State.key,\n headers: Object.create(null),\n key: \"\",\n value: undefined,\n crlf: 0,\n previousChunk: undefined,\n pairs: 0,\n size: 0\n };\n function reset(value) {\n state.state = State.key;\n state.headers = Object.create(null);\n state.key = \"\";\n state.value = undefined;\n state.crlf = 0;\n state.previousChunk = undefined;\n state.pairs = 0;\n state.size = 0;\n return value;\n }\n function concatUint8Array(a, b) {\n const newUint8Array = new Uint8Array(a.length + b.length);\n newUint8Array.set(a);\n newUint8Array.set(b, a.length);\n return newUint8Array;\n }\n function error(reason) {\n return reset({\n _tag: \"Failure\",\n reason,\n headers: state.headers\n });\n }\n return function write(chunk, start) {\n let endOffset = 0;\n let previousCursor;\n if (state.previousChunk !== undefined) {\n endOffset = state.previousChunk.length;\n previousCursor = endOffset;\n const newChunk = new Uint8Array(chunk.length + endOffset);\n newChunk.set(state.previousChunk);\n newChunk.set(chunk, endOffset);\n state.previousChunk = undefined;\n chunk = newChunk;\n }\n const end = chunk.length;\n outer: while (start < end) {\n if (state.state === State.key) {\n let i = start;\n for (; i < end; i++) {\n if (state.size++ > constMaxSize) {\n return error(\"HeaderTooLarge\");\n }\n if (chunk[i] === 58) {\n state.key += decoder.decode(chunk.subarray(start, i)).toLowerCase();\n if (state.key.length === 0) {\n return error(\"InvalidHeaderName\");\n }\n if (chunk[i + 1] === 32 && chunk[i + 2] !== 32 && chunk[i + 2] !== 9) {\n start = i + 2;\n state.state = State.value;\n state.size++;\n } else if (chunk[i + 1] !== 32 && chunk[i + 1] !== 9) {\n start = i + 1;\n state.state = State.value;\n } else {\n start = i + 1;\n state.state = State.whitespace;\n }\n break;\n } else if (constNameChars[chunk[i]] !== 1) {\n return error(\"InvalidHeaderName\");\n }\n }\n if (i === end) {\n state.key += decoder.decode(chunk.subarray(start, end)).toLowerCase();\n return constContinue;\n }\n }\n if (state.state === State.whitespace) {\n for (; start < end; start++) {\n if (state.size++ > constMaxSize) {\n return error(\"HeaderTooLarge\");\n }\n if (chunk[start] !== 32 && chunk[start] !== 9) {\n state.state = State.value;\n break;\n }\n }\n if (start === end) {\n return constContinue;\n }\n }\n if (state.state === State.value) {\n let i = start;\n if (previousCursor !== undefined) {\n i = previousCursor;\n previousCursor = undefined;\n }\n for (; i < end; i++) {\n if (state.size++ > constMaxSize) {\n return error(\"HeaderTooLarge\");\n }\n if (chunk[i] === 13 || state.crlf > 0) {\n let byte = chunk[i];\n if (byte === 13 && state.crlf === 0) {\n state.crlf = 1;\n i++;\n state.size++;\n byte = chunk[i];\n }\n if (byte === 10 && state.crlf === 1) {\n state.crlf = 2;\n i++;\n state.size++;\n byte = chunk[i];\n }\n if (byte === 13 && state.crlf === 2) {\n state.crlf = 3;\n i++;\n state.size++;\n byte = chunk[i];\n }\n if (byte === 10 && state.crlf === 3) {\n state.crlf = 4;\n i++;\n state.size++;\n }\n if (state.crlf < 4 && i >= end) {\n state.previousChunk = chunk.subarray(start);\n return constContinue;\n } else if (state.crlf >= 2) {\n state.value = state.value === undefined ? chunk.subarray(start, i - state.crlf) : concatUint8Array(state.value, chunk.subarray(start, i - state.crlf));\n const value = decoder.decode(state.value);\n if (state.headers[state.key] === undefined) {\n state.headers[state.key] = value;\n } else if (typeof state.headers[state.key] === \"string\") {\n state.headers[state.key] = [state.headers[state.key], value];\n } else {\n ;\n state.headers[state.key].push(value);\n }\n start = i;\n state.size--;\n if (state.crlf !== 4 && state.pairs === constMaxPairs) {\n return error(\"TooManyHeaders\");\n } else if (state.crlf === 3) {\n return error(\"InvalidHeaderValue\");\n } else if (state.crlf === 4) {\n return reset({\n _tag: \"Headers\",\n headers: state.headers,\n endPosition: start - endOffset\n });\n }\n state.pairs++;\n state.key = \"\";\n state.value = undefined;\n state.crlf = 0;\n state.state = State.key;\n continue outer;\n }\n } else if (constValueChars[chunk[i]] !== 1) {\n return error(\"InvalidHeaderValue\");\n }\n }\n if (i === end) {\n state.value = state.value === undefined ? chunk.subarray(start, end) : concatUint8Array(state.value, chunk.subarray(start, end));\n return constContinue;\n }\n }\n }\n if (start > end) {\n state.size += end - start;\n }\n return constContinue;\n };\n}\n//# sourceMappingURL=headers.js.map","function makeState(needle_) {\n const needle = new TextEncoder().encode(needle_);\n const needleLength = needle.length;\n const indexes = {};\n for (let i = 0; i < needleLength; i++) {\n const b = needle[i];\n if (indexes[b] === undefined) indexes[b] = [];\n indexes[b].push(i);\n }\n return {\n needle,\n needleLength,\n indexes,\n firstByte: needle[0],\n previousChunk: undefined,\n previousChunkLength: 0,\n matchIndex: 0\n };\n}\nexport function make(needle, callback, seed) {\n const state = makeState(needle);\n if (seed !== undefined) {\n state.previousChunk = seed;\n state.previousChunkLength = seed.length;\n }\n function makeIndexOf() {\n // on node.js use the Buffer api\n if (\"Buffer\" in globalThis && !(\"Bun\" in globalThis || \"Deno\" in globalThis)) {\n return function (chunk, needle, fromIndex) {\n return Buffer.prototype.indexOf.call(chunk, needle, fromIndex);\n };\n }\n const skipTable = new Uint8Array(256).fill(state.needle.length);\n for (let i = 0, lastIndex = state.needle.length - 1; i < lastIndex; ++i) {\n skipTable[state.needle[i]] = lastIndex - i;\n }\n return function (chunk, needle, fromIndex) {\n const lengthTotal = chunk.length;\n let i = fromIndex + state.needleLength - 1;\n while (i < lengthTotal) {\n for (let j = state.needleLength - 1, k = i; j >= 0 && chunk[k] === needle[j]; j--, k--) {\n if (j === 0) return k;\n }\n i += skipTable[chunk[i]];\n }\n return -1;\n };\n }\n const indexOf = makeIndexOf();\n function write(chunk) {\n let chunkLength = chunk.length;\n if (state.previousChunk !== undefined) {\n const newChunk = new Uint8Array(state.previousChunkLength + chunkLength);\n newChunk.set(state.previousChunk);\n newChunk.set(chunk, state.previousChunkLength);\n chunk = newChunk;\n chunkLength = state.previousChunkLength + chunkLength;\n state.previousChunk = undefined;\n }\n if (chunkLength < state.needleLength) {\n state.previousChunk = chunk;\n state.previousChunkLength = chunkLength;\n return;\n }\n let pos = 0;\n while (pos < chunkLength) {\n const match = indexOf(chunk, state.needle, pos);\n if (match > -1) {\n if (match > pos) {\n callback(state.matchIndex, chunk.subarray(pos, match));\n }\n state.matchIndex += 1;\n pos = match + state.needleLength;\n continue;\n } else if (chunk[chunkLength - 1] in state.indexes) {\n const indexes = state.indexes[chunk[chunkLength - 1]];\n let earliestIndex = -1;\n for (let i = 0, len = indexes.length; i < len; i++) {\n const index = indexes[i];\n if (chunk[chunkLength - 1 - index] === state.firstByte && i > earliestIndex) {\n earliestIndex = index;\n }\n }\n if (earliestIndex === -1) {\n if (pos === 0) {\n callback(state.matchIndex, chunk);\n } else {\n callback(state.matchIndex, chunk.subarray(pos));\n }\n } else {\n if (chunkLength - 1 - earliestIndex > pos) {\n callback(state.matchIndex, chunk.subarray(pos, chunkLength - 1 - earliestIndex));\n }\n state.previousChunk = chunk.subarray(chunkLength - 1 - earliestIndex);\n state.previousChunkLength = earliestIndex + 1;\n }\n } else if (pos === 0) {\n callback(state.matchIndex, chunk);\n } else {\n callback(state.matchIndex, chunk.subarray(pos));\n }\n break;\n }\n }\n function end() {\n if (state.previousChunk !== undefined && state.previousChunk !== seed) {\n callback(state.matchIndex, state.previousChunk);\n }\n state.previousChunk = seed;\n state.previousChunkLength = seed?.length ?? 0;\n state.matchIndex = 0;\n }\n return {\n write,\n end\n };\n}\n//# sourceMappingURL=search.js.map","import * as CT from \"./contentType.js\";\nimport * as HP from \"./headers.js\";\nimport * as Search from \"./search.js\";\nvar State;\n(function (State) {\n State[State[\"headers\"] = 0] = \"headers\";\n State[State[\"body\"] = 1] = \"body\";\n})(State || (State = {}));\nconst errInvalidDisposition = {\n _tag: \"InvalidDisposition\"\n};\nconst errEndNotReached = {\n _tag: \"EndNotReached\"\n};\nconst errMaxParts = {\n _tag: \"ReachedLimit\",\n limit: \"MaxParts\"\n};\nconst errMaxTotalSize = {\n _tag: \"ReachedLimit\",\n limit: \"MaxTotalSize\"\n};\nconst errMaxPartSize = {\n _tag: \"ReachedLimit\",\n limit: \"MaxPartSize\"\n};\nconst errMaxFieldSize = {\n _tag: \"ReachedLimit\",\n limit: \"MaxFieldSize\"\n};\nconst constCR = /*#__PURE__*/new TextEncoder().encode(\"\\r\\n\");\nexport function defaultIsFile(info) {\n return info.filename !== undefined || info.contentType === \"application/octet-stream\";\n}\nfunction parseBoundary(headers) {\n const contentType = CT.parse(headers[\"content-type\"]);\n return contentType.parameters.boundary;\n}\nfunction noopOnChunk(_chunk) {}\nexport function make({\n headers,\n onFile: onPart,\n onField,\n onError,\n onDone,\n isFile = defaultIsFile,\n maxParts = Infinity,\n maxTotalSize = Infinity,\n maxPartSize = Infinity,\n maxFieldSize = 1024 * 1024\n}) {\n const boundary = parseBoundary(headers);\n if (boundary === undefined) {\n onError({\n _tag: \"InvalidBoundary\"\n });\n return {\n write: noopOnChunk,\n end() {}\n };\n }\n const state = {\n state: State.headers,\n index: 0,\n parts: 0,\n onChunk: noopOnChunk,\n info: undefined,\n headerSkip: 0,\n partSize: 0,\n totalSize: 0,\n isFile: false,\n fieldChunks: [],\n fieldSize: 0\n };\n function skipBody() {\n state.state = State.body;\n state.isFile = true;\n state.onChunk = noopOnChunk;\n }\n const headerParser = HP.make();\n const split = Search.make(`\\r\\n--${boundary}`, function (index, chunk) {\n if (index === 0) {\n // data before the first boundary\n skipBody();\n return;\n } else if (index !== state.index) {\n if (state.index > 0) {\n if (state.isFile) {\n state.onChunk(null);\n state.partSize = 0;\n } else {\n if (state.fieldChunks.length === 1) {\n onField(state.info, state.fieldChunks[0]);\n } else {\n const buf = new Uint8Array(state.fieldSize);\n let offset = 0;\n for (let i = 0; i < state.fieldChunks.length; i++) {\n const chunk = state.fieldChunks[i];\n buf.set(chunk, offset);\n offset += chunk.length;\n }\n onField(state.info, buf);\n }\n state.fieldSize = 0;\n state.fieldChunks = [];\n }\n }\n state.state = State.headers;\n state.index = index;\n state.headerSkip = 2; // skip the first \\r\\n\n // trailing --\n if (chunk[0] === 45 && chunk[1] === 45) {\n return onDone();\n }\n state.parts++;\n if (state.parts > maxParts) {\n onError(errMaxParts);\n }\n }\n if ((state.partSize += chunk.length) > maxPartSize) {\n onError(errMaxPartSize);\n }\n if (state.state === State.headers) {\n const result = headerParser(chunk, state.headerSkip);\n state.headerSkip = 0;\n if (result._tag === \"Continue\") {\n return;\n } else if (result._tag === \"Failure\") {\n skipBody();\n return onError({\n _tag: \"BadHeaders\",\n error: result\n });\n }\n const contentType = CT.parse(result.headers[\"content-type\"]);\n const contentDisposition = CT.parse(result.headers[\"content-disposition\"], true);\n if (\"form-data\" === contentDisposition.value && !(\"name\" in contentDisposition.parameters)) {\n skipBody();\n return onError(errInvalidDisposition);\n }\n let encodedFilename;\n if (\"filename*\" in contentDisposition.parameters) {\n const parts = contentDisposition.parameters[\"filename*\"].split(\"''\");\n if (parts.length === 2) {\n encodedFilename = decodeURIComponent(parts[1]);\n }\n }\n state.info = {\n name: contentDisposition.parameters.name ?? \"\",\n filename: encodedFilename ?? contentDisposition.parameters.filename,\n contentType: contentType.value === \"\" ? contentDisposition.parameters.filename !== undefined ? \"application/octet-stream\" : \"text/plain\" : contentType.value,\n contentTypeParameters: contentType.parameters,\n contentDisposition: contentDisposition.value,\n contentDispositionParameters: contentDisposition.parameters,\n headers: result.headers\n };\n state.state = State.body;\n state.isFile = isFile(state.info);\n if (state.isFile) {\n state.onChunk = onPart(state.info);\n }\n if (result.endPosition < chunk.length) {\n if (state.isFile) {\n state.onChunk(chunk.subarray(result.endPosition));\n } else {\n const buf = chunk.subarray(result.endPosition);\n if ((state.fieldSize += buf.length) > maxFieldSize) {\n onError(errMaxFieldSize);\n }\n state.fieldChunks.push(buf);\n }\n }\n } else if (state.isFile) {\n state.onChunk(chunk);\n } else {\n if ((state.fieldSize += chunk.length) > maxFieldSize) {\n onError(errMaxFieldSize);\n }\n state.fieldChunks.push(chunk);\n }\n }, constCR);\n return {\n write(chunk) {\n if ((state.totalSize += chunk.length) > maxTotalSize) {\n return onError(errMaxTotalSize);\n }\n return split.write(chunk);\n },\n end() {\n split.end();\n if (state.state === State.body) {\n onError(errEndNotReached);\n }\n state.state = State.headers;\n state.index = 0;\n state.parts = 0;\n state.onChunk = noopOnChunk;\n state.info = undefined;\n state.totalSize = 0;\n state.partSize = 0;\n state.fieldChunks = [];\n state.fieldSize = 0;\n }\n };\n}\nconst utf8Decoder = /*#__PURE__*/new TextDecoder(\"utf-8\");\nfunction getDecoder(charset) {\n if (charset === \"utf-8\" || charset === \"utf8\" || charset === \"\") {\n return utf8Decoder;\n }\n try {\n return new TextDecoder(charset);\n } catch (error) {\n return utf8Decoder;\n }\n}\nexport function decodeField(info, value) {\n return getDecoder(info.contentTypeParameters.charset ?? \"utf-8\").decode(value);\n}\n//# sourceMappingURL=multipart.js.map","import * as internal from \"./internal/multipart.js\";\nexport const make = internal.make;\nexport const defaultIsFile = internal.defaultIsFile;\nexport const decodeField = internal.decodeField;\n//# sourceMappingURL=index.js.map","/**\n * Parses and persists HTTP `multipart/form-data` request bodies.\n *\n * `Multipart` turns incoming byte streams into typed form parts. Text parts\n * become decoded fields, while upload parts stay as streamed files until they\n * are collected or written to scoped temporary files. The persisted\n * representation can then be decoded with schemas for handlers that receive\n * fields and uploaded files together. This module also includes multipart error\n * types, schema helpers for persisted files, and parser limit settings.\n *\n * @since 4.0.0\n */\nimport * as Arr from \"../../Array.js\";\nimport * as Cause from \"../../Cause.js\";\nimport * as Channel from \"../../Channel.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Data from \"../../Data.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as ErrorReporter from \"../../ErrorReporter.js\";\nimport * as Exit from \"../../Exit.js\";\nimport * as FileSystem from \"../../FileSystem.js\";\nimport { constant, dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Path from \"../../Path.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Pull from \"../../Pull.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as SchemaTransformation from \"../../SchemaTransformation.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as UndefinedOr from \"../../UndefinedOr.js\";\nimport * as IncomingMessage from \"./HttpIncomingMessage.js\";\nimport * as HttpServerRespondable from \"./HttpServerRespondable.js\";\nimport * as HttpServerResponse from \"./HttpServerResponse.js\";\nimport * as MP from \"./Multipasta.js\";\n/**\n * Type identifier used to brand multipart part values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/http/Multipart\";\n/**\n * Returns `true` when a value is a multipart `Part`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isPart = u => Predicate.hasProperty(u, TypeId);\n/**\n * Returns `true` when a value is a multipart text `Field`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isField = u => isPart(u) && u._tag === \"Field\";\n/**\n * Returns `true` when a value is a multipart `File`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isFile = u => isPart(u) && u._tag === \"File\";\n/**\n * Returns `true` when a value is a persisted multipart file.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isPersistedFile = u => Predicate.hasProperty(u, TypeId) && Predicate.isTagged(u, \"PersistedFile\");\nconst MultipartErrorTypeId = \"~effect/http/Multipart/MultipartError\";\n/**\n * Error reason carried by a `MultipartError`.\n *\n * **Details**\n *\n * It identifies parser and limit failures such as oversized files or fields, too\n * many parts, total body size limits, parse errors, and internal errors.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class MultipartErrorReason extends Data.Error {}\nconst responseStatusByReason = {\n FileTooLarge: 413,\n FieldTooLarge: 413,\n BodyTooLarge: 413,\n TooManyParts: 413,\n InternalError: 500,\n Parse: 400\n};\n/**\n * Error raised while parsing, streaming, or persisting multipart form data.\n *\n * **Details**\n *\n * The `reason` field contains the concrete `MultipartErrorReason`. When used as\n * a server response, parse errors render as `400`, limit errors as `413`, and\n * internal errors as `500`. Multipart errors are ignored by the error reporter.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class MultipartError extends /*#__PURE__*/Data.TaggedError(\"MultipartError\") {\n /**\n * Creates a multipart error from a reason tag and optional cause.\n *\n * @since 4.0.0\n */\n static fromReason(reason, cause) {\n return new MultipartError({\n reason: new MultipartErrorReason({\n _tag: reason,\n cause\n })\n });\n }\n /**\n * Marks this value as a multipart error for runtime guards.\n *\n * @since 4.0.0\n */\n [MultipartErrorTypeId] = MultipartErrorTypeId;\n [ErrorReporter.ignore] = true;\n /**\n * Converts the multipart error into an HTTP response based on its reason.\n *\n * **Details**\n *\n * Parse errors produce `400`, size and part-count limits produce `413`, and\n * internal errors produce `500`.\n *\n * @since 4.0.0\n */\n [HttpServerRespondable.symbol]() {\n return Effect.succeed(HttpServerResponse.empty({\n status: responseStatusByReason[this.reason._tag]\n }));\n }\n /**\n * Uses the concrete multipart error reason as the public message.\n *\n * @since 4.0.0\n */\n get message() {\n return this.reason._tag;\n }\n}\nconst PersistedFileEncoded = /*#__PURE__*/Schema.Struct({\n key: Schema.String,\n name: Schema.String,\n contentType: /*#__PURE__*/Schema.String.annotate({\n contentEncoding: \"binary\"\n }),\n path: Schema.String\n});\n/**\n * Schema for persisted multipart files.\n *\n * **Details**\n *\n * The encoded form contains the field key, original file name, content type, and\n * filesystem path.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const PersistedFileSchema = /*#__PURE__*/Schema.declare(isPersistedFile, {\n representation: {\n id: \"effect/http/PersistedFile\",\n payload: null\n },\n toCode: () => ({\n runtime: \"Multipart.PersistedFileSchema\",\n Type: \"Multipart.PersistedFile\",\n importDeclarations: [`import * as Multipart from \"effect/unstable/http/Multipart\"`]\n }),\n expected: \"PersistedFile\",\n toCodecJson: () => Schema.link()(PersistedFileEncoded, SchemaTransformation.transform({\n decode: ({\n contentType,\n key,\n name,\n path\n }) => new PersistedFileImpl(key, name, contentType, path),\n encode: file => ({\n key: file.key,\n name: file.name,\n contentType: file.contentType,\n path: file.path\n })\n }))\n});\n/**\n * Schema for an array of persisted multipart files.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const FilesSchema = /*#__PURE__*/Schema.Array(PersistedFileSchema);\n/**\n * Schema for exactly one persisted multipart file.\n *\n * **Details**\n *\n * The encoded form is a one-element file array, while the decoded value is the\n * single `PersistedFile`.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const SingleFileSchema = /*#__PURE__*/FilesSchema.check(Schema.isLengthBetween(1, 1)).pipe(/*#__PURE__*/Schema.decodeTo(PersistedFileSchema, /*#__PURE__*/SchemaTransformation.transform({\n decode: ([file]) => file,\n encode: file => [file]\n})));\n/**\n * Creates a decoder for persisted multipart data using the supplied schema.\n *\n * **Details**\n *\n * The returned function decodes an unknown input into the schema output and fails\n * with `SchemaError` when validation fails.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaPersisted = schema => Schema.decodeUnknownEffect(schema);\n/**\n * Creates a decoder for a JSON-encoded field in persisted multipart data.\n *\n * **Details**\n *\n * The selected field is parsed from a JSON string and decoded with the supplied\n * schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaJson = (schema, options) => {\n const fromJson = Schema.fromJsonString(schema);\n return dual(2, (persisted, field) => Effect.map(Schema.decodeUnknownEffect(Schema.Struct({\n [field]: fromJson\n }))(persisted, options), _ => _[field]));\n};\n/**\n * Builds the low-level multipart parser configuration from request headers and\n * the current fiber context.\n *\n * **Details**\n *\n * Parser limits are read from the multipart references, including maximum parts,\n * field size, file size, total body size, and field MIME type overrides.\n *\n * @category configuration\n * @since 4.0.0\n */\nexport const makeConfig = headers => Effect.withFiber(fiber => {\n const mimeTypes = Context.get(fiber.context, FieldMimeTypes);\n return Effect.succeed({\n headers,\n maxParts: fiber.getRef(MaxParts),\n maxFieldSize: Number(fiber.getRef(MaxFieldSize)),\n maxPartSize: UndefinedOr.map(fiber.getRef(MaxFileSize), Number),\n maxTotalSize: UndefinedOr.map(fiber.getRef(IncomingMessage.MaxBodySize), Number),\n isFile: mimeTypes.length === 0 ? undefined : info => !mimeTypes.some(_ => info.contentType.includes(_)) && MP.defaultIsFile(info)\n });\n});\n/**\n * Creates a channel that parses multipart byte chunks into multipart parts.\n *\n * **Details**\n *\n * The channel consumes non-empty batches of `Uint8Array` chunks and emits\n * non-empty batches of parsed `Part` values, failing with `MultipartError` for\n * parser and limit failures.\n *\n * @category parsing\n * @since 4.0.0\n */\nexport const makeChannel = headers => Channel.fromTransform(upstream => Effect.map(makeConfig(headers), config => {\n let partsBuffer = [];\n let exit = Option.none();\n const parser = MP.make({\n ...config,\n onField(info, value) {\n partsBuffer.push(new FieldImpl(info.name, info.contentType, MP.decodeField(info, value)));\n },\n onFile(info) {\n let chunks = [];\n let finished = false;\n const pullChunks = Channel.fromPull(Effect.succeed(Effect.suspend(function loop() {\n if (!Arr.isReadonlyArrayNonEmpty(chunks)) {\n return finished ? Cause.done() : Effect.flatMap(pump, loop);\n }\n const chunk = chunks;\n chunks = [];\n return Effect.succeed(chunk);\n })));\n partsBuffer.push(new FileImpl(info, pullChunks));\n return function (chunk) {\n if (chunk === null) {\n finished = true;\n } else {\n chunks.push(chunk);\n }\n };\n },\n onError(error_) {\n exit = Option.some(Exit.fail(convertError(error_)));\n },\n onDone() {\n if (Option.isNone(exit)) {\n exit = Option.some(Exit.fail(Cause.Done()));\n }\n }\n });\n const pump = upstream.pipe(Effect.flatMap(chunk => {\n for (let i = 0; i < chunk.length; i++) {\n parser.write(chunk[i]);\n }\n return Effect.void;\n }), Effect.catchCause(cause => {\n if (Pull.isDoneCause(cause)) {\n parser.end();\n } else {\n exit = Option.some(Exit.failCause(cause));\n }\n return Effect.void;\n }));\n return pump.pipe(Effect.flatMap(function loop() {\n if (!Arr.isReadonlyArrayNonEmpty(partsBuffer)) {\n if (Option.isSome(exit)) {\n return exit.value;\n }\n return Effect.flatMap(pump, loop);\n }\n const parts = partsBuffer;\n partsBuffer = [];\n return Effect.succeed(parts);\n }));\n}));\nfunction convertError(cause) {\n switch (cause._tag) {\n case \"ReachedLimit\":\n {\n switch (cause.limit) {\n case \"MaxParts\":\n {\n return MultipartError.fromReason(\"TooManyParts\", cause);\n }\n case \"MaxFieldSize\":\n {\n return MultipartError.fromReason(\"FieldTooLarge\", cause);\n }\n case \"MaxPartSize\":\n {\n return MultipartError.fromReason(\"FileTooLarge\", cause);\n }\n case \"MaxTotalSize\":\n {\n return MultipartError.fromReason(\"BodyTooLarge\", cause);\n }\n }\n }\n default:\n {\n return MultipartError.fromReason(\"Parse\", cause);\n }\n }\n}\nclass PartBase extends Inspectable.Class {\n [TypeId];\n constructor() {\n super();\n this[TypeId] = TypeId;\n }\n}\nclass FieldImpl extends PartBase {\n _tag = \"Field\";\n key;\n contentType;\n value;\n constructor(key, contentType, value) {\n super();\n this.key = key;\n this.contentType = contentType;\n this.value = value;\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"Field\",\n key: this.key,\n contentType: this.contentType,\n value: this.value\n };\n }\n}\nclass FileImpl extends PartBase {\n _tag = \"File\";\n key;\n name;\n contentType;\n content;\n contentEffect;\n constructor(info, channel) {\n super();\n this.key = info.name;\n this.name = info.filename ?? info.name;\n this.contentType = info.contentType;\n this.content = Stream.fromChannel(channel);\n this.contentEffect = channel.pipe(collectUint8Array, Effect.mapError(cause => MultipartError.fromReason(\"InternalError\", cause)));\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"File\",\n key: this.key,\n name: this.name,\n contentType: this.contentType\n };\n }\n}\nconst defaultWriteFile = (path, file) => Effect.flatMap(FileSystem.FileSystem, fs => Effect.mapError(Stream.run(file.content, fs.sink(path)), cause => MultipartError.fromReason(\"InternalError\", cause)));\n/**\n * Runs a channel of byte chunks and collects all output into a single\n * `Uint8Array`.\n *\n * **Gotchas**\n *\n * This materializes the full content in memory.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const collectUint8Array = self => Channel.runFold(self, constant(new Uint8Array(0)), (accumulator, chunk) => {\n const totalLength = chunk.reduce((sum, element) => sum + element.length, accumulator.length);\n const newAccumulator = new Uint8Array(totalLength);\n newAccumulator.set(accumulator, 0);\n let offset = accumulator.length;\n for (const element of chunk) {\n newAccumulator.set(element, offset);\n offset += element.length;\n }\n return newAccumulator;\n});\n/**\n * Persists a stream of multipart parts into a record.\n *\n * **Details**\n *\n * Text fields are collected as strings, and file parts are written to files in a\n * scoped temporary directory.\n *\n * **Gotchas**\n *\n * Persisted file paths remain valid for the lifetime of the scope.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toPersisted = (stream, writeFile = defaultWriteFile) => Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path_ = yield* Path.Path;\n const dir = yield* fs.makeTempDirectoryScoped();\n const persisted = Object.create(null);\n yield* Stream.runForEach(stream, part => {\n if (part._tag === \"Field\") {\n if (!(part.key in persisted)) {\n persisted[part.key] = part.value;\n } else if (typeof persisted[part.key] === \"string\") {\n persisted[part.key] = [persisted[part.key], part.value];\n } else {\n ;\n persisted[part.key].push(part.value);\n }\n return Effect.void;\n } else if (part.name === \"\") {\n return Effect.void;\n }\n const file = part;\n const path = path_.join(dir, path_.basename(file.name).slice(-128));\n const filePart = new PersistedFileImpl(file.key, file.name, file.contentType, path);\n if (Array.isArray(persisted[part.key])) {\n ;\n persisted[part.key].push(filePart);\n } else {\n persisted[part.key] = [filePart];\n }\n return writeFile(path, file);\n });\n return persisted;\n}).pipe(Effect.catchTag(\"PlatformError\", cause => Effect.fail(MultipartError.fromReason(\"InternalError\", cause))));\nclass PersistedFileImpl extends PartBase {\n _tag = \"PersistedFile\";\n key;\n name;\n contentType;\n path;\n constructor(key, name, contentType, path) {\n super();\n this.key = key;\n this.name = name;\n this.contentType = contentType;\n this.path = path;\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"PersistedFile\",\n key: this.key,\n name: this.name,\n contentType: this.contentType,\n path: this.path\n };\n }\n}\n/**\n * Creates a context containing multipart parser limit settings.\n *\n * **Details**\n *\n * The context can provide maximum part count, field size, file size, total body\n * size, and MIME types that should be parsed as fields.\n *\n * @category references\n * @since 4.0.0\n */\nexport const limitsServices = options => {\n const map = new Map();\n if (options.maxParts !== undefined) {\n map.set(MaxParts.key, options.maxParts);\n }\n if (options.maxFieldSize !== undefined) {\n map.set(MaxFieldSize.key, FileSystem.Size(options.maxFieldSize));\n }\n if (options.maxFileSize !== undefined) {\n map.set(MaxFileSize.key, UndefinedOr.map(options.maxFileSize, FileSystem.Size));\n }\n if (options.maxTotalSize !== undefined) {\n map.set(IncomingMessage.MaxBodySize.key, UndefinedOr.map(options.maxTotalSize, FileSystem.Size));\n }\n if (options.fieldMimeTypes !== undefined) {\n map.set(FieldMimeTypes.key, options.fieldMimeTypes);\n }\n return Context.makeUnsafe(map);\n};\n/**\n * Context reference for the maximum number of multipart parts allowed.\n *\n * **Details**\n *\n * The default is `undefined`, meaning no explicit part-count limit.\n *\n * @category services\n * @since 4.0.0\n */\nexport const MaxParts = /*#__PURE__*/Context.Reference(\"effect/http/Multipart/MaxParts\", {\n defaultValue: () => undefined\n});\n/**\n * Context reference for the maximum size of a multipart field value.\n *\n * **Details**\n *\n * The default limit is 10 MiB.\n *\n * @category services\n * @since 4.0.0\n */\nexport const MaxFieldSize = /*#__PURE__*/Context.Reference(\"effect/http/Multipart/MaxFieldSize\", {\n defaultValue: /*#__PURE__*/constant(/*#__PURE__*/FileSystem.Size(10 * 1024 * 1024))\n});\n/**\n * Context reference for the maximum size of a multipart file part.\n *\n * **Details**\n *\n * The default is `undefined`, meaning no explicit per-file limit.\n *\n * @category services\n * @since 4.0.0\n */\nexport const MaxFileSize = /*#__PURE__*/Context.Reference(\"effect/http/Multipart/MaxFileSize\", {\n defaultValue: () => undefined\n});\n/**\n * Context reference for MIME type fragments that should be parsed as multipart\n * fields instead of files.\n *\n * **Details**\n *\n * The default treats `application/json` parts as fields.\n *\n * @category services\n * @since 4.0.0\n */\nexport const FieldMimeTypes = /*#__PURE__*/Context.Reference(\"effect/http/Multipart/FieldMimeTypes\", {\n defaultValue: /*#__PURE__*/constant([\"application/json\"])\n});\n//# sourceMappingURL=Multipart.js.map","import * as Channel from \"../../Channel.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as InternalRecord from \"../../internal/record.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Socket from \"../socket/Socket.js\";\nimport * as Cookies from \"./Cookies.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as HttpBody from \"./HttpBody.js\";\nimport * as HttpClientRequest from \"./HttpClientRequest.js\";\nimport * as HttpIncomingMessage from \"./HttpIncomingMessage.js\";\nimport { hasBody } from \"./HttpMethod.js\";\nimport { HttpServerError, RequestParseError } from \"./HttpServerError.js\";\nimport * as Multipart from \"./Multipart.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nexport {\n/**\n * Provides the `MaxBodySize` fiber reference for configuring request body limits.\n *\n * **When to use**\n *\n * Use to configure the maximum body size accepted while reading server\n * request bodies.\n *\n * @category references\n * @since 4.0.0\n */\nMaxBodySize } from \"./HttpIncomingMessage.js\";\n/**\n * Runtime type identifier for `HttpServerRequest` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/http/HttpServerRequest\";\n/**\n * Service tag for the active server-side HTTP request.\n *\n * **When to use**\n *\n * Use to access the request currently being handled by HTTP server routes and\n * middleware.\n *\n * @category services\n * @since 4.0.0\n */\nexport const HttpServerRequest = /*#__PURE__*/Context.Service(\"effect/http/HttpServerRequest\");\n/**\n * Service that contains decoded URL query parameters for the current request.\n *\n * **When to use**\n *\n * Use to access query parameters that have already been parsed for the current\n * server request.\n *\n * **Details**\n *\n * Each key maps to a string value, or to an array when the parameter appears more\n * than once.\n *\n * @category services\n * @since 4.0.0\n */\nexport class ParsedSearchParams extends /*#__PURE__*/Context.Service()(\"effect/http/ParsedSearchParams\") {}\n/**\n * Converts a `URL` object's search parameters into a record.\n *\n * **Details**\n *\n * Repeated parameters are represented as arrays in insertion order.\n *\n * @category parsing\n * @since 4.0.0\n */\nexport const searchParamsFromURL = url => {\n const out = {};\n for (const [key, value] of url.searchParams.entries()) {\n if (Object.hasOwn(out, key)) {\n const entry = out[key];\n if (Array.isArray(entry)) {\n entry.push(value);\n } else {\n InternalRecord.assignProperty(out, key, [entry, value]);\n }\n } else {\n InternalRecord.assignProperty(out, key, value);\n }\n }\n return out;\n};\n/**\n * Creates a channel backed by the current request's upgraded socket.\n *\n * **Details**\n *\n * The channel reads incoming socket messages and writes byte chunks to the\n * socket, failing if the request cannot be upgraded or the socket fails.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const upgradeChannel = () => HttpServerRequest.pipe(Effect.flatMap(_ => _.upgrade), Effect.map(Socket.toChannelWith()), Channel.unwrap);\n/**\n * Decodes a schema from the cookies of the current request.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaCookies = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.flatMap(HttpServerRequest, req => parse(req.cookies, options));\n};\n/**\n * Decodes a schema from the headers of the current request.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaHeaders = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.flatMap(HttpServerRequest, req => parse(req.headers, options));\n};\n/**\n * Decodes a schema from the parsed search parameters of the current request.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaSearchParams = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.flatMap(ParsedSearchParams, params => parse(params, options));\n};\n/**\n * Reads the current request body as JSON and decodes it with the supplied schema.\n *\n * **Details**\n *\n * The effect can fail if the body cannot be read or parsed, or if schema decoding\n * fails.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyJson = (schema, options) => {\n const parse = HttpIncomingMessage.schemaBodyJson(schema, options);\n return Effect.flatMap(HttpServerRequest, parse);\n};\nconst isMultipart = request => request.headers[\"content-type\"]?.toLowerCase().includes(\"multipart/form-data\") === true || getFormDataBody(request) !== undefined;\n/**\n * Decodes the current request body as form data.\n *\n * **Details**\n *\n * Multipart requests are persisted and decoded as multipart data; other form\n * requests are decoded from URL-encoded body parameters.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyForm = (schema, options) => {\n const parseMultipart = Multipart.schemaPersisted(schema);\n const parseUrlParams = HttpIncomingMessage.schemaBodyUrlParams(schema, options);\n return Effect.flatMap(HttpServerRequest, request => {\n if (isMultipart(request)) {\n return Effect.flatMap(request.multipart, _ => parseMultipart(_, options));\n }\n return parseUrlParams(request);\n });\n};\n/**\n * Reads the current request body as URL-encoded parameters and decodes them with\n * the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyUrlParams = (schema, options) => {\n const parse = HttpIncomingMessage.schemaBodyUrlParams(schema, options);\n return Effect.flatMap(HttpServerRequest, parse);\n};\n/**\n * Persists the current multipart request body and decodes it with the supplied\n * schema.\n *\n * **Details**\n *\n * The effect requires the services needed to persist multipart files, including a\n * scope, file system, and path service.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyMultipart = (schema, options) => {\n const parse = Multipart.schemaPersisted(schema);\n return HttpServerRequest.pipe(Effect.flatMap(_ => _.multipart), Effect.flatMap(_ => parse(_, options)));\n};\n/**\n * Creates a decoder for a JSON value stored in a form field.\n *\n * **Details**\n *\n * For multipart requests, the named multipart field is decoded as JSON. For\n * URL-encoded requests, the named parameter is decoded as JSON and then decoded\n * with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyFormJson = (schema, options) => {\n const parseMultipart = Multipart.schemaJson(schema, options);\n return field => {\n const parseUrlParams = UrlParams.schemaJsonField(field).pipe(Schema.decodeTo(schema), Schema.decodeEffect);\n return Effect.flatMap(HttpServerRequest, request => {\n if (isMultipart(request)) {\n return Effect.flatMap(Effect.mapError(request.multipart, cause => new HttpServerError({\n reason: new RequestParseError({\n request,\n cause\n })\n })), parseMultipart(field));\n }\n return Effect.flatMap(request.urlParamsBody, _ => parseUrlParams(_, options));\n });\n };\n};\n/**\n * Creates an `HttpServerRequest` view of an `HttpClientRequest`.\n *\n * **Details**\n *\n * If the client request can be converted to an absolute URL, that URL is used as\n * the original URL.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromClientRequest = request => {\n const url = Option.match(HttpClientRequest.toUrl(request), {\n onNone: () => request.url,\n onSome: url => url.toString()\n });\n return new ClientRequestImpl(request, url);\n};\n/**\n * Wraps a Web `Request` as an `HttpServerRequest`.\n *\n * **Details**\n *\n * The request's current URL is stored without the scheme and host, while the\n * original Web URL remains available as `originalUrl`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromWeb = request => new ServerRequestImpl(request, removeHost(request.url));\n/**\n * Converts an `HttpServerRequest` into an `HttpClientRequest`.\n *\n * **Details**\n *\n * The converted request preserves the method, headers, body stream, and a URL\n * derived from the request when possible.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toClientRequest = request => HttpClientRequest.setUrl(HttpClientRequest.makeWith(request.method, \"\", UrlParams.empty, Option.none(), request.headers, toClientBody(request)), Option.getOrElse(toURL(request), () => request.url));\nconst toClientBody = request => hasBody(request.method) ? HttpBody.stream(request.stream, request.headers[\"content-type\"], parseContentLength(request.headers[\"content-length\"])) : HttpBody.empty;\nconst parseContentLength = contentLength => {\n if (contentLength === undefined) {\n return undefined;\n }\n const parsed = Number.parseInt(contentLength, 10);\n return Number.isNaN(parsed) ? undefined : parsed;\n};\nconst removeHost = url => {\n if (url[0] === \"/\") {\n return url;\n }\n const index = url.indexOf(\"/\", url.indexOf(\"//\") + 2);\n return index === -1 ? \"/\" : url.slice(index);\n};\nclass ServerRequestImpl extends Inspectable.Class {\n [TypeId];\n [HttpIncomingMessage.TypeId];\n source;\n url;\n headersOverride;\n remoteAddressOverride;\n constructor(source, url, headersOverride, remoteAddressOverride) {\n super();\n this[TypeId] = TypeId;\n this[HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n this.source = source;\n this.url = url;\n this.headersOverride = headersOverride;\n this.remoteAddressOverride = remoteAddressOverride;\n }\n toJSON() {\n return HttpIncomingMessage.inspect(this, {\n _id: \"HttpServerRequest\",\n method: this.method,\n url: this.originalUrl\n });\n }\n modify(options) {\n return new ServerRequestImpl(this.source, options.url ?? this.url, options.headers ?? this.headersOverride, \"remoteAddress\" in options ? options.remoteAddress : this.remoteAddressOverride);\n }\n get method() {\n return this.source.method.toUpperCase();\n }\n get originalUrl() {\n return this.source.url;\n }\n get remoteAddress() {\n return this.remoteAddressOverride ?? Option.none();\n }\n get headers() {\n this.headersOverride ??= Headers.fromInput(this.source.headers);\n return this.headersOverride;\n }\n cachedCookies;\n get cookies() {\n if (this.cachedCookies) {\n return this.cachedCookies;\n }\n return this.cachedCookies = Cookies.parseHeader(this.headers.cookie ?? \"\");\n }\n get stream() {\n return this.source.body ? Stream.fromReadableStream({\n evaluate: () => this.source.body,\n onError: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n }) : Stream.fail(new HttpServerError({\n reason: new RequestParseError({\n request: this,\n description: \"can not create stream from empty body\"\n })\n }));\n }\n textEffect;\n get text() {\n if (this.textEffect) {\n return this.textEffect;\n }\n this.textEffect = Effect.runSync(Effect.cached(Effect.tryPromise({\n try: () => this.source.text(),\n catch: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n })));\n return this.textEffect;\n }\n get json() {\n return Effect.flatMap(this.text, text => Effect.try({\n try: () => JSON.parse(text),\n catch: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n }));\n }\n get urlParamsBody() {\n return Effect.flatMap(this.text, _ => Effect.try({\n try: () => UrlParams.fromInput(new URLSearchParams(_)),\n catch: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n }));\n }\n multipartEffect;\n get multipart() {\n if (this.multipartEffect) {\n return this.multipartEffect;\n }\n this.multipartEffect = Effect.runSync(Effect.cached(Multipart.toPersisted(this.multipartStream)));\n return this.multipartEffect;\n }\n get multipartStream() {\n return Stream.pipeThroughChannel(Stream.mapError(this.stream, cause => Multipart.MultipartError.fromReason(\"InternalError\", cause)), Multipart.makeChannel(this.headers));\n }\n arrayBufferEffect;\n get arrayBuffer() {\n if (this.arrayBufferEffect) {\n return this.arrayBufferEffect;\n }\n this.arrayBufferEffect = Effect.runSync(Effect.cached(Effect.tryPromise({\n try: () => this.source.arrayBuffer(),\n catch: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n })));\n return this.arrayBufferEffect;\n }\n get upgrade() {\n return Effect.fail(new HttpServerError({\n reason: new RequestParseError({\n request: this,\n description: \"Not an upgradeable ServerRequest\"\n })\n }));\n }\n}\nclass ClientRequestImpl extends Inspectable.Class {\n [TypeId];\n [HttpIncomingMessage.TypeId];\n source;\n originalUrl;\n headersOverride;\n remoteAddressOverride;\n urlOverride;\n constructor(source, originalUrl, urlOverride, headersOverride, remoteAddressOverride) {\n super();\n this[TypeId] = TypeId;\n this[HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n this.source = source;\n this.originalUrl = originalUrl;\n this.urlOverride = urlOverride;\n this.headersOverride = headersOverride;\n this.remoteAddressOverride = remoteAddressOverride;\n }\n toJSON() {\n return HttpIncomingMessage.inspect(this, {\n _id: \"HttpServerRequest\",\n method: this.method,\n url: this.originalUrl\n });\n }\n modify(options) {\n return new ClientRequestImpl(this.source, this.originalUrl, options.url ?? this.url, options.headers ?? this.headersOverride, \"remoteAddress\" in options ? options.remoteAddress : this.remoteAddressOverride);\n }\n get method() {\n return this.source.method;\n }\n get url() {\n return this.urlOverride ?? removeHost(this.originalUrl);\n }\n get remoteAddress() {\n return this.remoteAddressOverride ?? Option.none();\n }\n get headers() {\n return this.headersOverride ??= this.source.headers;\n }\n cachedCookies;\n get cookies() {\n if (this.cachedCookies) {\n return this.cachedCookies;\n }\n return this.cachedCookies = Cookies.parseHeader(this.headers.cookie ?? \"\");\n }\n get stream() {\n const body = this.source.body;\n switch (body._tag) {\n case \"Empty\":\n {\n return Stream.empty;\n }\n case \"Uint8Array\":\n {\n return Stream.succeed(body.body);\n }\n case \"Stream\":\n {\n return Stream.mapError(body.stream, cause => requestParseError(this, undefined, cause));\n }\n case \"FormData\":\n {\n return streamFromReadable(this, new Response(body.formData).body);\n }\n case \"Raw\":\n {\n return rawBodyStream(this, body.body);\n }\n }\n }\n bytesEffect;\n get bytes() {\n if (this.bytesEffect) {\n return this.bytesEffect;\n }\n const body = this.source.body;\n let effect;\n switch (body._tag) {\n case \"Empty\":\n {\n effect = Effect.succeed(new Uint8Array(0));\n break;\n }\n case \"Uint8Array\":\n {\n effect = Effect.succeed(body.body);\n break;\n }\n case \"FormData\":\n {\n effect = bytesFromBodyInit(this, body.formData);\n break;\n }\n case \"Stream\":\n {\n effect = Stream.mkUint8Array(this.stream);\n break;\n }\n case \"Raw\":\n {\n effect = rawBodyBytes(this, body.body);\n break;\n }\n }\n this.bytesEffect = Effect.runSync(Effect.cached(effect));\n return this.bytesEffect;\n }\n get text() {\n return Effect.map(this.bytes, bytes => textDecoder.decode(bytes));\n }\n get json() {\n return Effect.flatMap(this.text, text => Effect.try({\n try: () => text === \"\" ? null : JSON.parse(text),\n catch: cause => requestParseError(this, undefined, cause)\n }));\n }\n get urlParamsBody() {\n return Effect.flatMap(this.text, _ => Effect.try({\n try: () => UrlParams.fromInput(new URLSearchParams(_)),\n catch: cause => requestParseError(this, undefined, cause)\n }));\n }\n multipartEffect;\n get multipart() {\n if (this.multipartEffect) {\n return this.multipartEffect;\n }\n this.multipartEffect = Effect.runSync(Effect.cached(Multipart.toPersisted(this.multipartStream)));\n return this.multipartEffect;\n }\n get multipartStream() {\n const formData = this.source.body._tag === \"FormData\" && this.source.body.formData;\n if (formData) {\n return Stream.fromIterable(formDataToParts(formData));\n }\n return Stream.pipeThroughChannel(Stream.mapError(this.stream, cause => Multipart.MultipartError.fromReason(\"InternalError\", cause)), Multipart.makeChannel(this.headers));\n }\n get arrayBuffer() {\n return Effect.map(this.bytes, bytes => bytes.slice().buffer);\n }\n get upgrade() {\n return Effect.fail(requestParseError(this, \"Not an upgradeable ServerRequest\"));\n }\n}\nconst getFormDataBody = request => {\n if (!HttpClientRequest.isHttpClientRequest(request.source)) {\n return undefined;\n }\n const body = request.source.body;\n if (body._tag === \"FormData\") {\n return body.formData;\n }\n if (body._tag === \"Raw\" && isFormData(body.body)) {\n return body.body;\n }\n return undefined;\n};\nconst rawBodyStream = (request, body) => {\n if (body instanceof Request) {\n return streamFromReadable(request, body.body);\n }\n if (isFormData(body)) {\n return streamFromReadable(request, new Response(body).body);\n }\n if (isReadableStream(body)) {\n return streamFromReadable(request, body);\n }\n return Stream.fail(requestParseError(request, \"Unsupported body type\"));\n};\nconst rawBodyBytes = (request, body) => {\n if (body instanceof Blob) {\n return bytesFromBodyInit(request, body);\n }\n if (body instanceof Request) {\n return Effect.tryPromise({\n try: () => body.arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => requestParseError(request, undefined, cause)\n });\n }\n return Effect.fail(requestParseError(request, \"Unsupported body type\"));\n};\nconst bytesFromBodyInit = (request, body) => Effect.tryPromise({\n try: () => new Response(body).arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => requestParseError(request, undefined, cause)\n});\nconst streamFromReadable = (request, body) => body ? Stream.fromReadableStream({\n evaluate: () => body,\n onError: cause => requestParseError(request, undefined, cause)\n}) : Stream.empty;\nconst requestParseError = (request, description, cause) => new HttpServerError({\n reason: new RequestParseError({\n request,\n ...(description === undefined ? undefined : {\n description\n }),\n ...(cause === undefined ? undefined : {\n cause\n })\n })\n});\nconst formDataToParts = formData => {\n const parts = [];\n for (const [key, value] of formData.entries()) {\n parts.push(typeof value === \"string\" ? new MultipartFieldPart(key, value) : new MultipartFilePart(key, value));\n }\n return parts;\n};\nclass MultipartFieldPart extends Inspectable.Class {\n [Multipart.TypeId];\n _tag = \"Field\";\n contentType = \"text/plain\";\n key;\n value;\n constructor(key, value) {\n super();\n this[Multipart.TypeId] = Multipart.TypeId;\n this.key = key;\n this.value = value;\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"Field\",\n key: this.key,\n contentType: this.contentType,\n value: this.value\n };\n }\n}\nclass MultipartFilePart extends Inspectable.Class {\n [Multipart.TypeId];\n _tag = \"File\";\n key;\n name;\n contentType;\n content;\n contentEffect;\n constructor(key, file) {\n super();\n this[Multipart.TypeId] = Multipart.TypeId;\n this.key = key;\n this.name = file.name;\n this.contentType = file.type;\n this.content = Stream.fromReadableStream({\n evaluate: () => file.stream(),\n onError: cause => Multipart.MultipartError.fromReason(\"InternalError\", cause)\n });\n this.contentEffect = Effect.tryPromise({\n try: () => file.arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => Multipart.MultipartError.fromReason(\"InternalError\", cause)\n });\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"File\",\n key: this.key,\n name: this.name,\n contentType: this.contentType\n };\n }\n}\nconst isReadableStream = u => typeof ReadableStream !== \"undefined\" && u instanceof ReadableStream;\nconst isFormData = u => typeof FormData !== \"undefined\" && u instanceof FormData;\nconst textDecoder = /*#__PURE__*/new TextDecoder();\n/**\n * Attempts to construct an absolute `URL` for a server request safely.\n *\n * **Details**\n *\n * The host comes from the `host` header, defaulting to `localhost`, and the\n * protocol is `https` only when `x-forwarded-proto` is `https`; invalid URLs\n * return `Option.none`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toURL = self => {\n const host = self.headers.host ?? \"localhost\";\n const protocol = self.headers[\"x-forwarded-proto\"] === \"https\" ? \"https\" : \"http\";\n try {\n return Option.some(new URL(self.url, `${protocol}://${host}`));\n } catch {\n return Option.none();\n }\n};\n/**\n * Converts an `HttpServerRequest` safely to a Web `Request` as a `Result`.\n *\n * **Details**\n *\n * If the source is already a Web `Request`, it is returned unchanged. Otherwise\n * an absolute URL is derived from the request; invalid URLs fail with a\n * `RequestParseError`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebResult = (self, options) => {\n if (self.source instanceof Request) {\n return Result.succeed(self.source);\n }\n const url = toURL(self);\n if (Option.isNone(url)) {\n return Result.fail(new RequestParseError({\n request: self,\n description: \"Invalid URL\"\n }));\n }\n const requestInit = {\n method: self.method,\n headers: self.headers\n };\n if (options?.signal) {\n requestInit.signal = options.signal;\n }\n if (hasBody(self.method)) {\n requestInit.body = Stream.toReadableStreamWith(self.stream, options?.context ?? Context.empty());\n requestInit.duplex = \"half\";\n }\n return Result.succeed(new Request(url.value, requestInit));\n};\n/**\n * Converts an `HttpServerRequest` to a Web `Request` in `Effect`.\n *\n * **Details**\n *\n * The current context is used when streaming the request body into the Web\n * request.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWeb = (self, options) => Effect.contextWith(context => Effect.fromResult(toWebResult(self, {\n context,\n signal: options?.signal\n})));\n//# sourceMappingURL=HttpServerRequest.js.map","/**\n * HTTP propagation helpers for Effect tracing context.\n *\n * This module converts Effect `Tracer.Span` values into outbound trace headers\n * and decodes inbound propagation headers into `Tracer.ExternalSpan` parents.\n * HTTP clients use it to continue the current span across outgoing requests, and\n * server middleware uses it to parent request spans from upstream services.\n *\n * @since 4.0.0\n */\nimport * as Option from \"../../Option.js\";\nimport * as Tracer from \"../../Tracer.js\";\nimport * as Headers from \"./Headers.js\";\n/**\n * Encodes a span into HTTP trace propagation headers.\n *\n * **Details**\n *\n * The generated headers include both compact B3 (`b3`) and W3C `traceparent`\n * formats.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toHeaders = span => Headers.fromRecordUnsafe({\n b3: `${span.traceId}-${span.spanId}-${span.sampled ? \"1\" : \"0\"}${Option.match(span.parent, {\n onNone: () => \"\",\n onSome: parent => `-${parent.spanId}`\n })}`,\n traceparent: `00-${span.traceId}-${span.spanId}-${span.sampled ? \"01\" : \"00\"}`\n});\n/**\n * Decodes an external span safely from HTTP trace propagation headers.\n *\n * **Details**\n *\n * W3C `traceparent` is tried first, followed by compact B3 (`b3`) and then\n * multi-header B3 (`x-b3-*`).\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const fromHeaders = headers => {\n let span = w3c(headers);\n if (Option.isSome(span)) {\n return span;\n }\n span = b3(headers);\n if (Option.isSome(span)) {\n return span;\n }\n return xb3(headers);\n};\n/**\n * Decodes an external span safely from the compact B3 `b3` header.\n *\n * **Details**\n *\n * Returns `Option.none` when the header is missing or does not contain trace and\n * span identifiers.\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const b3 = headers => {\n if (!(\"b3\" in headers)) {\n return Option.none();\n }\n const parts = headers[\"b3\"].split(\"-\");\n if (parts.length < 2) {\n return Option.none();\n }\n return Option.some(Tracer.externalSpan({\n traceId: parts[0],\n spanId: parts[1],\n sampled: parts[2] ? parts[2] === \"1\" : true\n }));\n};\n/**\n * Decodes an external span safely from multi-header B3 propagation headers.\n *\n * **Details**\n *\n * The decoder reads `x-b3-traceid`, `x-b3-spanid`, and optional `x-b3-sampled`\n * headers.\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const xb3 = headers => {\n if (!headers[\"x-b3-traceid\"] || !headers[\"x-b3-spanid\"]) {\n return Option.none();\n }\n return Option.some(Tracer.externalSpan({\n traceId: headers[\"x-b3-traceid\"],\n spanId: headers[\"x-b3-spanid\"],\n sampled: headers[\"x-b3-sampled\"] ? headers[\"x-b3-sampled\"] === \"1\" : true\n }));\n};\nconst w3cTraceId = /^[0-9a-f]{32}$/i;\nconst w3cSpanId = /^[0-9a-f]{16}$/i;\n/**\n * Decodes an external span safely from the W3C `traceparent` header.\n *\n * **Details**\n *\n * Only version `00` headers with valid trace and span identifiers are accepted.\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const w3c = headers => {\n if (!headers[\"traceparent\"]) {\n return Option.none();\n }\n const parts = headers[\"traceparent\"].split(\"-\");\n if (parts.length !== 4) {\n return Option.none();\n }\n const [version, traceId, spanId, flags] = parts;\n switch (version) {\n case \"00\":\n {\n if (w3cTraceId.test(traceId) === false || w3cSpanId.test(spanId) === false) {\n return Option.none();\n }\n return Option.some(Tracer.externalSpan({\n traceId,\n spanId,\n sampled: (parseInt(flags, 16) & 1) === 1\n }));\n }\n default:\n {\n return Option.none();\n }\n }\n};\n//# sourceMappingURL=HttpTraceContext.js.map","import * as Effect from \"../../../Effect.js\";\n/** @internal */\nexport const requestPreResponseHandlers = /*#__PURE__*/new WeakMap();\n/** @internal */\nexport const appendPreResponseHandlerUnsafe = (request, handler) => {\n const prev = requestPreResponseHandlers.get(request.source);\n const next = prev ? (request, response) => Effect.flatMap(prev(request, response), response => handler(request, response)) : handler;\n requestPreResponseHandlers.set(request.source, next);\n};\n//# sourceMappingURL=preResponseHandler.js.map","/**\n * Wraps HTTP server apps with request and response behavior.\n *\n * A middleware is a function from one HTTP server app effect to another. The app\n * runs with the current `HttpServerRequest` in its context, so middleware can\n * inspect or rewrite the request, provide request-scoped services, attach hooks\n * before the response is sent, or observe the app exit. This module includes\n * middleware for response logging, server tracing, forwarded proxy headers,\n * parsed search parameters, and CORS response headers.\n *\n * @since 4.0.0\n */\nimport { Clock } from \"../../Clock.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Exit from \"../../Exit.js\";\nimport { constant, constFalse } from \"../../Function.js\";\nimport * as internalEffect from \"../../internal/effect.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\nimport { TracerEnabled } from \"../../References.js\";\nimport { ParentSpan } from \"../../Tracer.js\";\nimport * as Headers from \"./Headers.js\";\nimport { HttpPlatform } from \"./HttpPlatform.js\";\nimport { causeResponseStripped } from \"./HttpServerError.js\";\nimport { HttpServerRequest } from \"./HttpServerRequest.js\";\nimport * as Request from \"./HttpServerRequest.js\";\nimport * as Response from \"./HttpServerResponse.js\";\nimport * as TraceContext from \"./HttpTraceContext.js\";\nimport * as compressionInternal from \"./internal/compression.js\";\nimport { appendPreResponseHandlerUnsafe } from \"./internal/preResponseHandler.js\";\n/**\n * Defines an `HttpMiddleware` while preserving its precise type.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = middleware => middleware;\nconst loggerDisabledRequests = /*#__PURE__*/new WeakSet();\nconst stripSearchAndHash = url => {\n const queryIndex = url.indexOf(\"?\");\n const hashIndex = url.indexOf(\"#\");\n if (queryIndex === -1) {\n return hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n if (hashIndex === -1) {\n return url.slice(0, queryIndex);\n }\n return url.slice(0, Math.min(queryIndex, hashIndex));\n};\n/**\n * Runs an effect with HTTP response logging disabled for the current server request.\n *\n * @category logging\n * @since 4.0.0\n */\nexport const withLoggerDisabled = self => Effect.withFiber(fiber => {\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n loggerDisabledRequests.add(request.source);\n return self;\n});\n/**\n * Context reference for a predicate that disables server-side tracing for matching requests.\n *\n * @category services\n * @since 4.0.0\n */\nexport const TracerDisabledWhen = /*#__PURE__*/Context.Reference(\"effect/http/HttpMiddleware/TracerDisabledWhen\", {\n defaultValue: () => constFalse\n});\n/**\n * Creates a layer that disables server-side tracing for requests whose URL exactly matches one of the supplied URLs.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerTracerDisabledForUrls = urls => Layer.succeed(TracerDisabledWhen)(req => urls.includes(req.url));\n/**\n * Context reference for generating server span names from HTTP server requests.\n *\n * @category services\n * @since 4.0.0\n */\nexport const SpanNameGenerator = /*#__PURE__*/Context.Reference(\"@effect/platform/HttpMiddleware/SpanNameGenerator\", {\n defaultValue: () => request => `http.server ${request.method}`\n});\n/**\n * Middleware that logs sent HTTP responses with request method, request URL, and response status annotations.\n *\n * @category logging\n * @since 4.0.0\n */\nexport const logger = /*#__PURE__*/make(httpApp => Effect.withFiber(fiber => {\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const path = stripSearchAndHash(request.url);\n return Effect.withLogSpan(Effect.flatMap(Effect.exit(httpApp), exit => {\n if (loggerDisabledRequests.has(request.source)) {\n return exit;\n } else if (exit._tag === \"Failure\") {\n const [response, cause] = causeResponseStripped(exit.cause);\n return Effect.andThen(Effect.annotateLogs(Effect.log(Option.getOrElse(cause, () => \"Sent HTTP Response\")), {\n \"http.method\": request.method,\n \"http.url\": path,\n \"http.status\": response.status\n }), exit);\n }\n return Effect.andThen(Effect.annotateLogs(Effect.log(\"Sent HTTP response\"), {\n \"http.method\": request.method,\n \"http.url\": path,\n \"http.status\": exit.value.status\n }), exit);\n }), \"http.span\");\n}));\n/**\n * Middleware that creates a server trace span for each request and records request and response HTTP attributes.\n *\n * @category tracing\n * @since 4.0.0\n */\nexport const tracer = /*#__PURE__*/make(httpApp => Effect.withFiber(fiber => {\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const disabled = !fiber.getRef(TracerEnabled) || fiber.getRef(TracerDisabledWhen)(request);\n if (disabled) {\n return httpApp;\n }\n const nameGenerator = fiber.getRef(SpanNameGenerator);\n const span = internalEffect.makeSpanUnsafe(fiber, nameGenerator(request), {\n parent: Option.getOrUndefined(TraceContext.fromHeaders(request.headers)),\n kind: \"server\"\n });\n const prevServices = fiber.context;\n fiber.setContext(Context.add(fiber.context, ParentSpan, span));\n return Effect.onExitPrimitive(httpApp, exit => {\n fiber.setContext(prevServices);\n const endTime = fiber.getRef(Clock).currentTimeNanosUnsafe();\n fiber.currentDispatcher.scheduleTask(() => {\n let response;\n let spanExit = exit;\n if (Exit.isFailure(exit)) {\n const [failureResponse, cause] = causeResponseStripped(exit.cause);\n response = failureResponse;\n spanExit = Option.isSome(cause) ? Exit.failCause(cause.value) : Exit.succeed(response);\n } else {\n response = exit.value;\n }\n if (span.sampled) {\n const url = Request.toURL(request);\n if (Option.isSome(url) && (url.value.username !== \"\" || url.value.password !== \"\")) {\n url.value.username = \"REDACTED\";\n url.value.password = \"REDACTED\";\n }\n const redactedHeaderNames = fiber.getRef(Headers.CurrentRedactedNames);\n const requestHeaders = Headers.redact(request.headers, redactedHeaderNames);\n span.attribute(\"http.request.method\", request.method);\n if (Option.isSome(url)) {\n span.attribute(\"url.full\", url.value.toString());\n span.attribute(\"url.path\", url.value.pathname);\n const query = url.value.search.slice(1);\n if (query !== \"\") {\n span.attribute(\"url.query\", url.value.search.slice(1));\n }\n span.attribute(\"url.scheme\", url.value.protocol.slice(0, -1));\n }\n if (request.headers[\"user-agent\"] !== undefined) {\n span.attribute(\"user_agent.original\", request.headers[\"user-agent\"]);\n }\n for (const name in requestHeaders) {\n span.attribute(`http.request.header.${name}`, String(requestHeaders[name]));\n }\n if (Option.isSome(request.remoteAddress)) {\n span.attribute(\"client.address\", request.remoteAddress.value);\n }\n span.attribute(\"http.response.status_code\", response.status);\n const responseHeaders = Headers.redact(response.headers, redactedHeaderNames);\n for (const name in responseHeaders) {\n span.attribute(`http.response.header.${name}`, String(responseHeaders[name]));\n }\n }\n span.end(endTime, spanExit);\n }, 0);\n return undefined;\n }, true);\n}));\n/**\n * Middleware that trusts `X-Forwarded-Host` and `X-Forwarded-For`, updating the request host header and remote address.\n *\n * @category proxying\n * @since 4.0.0\n */\nexport const xForwardedHeaders = /*#__PURE__*/make(httpApp => Effect.updateService(httpApp, HttpServerRequest, request => request.headers[\"x-forwarded-host\"] ? request.modify({\n headers: Headers.set(request.headers, \"host\", request.headers[\"x-forwarded-host\"]),\n remoteAddress: Option.fromNullishOr(request.headers[\"x-forwarded-for\"]?.split(\",\")[0].trim())\n}) : request));\n/**\n * Middleware that parses the current request URL's search parameters and provides them as `ParsedSearchParams`.\n *\n * @category parsing\n * @since 4.0.0\n */\nexport const searchParamsParser = httpApp => Effect.withFiber(fiber => {\n const services = fiber.context;\n const request = Context.getUnsafe(services, HttpServerRequest);\n const params = Request.searchParamsFromURL(new URL(request.originalUrl));\n return Effect.provideService(httpApp, Request.ParsedSearchParams, params);\n});\n/**\n * Middleware that handles CORS preflight requests and adds configured CORS headers to HTTP responses.\n *\n * @category middleware\n * @since 4.0.0\n */\nexport const cors = options => {\n const opts = {\n allowedOrigins: options?.allowedOrigins ?? [],\n allowedMethods: options?.allowedMethods ?? [\"GET\", \"HEAD\", \"PUT\", \"PATCH\", \"POST\", \"DELETE\"],\n allowedHeaders: options?.allowedHeaders ?? [],\n exposedHeaders: options?.exposedHeaders ?? [],\n credentials: options?.credentials ?? false,\n maxAge: options?.maxAge\n };\n const isAllowedOrigin = typeof opts.allowedOrigins === \"function\" ? opts.allowedOrigins : origin => opts.allowedOrigins.includes(origin);\n const allowOrigin = typeof opts.allowedOrigins === \"function\" || opts.allowedOrigins.length > 1 ? originHeader => {\n if (!isAllowedOrigin(originHeader)) return undefined;\n return {\n \"access-control-allow-origin\": originHeader,\n vary: \"Origin\"\n };\n } : opts.allowedOrigins.length === 0 ? constant({\n \"access-control-allow-origin\": \"*\"\n }) : constant({\n \"access-control-allow-origin\": opts.allowedOrigins[0],\n vary: \"Origin\"\n });\n const allowMethods = opts.allowedMethods.length > 0 ? {\n \"access-control-allow-methods\": opts.allowedMethods.join(\", \")\n } : undefined;\n const allowCredentials = opts.credentials ? {\n \"access-control-allow-credentials\": \"true\"\n } : undefined;\n const allowHeaders = accessControlRequestHeaders => {\n if (opts.allowedHeaders.length === 0 && accessControlRequestHeaders) {\n return {\n vary: \"Access-Control-Request-Headers\",\n \"access-control-allow-headers\": accessControlRequestHeaders\n };\n }\n if (opts.allowedHeaders) {\n return {\n \"access-control-allow-headers\": opts.allowedHeaders.join(\",\")\n };\n }\n return undefined;\n };\n const exposeHeaders = opts.exposedHeaders.length > 0 ? {\n \"access-control-expose-headers\": opts.exposedHeaders.join(\",\")\n } : undefined;\n const maxAge = opts.maxAge ? {\n \"access-control-max-age\": opts.maxAge.toString()\n } : undefined;\n const headersFromRequest = request => {\n const origin = request.headers[\"origin\"];\n return Headers.fromRecordUnsafe({\n ...allowOrigin(origin),\n ...allowCredentials,\n ...exposeHeaders\n });\n };\n const headersFromRequestOptions = request => {\n const origin = request.headers[\"origin\"];\n const accessControlRequestHeaders = request.headers[\"access-control-request-headers\"];\n return Headers.fromRecordUnsafe({\n ...allowOrigin(origin),\n ...allowCredentials,\n ...exposeHeaders,\n ...allowMethods,\n ...allowHeaders(accessControlRequestHeaders),\n ...maxAge\n });\n };\n const preResponseHandler = (request, response) => Effect.succeed(Response.setHeaders(response, headersFromRequest(request)));\n return httpApp => Effect.withFiber(fiber => {\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n if (request.method === \"OPTIONS\") {\n return Effect.succeed(Response.empty({\n status: 204,\n headers: headersFromRequestOptions(request)\n }));\n }\n appendPreResponseHandlerUnsafe(request, preResponseHandler);\n return httpApp;\n });\n};\n/**\n * Middleware that compresses HTTP response bodies based on the request's\n * `Accept-Encoding` header.\n *\n * **Details**\n *\n * Content negotiation follows RFC 9110: the first algorithm in server\n * preference order that the client accepts with a positive q-value and the\n * platform supports is used. When no algorithm is acceptable the response is\n * sent uncompressed.\n *\n * The body transform is performed by the `HttpPlatform` service.\n *\n * Responses are skipped when the status is 1xx, 204, 206, or 304, when a\n * `Content-Encoding` is already present, when `Cache-Control: no-transform`\n * is set, when the content type is absent or not compressible, when a known\n * body length is below `minSize`, or when the body is empty or `FormData`. A\n * response carrying `Content-Encoding: identity` opts out of compression and\n * has the header stripped before sending.\n *\n * `Vary: Accept-Encoding` is set on every response that was eligible by\n * status and content type, including ones skipped by negotiation or\n * `minSize`.\n *\n * Do not combine this middleware with Deno's automatic response compression.\n * On edge runtimes that already apply automatic compression, the middleware\n * is unnecessary. Platforms backed by Web `CompressionStream` also cannot\n * explicitly flush each input chunk, so incremental delivery depends on the\n * runtime's implementation.\n *\n * **Security**\n *\n * Compression can expose secrets through BREACH-style attacks when one\n * response contains both secret data and attacker-controlled input and an\n * attacker can observe the compressed response length. For affected routes,\n * disable compression with `Content-Encoding: identity` or\n * `Cache-Control: no-transform`, or use `compressible` to restrict which\n * response content types can be compressed.\n *\n * @category compression\n * @since 4.0.0\n */\nexport const compression = options => {\n const preferred = options?.algorithms ?? defaultAlgorithms;\n const minSize = options?.minSize ?? 1024;\n const compressible = options?.compressible ?? compressionInternal.defaultCompressible;\n const levels = {\n ...defaultLevels,\n ...options?.levels\n };\n const levelOptions = {\n gzip: {\n level: levels.gzip\n },\n deflate: {\n level: levels.deflate\n },\n br: {\n level: levels.br\n },\n zstd: {\n level: levels.zstd\n }\n };\n const transform = (compression, acceptEncoding, response) => {\n if (response.status < 200 || response.status === 204 || response.status === 206 || response.status === 304) {\n return Effect.succeed(response);\n }\n const currentEncoding = response.headers[\"content-encoding\"];\n if (currentEncoding !== undefined) {\n return Effect.succeed(currentEncoding.trim().toLowerCase() === \"identity\" ? Response.removeHeader(response, \"content-encoding\") : response);\n }\n const body = response.body;\n if (body._tag === \"Empty\" || body._tag === \"FormData\") {\n return Effect.succeed(response);\n }\n const cacheControl = response.headers[\"cache-control\"];\n if (cacheControl !== undefined && noTransformRegex.test(cacheControl)) {\n return Effect.succeed(response);\n }\n const contentType = response.headers[\"content-type\"] ?? body.contentType;\n if (contentType === undefined || !compressible(contentType)) {\n return Effect.succeed(response);\n }\n const algorithm = compressionInternal.negotiate(acceptEncoding, preferred, compression.algorithms);\n if (algorithm === undefined) {\n return Effect.succeed(withVary(response));\n }\n const contentLength = body.contentLength ?? contentLengthHeader(response.headers);\n if (contentLength !== undefined && contentLength < minSize) {\n return Effect.succeed(withVary(response));\n }\n return compression.compressResponse(response, algorithm, levelOptions[algorithm]);\n };\n return httpApp => Effect.withFiber(fiber => {\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const compression = Context.getUnsafe(fiber.context, HttpPlatform).compression;\n appendPreResponseHandlerUnsafe(request, (request, response) => transform(compression, request.headers[\"accept-encoding\"], response));\n return httpApp;\n });\n};\nconst withVary = response => {\n const vary = compressionInternal.varyAcceptEncoding(response.headers);\n return vary === undefined ? response : Response.setHeader(response, \"vary\", vary);\n};\nconst defaultAlgorithms = [\"br\", \"gzip\", \"deflate\"];\nconst defaultLevels = {\n gzip: 6,\n deflate: 6,\n br: 4,\n zstd: 3\n};\nconst noTransformRegex = /(?:^|[\\s,])no-transform(?:$|[\\s,;])/i;\nconst contentLengthHeader = headers => {\n const value = headers[\"content-length\"];\n if (value === undefined) {\n return undefined;\n }\n const parsed = Number(value);\n return Number.isFinite(parsed) && parsed >= 0 ? parsed : undefined;\n};\n//# sourceMappingURL=HttpMiddleware.js.map","import * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Exit from \"../../Exit.js\";\nimport * as Fiber from \"../../Fiber.js\";\nimport { dual } from \"../../Function.js\";\nimport { reportCauseUnsafe } from \"../../internal/effect.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Scope from \"../../Scope.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as HttpBody from \"./HttpBody.js\";\nimport { tracer } from \"./HttpMiddleware.js\";\nimport { causeResponse, ClientAbort, HttpServerError, InternalError } from \"./HttpServerError.js\";\nimport { HttpServerRequest } from \"./HttpServerRequest.js\";\nimport * as Request from \"./HttpServerRequest.js\";\nimport * as Response from \"./HttpServerResponse.js\";\nimport * as preResponseHandler from \"./internal/preResponseHandler.js\";\n/**\n * Runs an HTTP server effect, sends the produced response with the supplied handler, and converts failures into HTTP responses.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toHandled = (self, handleResponse, middleware) => {\n const handleCause = cause => Effect.flatMapEager(causeResponse(cause), ([response, cause]) => {\n const fiber = Fiber.getCurrent();\n reportCauseUnsafe(fiber, cause);\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const handler = preResponseHandler.requestPreResponseHandlers.get(request.source);\n const cont = cause.reasons.length === 0 ? Effect.succeed(response) : Effect.failCause(cause);\n if (handler === undefined) {\n ;\n request[handledSymbol] = true;\n return Effect.flatMapEager(handleResponse(request, response), () => cont);\n }\n return Effect.flatMapEager(Effect.flatMapEager(handler(request, response), response => {\n ;\n request[handledSymbol] = true;\n return handleResponse(request, response);\n }), () => cont);\n });\n const responded = Effect.matchCauseEffect(self, {\n onSuccess: response => {\n const fiber = Fiber.getCurrent();\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const handler = preResponseHandler.requestPreResponseHandlers.get(request.source);\n if (handler === undefined) {\n ;\n request[handledSymbol] = true;\n return Effect.mapEager(handleResponse(request, response), () => response);\n }\n return Effect.flatMapEager(handler(request, response), sentResponse => {\n ;\n request[handledSymbol] = true;\n return Effect.mapEager(handleResponse(request, sentResponse), () => response);\n });\n },\n onFailure: handleCause\n });\n const withMiddleware = middleware === undefined ? tracer(responded) : Effect.matchCauseEffect(tracer(middleware(responded)), {\n onFailure(cause) {\n const fiber = Fiber.getCurrent();\n reportCauseUnsafe(fiber, cause);\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n if (handledSymbol in request) return Effect.void;\n return Effect.matchCauseEffectEager(causeResponse(cause), {\n onFailure(_) {\n return handleResponse(request, Response.empty({\n status: 500\n }));\n },\n onSuccess([response]) {\n return handleResponse(request, response);\n }\n });\n },\n onSuccess(response) {\n const fiber = Fiber.getCurrent();\n const request = Context.getUnsafe(fiber.context, Request.HttpServerRequest);\n return handledSymbol in request ? Effect.void : handleResponse(request, response);\n }\n });\n return Effect.uninterruptible(scoped(withMiddleware));\n};\nconst handledSymbol = /*#__PURE__*/Symbol.for(\"effect/http/HttpEffect/handled\");\n/**\n * Disables automatic closing for an HTTP request scope.\n *\n * **Gotchas**\n *\n * Use only when another owner will close the scope; otherwise resources attached\n * to the request scope can leak.\n *\n * @category resource management\n * @since 4.0.0\n */\nexport const scopeDisableClose = scope => {\n ;\n scope[scopeEjected] = true;\n};\n/**\n * Returns a streaming server response that closes the request scope when the body stream exits.\n *\n * @category resource management\n * @since 4.0.0\n */\nexport const scopeTransferToStream = response => {\n if (response.body._tag !== \"Stream\") {\n return response;\n }\n const fiber = Fiber.getCurrent();\n const scope = Context.getUnsafe(fiber.context, Scope.Scope);\n scopeDisableClose(scope);\n return Response.setBody(response, HttpBody.stream(Stream.onExit(response.body.stream, exit => Scope.close(scope, exit)), response.body.contentType, response.body.contentLength));\n};\nconst scopeEjected = /*#__PURE__*/Symbol.for(\"effect/http/HttpEffect/scopeEjected\");\nconst scoped = effect => Effect.withFiber(fiber => {\n const scope = Scope.makeUnsafe();\n const prevServices = fiber.context;\n fiber.setContext(Context.add(fiber.context, Scope.Scope, scope));\n return Effect.onExitPrimitive(effect, exit => {\n fiber.setContext(prevServices);\n if (scopeEjected in scope) return undefined;\n return Scope.closeUnsafe(scope, exit);\n }, true);\n});\n/**\n * Registers an additional pre-response handler for the current HTTP server request.\n *\n * @category handlers\n * @since 4.0.0\n */\nexport const appendPreResponseHandler = handler => HttpServerRequest.use(request => {\n appendPreResponseHandlerUnsafe(request, handler);\n return Effect.void;\n});\n/**\n * Registers a pre-response handler for the supplied HTTP server request.\n *\n * @category unsafe\n * @since 4.0.0\n */\nexport const appendPreResponseHandlerUnsafe = preResponseHandler.appendPreResponseHandlerUnsafe;\n/**\n * Runs an effect after registering a pre-response handler for the current HTTP server request.\n *\n * @category handlers\n * @since 4.0.0\n */\nexport const withPreResponseHandler = /*#__PURE__*/dual(2, (self, handler) => HttpServerRequest.use(request => {\n appendPreResponseHandlerUnsafe(request, handler);\n return self;\n}));\n/**\n * Converts an HTTP server effect into a Web `Request` handler using the supplied base context and optional middleware.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebHandlerWith = context => (self, middleware) => {\n const resolveSymbol = Symbol.for(\"@effect/platform/HttpApp/resolve\");\n const httpApp = toHandled(self, (request, response) => {\n response = scopeTransferToStream(response);\n request[resolveSymbol](Response.toWeb(response, {\n withoutBody: request.method === \"HEAD\",\n context\n }));\n return Effect.void;\n }, middleware);\n return (request, reqContext) => new Promise(resolve => {\n const contextMap = new Map(context.mapUnsafe);\n if (Context.isContext(reqContext)) {\n for (const [key, value] of reqContext.mapUnsafe) {\n contextMap.set(key, value);\n }\n }\n const httpServerRequest = Request.fromWeb(request);\n contextMap.set(HttpServerRequest.key, httpServerRequest);\n httpServerRequest[resolveSymbol] = resolve;\n const fiber = Effect.runForkWith(Context.makeUnsafe(contextMap))(httpApp);\n request.signal?.addEventListener(\"abort\", () => {\n fiber.interruptUnsafe(undefined, ClientAbort.annotation);\n }, {\n once: true\n });\n });\n};\n/**\n * Converts an HTTP server effect into a Web `Request` handler using an empty base context.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebHandler = /*#__PURE__*/toWebHandlerWith(/*#__PURE__*/Context.empty());\n/**\n * Builds a Web `Request` handler from a layer and handler factory, returning the handler with a `dispose` function for the layer scope.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebHandlerLayerWith = (layer, options) => {\n const scope = Scope.makeUnsafe();\n const dispose = () => Effect.runPromise(Scope.close(scope, Exit.void));\n let handlerCache;\n let handlerPromise;\n function handler(request, context) {\n if (handlerCache) {\n return handlerCache(request, context);\n }\n handlerPromise ??= Effect.runPromise(Effect.gen(function* () {\n const context = yield* options.memoMap ? Layer.buildWithMemoMap(layer, options.memoMap, scope) : Layer.buildWithScope(layer, scope);\n return handlerCache = toWebHandlerWith(context)(yield* options.toHandler(context), options.middleware);\n }));\n return handlerPromise.then(f => f(request, context));\n }\n return {\n dispose,\n handler: handler\n };\n};\n/**\n * Builds a Web `Request` handler for an HTTP server effect using a layer to provide its services, returning the handler with a `dispose` function.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebHandlerLayer = (self, layer, options) => toWebHandlerLayerWith(layer, {\n ...options,\n toHandler: () => Effect.succeed(self)\n});\n/**\n * Adapts a Web `Request` handler into an HTTP server effect for the current `HttpServerRequest`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromWebHandler = handler => Effect.callback((resume, signal) => {\n const fiber = Fiber.getCurrent();\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const requestResult = Request.toWebResult(request, {\n signal,\n context: fiber.context\n });\n if (requestResult._tag === \"Failure\") {\n return resume(Effect.fail(new HttpServerError({\n reason: requestResult.failure\n })));\n }\n handler(requestResult.success).then(response => resume(Effect.succeed(Response.fromWeb(response))), cause => resume(Effect.fail(new HttpServerError({\n reason: new InternalError({\n cause,\n request,\n description: \"HttpApp.fromWebHandler: Error in handler\"\n })\n }))));\n});\n//# sourceMappingURL=HttpEffect.js.map","/**\n * Stores fiber-safe mutable state inside Effect programs.\n *\n * A `Ref<A>` holds one value and exposes reads, writes, and atomic\n * transformations as effects, so state changes compose with Effect's\n * concurrency model. This module includes constructors, safe and unsafe reads,\n * set and get-and-set helpers, update and modify helpers, and conditional\n * update variants that leave the value unchanged when an `Option.none` result\n * is returned.\n *\n * @since 2.0.0\n */\nimport * as Effect from \"./Effect.js\";\nimport { dual, identity } from \"./Function.js\";\nimport { PipeInspectableProto } from \"./internal/core.js\";\nimport * as MutableRef from \"./MutableRef.js\";\nconst TypeId = \"~effect/Ref\";\nconst RefProto = {\n [TypeId]: {\n _A: identity\n },\n ...PipeInspectableProto,\n toJSON() {\n return {\n _id: \"Ref\",\n ref: this.ref\n };\n }\n};\n/**\n * Creates a new Ref with the specified initial value (unsafe version).\n *\n * **When to use**\n *\n * Use when you need immediate synchronous construction and can guarantee\n * that creating the `Ref` outside of `Effect` is safe.\n *\n * **Gotchas**\n *\n * Prefer `Ref.make` for Effect-wrapped creation in Effect programs.\n *\n * **Example** (Creating a ref unsafely)\n *\n * ```ts import.meta.vitest\n * import { Ref } from \"effect\"\n *\n * const counter = Ref.makeUnsafe(0)\n * Ref.getUnsafe(counter) // => 0\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeUnsafe = value => {\n const self = Object.create(RefProto);\n self.ref = MutableRef.make(value);\n return self;\n};\n/**\n * Creates a new Ref with the specified initial value.\n *\n * **When to use**\n *\n * Use to create a `Ref` for shared mutable state inside an Effect program.\n *\n * **Example** (Creating a ref)\n *\n * ```ts import.meta.vitest\n * import { Effect, Ref } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const ref = yield* Ref.make(42)\n * return yield* Ref.get(ref)\n * })\n *\n * await Effect.runPromise(program) // => 42\n * ```\n *\n * @see {@link makeUnsafe} for synchronous construction outside Effect code\n *\n * @category constructors\n * @since 2.0.0\n */\nexport const make = value => Effect.sync(() => makeUnsafe(value));\n/**\n * Gets the current value of the Ref.\n *\n * **When to use**\n *\n * Use to read the current `Ref` value without changing it.\n *\n * **Example** (Getting the current value)\n *\n * ```ts import.meta.vitest\n * import { Effect, Ref } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const ref = yield* Ref.make(42)\n * return yield* Ref.get(ref)\n * })\n *\n * await Effect.runPromise(program) // => 42\n * ```\n *\n * @see {@link set} for replacing the current value\n *\n * @category getters\n * @since 2.0.0\n */\nexport const get = self => Effect.sync(() => self.ref.current);\n/**\n * Sets the value of the Ref to the specified value.\n *\n * **When to use**\n *\n * Use to replace the current `Ref` value with a known value.\n *\n * **Example** (Setting a value)\n *\n * ```ts import.meta.vitest\n * import { Effect, Ref } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const ref = yield* Ref.make(0)\n * yield* Ref.set(ref, 42)\n * return yield* Ref.get(ref)\n * })\n *\n * const program2 = Effect.gen(function*() {\n * const ref = yield* Ref.make(0)\n * yield* Ref.set(ref, 100)\n * return yield* Ref.get(ref)\n * })\n *\n * await Effect.runPromise(program) // => 42\n * await Effect.runPromise(program2) // => 100\n * ```\n *\n * @see {@link getAndSet} for setting while returning the previous value\n * @see {@link setAndGet} for setting while returning the new value\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const set = /*#__PURE__*/dual(2, (self, value) => Effect.sync(() => MutableRef.set(self.ref, value)));\n/**\n * Gets the current value of the Ref, sets it to the specified value, and returns the previous value atomically.\n *\n * **When to use**\n *\n * Use to replace a plain `Ref` value while returning the previous value.\n *\n * **Example** (Replacing a value atomically)\n *\n * ```ts import.meta.vitest\n * import { Effect, Ref } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const ref = yield* Ref.make(\"initial\")\n *\n * const previous = yield* Ref.getAndSet(ref, \"updated\")\n * const current = yield* Ref.get(ref)\n * return [previous, current]\n * })\n *\n * await Effect.runPromise(program) // => [\"initial\", \"updated\"]\n * ```\n *\n * @see {@link set} for setting without returning the previous value\n * @see {@link getAndUpdate} for deriving the new value from the previous value\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const getAndSet = /*#__PURE__*/dual(2, (self, value) => Effect.sync(() => {\n const current = self.ref.current;\n self.ref.current = value;\n return current;\n}));\n/**\n * Gets the current value of the Ref, updates it with the given function, and returns the previous value atomically.\n *\n * **When to use**\n *\n * Use to derive a new `Ref` value while returning the previous value.\n *\n * **Example** (Updating and returning the previous value)\n *\n * ```ts import.meta.vitest\n * import { Effect, Ref } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const counter = yield* Ref.make(10)\n *\n * const previous = yield* Ref.getAndUpdate(counter, (n) => n * 2)\n * const current = yield* Ref.get(counter)\n * return [previous, current]\n * })\n *\n * await Effect.runPromise(program) // => [10, 20]\n * ```\n *\n * @see {@link update} for updating without returning the previous value\n * @see {@link updateAndGet} for returning the new value instead\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const getAndUpdate = /*#__PURE__*/dual(2, (self, f) => Effect.sync(() => {\n const current = self.ref.current;\n self.ref.current = f(current);\n return current;\n}));\n/**\n * Gets the current value of the Ref and updates it atomically with the given partial function.\n *\n * **When to use**\n *\n * Use to return the previous `Ref` value while applying a conditional update.\n *\n * **Details**\n *\n * If the partial function returns `Option.some`, the Ref is updated with the\n * new value. If it returns `Option.none`, the Ref is left unchanged. The effect\n * always returns the value that was in the Ref before the attempted update.\n *\n * **Example** (Conditionally updating and returning the previous value)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, Ref } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const counter = yield* Ref.make(5)\n *\n * const previous1 = yield* Ref.getAndUpdateSome(\n * counter,\n * (n) => n > 3 ? Option.some(n * 2) : Option.none()\n * )\n * const current1 = yield* Ref.get(counter)\n * const previous2 = yield* Ref.getAndUpdateSome(\n * counter,\n * (n) => n < 3 ? Option.some(n * 2) : Option.none()\n * )\n * const current2 = yield* Ref.get(counter)\n * return [previous1, current1, previous2, current2]\n * })\n *\n * await Effect.runPromise(program) // => [5, 10, 10, 10]\n * ```\n *\n * @see {@link getAndUpdate} for always applying an update\n * @see {@link updateSome} for conditional updates without returning the previous value\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const getAndUpdateSome = /*#__PURE__*/dual(2, (self, pf) => Effect.sync(() => {\n const current = self.ref.current;\n const option = pf(current);\n if (option._tag === \"Some\") {\n self.ref.current = option.value;\n }\n return current;\n}));\n/**\n * Sets the value of the Ref atomically to the specified value and returns the new value.\n *\n * **When to use**\n *\n * Use when you want to set a `Ref` value and immediately get it back in one\n * atomic operation.\n *\n * **Example** (Setting and returning the new value)\n *\n * ```ts import.meta.vitest\n * import { Effect, Ref } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const ref = yield* Ref.make(10)\n *\n * const newValue = yield* Ref.setAndGet(ref, 42)\n * const current = yield* Ref.get(ref)\n * return [newValue, current]\n * })\n *\n * const program2 = Effect.gen(function*() {\n * const counter = yield* Ref.make(0)\n * return yield* Ref.setAndGet(counter, 20)\n * })\n *\n * await Effect.runPromise(program) // => [42, 42]\n * await Effect.runPromise(program2) // => 20\n * ```\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const setAndGet = /*#__PURE__*/dual(2, (self, value) => Effect.sync(() => self.ref.current = value));\n/**\n * Modifies the value of the Ref atomically using the given function.\n *\n * **When to use**\n *\n * Use to compute both a separate return value and the next stored `Ref` value\n * in one atomic update.\n *\n * **Details**\n *\n * The function receives the current value and returns a tuple of\n * `[result, newValue]`. The Ref is updated with `newValue`, and `result` is\n * returned by the effect.\n *\n * **Example** (Modifying a value atomically)\n *\n * ```ts import.meta.vitest\n * import { Effect, Ref } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const counter = yield* Ref.make(10)\n *\n * const result = yield* Ref.modify(counter, (n) => [\n * `Previous value was ${n}`,\n * n * 2\n * ])\n * const current = yield* Ref.get(counter)\n * return [result, current]\n * })\n *\n * const program2 = Effect.gen(function*() {\n * const state = yield* Ref.make({ count: 0, total: 0 })\n * return yield* Ref.modify(state, (s) => [\n * s.count,\n * { count: s.count + 1, total: s.total + s.count + 1 }\n * ])\n * })\n *\n * await Effect.runPromise(program) // => [\"Previous value was 10\", 20]\n * await Effect.runPromise(program2) // => 0\n * ```\n *\n * @see {@link updateAndGet} for returning the new stored value\n * @see {@link modifySome} for optionally updating while returning a separate result\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const modify = /*#__PURE__*/dual(2, (self, f) => Effect.sync(() => {\n const [b, a] = f(self.ref.current);\n self.ref.current = a;\n return b;\n}));\n/**\n * Computes a result atomically and optionally updates the value of the `Ref`.\n *\n * **When to use**\n *\n * Use to compute a return value while optionally updating a plain `Ref`.\n *\n * **Details**\n *\n * The callback receives the current value and returns `[result, nextValue]`,\n * where `nextValue` is an `Option`. If `nextValue` is `Option.some(value)`,\n * the `Ref` is updated to `value`; if it is `Option.none()`, the `Ref` is left\n * unchanged. The returned effect always succeeds with `result`.\n *\n * **Example** (Conditionally modifying a value)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, Ref } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const counter = yield* Ref.make(5)\n *\n * const result1 = yield* Ref.modifySome(\n * counter,\n * (n) =>\n * n > 3\n * ? [`incremented ${n}`, Option.some(n + 10)]\n * : [\"no change\", Option.none()]\n * )\n * const current1 = yield* Ref.get(counter)\n * const result2 = yield* Ref.modifySome(\n * counter,\n * (n) =>\n * n < 10\n * ? [`decremented ${n}`, Option.some(n - 5)]\n * : [\"no change\", Option.none()]\n * )\n * const current2 = yield* Ref.get(counter)\n * return [result1, current1, result2, current2]\n * })\n *\n * await Effect.runPromise(program) // => [\"incremented 5\", 15, \"no change\", 15]\n * ```\n *\n * @see {@link modify} for always storing a new value\n * @see {@link updateSome} for optional updates without a separate return value\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const modifySome = /*#__PURE__*/dual(2, (self, pf) => modify(self, value => {\n const [b, option] = pf(value);\n return [b, option._tag === \"None\" ? value : option.value];\n}));\n/**\n * Updates the value of the Ref atomically using the given function.\n *\n * **When to use**\n *\n * Use to apply a `Ref` state transition without returning a value.\n *\n * **Example** (Updating a value)\n *\n * ```ts import.meta.vitest\n * import { Effect, Ref } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const counter = yield* Ref.make(5)\n *\n * yield* Ref.update(counter, (n) => n * 2)\n * return yield* Ref.get(counter)\n * })\n *\n * const program2 = Effect.gen(function*() {\n * const counter = yield* Ref.make(5)\n * yield* Ref.update(counter, (n: number) => n + 10)\n * return yield* Ref.get(counter)\n * })\n *\n * await Effect.runPromise(program) // => 10\n * await Effect.runPromise(program2) // => 15\n * ```\n *\n * @see {@link updateAndGet} for returning the new value\n * @see {@link getAndUpdate} for returning the previous value\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const update = /*#__PURE__*/dual(2, (self, f) => Effect.sync(() => {\n self.ref.current = f(self.ref.current);\n}));\n/**\n * Updates the value of the Ref atomically using the given function and returns the new value.\n *\n * **When to use**\n *\n * Use to apply a `Ref` state transition and return the new stored value.\n *\n * **Example** (Updating and returning the new value)\n *\n * ```ts import.meta.vitest\n * import { Effect, Ref } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const counter = yield* Ref.make(5)\n *\n * const newValue = yield* Ref.updateAndGet(counter, (n) => n * 3)\n * const current = yield* Ref.get(counter)\n * return [newValue, current]\n * })\n *\n * await Effect.runPromise(program) // => [15, 15]\n * ```\n *\n * @see {@link update} for updating without returning the new value\n * @see {@link getAndUpdate} for returning the previous value instead\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const updateAndGet = /*#__PURE__*/dual(2, (self, f) => Effect.sync(() => self.ref.current = f(self.ref.current)));\n/**\n * Updates the value of the Ref atomically using the given partial function.\n *\n * **When to use**\n *\n * Use to apply a conditional `Ref` update without returning a value.\n *\n * **Details**\n *\n * If the partial function returns `Option.some`, the Ref is updated with the\n * new value. If it returns `Option.none`, the Ref is left unchanged.\n *\n * **Example** (Conditionally updating a value)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, Ref } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const counter = yield* Ref.make(5)\n *\n * yield* Ref.updateSome(\n * counter,\n * (n) => n % 2 === 0 ? Option.some(n * 2) : Option.none()\n * )\n * const before = yield* Ref.get(counter)\n * yield* Ref.set(counter, 6)\n * yield* Ref.updateSome(\n * counter,\n * (n) => n % 2 === 0 ? Option.some(n * 2) : Option.none()\n * )\n * const after = yield* Ref.get(counter)\n * return [before, after]\n * })\n *\n * await Effect.runPromise(program) // => [5, 12]\n * ```\n *\n * @see {@link update} for always applying an update\n * @see {@link updateSomeAndGet} for returning the resulting current value\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const updateSome = /*#__PURE__*/dual(2, (self, f) => Effect.sync(() => {\n const option = f(self.ref.current);\n if (option._tag === \"Some\") {\n self.ref.current = option.value;\n }\n}));\n/**\n * Updates the value of the Ref atomically using the given partial function and returns the current value.\n *\n * **When to use**\n *\n * Use to apply a conditional `Ref` update and return the resulting current\n * value.\n *\n * **Details**\n *\n * If the partial function returns `Option.some`, the Ref is updated with the\n * new value. If it returns `Option.none`, the Ref is left unchanged. The effect\n * returns the current value of the Ref after the potential update.\n *\n * **Example** (Conditionally updating and returning the current value)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, Ref } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const counter = yield* Ref.make(10)\n *\n * const result1 = yield* Ref.updateSomeAndGet(\n * counter,\n * (n) => n > 5 ? Option.some(n / 2) : Option.none()\n * )\n * const result2 = yield* Ref.updateSomeAndGet(\n * counter,\n * (n) => n > 5 ? Option.some(n / 2) : Option.none()\n * )\n * return [result1, result2]\n * })\n *\n * await Effect.runPromise(program) // => [5, 5]\n * ```\n *\n * @see {@link updateSome} for conditional updates without returning a value\n * @see {@link updateAndGet} for always updating and returning the new value\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const updateSomeAndGet = /*#__PURE__*/dual(2, (self, pf) => Effect.sync(() => {\n const option = pf(self.ref.current);\n if (option._tag === \"Some\") {\n self.ref.current = option.value;\n }\n return self.ref.current;\n}));\n/**\n * Gets the current value of the Ref synchronously (unsafe version).\n *\n * **When to use**\n *\n * Use when you need immediate synchronous access and can guarantee that\n * reading the `Ref` outside of `Effect` is safe.\n *\n * **Gotchas**\n *\n * Prefer `Ref.get` for Effect-wrapped access in Effect programs.\n *\n * **Example** (Reading a ref unsafely)\n *\n * ```ts import.meta.vitest\n * import { Ref } from \"effect\"\n *\n * const counter = Ref.makeUnsafe(42)\n * Ref.getUnsafe(counter) // => 42\n * ```\n *\n * @category getters\n * @since 4.0.0\n */\nexport const getUnsafe = self => self.ref.current;\n//# sourceMappingURL=Ref.js.map","import * as Cause from \"../../Cause.js\";\nimport { Clock } from \"../../Clock.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Duration from \"../../Duration.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Fiber from \"../../Fiber.js\";\nimport { constant, constFalse, constTrue, dual, flow, identity } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Ref from \"../../Ref.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schedule from \"../../Schedule.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Tracer from \"../../Tracer.js\";\nimport * as Cookies from \"./Cookies.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as HttpBody from \"./HttpBody.js\";\nimport * as Error from \"./HttpClientError.js\";\nimport * as HttpClientRequest from \"./HttpClientRequest.js\";\nimport * as HttpClientResponse from \"./HttpClientResponse.js\";\nimport * as HttpIncomingMessage from \"./HttpIncomingMessage.js\";\nimport * as HttpMethod from \"./HttpMethod.js\";\nimport * as TraceContext from \"./HttpTraceContext.js\";\nimport * as Url from \"./Url.js\";\nconst TypeId = \"~effect/http/HttpClient\";\n/**\n * Returns `true` if the provided value is an `HttpClient`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpClient = u => Predicate.hasProperty(u, TypeId);\n/**\n * Service tag for the default outgoing HTTP client service.\n *\n * **When to use**\n *\n * Use to provide the default outgoing HTTP client service used by request\n * accessors such as `execute`, `get`, and `post`.\n *\n * @category services\n * @since 4.0.0\n */\nexport const HttpClient = /*#__PURE__*/Context.Service(\"effect/HttpClient\");\nconst accessor = method => (...args) => Effect.flatMap(HttpClient, client => client[method](...args));\n/**\n * Executes a prebuilt `HttpClientRequest` using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const execute = /*#__PURE__*/accessor(\"execute\");\n/**\n * Executes a `GET` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/accessor(\"get\");\n/**\n * Executes a `HEAD` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const head = /*#__PURE__*/accessor(\"head\");\n/**\n * Executes a `POST` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const post = /*#__PURE__*/accessor(\"post\");\n/**\n * Executes a `PATCH` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const patch = /*#__PURE__*/accessor(\"patch\");\n/**\n * Executes a `PUT` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const put = /*#__PURE__*/accessor(\"put\");\n/**\n * Executes a `DELETE` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const del = /*#__PURE__*/accessor(\"del\");\n/**\n * Executes an `OPTIONS` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const options = /*#__PURE__*/accessor(\"options\");\n/**\n * Transforms a client by wrapping the response effect for each request.\n *\n * **Details**\n *\n * The transformation receives both the response effect and the original request, allowing it to change success, error, and environment behavior.\n *\n * @category mapping\n * @since 4.0.0\n */\nexport const transform = /*#__PURE__*/dual(2, (self, f) => makeWith(Effect.flatMap(request => f(self.postprocess(Effect.succeed(request)), request)), self.preprocess));\n/**\n * Transforms a client by applying an effectful transformation to each response effect.\n *\n * @category mapping\n * @since 4.0.0\n */\nexport const transformResponse = /*#__PURE__*/dual(2, (self, f) => makeWith(request => f(self.postprocess(request)), self.preprocess));\nconst catch_ = /*#__PURE__*/dual(2, (self, f) => transformResponse(self, Effect.catch(f)));\nexport {\n/**\n * Handles all client failures with an effectful recovery function and returns a transformed client.\n *\n * @category error handling\n * @since 4.0.0\n */\ncatch_ as catch };\n/**\n * Handles client failures with one or more matching `_tag` values and returns a transformed client.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const catchTag = /*#__PURE__*/dual(3, (self, tag, f) => transformResponse(self, effect => Effect.catchTag(effect, tag, f)));\n/**\n * Handles client failures by matching their `_tag` values against a case map.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const catchTags = /*#__PURE__*/dual(2, (self, cases) => transformResponse(self, Effect.catchTags(cases)));\n/**\n * Filters the result of a response, or runs an alternative effect if the predicate fails.\n *\n * @category filtering\n * @since 4.0.0\n */\nexport const filterOrElse = /*#__PURE__*/dual(3, (self, f, orElse) => transformResponse(self, Effect.filterOrElse(f, orElse)));\n/**\n * Filters successful responses, or fails with the error produced by `orFailWith` when the predicate does not match.\n *\n * @category filtering\n * @since 4.0.0\n */\nexport const filterOrFail = /*#__PURE__*/dual(3, (self, f, orFailWith) => transformResponse(self, Effect.filterOrFail(f, orFailWith)));\n/**\n * Filters responses by HTTP status code.\n *\n * @category filtering\n * @since 4.0.0\n */\nexport const filterStatus = /*#__PURE__*/dual(2, (self, f) => transformResponse(self, Effect.flatMap(HttpClientResponse.filterStatus(f))));\n/**\n * Filters responses that return a 2xx status code.\n *\n * @category filtering\n * @since 4.0.0\n */\nexport const filterStatusOk = /*#__PURE__*/transformResponse(/*#__PURE__*/Effect.flatMap(HttpClientResponse.filterStatusOk));\n/**\n * Constructs an `HttpClient.With` from a preprocessing function and a postprocessing function.\n *\n * **Details**\n *\n * `execute` applies preprocessing to the request and then passes the resulting request effect to postprocessing.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeWith = (postprocess, preprocess) => {\n const self = Object.create(Proto);\n self.preprocess = preprocess;\n self.postprocess = postprocess;\n self.execute = function (request) {\n return postprocess(preprocess(request));\n };\n return self;\n};\nconst Proto = {\n [TypeId]: TypeId,\n pipe() {\n return pipeArguments(this, arguments);\n },\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"effect/HttpClient\"\n };\n },\n ... /*#__PURE__*/Object.fromEntries(/*#__PURE__*/HttpMethod.allShort.map(([fullMethod, method]) => [method, function (url, options) {\n return this.execute(HttpClientRequest.make(fullMethod)(url, options));\n }]))\n};\n/**\n * Constructs an `HttpClient` from a low-level request runner.\n *\n * **Details**\n *\n * The runner receives the request, resolved URL, abort signal, and current fiber. The client wrapper handles URL construction failures, tracing and propagation, header redaction, and aborting non-scoped requests on interruption.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = f => makeWith(effect => Effect.flatMap(effect, request => Effect.withFiber(fiber => {\n const scopedController = scopedRequests.get(request);\n const controller = scopedController ?? new AbortController();\n const urlResult = Url.make(request.url, request.urlParams, Option.getOrUndefined(request.hash));\n if (Result.isFailure(urlResult)) {\n return Effect.fail(new Error.HttpClientError({\n reason: new Error.InvalidUrlError({\n request,\n cause: urlResult.failure\n })\n }));\n }\n const url = urlResult.success;\n const tracerDisabled = fiber.getRef(Tracer.DisablePropagation) || fiber.getRef(TracerDisabledWhen)(request);\n if (tracerDisabled) {\n const effect = f(request, url, controller.signal, fiber);\n if (scopedController) return effect;\n return Effect.uninterruptibleMask(restore => Effect.matchCauseEffect(restore(effect), {\n onSuccess(response) {\n responseRegistry.register(response, controller);\n return Effect.succeed(new InterruptibleResponse(response, controller));\n },\n onFailure(cause) {\n if (Cause.hasInterrupts(cause)) {\n controller.abort();\n }\n return Effect.failCause(cause);\n }\n }));\n }\n return Effect.useSpan(fiber.getRef(SpanNameGenerator)(request), {\n kind: \"client\"\n }, span => {\n span.attribute(\"http.request.method\", request.method);\n span.attribute(\"server.address\", url.origin);\n if (url.port !== \"\") {\n span.attribute(\"server.port\", +url.port);\n }\n span.attribute(\"url.full\", url.toString());\n span.attribute(\"url.path\", url.pathname);\n span.attribute(\"url.scheme\", url.protocol.slice(0, -1));\n const query = url.search.slice(1);\n if (query !== \"\") {\n span.attribute(\"url.query\", query);\n }\n const redactedHeaderNames = fiber.getRef(Headers.CurrentRedactedNames);\n const headerFilter = fiber.getRef(TracerHeaderFilter);\n const redactedHeaders = Headers.redact(request.headers, redactedHeaderNames);\n for (const name in redactedHeaders) {\n if (!headerFilter(name, \"request\")) continue;\n span.attribute(`http.request.header.${name}`, String(redactedHeaders[name]));\n }\n request = fiber.getRef(TracerPropagationEnabled) ? HttpClientRequest.setHeaders(request, TraceContext.toHeaders(span)) : request;\n return Effect.uninterruptibleMask(restore => restore(f(request, url, controller.signal, fiber)).pipe(Effect.withParentSpan(span, {\n captureStackTrace: false\n }), Effect.matchCauseEffect({\n onSuccess: response => {\n span.attribute(\"http.response.status_code\", response.status);\n const redactedHeaders = Headers.redact(response.headers, redactedHeaderNames);\n for (const name in redactedHeaders) {\n if (!headerFilter(name, \"response\")) continue;\n span.attribute(`http.response.header.${name}`, String(redactedHeaders[name]));\n }\n if (scopedController) return Effect.succeed(response);\n responseRegistry.register(response, controller);\n return Effect.succeed(new InterruptibleResponse(response, controller));\n },\n onFailure(cause) {\n if (!scopedController && Cause.hasInterrupts(cause)) {\n controller.abort();\n }\n return Effect.failCause(cause);\n }\n })));\n });\n})), Effect.succeed);\n/**\n * Appends a transformation of the request object before sending it.\n *\n * @category mapping\n * @since 4.0.0\n */\nexport const mapRequest = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => Effect.map(self.preprocess(request), f)));\n/**\n * Appends an effectful transformation of the request object before sending it.\n *\n * @category mapping\n * @since 4.0.0\n */\nexport const mapRequestEffect = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => Effect.flatMap(self.preprocess(request), f)));\n/**\n * Prepends a transformation of the request object before sending it.\n *\n * @category mapping\n * @since 4.0.0\n */\nexport const mapRequestInput = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => self.preprocess(f(request))));\n/**\n * Prepends an effectful transformation of the request object before sending it.\n *\n * @category mapping\n * @since 4.0.0\n */\nexport const mapRequestInputEffect = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => Effect.flatMap(f(request), self.preprocess)));\n/**\n * Retries the request based on a provided schedule or policy.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const retry = /*#__PURE__*/dual(2, (self, policy) => transformResponse(self, Effect.retry(policy)));\n/**\n * Retries common transient errors, such as rate limiting, timeouts or network issues.\n *\n * **When to use**\n *\n * Use to focus on retrying errors, transient responses, or both.\n *\n * **Details**\n *\n * Specifying a `while` predicate allows you to consider other errors as\n * transient, and is ignored in \"response-only\" mode.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const retryTransient = /*#__PURE__*/dual(2, (self, options) => {\n const isOnlySchedule = Schedule.isSchedule(options);\n const retryOn = isOnlySchedule ? \"errors-and-responses\" : options.retryOn ?? \"errors-and-responses\";\n const schedule = isOnlySchedule ? options : options.schedule;\n const passthroughSchedule = schedule && Schedule.passthrough(schedule);\n const times = isOnlySchedule ? undefined : options.times;\n return transformResponse(self, flow(retryOn === \"errors-only\" ? identity : Effect.repeat({\n schedule: passthroughSchedule,\n times,\n while: isTransientResponse\n }), retryOn === \"response-only\" ? identity : Effect.retry({\n while: isOnlySchedule || options.while === undefined ? isTransientError : Predicate.or(isTransientError, options.while),\n schedule,\n times\n })));\n});\n/**\n * Applies request rate limiting using the `RateLimiter` service.\n *\n * **Details**\n *\n * It can update limits by inspecting common rate limit response headers and\n * automatically retries HTTP `429` responses (or `HttpClientError` values\n * wrapping a `429` response) by forcing the retry back through the limiter.\n *\n * @category rate limiting\n * @since 4.0.0\n */\nexport const withRateLimiter = /*#__PURE__*/dual(2, (self, options) => {\n const initialState = {\n initial: true,\n limit: options.limit,\n window: Duration.max(Duration.fromInputUnsafe(options.window), Duration.millis(1))\n };\n const states = new Map();\n const keyOption = options.key;\n const resolveKey = typeof keyOption === \"function\" ? keyOption : constant(keyOption);\n const tokensOption = options.tokens;\n const resolveTokens = typeof tokensOption === \"function\" ? tokensOption : constant(tokensOption ?? 1);\n const adaptiveLearningEnabled = !options.disableAdaptiveLearning;\n const getState = key => {\n const current = states.get(key);\n if (current !== undefined) {\n return current;\n }\n states.set(key, initialState);\n return initialState;\n };\n const onResponse = options.disableResponseInspection ? undefined : (clock, key, headers, tokens) => {\n const current = getState(key);\n const next = parseRateLimiterState(current, clock, headers, tokens);\n if (next.limit !== current.limit || !Duration.equals(next.window, current.window)) {\n states.set(key, next);\n }\n };\n return transform(self, function loop(effect, request) {\n const fiber = Fiber.getCurrent();\n const clock = fiber.getRef(Clock);\n const key = resolveKey(request);\n const tokens = Math.max(resolveTokens(request), 1);\n const current = getState(key);\n function retry(retryAfter) {\n if (options.disableResponseInspection) return loop(effect, request);\n return retryAfter ? Effect.flatMap(Effect.sleep(retryAfter), () => loop(effect, request)) : loop(effect, request);\n }\n const inspectResponse = (response, adaptive) => {\n onResponse?.(clock, key, response.headers, tokens);\n if (options.disableResponseInspection || response.status !== 429) {\n return Effect.succeed(undefined);\n }\n const retryAfter = parseRetryAfter(clock, getHeader(response.headers, \"retry-after\"));\n if (retryAfter === undefined) {\n return Effect.succeed(undefined);\n }\n const delay = parseRateLimitWindow(clock, response.headers) ?? retryAfter;\n if (adaptive === undefined) {\n return Effect.succeed(delay);\n }\n return Effect.as(options.limiter.adaptiveFeedback({\n key,\n epoch: adaptive.epoch,\n tokens,\n status: response.status,\n retryAfter: delay\n }), delay);\n };\n return Effect.flatMap(options.limiter.consume({\n algorithm: options.algorithm,\n onExceeded: \"delay\",\n key,\n limit: current.limit,\n window: current.window,\n tokens\n }), ({\n delay\n }) => {\n const runAdaptive = () => {\n const runRequest = adaptive => {\n const request = Effect.matchEffect(effect, {\n onSuccess(response) {\n return Effect.flatMap(inspectResponse(response, adaptive), retryAfter => {\n if (response.status !== 429) return Effect.succeed(response);\n return retry(retryAfter);\n });\n },\n onFailure(error) {\n if (isTooManyRequestsHttpClientError(error)) {\n return Effect.flatMap(inspectResponse(error.reason.response, adaptive), retryAfter => retry(retryAfter));\n }\n return Effect.fail(error);\n }\n });\n return adaptive === undefined || Duration.isZero(adaptive.delay) ? request : Effect.delay(request, adaptive.delay);\n };\n if (!adaptiveLearningEnabled) {\n return runRequest(undefined);\n }\n return Effect.flatMap(options.limiter.adaptiveConsume({\n key,\n tokens,\n fallbackLimit: current.limit,\n fallbackWindow: current.window\n }), adaptive => {\n if (!Duration.isZero(adaptive.delay) && adaptive.phase === \"cooldown\") {\n return Effect.flatMap(Effect.sleep(adaptive.delay), runAdaptive);\n }\n return runRequest(adaptive);\n });\n };\n return Duration.isZero(delay) ? runAdaptive() : Effect.flatMap(Effect.sleep(delay), runAdaptive);\n });\n });\n});\nconst parseRateLimiterState = (state, clock, headers, tokens) => {\n const limit = parseRateLimitLimit(state, headers, tokens) ?? state.limit;\n const window = parseRateLimitWindow(clock, headers) ?? state.window;\n if (limit === state.limit && Duration.equals(window, state.window)) {\n return state;\n }\n return {\n limit,\n window,\n initial: false\n };\n};\nconst parseRateLimitLimit = (state, headers, tokens) => {\n const raw = getHeader(headers, \"ratelimit-limit\", \"x-ratelimit-limit\");\n const value = parseNumberHeader(raw);\n if (value !== undefined && value > 0) {\n return value;\n }\n const remaining = parseRateLimitRemaining(headers);\n if (remaining === undefined) {\n return undefined;\n }\n return state.initial ? remaining + tokens : Math.max(remaining + tokens, state.limit);\n};\nconst parseRateLimitRemaining = headers => {\n const raw = getHeader(headers, \"ratelimit-remaining\", \"x-ratelimit-remaining\");\n const value = parseNumberHeader(raw);\n return value !== undefined && value >= 0 ? value : undefined;\n};\nconst parseRateLimitWindow = (clock, headers) => {\n const resetAfter = parseResetAfter(getHeader(headers, \"ratelimit-reset-after\", \"x-ratelimit-reset-after\"));\n if (resetAfter !== undefined) {\n return resetAfter;\n }\n return parseResetHeader(clock, getHeader(headers, \"ratelimit-reset\", \"x-ratelimit-reset\"));\n};\nconst parseRetryAfter = (clock, value) => {\n if (value === undefined) {\n return undefined;\n }\n const numeric = parseNumberHeader(value);\n if (numeric !== undefined) {\n return Duration.max(Duration.seconds(numeric), Duration.millis(1));\n }\n const parsedDate = Date.parse(value);\n if (Number.isNaN(parsedDate)) {\n return undefined;\n }\n const millis = parsedDate - clock.currentTimeMillisUnsafe();\n if (millis <= 0) {\n return Duration.millis(1);\n }\n return Duration.millis(millis);\n};\nconst parseResetAfter = value => {\n const numeric = parseNumberHeader(value);\n if (numeric === undefined || numeric <= 0) {\n return undefined;\n }\n return Duration.max(Duration.seconds(numeric), Duration.millis(1));\n};\nconst parseResetHeader = (clock, value) => {\n const numeric = parseNumberHeader(value);\n if (numeric === undefined || numeric <= 0) {\n return undefined;\n }\n const nowMillis = clock.currentTimeMillisUnsafe();\n if (numeric > 1_000_000_000_000) {\n return Duration.millis(Math.max(numeric - nowMillis, 1));\n }\n if (numeric > 1_000_000_000) {\n return Duration.millis(Math.max(numeric * 1_000 - nowMillis, 1));\n }\n return Duration.max(Duration.seconds(numeric), Duration.millis(1));\n};\nconst parseNumberHeader = value => {\n if (value === undefined) {\n return undefined;\n }\n const match = /-?\\d+(?:\\.\\d+)?/.exec(value);\n if (match === null) {\n return undefined;\n }\n const parsed = Number(match[0]);\n return Number.isFinite(parsed) ? parsed : undefined;\n};\nconst getHeader = (headers, ...keys) => {\n for (let i = 0; i < keys.length; i++) {\n const value = headers[keys[i]];\n if (value !== undefined) {\n return value;\n }\n }\n return undefined;\n};\n/**\n * Performs an additional effect after a successful request.\n *\n * @category sequencing\n * @since 4.0.0\n */\nexport const tap = /*#__PURE__*/dual(2, (self, f) => transformResponse(self, Effect.tap(f)));\n/**\n * Performs an additional effect after an unsuccessful request.\n *\n * @category sequencing\n * @since 4.0.0\n */\nexport const tapError = /*#__PURE__*/dual(2, (self, f) => transformResponse(self, Effect.tapError(f)));\n/**\n * Performs an additional effect on the request before sending it.\n *\n * @category sequencing\n * @since 4.0.0\n */\nexport const tapRequest = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => Effect.tap(self.preprocess(request), f)));\n/**\n * Adds a `Ref` of cookies to the client for handling cookies across requests.\n *\n * **When to use**\n *\n * Use to add shared cookie storage to a client so response cookies are retained\n * and sent by later requests.\n *\n * @category cookies\n * @since 4.0.0\n */\nexport const withCookiesRef = /*#__PURE__*/dual(2, (self, ref) => makeWith(request => Effect.tap(self.postprocess(request), response => Ref.update(ref, cookies => Cookies.merge(cookies, response.cookies))), request => Effect.flatMap(self.preprocess(request), request => Effect.map(Ref.get(ref), cookies => Cookies.isEmpty(cookies) ? request : HttpClientRequest.setHeader(request, \"cookie\", Cookies.toCookieHeader(cookies))))));\n/**\n * Attaches the lifetime of the `HttpClientRequest` to a `Scope`.\n *\n * @category resource management\n * @since 4.0.0\n */\nexport const withScope = self => transform(self, (effect, request) => {\n const controller = new AbortController();\n scopedRequests.set(request, controller);\n return Effect.andThen(Effect.addFinalizer(() => Effect.sync(() => controller.abort())), effect);\n});\n/**\n * Enables following HTTP redirects up to a specified number of times.\n *\n * @category redirects\n * @since 4.0.0\n */\nexport const followRedirects = /*#__PURE__*/dual(args => isHttpClient(args[0]), (self, maxRedirects) => makeWith(request => {\n const loop = (request, redirects) => Effect.flatMap(self.postprocess(Effect.succeed(request)), response => {\n if (response.status < 300 || response.status >= 400 || !response.headers.location || redirects >= (maxRedirects ?? 10)) {\n return Effect.succeed(response);\n }\n const url = new URL(response.headers.location, response.request.url);\n let nextRequest = request;\n if ((response.status === 301 || response.status === 302) && request.method === \"POST\" || response.status === 303 && request.method !== \"GET\" && request.method !== \"HEAD\") {\n nextRequest = HttpClientRequest.setMethod(nextRequest, \"GET\");\n nextRequest = HttpClientRequest.setBody(nextRequest, HttpBody.empty);\n }\n if (url.origin !== new URL(response.request.url).origin) {\n nextRequest = HttpClientRequest.removeHeader(nextRequest, \"authorization\");\n nextRequest = HttpClientRequest.removeHeader(nextRequest, \"proxy-authorization\");\n nextRequest = HttpClientRequest.removeHeader(nextRequest, \"cookie\");\n }\n return loop(HttpClientRequest.setUrl(nextRequest, url), redirects + 1);\n });\n return Effect.flatMap(request, request => loop(request, 0));\n}, self.preprocess));\n/**\n * Context reference for a predicate that disables client-side tracing for matching outgoing requests.\n *\n * @category services\n * @since 4.0.0\n */\nexport const TracerDisabledWhen = /*#__PURE__*/Context.Reference(\"effect/http/HttpClient/TracerDisabledWhen\", {\n defaultValue: () => constFalse\n});\n/**\n * Context reference for filtering request and response headers added to client spans.\n *\n * @category services\n * @since 4.0.0\n */\nexport const TracerHeaderFilter = /*#__PURE__*/Context.Reference(\"effect/http/HttpClient/TracerHeaderFilter\", {\n defaultValue: () => constTrue\n});\n/**\n * Context reference that controls whether outgoing client spans are propagated to request headers.\n *\n * @category services\n * @since 4.0.0\n */\nexport const TracerPropagationEnabled = /*#__PURE__*/Context.Reference(\"effect/HttpClient/TracerPropagationEnabled\", {\n defaultValue: constTrue\n});\n/**\n * Context reference for generating the span name used for outgoing client request spans.\n *\n * @category services\n * @since 4.0.0\n */\nexport const SpanNameGenerator = /*#__PURE__*/Context.Reference(\"effect/http/HttpClient/SpanNameGenerator\", {\n defaultValue: () => request => `http.client ${request.method}`\n});\n/**\n * Creates an `HttpClient` layer and merges the layer construction context into client response effects.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerMergedContext = effect => Layer.effect(HttpClient)(Effect.contextWith(context => Effect.map(effect, client => transformResponse(client, Effect.updateContext(input => Context.merge(context, input))))));\n// -----------------------------------------------------------------------------\n// internal\n// -----------------------------------------------------------------------------\nconst responseRegistry = /*#__PURE__*/(() => {\n if (\"FinalizationRegistry\" in globalThis && globalThis.FinalizationRegistry) {\n const registry = /*#__PURE__*/new FinalizationRegistry(controller => {\n controller.abort();\n });\n return {\n register(response, controller) {\n registry.register(response, controller, response);\n },\n unregister(response) {\n registry.unregister(response);\n }\n };\n }\n const timers = /*#__PURE__*/new Map();\n return {\n register(response, controller) {\n timers.set(response, setTimeout(() => controller.abort(), 5000));\n },\n unregister(response) {\n const timer = timers.get(response);\n if (timer === undefined) return;\n clearTimeout(timer);\n timers.delete(response);\n }\n };\n})();\nconst scopedRequests = /*#__PURE__*/new WeakMap();\nclass InterruptibleResponse {\n original;\n controller;\n constructor(original, controller) {\n this.original = original;\n this.controller = controller;\n }\n [HttpClientResponse.TypeId] = HttpClientResponse.TypeId;\n [HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n applyInterrupt(effect) {\n return Effect.suspend(() => {\n responseRegistry.unregister(this.original);\n return Effect.onInterrupt(effect, () => Effect.sync(() => {\n this.controller.abort();\n }));\n });\n }\n get request() {\n return this.original.request;\n }\n get status() {\n return this.original.status;\n }\n get headers() {\n return this.original.headers;\n }\n get cookies() {\n return this.original.cookies;\n }\n get remoteAddress() {\n return this.original.remoteAddress;\n }\n get formData() {\n return this.applyInterrupt(this.original.formData);\n }\n get text() {\n return this.applyInterrupt(this.original.text);\n }\n get json() {\n return this.applyInterrupt(this.original.json);\n }\n get urlParamsBody() {\n return this.applyInterrupt(this.original.urlParamsBody);\n }\n get arrayBuffer() {\n return this.applyInterrupt(this.original.arrayBuffer);\n }\n get stream() {\n return Stream.suspend(() => {\n responseRegistry.unregister(this.original);\n return Stream.ensuring(this.original.stream, Effect.sync(() => {\n this.controller.abort();\n }));\n });\n }\n toJSON() {\n return this.original.toJSON();\n }\n [Inspectable.NodeInspectSymbol]() {\n return this.original[Inspectable.NodeInspectSymbol]();\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n}\nconst isTransientError = error => Cause.isTimeoutError(error) || isTransientHttpError(error);\nconst isTransientHttpError = error => Error.isHttpClientError(error) && (error.reason._tag === \"TransportError\" || error.reason._tag === \"StatusCodeError\" && isTransientResponse(error.reason.response));\nconst isTooManyRequestsHttpClientError = error => Error.isHttpClientError(error) && error.reason._tag === \"StatusCodeError\" && error.reason.response.status === 429;\nconst isTransientResponse = response => response.status === 408 || response.status === 429 || response.status === 500 || response.status === 502 || response.status === 503 || response.status === 504;\n//# sourceMappingURL=HttpClient.js.map","/**\n * Service for serving Effect HTTP responses on a concrete HTTP server.\n *\n * Platform adapters provide `HttpServer`, and routers or applications consume\n * it to run an `HttpServerResponse` effect for each incoming request. The\n * service exposes the listening address, while this module also includes helpers\n * for address formatting, server logging, and clients that target the current\n * server in tests.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as FileSystem from \"../../FileSystem.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Path from \"../../Path.js\";\nimport * as Etag from \"./Etag.js\";\nimport * as HttpClient from \"./HttpClient.js\";\nimport * as ClientRequest from \"./HttpClientRequest.js\";\nimport * as HttpPlatform from \"./HttpPlatform.js\";\n/**\n * Service tag for an HTTP server runtime.\n *\n * **Details**\n *\n * The service can serve an HTTP response effect and exposes the address where the\n * server is listening.\n *\n * @category services\n * @since 4.0.0\n */\nexport class HttpServer extends /*#__PURE__*/Context.Service()(\"effect/http/HttpServer\") {}\n/**\n * Constructs an `HttpServer` service from a serving implementation and listening\n * address.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = options => options;\n/**\n * Creates a layer that starts serving an HTTP response effect with the current\n * `HttpServer`.\n *\n * **Details**\n *\n * The request service is supplied by the server for each request; the returned\n * layer still requires the server, a scope, and any non-request dependencies of\n * the response effect or middleware.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const serve = /*#__PURE__*/dual(args => Effect.isEffect(args[0]), (effect, middleware) => Layer.effectDiscard(HttpServer.use(server => server.serve(effect, middleware))));\n/**\n * Effect that starts serving an HTTP response effect with the current\n * `HttpServer`.\n *\n * **Details**\n *\n * The request service is supplied by the server for each request; the effect\n * requires a scope and any non-request dependencies of the response effect or\n * middleware.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const serveEffect = /*#__PURE__*/dual(args => Effect.isEffect(args[0]), (effect, middleware) => HttpServer.use(server => server.serve(effect, middleware)));\n/**\n * Formats a server address as a display string.\n *\n * **Details**\n *\n * TCP addresses are formatted as `http://host:port`; Unix socket addresses are\n * formatted as `unix://path`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const formatAddress = address => {\n switch (address._tag) {\n case \"UnixAddress\":\n return `unix://${address.path}`;\n case \"TcpAddress\":\n return `http://${address.hostname}:${address.port}`;\n }\n};\n/**\n * Reads the current server address, formats it with `formatAddress`, and passes\n * the formatted address to the supplied effectful function.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const addressFormattedWith = f => Effect.flatMap(HttpServer, server => f(formatAddress(server.address)));\n/**\n * Logs the formatted address of the current HTTP server.\n *\n * @category logging\n * @since 4.0.0\n */\nexport const logAddress = /*#__PURE__*/addressFormattedWith(_ => Effect.log(`Listening on ${_}`));\n/**\n * Adds address logging to a layer that provides an `HttpServer`.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const withLogAddress = layer => Layer.effectDiscard(logAddress).pipe(Layer.provideMerge(layer));\n/**\n * Builds an `HttpClient` that sends requests to the current test HTTP server.\n *\n * **Details**\n *\n * For TCP servers, requests are prefixed with the server URL and `0.0.0.0` is\n * rewritten to `127.0.0.1`.\n *\n * **Gotchas**\n *\n * Unix socket addresses are not supported.\n *\n * @category testing\n * @since 4.0.0\n */\nexport const makeTestClient = /*#__PURE__*/Effect.gen(function* () {\n const server = yield* HttpServer;\n const client = yield* HttpClient.HttpClient;\n const address = server.address;\n if (address._tag === \"UnixAddress\") {\n return yield* Effect.die(new Error(\"HttpServer.layerTestClient: UnixAddress not supported\"));\n }\n const host = address.hostname === \"0.0.0.0\" ? \"127.0.0.1\" : address.hostname;\n const url = `http://${host}:${address.port}`;\n return HttpClient.mapRequest(client, ClientRequest.prependUrl(url));\n});\n/**\n * Layer that provides the test `HttpClient` created by `makeTestClient`.\n *\n * @category testing\n * @since 4.0.0\n */\nexport const layerTestClient = /*#__PURE__*/Layer.effect(HttpClient.HttpClient)(makeTestClient);\n/**\n * Layer that provides the platform services commonly needed by HTTP\n * server tests.\n *\n * **Details**\n *\n * It includes `HttpPlatform`, `Path`, a weak ETag generator, and a no-op\n * `FileSystem`.\n *\n * @category testing\n * @since 4.0.0\n */\nexport const layerServices = /*#__PURE__*/Layer.mergeAll(HttpPlatform.layer, Path.layer, Etag.layerWeak).pipe(/*#__PURE__*/Layer.provideMerge(/*#__PURE__*/FileSystem.layerNoop({})));\n//# sourceMappingURL=HttpServer.js.map","/**\n * Fetch-based implementation of the Effect HTTP client service.\n *\n * This module provides an `HttpClient` layer that executes requests through a\n * Web Fetch API implementation. It is the transport to use in browsers, edge\n * runtimes, and Node.js environments where `globalThis.fetch` is available, or\n * anywhere a compatible fetch function can be supplied.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as HttpClient from \"./HttpClient.js\";\nimport * as HttpClientError from \"./HttpClientError.js\";\nimport * as HttpClientResponse from \"./HttpClientResponse.js\";\n/**\n * Context reference for the `fetch` implementation used by the fetch-based HTTP client.\n *\n * **Details**\n *\n * Defaults to `globalThis.fetch`.\n *\n * @category services\n * @since 4.0.0\n */\nexport const Fetch = /*#__PURE__*/Context.Reference(\"effect/http/FetchHttpClient/Fetch\", {\n defaultValue: () => globalThis.fetch\n});\n/**\n * Service that contains default fetch options for the fetch-based HTTP client.\n *\n * **When to use**\n *\n * Use to provide default credentials, cache, redirect, integrity, or other\n * fetch options for outgoing HTTP requests.\n *\n * **Details**\n *\n * Request-specific method, headers, body, and abort signal are supplied by the client when a request is executed.\n *\n * @category services\n * @since 4.0.0\n */\nexport class RequestInit extends /*#__PURE__*/Context.Service()(\"effect/http/FetchHttpClient/RequestInit\") {}\nconst fetch = /*#__PURE__*/HttpClient.make((request, url, signal, fiber) => {\n const fetch = fiber.getRef(Fetch);\n const options = fiber.context.mapUnsafe.get(RequestInit.key) ?? {};\n let headers = options.headers ? Headers.merge(Headers.fromInput(options.headers), request.headers) : request.headers;\n if (headers[\"content-length\"]) {\n headers = Headers.remove(headers, \"content-length\");\n }\n const send = body => Effect.map(Effect.tryPromise({\n try: () => fetch(url, {\n ...options,\n method: request.method,\n headers,\n body,\n duplex: request.body._tag === \"Stream\" ? \"half\" : undefined,\n signal\n }),\n catch: cause => new HttpClientError.HttpClientError({\n reason: new HttpClientError.TransportError({\n request,\n cause\n })\n })\n }), response => HttpClientResponse.fromWeb(request, response));\n switch (request.body._tag) {\n case \"Raw\":\n case \"Uint8Array\":\n return send(request.body.body);\n case \"FormData\":\n return send(request.body.formData);\n case \"Stream\":\n return Effect.flatMap(Stream.toReadableStreamEffect(request.body.stream), send);\n }\n return send(undefined);\n});\n/**\n * Layer that provides an `HttpClient` implementation backed by the configured\n * `Fetch` function.\n *\n * **When to use**\n *\n * Use when an Effect program should execute `HttpClient` requests through the\n * platform `fetch` implementation, especially in browser, edge, or Node.js\n * runtimes with `globalThis.fetch`.\n *\n * **Details**\n *\n * The layer uses the current `Fetch` reference and optional `RequestInit`\n * service for each request. Request-specific method, headers, body, and abort\n * signal are supplied by the client and override matching `RequestInit` fields.\n *\n * **Gotchas**\n *\n * Fetch behavior comes from the runtime's implementation, so CORS, cookies,\n * redirects, abort handling, and streaming support can vary by platform. Stream\n * request bodies are sent as Web streams with `duplex: \"half\"`, and any\n * `content-length` header is removed before calling `fetch`.\n *\n * @see {@link Fetch} for supplying the fetch implementation used by this layer\n * @see {@link RequestInit} for default `RequestInit` options applied before request-specific fields\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/HttpClient.layerMergedContext(/*#__PURE__*/Effect.succeed(fetch));\n//# sourceMappingURL=FetchHttpClient.js.map","const types = {\n 'application/prs.cww': ['cww'],\n 'application/prs.xsf+xml': ['xsf'],\n 'application/vnd.1000minds.decision-model+xml': ['1km'],\n 'application/vnd.3gpp.pic-bw-large': ['plb'],\n 'application/vnd.3gpp.pic-bw-small': ['psb'],\n 'application/vnd.3gpp.pic-bw-var': ['pvb'],\n 'application/vnd.3gpp2.tcap': ['tcap'],\n 'application/vnd.3m.post-it-notes': ['pwn'],\n 'application/vnd.accpac.simply.aso': ['aso'],\n 'application/vnd.accpac.simply.imp': ['imp'],\n 'application/vnd.acucobol': ['acu'],\n 'application/vnd.acucorp': ['atc', 'acutc'],\n 'application/vnd.adobe.air-application-installer-package+zip': ['air'],\n 'application/vnd.adobe.formscentral.fcdt': ['fcdt'],\n 'application/vnd.adobe.fxp': ['fxp', 'fxpl'],\n 'application/vnd.adobe.xdp+xml': ['xdp'],\n 'application/vnd.adobe.xfdf': ['*xfdf'],\n 'application/vnd.age': ['age'],\n 'application/vnd.ahead.space': ['ahead'],\n 'application/vnd.airzip.filesecure.azf': ['azf'],\n 'application/vnd.airzip.filesecure.azs': ['azs'],\n 'application/vnd.amazon.ebook': ['azw'],\n 'application/vnd.americandynamics.acc': ['acc'],\n 'application/vnd.amiga.ami': ['ami'],\n 'application/vnd.android.package-archive': ['apk'],\n 'application/vnd.anser-web-certificate-issue-initiation': ['cii'],\n 'application/vnd.anser-web-funds-transfer-initiation': ['fti'],\n 'application/vnd.antix.game-component': ['atx'],\n 'application/vnd.apple.installer+xml': ['mpkg'],\n 'application/vnd.apple.keynote': ['key'],\n 'application/vnd.apple.mpegurl': ['m3u8'],\n 'application/vnd.apple.numbers': ['numbers'],\n 'application/vnd.apple.pages': ['pages'],\n 'application/vnd.apple.pkpass': ['pkpass'],\n 'application/vnd.aristanetworks.swi': ['swi'],\n 'application/vnd.astraea-software.iota': ['iota'],\n 'application/vnd.audiograph': ['aep'],\n 'application/vnd.autodesk.fbx': ['fbx'],\n 'application/vnd.balsamiq.bmml+xml': ['bmml'],\n 'application/vnd.blueice.multipass': ['mpm'],\n 'application/vnd.bmi': ['bmi'],\n 'application/vnd.businessobjects': ['rep'],\n 'application/vnd.chemdraw+xml': ['cdxml'],\n 'application/vnd.chipnuts.karaoke-mmd': ['mmd'],\n 'application/vnd.cinderella': ['cdy'],\n 'application/vnd.citationstyles.style+xml': ['csl'],\n 'application/vnd.claymore': ['cla'],\n 'application/vnd.cloanto.rp9': ['rp9'],\n 'application/vnd.clonk.c4group': ['c4g', 'c4d', 'c4f', 'c4p', 'c4u'],\n 'application/vnd.cluetrust.cartomobile-config': ['c11amc'],\n 'application/vnd.cluetrust.cartomobile-config-pkg': ['c11amz'],\n 'application/vnd.commonspace': ['csp'],\n 'application/vnd.contact.cmsg': ['cdbcmsg'],\n 'application/vnd.cosmocaller': ['cmc'],\n 'application/vnd.crick.clicker': ['clkx'],\n 'application/vnd.crick.clicker.keyboard': ['clkk'],\n 'application/vnd.crick.clicker.palette': ['clkp'],\n 'application/vnd.crick.clicker.template': ['clkt'],\n 'application/vnd.crick.clicker.wordbank': ['clkw'],\n 'application/vnd.criticaltools.wbs+xml': ['wbs'],\n 'application/vnd.ctc-posml': ['pml'],\n 'application/vnd.cups-ppd': ['ppd'],\n 'application/vnd.curl.car': ['car'],\n 'application/vnd.curl.pcurl': ['pcurl'],\n 'application/vnd.dart': ['dart'],\n 'application/vnd.data-vision.rdz': ['rdz'],\n 'application/vnd.dbf': ['dbf'],\n 'application/vnd.dcmp+xml': ['dcmp'],\n 'application/vnd.dece.data': ['uvf', 'uvvf', 'uvd', 'uvvd'],\n 'application/vnd.dece.ttml+xml': ['uvt', 'uvvt'],\n 'application/vnd.dece.unspecified': ['uvx', 'uvvx'],\n 'application/vnd.dece.zip': ['uvz', 'uvvz'],\n 'application/vnd.denovo.fcselayout-link': ['fe_launch'],\n 'application/vnd.dna': ['dna'],\n 'application/vnd.dolby.mlp': ['mlp'],\n 'application/vnd.dpgraph': ['dpg'],\n 'application/vnd.dreamfactory': ['dfac'],\n 'application/vnd.ds-keypoint': ['kpxx'],\n 'application/vnd.dvb.ait': ['ait'],\n 'application/vnd.dvb.service': ['svc'],\n 'application/vnd.dynageo': ['geo'],\n 'application/vnd.ecowin.chart': ['mag'],\n 'application/vnd.enliven': ['nml'],\n 'application/vnd.epson.esf': ['esf'],\n 'application/vnd.epson.msf': ['msf'],\n 'application/vnd.epson.quickanime': ['qam'],\n 'application/vnd.epson.salt': ['slt'],\n 'application/vnd.epson.ssf': ['ssf'],\n 'application/vnd.eszigno3+xml': ['es3', 'et3'],\n 'application/vnd.ezpix-album': ['ez2'],\n 'application/vnd.ezpix-package': ['ez3'],\n 'application/vnd.fdf': ['*fdf'],\n 'application/vnd.fdsn.mseed': ['mseed'],\n 'application/vnd.fdsn.seed': ['seed', 'dataless'],\n 'application/vnd.flographit': ['gph'],\n 'application/vnd.fluxtime.clip': ['ftc'],\n 'application/vnd.framemaker': ['fm', 'frame', 'maker', 'book'],\n 'application/vnd.frogans.fnc': ['fnc'],\n 'application/vnd.frogans.ltf': ['ltf'],\n 'application/vnd.fsc.weblaunch': ['fsc'],\n 'application/vnd.fujitsu.oasys': ['oas'],\n 'application/vnd.fujitsu.oasys2': ['oa2'],\n 'application/vnd.fujitsu.oasys3': ['oa3'],\n 'application/vnd.fujitsu.oasysgp': ['fg5'],\n 'application/vnd.fujitsu.oasysprs': ['bh2'],\n 'application/vnd.fujixerox.ddd': ['ddd'],\n 'application/vnd.fujixerox.docuworks': ['xdw'],\n 'application/vnd.fujixerox.docuworks.binder': ['xbd'],\n 'application/vnd.fuzzysheet': ['fzs'],\n 'application/vnd.genomatix.tuxedo': ['txd'],\n 'application/vnd.geogebra.file': ['ggb'],\n 'application/vnd.geogebra.slides': ['ggs'],\n 'application/vnd.geogebra.tool': ['ggt'],\n 'application/vnd.geometry-explorer': ['gex', 'gre'],\n 'application/vnd.geonext': ['gxt'],\n 'application/vnd.geoplan': ['g2w'],\n 'application/vnd.geospace': ['g3w'],\n 'application/vnd.gmx': ['gmx'],\n 'application/vnd.google-apps.document': ['gdoc'],\n 'application/vnd.google-apps.drawing': ['gdraw'],\n 'application/vnd.google-apps.form': ['gform'],\n 'application/vnd.google-apps.jam': ['gjam'],\n 'application/vnd.google-apps.map': ['gmap'],\n 'application/vnd.google-apps.presentation': ['gslides'],\n 'application/vnd.google-apps.script': ['gscript'],\n 'application/vnd.google-apps.site': ['gsite'],\n 'application/vnd.google-apps.spreadsheet': ['gsheet'],\n 'application/vnd.google-earth.kml+xml': ['kml'],\n 'application/vnd.google-earth.kmz': ['kmz'],\n 'application/vnd.gov.sk.xmldatacontainer+xml': ['xdcf'],\n 'application/vnd.grafeq': ['gqf', 'gqs'],\n 'application/vnd.groove-account': ['gac'],\n 'application/vnd.groove-help': ['ghf'],\n 'application/vnd.groove-identity-message': ['gim'],\n 'application/vnd.groove-injector': ['grv'],\n 'application/vnd.groove-tool-message': ['gtm'],\n 'application/vnd.groove-tool-template': ['tpl'],\n 'application/vnd.groove-vcard': ['vcg'],\n 'application/vnd.hal+xml': ['hal'],\n 'application/vnd.handheld-entertainment+xml': ['zmm'],\n 'application/vnd.hbci': ['hbci'],\n 'application/vnd.hhe.lesson-player': ['les'],\n 'application/vnd.hp-hpgl': ['hpgl'],\n 'application/vnd.hp-hpid': ['hpid'],\n 'application/vnd.hp-hps': ['hps'],\n 'application/vnd.hp-jlyt': ['jlt'],\n 'application/vnd.hp-pcl': ['pcl'],\n 'application/vnd.hp-pclxl': ['pclxl'],\n 'application/vnd.hydrostatix.sof-data': ['sfd-hdstx'],\n 'application/vnd.ibm.minipay': ['mpy'],\n 'application/vnd.ibm.modcap': ['afp', 'listafp', 'list3820'],\n 'application/vnd.ibm.rights-management': ['irm'],\n 'application/vnd.ibm.secure-container': ['sc'],\n 'application/vnd.iccprofile': ['icc', 'icm'],\n 'application/vnd.igloader': ['igl'],\n 'application/vnd.immervision-ivp': ['ivp'],\n 'application/vnd.immervision-ivu': ['ivu'],\n 'application/vnd.insors.igm': ['igm'],\n 'application/vnd.intercon.formnet': ['xpw', 'xpx'],\n 'application/vnd.intergeo': ['i2g'],\n 'application/vnd.intu.qbo': ['qbo'],\n 'application/vnd.intu.qfx': ['qfx'],\n 'application/vnd.ipunplugged.rcprofile': ['rcprofile'],\n 'application/vnd.irepository.package+xml': ['irp'],\n 'application/vnd.is-xpr': ['xpr'],\n 'application/vnd.isac.fcs': ['fcs'],\n 'application/vnd.jam': ['jam'],\n 'application/vnd.jcp.javame.midlet-rms': ['rms'],\n 'application/vnd.jisp': ['jisp'],\n 'application/vnd.joost.joda-archive': ['joda'],\n 'application/vnd.kahootz': ['ktz', 'ktr'],\n 'application/vnd.kde.karbon': ['karbon'],\n 'application/vnd.kde.kchart': ['chrt'],\n 'application/vnd.kde.kformula': ['kfo'],\n 'application/vnd.kde.kivio': ['flw'],\n 'application/vnd.kde.kontour': ['kon'],\n 'application/vnd.kde.kpresenter': ['kpr', 'kpt'],\n 'application/vnd.kde.kspread': ['ksp'],\n 'application/vnd.kde.kword': ['kwd', 'kwt'],\n 'application/vnd.kenameaapp': ['htke'],\n 'application/vnd.kidspiration': ['kia'],\n 'application/vnd.kinar': ['kne', 'knp'],\n 'application/vnd.koan': ['skp', 'skd', 'skt', 'skm'],\n 'application/vnd.kodak-descriptor': ['sse'],\n 'application/vnd.las.las+xml': ['lasxml'],\n 'application/vnd.llamagraphics.life-balance.desktop': ['lbd'],\n 'application/vnd.llamagraphics.life-balance.exchange+xml': ['lbe'],\n 'application/vnd.lotus-1-2-3': ['123'],\n 'application/vnd.lotus-approach': ['apr'],\n 'application/vnd.lotus-freelance': ['pre'],\n 'application/vnd.lotus-notes': ['nsf'],\n 'application/vnd.lotus-organizer': ['org'],\n 'application/vnd.lotus-screencam': ['scm'],\n 'application/vnd.lotus-wordpro': ['lwp'],\n 'application/vnd.macports.portpkg': ['portpkg'],\n 'application/vnd.mapbox-vector-tile': ['mvt'],\n 'application/vnd.mcd': ['mcd'],\n 'application/vnd.medcalcdata': ['mc1'],\n 'application/vnd.mediastation.cdkey': ['cdkey'],\n 'application/vnd.mfer': ['mwf'],\n 'application/vnd.mfmp': ['mfm'],\n 'application/vnd.micrografx.flo': ['flo'],\n 'application/vnd.micrografx.igx': ['igx'],\n 'application/vnd.mif': ['mif'],\n 'application/vnd.mobius.daf': ['daf'],\n 'application/vnd.mobius.dis': ['dis'],\n 'application/vnd.mobius.mbk': ['mbk'],\n 'application/vnd.mobius.mqy': ['mqy'],\n 'application/vnd.mobius.msl': ['msl'],\n 'application/vnd.mobius.plc': ['plc'],\n 'application/vnd.mobius.txf': ['txf'],\n 'application/vnd.mophun.application': ['mpn'],\n 'application/vnd.mophun.certificate': ['mpc'],\n 'application/vnd.mozilla.xul+xml': ['xul'],\n 'application/vnd.ms-artgalry': ['cil'],\n 'application/vnd.ms-cab-compressed': ['cab'],\n 'application/vnd.ms-excel': ['xls', 'xlm', 'xla', 'xlc', 'xlt', 'xlw'],\n 'application/vnd.ms-excel.addin.macroenabled.12': ['xlam'],\n 'application/vnd.ms-excel.sheet.binary.macroenabled.12': ['xlsb'],\n 'application/vnd.ms-excel.sheet.macroenabled.12': ['xlsm'],\n 'application/vnd.ms-excel.template.macroenabled.12': ['xltm'],\n 'application/vnd.ms-fontobject': ['eot'],\n 'application/vnd.ms-htmlhelp': ['chm'],\n 'application/vnd.ms-ims': ['ims'],\n 'application/vnd.ms-lrm': ['lrm'],\n 'application/vnd.ms-officetheme': ['thmx'],\n 'application/vnd.ms-outlook': ['msg'],\n 'application/vnd.ms-pki.seccat': ['cat'],\n 'application/vnd.ms-pki.stl': ['*stl'],\n 'application/vnd.ms-powerpoint': ['ppt', 'pps', 'pot'],\n 'application/vnd.ms-powerpoint.addin.macroenabled.12': ['ppam'],\n 'application/vnd.ms-powerpoint.presentation.macroenabled.12': ['pptm'],\n 'application/vnd.ms-powerpoint.slide.macroenabled.12': ['sldm'],\n 'application/vnd.ms-powerpoint.slideshow.macroenabled.12': ['ppsm'],\n 'application/vnd.ms-powerpoint.template.macroenabled.12': ['potm'],\n 'application/vnd.ms-project': ['*mpp', 'mpt'],\n 'application/vnd.ms-visio.viewer': ['vdx'],\n 'application/vnd.ms-word.document.macroenabled.12': ['docm'],\n 'application/vnd.ms-word.template.macroenabled.12': ['dotm'],\n 'application/vnd.ms-works': ['wps', 'wks', 'wcm', 'wdb'],\n 'application/vnd.ms-wpl': ['wpl'],\n 'application/vnd.ms-xpsdocument': ['xps'],\n 'application/vnd.mseq': ['mseq'],\n 'application/vnd.musician': ['mus'],\n 'application/vnd.muvee.style': ['msty'],\n 'application/vnd.mynfc': ['taglet'],\n 'application/vnd.nato.bindingdataobject+xml': ['bdo'],\n 'application/vnd.neurolanguage.nlu': ['nlu'],\n 'application/vnd.nitf': ['ntf', 'nitf'],\n 'application/vnd.noblenet-directory': ['nnd'],\n 'application/vnd.noblenet-sealer': ['nns'],\n 'application/vnd.noblenet-web': ['nnw'],\n 'application/vnd.nokia.n-gage.ac+xml': ['*ac'],\n 'application/vnd.nokia.n-gage.data': ['ngdat'],\n 'application/vnd.nokia.n-gage.symbian.install': ['n-gage'],\n 'application/vnd.nokia.radio-preset': ['rpst'],\n 'application/vnd.nokia.radio-presets': ['rpss'],\n 'application/vnd.novadigm.edm': ['edm'],\n 'application/vnd.novadigm.edx': ['edx'],\n 'application/vnd.novadigm.ext': ['ext'],\n 'application/vnd.oasis.opendocument.chart': ['odc'],\n 'application/vnd.oasis.opendocument.chart-template': ['otc'],\n 'application/vnd.oasis.opendocument.database': ['odb'],\n 'application/vnd.oasis.opendocument.formula': ['odf'],\n 'application/vnd.oasis.opendocument.formula-template': ['odft'],\n 'application/vnd.oasis.opendocument.graphics': ['odg'],\n 'application/vnd.oasis.opendocument.graphics-template': ['otg'],\n 'application/vnd.oasis.opendocument.image': ['odi'],\n 'application/vnd.oasis.opendocument.image-template': ['oti'],\n 'application/vnd.oasis.opendocument.presentation': ['odp'],\n 'application/vnd.oasis.opendocument.presentation-template': ['otp'],\n 'application/vnd.oasis.opendocument.spreadsheet': ['ods'],\n 'application/vnd.oasis.opendocument.spreadsheet-template': ['ots'],\n 'application/vnd.oasis.opendocument.text': ['odt'],\n 'application/vnd.oasis.opendocument.text-master': ['odm'],\n 'application/vnd.oasis.opendocument.text-template': ['ott'],\n 'application/vnd.oasis.opendocument.text-web': ['oth'],\n 'application/vnd.olpc-sugar': ['xo'],\n 'application/vnd.oma.dd2+xml': ['dd2'],\n 'application/vnd.openblox.game+xml': ['obgx'],\n 'application/vnd.openofficeorg.extension': ['oxt'],\n 'application/vnd.openstreetmap.data+xml': ['osm'],\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation': [\n 'pptx',\n ],\n 'application/vnd.openxmlformats-officedocument.presentationml.slide': [\n 'sldx',\n ],\n 'application/vnd.openxmlformats-officedocument.presentationml.slideshow': [\n 'ppsx',\n ],\n 'application/vnd.openxmlformats-officedocument.presentationml.template': [\n 'potx',\n ],\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['xlsx'],\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.template': [\n 'xltx',\n ],\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': [\n 'docx',\n ],\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.template': [\n 'dotx',\n ],\n 'application/vnd.osgeo.mapguide.package': ['mgp'],\n 'application/vnd.osgi.dp': ['dp'],\n 'application/vnd.osgi.subsystem': ['esa'],\n 'application/vnd.palm': ['pdb', 'pqa', 'oprc'],\n 'application/vnd.pawaafile': ['paw'],\n 'application/vnd.pg.format': ['str'],\n 'application/vnd.pg.osasli': ['ei6'],\n 'application/vnd.picsel': ['efif'],\n 'application/vnd.pmi.widget': ['wg'],\n 'application/vnd.pocketlearn': ['plf'],\n 'application/vnd.powerbuilder6': ['pbd'],\n 'application/vnd.previewsystems.box': ['box'],\n 'application/vnd.procrate.brushset': ['brushset'],\n 'application/vnd.procreate.brush': ['brush'],\n 'application/vnd.procreate.dream': ['drm'],\n 'application/vnd.proteus.magazine': ['mgz'],\n 'application/vnd.publishare-delta-tree': ['qps'],\n 'application/vnd.pvi.ptid1': ['ptid'],\n 'application/vnd.pwg-xhtml-print+xml': ['xhtm'],\n 'application/vnd.quark.quarkxpress': [\n 'qxd',\n 'qxt',\n 'qwd',\n 'qwt',\n 'qxl',\n 'qxb',\n ],\n 'application/vnd.rar': ['rar'],\n 'application/vnd.realvnc.bed': ['bed'],\n 'application/vnd.recordare.musicxml': ['mxl'],\n 'application/vnd.recordare.musicxml+xml': ['musicxml'],\n 'application/vnd.rig.cryptonote': ['cryptonote'],\n 'application/vnd.rim.cod': ['cod'],\n 'application/vnd.rn-realmedia': ['rm'],\n 'application/vnd.rn-realmedia-vbr': ['rmvb'],\n 'application/vnd.route66.link66+xml': ['link66'],\n 'application/vnd.sailingtracker.track': ['st'],\n 'application/vnd.seemail': ['see'],\n 'application/vnd.sema': ['sema'],\n 'application/vnd.semd': ['semd'],\n 'application/vnd.semf': ['semf'],\n 'application/vnd.shana.informed.formdata': ['ifm'],\n 'application/vnd.shana.informed.formtemplate': ['itp'],\n 'application/vnd.shana.informed.interchange': ['iif'],\n 'application/vnd.shana.informed.package': ['ipk'],\n 'application/vnd.simtech-mindmapper': ['twd', 'twds'],\n 'application/vnd.smaf': ['mmf'],\n 'application/vnd.smart.teacher': ['teacher'],\n 'application/vnd.software602.filler.form+xml': ['fo'],\n 'application/vnd.solent.sdkm+xml': ['sdkm', 'sdkd'],\n 'application/vnd.spotfire.dxp': ['dxp'],\n 'application/vnd.spotfire.sfs': ['sfs'],\n 'application/vnd.stardivision.calc': ['sdc'],\n 'application/vnd.stardivision.draw': ['sda'],\n 'application/vnd.stardivision.impress': ['sdd'],\n 'application/vnd.stardivision.math': ['smf'],\n 'application/vnd.stardivision.writer': ['sdw', 'vor'],\n 'application/vnd.stardivision.writer-global': ['sgl'],\n 'application/vnd.stepmania.package': ['smzip'],\n 'application/vnd.stepmania.stepchart': ['sm'],\n 'application/vnd.sun.wadl+xml': ['wadl'],\n 'application/vnd.sun.xml.calc': ['sxc'],\n 'application/vnd.sun.xml.calc.template': ['stc'],\n 'application/vnd.sun.xml.draw': ['sxd'],\n 'application/vnd.sun.xml.draw.template': ['std'],\n 'application/vnd.sun.xml.impress': ['sxi'],\n 'application/vnd.sun.xml.impress.template': ['sti'],\n 'application/vnd.sun.xml.math': ['sxm'],\n 'application/vnd.sun.xml.writer': ['sxw'],\n 'application/vnd.sun.xml.writer.global': ['sxg'],\n 'application/vnd.sun.xml.writer.template': ['stw'],\n 'application/vnd.sus-calendar': ['sus', 'susp'],\n 'application/vnd.svd': ['svd'],\n 'application/vnd.symbian.install': ['sis', 'sisx'],\n 'application/vnd.syncml+xml': ['xsm'],\n 'application/vnd.syncml.dm+wbxml': ['bdm'],\n 'application/vnd.syncml.dm+xml': ['xdm'],\n 'application/vnd.syncml.dmddf+xml': ['ddf'],\n 'application/vnd.tao.intent-module-archive': ['tao'],\n 'application/vnd.tcpdump.pcap': ['pcap', 'cap', 'dmp'],\n 'application/vnd.tmobile-livetv': ['tmo'],\n 'application/vnd.trid.tpt': ['tpt'],\n 'application/vnd.triscape.mxs': ['mxs'],\n 'application/vnd.trueapp': ['tra'],\n 'application/vnd.ufdl': ['ufd', 'ufdl'],\n 'application/vnd.uiq.theme': ['utz'],\n 'application/vnd.umajin': ['umj'],\n 'application/vnd.unity': ['unityweb'],\n 'application/vnd.uoml+xml': ['uoml', 'uo'],\n 'application/vnd.vcx': ['vcx'],\n 'application/vnd.visio': ['vsd', 'vst', 'vss', 'vsw', 'vsdx', 'vtx'],\n 'application/vnd.visionary': ['vis'],\n 'application/vnd.vsf': ['vsf'],\n 'application/vnd.wap.wbxml': ['wbxml'],\n 'application/vnd.wap.wmlc': ['wmlc'],\n 'application/vnd.wap.wmlscriptc': ['wmlsc'],\n 'application/vnd.webturbo': ['wtb'],\n 'application/vnd.wolfram.player': ['nbp'],\n 'application/vnd.wordperfect': ['wpd'],\n 'application/vnd.wqd': ['wqd'],\n 'application/vnd.wt.stf': ['stf'],\n 'application/vnd.xara': ['xar'],\n 'application/vnd.xfdl': ['xfdl'],\n 'application/vnd.yamaha.hv-dic': ['hvd'],\n 'application/vnd.yamaha.hv-script': ['hvs'],\n 'application/vnd.yamaha.hv-voice': ['hvp'],\n 'application/vnd.yamaha.openscoreformat': ['osf'],\n 'application/vnd.yamaha.openscoreformat.osfpvg+xml': ['osfpvg'],\n 'application/vnd.yamaha.smaf-audio': ['saf'],\n 'application/vnd.yamaha.smaf-phrase': ['spf'],\n 'application/vnd.yellowriver-custom-menu': ['cmp'],\n 'application/vnd.zul': ['zir', 'zirz'],\n 'application/vnd.zzazz.deck+xml': ['zaz'],\n 'application/x-7z-compressed': ['7z'],\n 'application/x-abiword': ['abw'],\n 'application/x-ace-compressed': ['ace'],\n 'application/x-apple-diskimage': ['*dmg'],\n 'application/x-arj': ['arj'],\n 'application/x-authorware-bin': ['aab', 'x32', 'u32', 'vox'],\n 'application/x-authorware-map': ['aam'],\n 'application/x-authorware-seg': ['aas'],\n 'application/x-bcpio': ['bcpio'],\n 'application/x-bdoc': ['*bdoc'],\n 'application/x-bittorrent': ['torrent'],\n 'application/x-blender': ['blend'],\n 'application/x-blorb': ['blb', 'blorb'],\n 'application/x-bzip': ['bz'],\n 'application/x-bzip2': ['bz2', 'boz'],\n 'application/x-cbr': ['cbr', 'cba', 'cbt', 'cbz', 'cb7'],\n 'application/x-cdlink': ['vcd'],\n 'application/x-cfs-compressed': ['cfs'],\n 'application/x-chat': ['chat'],\n 'application/x-chess-pgn': ['pgn'],\n 'application/x-chrome-extension': ['crx'],\n 'application/x-cocoa': ['cco'],\n 'application/x-compressed': ['*rar'],\n 'application/x-conference': ['nsc'],\n 'application/x-cpio': ['cpio'],\n 'application/x-csh': ['csh'],\n 'application/x-debian-package': ['*deb', 'udeb'],\n 'application/x-dgc-compressed': ['dgc'],\n 'application/x-director': [\n 'dir',\n 'dcr',\n 'dxr',\n 'cst',\n 'cct',\n 'cxt',\n 'w3d',\n 'fgd',\n 'swa',\n ],\n 'application/x-doom': ['wad'],\n 'application/x-dtbncx+xml': ['ncx'],\n 'application/x-dtbook+xml': ['dtb'],\n 'application/x-dtbresource+xml': ['res'],\n 'application/x-dvi': ['dvi'],\n 'application/x-envoy': ['evy'],\n 'application/x-eva': ['eva'],\n 'application/x-font-bdf': ['bdf'],\n 'application/x-font-ghostscript': ['gsf'],\n 'application/x-font-linux-psf': ['psf'],\n 'application/x-font-pcf': ['pcf'],\n 'application/x-font-snf': ['snf'],\n 'application/x-font-type1': ['pfa', 'pfb', 'pfm', 'afm'],\n 'application/x-freearc': ['arc'],\n 'application/x-futuresplash': ['spl'],\n 'application/x-gca-compressed': ['gca'],\n 'application/x-glulx': ['ulx'],\n 'application/x-gnumeric': ['gnumeric'],\n 'application/x-gramps-xml': ['gramps'],\n 'application/x-gtar': ['gtar'],\n 'application/x-hdf': ['hdf'],\n 'application/x-httpd-php': ['php'],\n 'application/x-install-instructions': ['install'],\n 'application/x-ipynb+json': ['ipynb'],\n 'application/x-iso9660-image': ['*iso'],\n 'application/x-iwork-keynote-sffkey': ['*key'],\n 'application/x-iwork-numbers-sffnumbers': ['*numbers'],\n 'application/x-iwork-pages-sffpages': ['*pages'],\n 'application/x-java-archive-diff': ['jardiff'],\n 'application/x-java-jnlp-file': ['jnlp'],\n 'application/x-keepass2': ['kdbx'],\n 'application/x-latex': ['latex'],\n 'application/x-lua-bytecode': ['luac'],\n 'application/x-lzh-compressed': ['lzh', 'lha'],\n 'application/x-makeself': ['run'],\n 'application/x-mie': ['mie'],\n 'application/x-mobipocket-ebook': ['*prc', 'mobi'],\n 'application/x-ms-application': ['application'],\n 'application/x-ms-shortcut': ['lnk'],\n 'application/x-ms-wmd': ['wmd'],\n 'application/x-ms-wmz': ['wmz'],\n 'application/x-ms-xbap': ['xbap'],\n 'application/x-msaccess': ['mdb'],\n 'application/x-msbinder': ['obd'],\n 'application/x-mscardfile': ['crd'],\n 'application/x-msclip': ['clp'],\n 'application/x-msdos-program': ['*exe'],\n 'application/x-msdownload': ['*exe', '*dll', 'com', 'bat', '*msi'],\n 'application/x-msmediaview': ['mvb', 'm13', 'm14'],\n 'application/x-msmetafile': ['*wmf', '*wmz', '*emf', 'emz'],\n 'application/x-msmoney': ['mny'],\n 'application/x-mspublisher': ['pub'],\n 'application/x-msschedule': ['scd'],\n 'application/x-msterminal': ['trm'],\n 'application/x-mswrite': ['wri'],\n 'application/x-netcdf': ['nc', 'cdf'],\n 'application/x-ns-proxy-autoconfig': ['pac'],\n 'application/x-nzb': ['nzb'],\n 'application/x-perl': ['pl', 'pm'],\n 'application/x-pilot': ['*prc', '*pdb'],\n 'application/x-pkcs12': ['p12', 'pfx'],\n 'application/x-pkcs7-certificates': ['p7b', 'spc'],\n 'application/x-pkcs7-certreqresp': ['p7r'],\n 'application/x-rar-compressed': ['*rar'],\n 'application/x-redhat-package-manager': ['rpm'],\n 'application/x-research-info-systems': ['ris'],\n 'application/x-sea': ['sea'],\n 'application/x-sh': ['sh'],\n 'application/x-shar': ['shar'],\n 'application/x-shockwave-flash': ['swf'],\n 'application/x-silverlight-app': ['xap'],\n 'application/x-sql': ['*sql'],\n 'application/x-stuffit': ['sit'],\n 'application/x-stuffitx': ['sitx'],\n 'application/x-subrip': ['srt'],\n 'application/x-sv4cpio': ['sv4cpio'],\n 'application/x-sv4crc': ['sv4crc'],\n 'application/x-t3vm-image': ['t3'],\n 'application/x-tads': ['gam'],\n 'application/x-tar': ['tar'],\n 'application/x-tcl': ['tcl', 'tk'],\n 'application/x-tex': ['tex'],\n 'application/x-tex-tfm': ['tfm'],\n 'application/x-texinfo': ['texinfo', 'texi'],\n 'application/x-tgif': ['*obj'],\n 'application/x-ustar': ['ustar'],\n 'application/x-virtualbox-hdd': ['hdd'],\n 'application/x-virtualbox-ova': ['ova'],\n 'application/x-virtualbox-ovf': ['ovf'],\n 'application/x-virtualbox-vbox': ['vbox'],\n 'application/x-virtualbox-vbox-extpack': ['vbox-extpack'],\n 'application/x-virtualbox-vdi': ['vdi'],\n 'application/x-virtualbox-vhd': ['vhd'],\n 'application/x-virtualbox-vmdk': ['vmdk'],\n 'application/x-wais-source': ['src'],\n 'application/x-web-app-manifest+json': ['webapp'],\n 'application/x-x509-ca-cert': ['der', 'crt', 'pem'],\n 'application/x-xfig': ['fig'],\n 'application/x-xliff+xml': ['*xlf'],\n 'application/x-xpinstall': ['xpi'],\n 'application/x-xz': ['xz'],\n 'application/x-zip-compressed': ['*zip'],\n 'application/x-zmachine': ['z1', 'z2', 'z3', 'z4', 'z5', 'z6', 'z7', 'z8'],\n 'audio/vnd.dece.audio': ['uva', 'uvva'],\n 'audio/vnd.digital-winds': ['eol'],\n 'audio/vnd.dra': ['dra'],\n 'audio/vnd.dts': ['dts'],\n 'audio/vnd.dts.hd': ['dtshd'],\n 'audio/vnd.lucent.voice': ['lvp'],\n 'audio/vnd.ms-playready.media.pya': ['pya'],\n 'audio/vnd.nuera.ecelp4800': ['ecelp4800'],\n 'audio/vnd.nuera.ecelp7470': ['ecelp7470'],\n 'audio/vnd.nuera.ecelp9600': ['ecelp9600'],\n 'audio/vnd.rip': ['rip'],\n 'audio/x-aac': ['*aac'],\n 'audio/x-aiff': ['aif', 'aiff', 'aifc'],\n 'audio/x-caf': ['caf'],\n 'audio/x-flac': ['flac'],\n 'audio/x-m4a': ['*m4a'],\n 'audio/x-matroska': ['mka'],\n 'audio/x-mpegurl': ['m3u'],\n 'audio/x-ms-wax': ['wax'],\n 'audio/x-ms-wma': ['wma'],\n 'audio/x-pn-realaudio': ['ram', 'ra'],\n 'audio/x-pn-realaudio-plugin': ['rmp'],\n 'audio/x-realaudio': ['*ra'],\n 'audio/x-wav': ['*wav'],\n 'chemical/x-cdx': ['cdx'],\n 'chemical/x-cif': ['cif'],\n 'chemical/x-cmdf': ['cmdf'],\n 'chemical/x-cml': ['cml'],\n 'chemical/x-csml': ['csml'],\n 'chemical/x-xyz': ['xyz'],\n 'image/prs.btif': ['btif', 'btf'],\n 'image/prs.pti': ['pti'],\n 'image/vnd.adobe.photoshop': ['psd'],\n 'image/vnd.airzip.accelerator.azv': ['azv'],\n 'image/vnd.blockfact.facti': ['facti'],\n 'image/vnd.dece.graphic': ['uvi', 'uvvi', 'uvg', 'uvvg'],\n 'image/vnd.djvu': ['djvu', 'djv'],\n 'image/vnd.dvb.subtitle': ['*sub'],\n 'image/vnd.dwg': ['dwg'],\n 'image/vnd.dxf': ['dxf'],\n 'image/vnd.fastbidsheet': ['fbs'],\n 'image/vnd.fpx': ['fpx'],\n 'image/vnd.fst': ['fst'],\n 'image/vnd.fujixerox.edmics-mmr': ['mmr'],\n 'image/vnd.fujixerox.edmics-rlc': ['rlc'],\n 'image/vnd.microsoft.icon': ['ico'],\n 'image/vnd.ms-dds': ['dds'],\n 'image/vnd.ms-modi': ['mdi'],\n 'image/vnd.ms-photo': ['wdp'],\n 'image/vnd.net-fpx': ['npx'],\n 'image/vnd.pco.b16': ['b16'],\n 'image/vnd.tencent.tap': ['tap'],\n 'image/vnd.valve.source.texture': ['vtf'],\n 'image/vnd.wap.wbmp': ['wbmp'],\n 'image/vnd.xiff': ['xif'],\n 'image/vnd.zbrush.pcx': ['pcx'],\n 'image/x-3ds': ['3ds'],\n 'image/x-adobe-dng': ['dng'],\n 'image/x-cmu-raster': ['ras'],\n 'image/x-cmx': ['cmx'],\n 'image/x-freehand': ['fh', 'fhc', 'fh4', 'fh5', 'fh7'],\n 'image/x-icon': ['*ico'],\n 'image/x-jng': ['jng'],\n 'image/x-mrsid-image': ['sid'],\n 'image/x-ms-bmp': ['*bmp'],\n 'image/x-pcx': ['*pcx'],\n 'image/x-pict': ['pic', 'pct'],\n 'image/x-portable-anymap': ['pnm'],\n 'image/x-portable-bitmap': ['pbm'],\n 'image/x-portable-graymap': ['pgm'],\n 'image/x-portable-pixmap': ['ppm'],\n 'image/x-rgb': ['rgb'],\n 'image/x-tga': ['tga'],\n 'image/x-xbitmap': ['xbm'],\n 'image/x-xpixmap': ['xpm'],\n 'image/x-xwindowdump': ['xwd'],\n 'message/vnd.wfa.wsc': ['wsc'],\n 'model/vnd.bary': ['bary'],\n 'model/vnd.cld': ['cld'],\n 'model/vnd.collada+xml': ['dae'],\n 'model/vnd.dwf': ['dwf'],\n 'model/vnd.gdl': ['gdl'],\n 'model/vnd.gtw': ['gtw'],\n 'model/vnd.mts': ['*mts'],\n 'model/vnd.opengex': ['ogex'],\n 'model/vnd.parasolid.transmit.binary': ['x_b'],\n 'model/vnd.parasolid.transmit.text': ['x_t'],\n 'model/vnd.pytha.pyox': ['pyo', 'pyox'],\n 'model/vnd.sap.vds': ['vds'],\n 'model/vnd.usda': ['usda'],\n 'model/vnd.usdz+zip': ['usdz'],\n 'model/vnd.valve.source.compiled-map': ['bsp'],\n 'model/vnd.vtu': ['vtu'],\n 'text/prs.lines.tag': ['dsc'],\n 'text/vnd.curl': ['curl'],\n 'text/vnd.curl.dcurl': ['dcurl'],\n 'text/vnd.curl.mcurl': ['mcurl'],\n 'text/vnd.curl.scurl': ['scurl'],\n 'text/vnd.dvb.subtitle': ['sub'],\n 'text/vnd.familysearch.gedcom': ['ged'],\n 'text/vnd.fly': ['fly'],\n 'text/vnd.fmi.flexstor': ['flx'],\n 'text/vnd.graphviz': ['gv'],\n 'text/vnd.in3d.3dml': ['3dml'],\n 'text/vnd.in3d.spot': ['spot'],\n 'text/vnd.sun.j2me.app-descriptor': ['jad'],\n 'text/vnd.wap.wml': ['wml'],\n 'text/vnd.wap.wmlscript': ['wmls'],\n 'text/x-asm': ['s', 'asm'],\n 'text/x-c': ['c', 'cc', 'cxx', 'cpp', 'h', 'hh', 'dic'],\n 'text/x-component': ['htc'],\n 'text/x-fortran': ['f', 'for', 'f77', 'f90'],\n 'text/x-handlebars-template': ['hbs'],\n 'text/x-java-source': ['java'],\n 'text/x-lua': ['lua'],\n 'text/x-markdown': ['mkd'],\n 'text/x-nfo': ['nfo'],\n 'text/x-opml': ['opml'],\n 'text/x-org': ['*org'],\n 'text/x-pascal': ['p', 'pas'],\n 'text/x-processing': ['pde'],\n 'text/x-sass': ['sass'],\n 'text/x-scss': ['scss'],\n 'text/x-setext': ['etx'],\n 'text/x-sfv': ['sfv'],\n 'text/x-suse-ymp': ['ymp'],\n 'text/x-uuencode': ['uu'],\n 'text/x-vcalendar': ['vcs'],\n 'text/x-vcard': ['vcf'],\n 'video/vnd.dece.hd': ['uvh', 'uvvh'],\n 'video/vnd.dece.mobile': ['uvm', 'uvvm'],\n 'video/vnd.dece.pd': ['uvp', 'uvvp'],\n 'video/vnd.dece.sd': ['uvs', 'uvvs'],\n 'video/vnd.dece.video': ['uvv', 'uvvv'],\n 'video/vnd.dvb.file': ['dvb'],\n 'video/vnd.fvt': ['fvt'],\n 'video/vnd.mpegurl': ['mxu', 'm4u'],\n 'video/vnd.ms-playready.media.pyv': ['pyv'],\n 'video/vnd.uvvu.mp4': ['uvu', 'uvvu'],\n 'video/vnd.vivo': ['viv'],\n 'video/x-f4v': ['f4v'],\n 'video/x-fli': ['fli'],\n 'video/x-flv': ['flv'],\n 'video/x-m4v': ['m4v'],\n 'video/x-matroska': ['mkv', 'mk3d', 'mks'],\n 'video/x-mng': ['mng'],\n 'video/x-ms-asf': ['asf', 'asx'],\n 'video/x-ms-vob': ['vob'],\n 'video/x-ms-wm': ['wm'],\n 'video/x-ms-wmv': ['wmv'],\n 'video/x-ms-wmx': ['wmx'],\n 'video/x-ms-wvx': ['wvx'],\n 'video/x-msvideo': ['avi'],\n 'video/x-sgi-movie': ['movie'],\n 'video/x-smv': ['smv'],\n 'x-conference/x-cooltalk': ['ice'],\n};\nObject.freeze(types);\nexport default types;\n","const types = {\n 'application/andrew-inset': ['ez'],\n 'application/appinstaller': ['appinstaller'],\n 'application/applixware': ['aw'],\n 'application/appx': ['appx'],\n 'application/appxbundle': ['appxbundle'],\n 'application/atom+xml': ['atom'],\n 'application/atomcat+xml': ['atomcat'],\n 'application/atomdeleted+xml': ['atomdeleted'],\n 'application/atomsvc+xml': ['atomsvc'],\n 'application/atsc-dwd+xml': ['dwd'],\n 'application/atsc-held+xml': ['held'],\n 'application/atsc-rsat+xml': ['rsat'],\n 'application/automationml-aml+xml': ['aml'],\n 'application/automationml-amlx+zip': ['amlx'],\n 'application/bdoc': ['bdoc'],\n 'application/calendar+xml': ['xcs'],\n 'application/ccxml+xml': ['ccxml'],\n 'application/cdfx+xml': ['cdfx'],\n 'application/cdmi-capability': ['cdmia'],\n 'application/cdmi-container': ['cdmic'],\n 'application/cdmi-domain': ['cdmid'],\n 'application/cdmi-object': ['cdmio'],\n 'application/cdmi-queue': ['cdmiq'],\n 'application/cpl+xml': ['cpl'],\n 'application/cu-seeme': ['cu'],\n 'application/cwl': ['cwl'],\n 'application/dash+xml': ['mpd'],\n 'application/dash-patch+xml': ['mpp'],\n 'application/davmount+xml': ['davmount'],\n 'application/dicom': ['dcm'],\n 'application/docbook+xml': ['dbk'],\n 'application/dssc+der': ['dssc'],\n 'application/dssc+xml': ['xdssc'],\n 'application/ecmascript': ['ecma'],\n 'application/emma+xml': ['emma'],\n 'application/emotionml+xml': ['emotionml'],\n 'application/epub+zip': ['epub'],\n 'application/exi': ['exi'],\n 'application/express': ['exp'],\n 'application/fdf': ['fdf'],\n 'application/fdt+xml': ['fdt'],\n 'application/font-tdpfr': ['pfr'],\n 'application/geo+json': ['geojson'],\n 'application/gml+xml': ['gml'],\n 'application/gpx+xml': ['gpx'],\n 'application/gxf': ['gxf'],\n 'application/gzip': ['gz'],\n 'application/hjson': ['hjson'],\n 'application/hyperstudio': ['stk'],\n 'application/inkml+xml': ['ink', 'inkml'],\n 'application/ipfix': ['ipfix'],\n 'application/its+xml': ['its'],\n 'application/java-archive': ['jar', 'war', 'ear'],\n 'application/java-serialized-object': ['ser'],\n 'application/java-vm': ['class'],\n 'application/javascript': ['*js'],\n 'application/json': ['json', 'map'],\n 'application/json5': ['json5'],\n 'application/jsonml+json': ['jsonml'],\n 'application/ld+json': ['jsonld'],\n 'application/lgr+xml': ['lgr'],\n 'application/lost+xml': ['lostxml'],\n 'application/mac-binhex40': ['hqx'],\n 'application/mac-compactpro': ['cpt'],\n 'application/mads+xml': ['mads'],\n 'application/manifest+json': ['webmanifest'],\n 'application/marc': ['mrc'],\n 'application/marcxml+xml': ['mrcx'],\n 'application/mathematica': ['ma', 'nb', 'mb'],\n 'application/mathml+xml': ['mathml'],\n 'application/mbox': ['mbox'],\n 'application/media-policy-dataset+xml': ['mpf'],\n 'application/mediaservercontrol+xml': ['mscml'],\n 'application/metalink+xml': ['metalink'],\n 'application/metalink4+xml': ['meta4'],\n 'application/mets+xml': ['mets'],\n 'application/mmt-aei+xml': ['maei'],\n 'application/mmt-usd+xml': ['musd'],\n 'application/mods+xml': ['mods'],\n 'application/mp21': ['m21', 'mp21'],\n 'application/mp4': ['*mp4', '*mpg4', 'mp4s', 'm4p'],\n 'application/msix': ['msix'],\n 'application/msixbundle': ['msixbundle'],\n 'application/msword': ['doc', 'dot'],\n 'application/mxf': ['mxf'],\n 'application/n-quads': ['nq'],\n 'application/n-triples': ['nt'],\n 'application/node': ['cjs'],\n 'application/octet-stream': [\n 'bin',\n 'dms',\n 'lrf',\n 'mar',\n 'so',\n 'dist',\n 'distz',\n 'pkg',\n 'bpk',\n 'dump',\n 'elc',\n 'deploy',\n 'exe',\n 'dll',\n 'deb',\n 'dmg',\n 'iso',\n 'img',\n 'msi',\n 'msp',\n 'msm',\n 'buffer',\n ],\n 'application/oda': ['oda'],\n 'application/oebps-package+xml': ['opf'],\n 'application/ogg': ['ogx'],\n 'application/omdoc+xml': ['omdoc'],\n 'application/onenote': [\n 'onetoc',\n 'onetoc2',\n 'onetmp',\n 'onepkg',\n 'one',\n 'onea',\n ],\n 'application/oxps': ['oxps'],\n 'application/p2p-overlay+xml': ['relo'],\n 'application/patch-ops-error+xml': ['xer'],\n 'application/pdf': ['pdf'],\n 'application/pgp-encrypted': ['pgp'],\n 'application/pgp-keys': ['asc'],\n 'application/pgp-signature': ['sig', '*asc'],\n 'application/pics-rules': ['prf'],\n 'application/pkcs10': ['p10'],\n 'application/pkcs7-mime': ['p7m', 'p7c'],\n 'application/pkcs7-signature': ['p7s'],\n 'application/pkcs8': ['p8'],\n 'application/pkix-attr-cert': ['ac'],\n 'application/pkix-cert': ['cer'],\n 'application/pkix-crl': ['crl'],\n 'application/pkix-pkipath': ['pkipath'],\n 'application/pkixcmp': ['pki'],\n 'application/pls+xml': ['pls'],\n 'application/postscript': ['ai', 'eps', 'ps'],\n 'application/provenance+xml': ['provx'],\n 'application/pskc+xml': ['pskcxml'],\n 'application/raml+yaml': ['raml'],\n 'application/rdf+xml': ['rdf', 'owl'],\n 'application/reginfo+xml': ['rif'],\n 'application/relax-ng-compact-syntax': ['rnc'],\n 'application/resource-lists+xml': ['rl'],\n 'application/resource-lists-diff+xml': ['rld'],\n 'application/rls-services+xml': ['rs'],\n 'application/route-apd+xml': ['rapd'],\n 'application/route-s-tsid+xml': ['sls'],\n 'application/route-usd+xml': ['rusd'],\n 'application/rpki-ghostbusters': ['gbr'],\n 'application/rpki-manifest': ['mft'],\n 'application/rpki-roa': ['roa'],\n 'application/rsd+xml': ['rsd'],\n 'application/rss+xml': ['rss'],\n 'application/rtf': ['rtf'],\n 'application/sbml+xml': ['sbml'],\n 'application/scvp-cv-request': ['scq'],\n 'application/scvp-cv-response': ['scs'],\n 'application/scvp-vp-request': ['spq'],\n 'application/scvp-vp-response': ['spp'],\n 'application/sdp': ['sdp'],\n 'application/senml+xml': ['senmlx'],\n 'application/sensml+xml': ['sensmlx'],\n 'application/set-payment-initiation': ['setpay'],\n 'application/set-registration-initiation': ['setreg'],\n 'application/shf+xml': ['shf'],\n 'application/sieve': ['siv', 'sieve'],\n 'application/smil+xml': ['smi', 'smil'],\n 'application/sparql-query': ['rq'],\n 'application/sparql-results+xml': ['srx'],\n 'application/sql': ['sql'],\n 'application/srgs': ['gram'],\n 'application/srgs+xml': ['grxml'],\n 'application/sru+xml': ['sru'],\n 'application/ssdl+xml': ['ssdl'],\n 'application/ssml+xml': ['ssml'],\n 'application/swid+xml': ['swidtag'],\n 'application/tei+xml': ['tei', 'teicorpus'],\n 'application/thraud+xml': ['tfi'],\n 'application/timestamped-data': ['tsd'],\n 'application/toml': ['toml'],\n 'application/trig': ['trig'],\n 'application/ttml+xml': ['ttml'],\n 'application/ubjson': ['ubj'],\n 'application/urc-ressheet+xml': ['rsheet'],\n 'application/urc-targetdesc+xml': ['td'],\n 'application/voicexml+xml': ['vxml'],\n 'application/wasm': ['wasm'],\n 'application/watcherinfo+xml': ['wif'],\n 'application/widget': ['wgt'],\n 'application/winhlp': ['hlp'],\n 'application/wsdl+xml': ['wsdl'],\n 'application/wspolicy+xml': ['wspolicy'],\n 'application/xaml+xml': ['xaml'],\n 'application/xcap-att+xml': ['xav'],\n 'application/xcap-caps+xml': ['xca'],\n 'application/xcap-diff+xml': ['xdf'],\n 'application/xcap-el+xml': ['xel'],\n 'application/xcap-ns+xml': ['xns'],\n 'application/xenc+xml': ['xenc'],\n 'application/xfdf': ['xfdf'],\n 'application/xhtml+xml': ['xhtml', 'xht'],\n 'application/xliff+xml': ['xlf'],\n 'application/xml': ['xml', 'xsl', 'xsd', 'rng'],\n 'application/xml-dtd': ['dtd'],\n 'application/xop+xml': ['xop'],\n 'application/xproc+xml': ['xpl'],\n 'application/xslt+xml': ['*xsl', 'xslt'],\n 'application/xspf+xml': ['xspf'],\n 'application/xv+xml': ['mxml', 'xhvml', 'xvml', 'xvm'],\n 'application/yang': ['yang'],\n 'application/yin+xml': ['yin'],\n 'application/zip': ['zip'],\n 'application/zip+dotlottie': ['lottie'],\n 'audio/3gpp': ['*3gpp'],\n 'audio/aac': ['adts', 'aac'],\n 'audio/adpcm': ['adp'],\n 'audio/amr': ['amr'],\n 'audio/basic': ['au', 'snd'],\n 'audio/midi': ['mid', 'midi', 'kar', 'rmi'],\n 'audio/mobile-xmf': ['mxmf'],\n 'audio/mp3': ['*mp3'],\n 'audio/mp4': ['m4a', 'mp4a', 'm4b'],\n 'audio/mpeg': ['mpga', 'mp2', 'mp2a', 'mp3', 'm2a', 'm3a'],\n 'audio/ogg': ['oga', 'ogg', 'spx', 'opus'],\n 'audio/s3m': ['s3m'],\n 'audio/silk': ['sil'],\n 'audio/wav': ['wav'],\n 'audio/wave': ['*wav'],\n 'audio/webm': ['weba'],\n 'audio/xm': ['xm'],\n 'font/collection': ['ttc'],\n 'font/otf': ['otf'],\n 'font/ttf': ['ttf'],\n 'font/woff': ['woff'],\n 'font/woff2': ['woff2'],\n 'image/aces': ['exr'],\n 'image/apng': ['apng'],\n 'image/avci': ['avci'],\n 'image/avcs': ['avcs'],\n 'image/avif': ['avif'],\n 'image/bmp': ['bmp', 'dib'],\n 'image/cgm': ['cgm'],\n 'image/dicom-rle': ['drle'],\n 'image/dpx': ['dpx'],\n 'image/emf': ['emf'],\n 'image/fits': ['fits'],\n 'image/g3fax': ['g3'],\n 'image/gif': ['gif'],\n 'image/heic': ['heic'],\n 'image/heic-sequence': ['heics'],\n 'image/heif': ['heif'],\n 'image/heif-sequence': ['heifs'],\n 'image/hej2k': ['hej2'],\n 'image/ief': ['ief'],\n 'image/jaii': ['jaii'],\n 'image/jais': ['jais'],\n 'image/jls': ['jls'],\n 'image/jp2': ['jp2', 'jpg2'],\n 'image/jpeg': ['jpg', 'jpeg', 'jpe'],\n 'image/jph': ['jph'],\n 'image/jphc': ['jhc'],\n 'image/jpm': ['jpm', 'jpgm'],\n 'image/jpx': ['jpx', 'jpf'],\n 'image/jxl': ['jxl'],\n 'image/jxr': ['jxr'],\n 'image/jxra': ['jxra'],\n 'image/jxrs': ['jxrs'],\n 'image/jxs': ['jxs'],\n 'image/jxsc': ['jxsc'],\n 'image/jxsi': ['jxsi'],\n 'image/jxss': ['jxss'],\n 'image/ktx': ['ktx'],\n 'image/ktx2': ['ktx2'],\n 'image/pjpeg': ['jfif'],\n 'image/png': ['png'],\n 'image/sgi': ['sgi'],\n 'image/svg+xml': ['svg', 'svgz'],\n 'image/t38': ['t38'],\n 'image/tiff': ['tif', 'tiff'],\n 'image/tiff-fx': ['tfx'],\n 'image/webp': ['webp'],\n 'image/wmf': ['wmf'],\n 'message/disposition-notification': ['disposition-notification'],\n 'message/global': ['u8msg'],\n 'message/global-delivery-status': ['u8dsn'],\n 'message/global-disposition-notification': ['u8mdn'],\n 'message/global-headers': ['u8hdr'],\n 'message/rfc822': ['eml', 'mime', 'mht', 'mhtml'],\n 'model/3mf': ['3mf'],\n 'model/gltf+json': ['gltf'],\n 'model/gltf-binary': ['glb'],\n 'model/iges': ['igs', 'iges'],\n 'model/jt': ['jt'],\n 'model/mesh': ['msh', 'mesh', 'silo'],\n 'model/mtl': ['mtl'],\n 'model/obj': ['obj'],\n 'model/prc': ['prc'],\n 'model/step': ['step', 'stp', 'stpnc', 'p21', '210'],\n 'model/step+xml': ['stpx'],\n 'model/step+zip': ['stpz'],\n 'model/step-xml+zip': ['stpxz'],\n 'model/stl': ['stl'],\n 'model/u3d': ['u3d'],\n 'model/vrml': ['wrl', 'vrml'],\n 'model/x3d+binary': ['*x3db', 'x3dbz'],\n 'model/x3d+fastinfoset': ['x3db'],\n 'model/x3d+vrml': ['*x3dv', 'x3dvz'],\n 'model/x3d+xml': ['x3d', 'x3dz'],\n 'model/x3d-vrml': ['x3dv'],\n 'text/cache-manifest': ['appcache', 'manifest'],\n 'text/calendar': ['ics', 'ifb'],\n 'text/coffeescript': ['coffee', 'litcoffee'],\n 'text/css': ['css'],\n 'text/csv': ['csv'],\n 'text/html': ['html', 'htm', 'shtml'],\n 'text/jade': ['jade'],\n 'text/javascript': ['js', 'mjs'],\n 'text/jsx': ['jsx'],\n 'text/less': ['less'],\n 'text/markdown': ['md', 'markdown'],\n 'text/mathml': ['mml'],\n 'text/mdx': ['mdx'],\n 'text/n3': ['n3'],\n 'text/plain': ['txt', 'text', 'conf', 'def', 'list', 'log', 'in', 'ini'],\n 'text/richtext': ['rtx'],\n 'text/rtf': ['*rtf'],\n 'text/sgml': ['sgml', 'sgm'],\n 'text/shex': ['shex'],\n 'text/slim': ['slim', 'slm'],\n 'text/spdx': ['spdx'],\n 'text/stylus': ['stylus', 'styl'],\n 'text/tab-separated-values': ['tsv'],\n 'text/troff': ['t', 'tr', 'roff', 'man', 'me', 'ms'],\n 'text/turtle': ['ttl'],\n 'text/uri-list': ['uri', 'uris', 'urls'],\n 'text/vcard': ['vcard'],\n 'text/vtt': ['vtt'],\n 'text/wgsl': ['wgsl'],\n 'text/xml': ['*xml'],\n 'text/yaml': ['yaml', 'yml'],\n 'video/3gpp': ['3gp', '3gpp'],\n 'video/3gpp2': ['3g2'],\n 'video/h261': ['h261'],\n 'video/h263': ['h263'],\n 'video/h264': ['h264'],\n 'video/iso.segment': ['m4s'],\n 'video/jpeg': ['jpgv'],\n 'video/jpm': ['*jpm', '*jpgm'],\n 'video/mj2': ['mj2', 'mjp2'],\n 'video/mp2t': ['ts', 'm2t', 'm2ts', 'mts'],\n 'video/mp4': ['mp4', 'mp4v', 'mpg4'],\n 'video/mpeg': ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v'],\n 'video/ogg': ['ogv'],\n 'video/quicktime': ['qt', 'mov'],\n 'video/webm': ['webm'],\n};\nObject.freeze(types);\nexport default types;\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions;\nclass Mime {\n constructor(...args) {\n _Mime_extensionToType.set(this, new Map());\n _Mime_typeToExtension.set(this, new Map());\n _Mime_typeToExtensions.set(this, new Map());\n for (const arg of args) {\n this.define(arg);\n }\n }\n define(typeMap, force = false) {\n for (let [type, extensions] of Object.entries(typeMap)) {\n type = type.toLowerCase();\n extensions = extensions.map((ext) => ext.toLowerCase());\n if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, \"f\").has(type)) {\n __classPrivateFieldGet(this, _Mime_typeToExtensions, \"f\").set(type, new Set());\n }\n const allExtensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, \"f\").get(type);\n let first = true;\n for (let extension of extensions) {\n const starred = extension.startsWith('*');\n extension = starred ? extension.slice(1) : extension;\n allExtensions?.add(extension);\n if (first) {\n __classPrivateFieldGet(this, _Mime_typeToExtension, \"f\").set(type, extension);\n }\n first = false;\n if (starred)\n continue;\n const currentType = __classPrivateFieldGet(this, _Mime_extensionToType, \"f\").get(extension);\n if (currentType && currentType != type && !force) {\n throw new Error(`\"${type} -> ${extension}\" conflicts with \"${currentType} -> ${extension}\". Pass \\`force=true\\` to override this definition.`);\n }\n __classPrivateFieldGet(this, _Mime_extensionToType, \"f\").set(extension, type);\n }\n }\n return this;\n }\n getType(path) {\n if (typeof path !== 'string')\n return null;\n const last = path.replace(/^.*[/\\\\]/s, '').toLowerCase();\n const ext = last.replace(/^.*\\./s, '').toLowerCase();\n const hasPath = last.length < path.length;\n const hasDot = ext.length < last.length - 1;\n if (!hasDot && hasPath)\n return null;\n return __classPrivateFieldGet(this, _Mime_extensionToType, \"f\").get(ext) ?? null;\n }\n getExtension(type) {\n if (typeof type !== 'string')\n return null;\n type = type?.split?.(';')[0];\n return ((type && __classPrivateFieldGet(this, _Mime_typeToExtension, \"f\").get(type.trim().toLowerCase())) ?? null);\n }\n getAllExtensions(type) {\n if (typeof type !== 'string')\n return null;\n return __classPrivateFieldGet(this, _Mime_typeToExtensions, \"f\").get(type.toLowerCase()) ?? null;\n }\n _freeze() {\n this.define = () => {\n throw new Error('define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances');\n };\n Object.freeze(this);\n for (const extensions of __classPrivateFieldGet(this, _Mime_typeToExtensions, \"f\").values()) {\n Object.freeze(extensions);\n }\n return this;\n }\n _getTestState() {\n return {\n types: __classPrivateFieldGet(this, _Mime_extensionToType, \"f\"),\n extensions: __classPrivateFieldGet(this, _Mime_typeToExtension, \"f\"),\n };\n }\n}\n_Mime_extensionToType = new WeakMap(), _Mime_typeToExtension = new WeakMap(), _Mime_typeToExtensions = new WeakMap();\nexport default Mime;\n","import otherTypes from '../types/other.js';\nimport standardTypes from '../types/standard.js';\nimport Mime from './Mime.js';\nexport { default as Mime } from './Mime.js';\nexport default new Mime(standardTypes, otherTypes)._freeze();\n","/**\n * Re-exports the `mime` package through the `@effect/platform-node/Mime`\n * module and the `Mime` namespace in the package barrel.\n *\n * @since 4.0.0\n */\n/* oxlint-disable no-named-as-default */\n/**\n * @since 4.0.0\n */\nimport Mime from \"mime\";\n/**\n * @category re-exports\n * @since 4.0.0\n */\nexport * from \"mime\";\n/**\n * @category re-exports\n * @since 4.0.0\n */\nexport default Mime;\n//# sourceMappingURL=Mime.js.map","'use strict';\n\nconst BINARY_TYPES = ['nodebuffer', 'arraybuffer', 'fragments'];\nconst hasBlob = typeof Blob !== 'undefined';\n\nif (hasBlob) BINARY_TYPES.push('blob');\n\nmodule.exports = {\n BINARY_TYPES,\n CLOSE_TIMEOUT: 30000,\n EMPTY_BUFFER: Buffer.alloc(0),\n GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11',\n hasBlob,\n kForOnEventAttribute: Symbol('kIsForOnEventAttribute'),\n kListener: Symbol('kListener'),\n kStatusCode: Symbol('status-code'),\n kWebSocket: Symbol('websocket'),\n NOOP: () => {}\n};\n","var fs = require('fs')\nvar path = require('path')\nvar os = require('os')\n\n// Workaround to fix webpack's build warnings: 'the request of a dependency is an expression'\nvar runtimeRequire = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require // eslint-disable-line\n\nvar vars = (process.config && process.config.variables) || {}\nvar prebuildsOnly = !!process.env.PREBUILDS_ONLY\nvar abi = process.versions.modules // TODO: support old node where this is undef\nvar runtime = isElectron() ? 'electron' : (isNwjs() ? 'node-webkit' : 'node')\n\nvar arch = process.env.npm_config_arch || os.arch()\nvar platform = process.env.npm_config_platform || os.platform()\nvar libc = process.env.LIBC || (isAlpine(platform) ? 'musl' : 'glibc')\nvar armv = process.env.ARM_VERSION || (arch === 'arm64' ? '8' : vars.arm_version) || ''\nvar uv = (process.versions.uv || '').split('.')[0]\n\nmodule.exports = load\n\nfunction load (dir) {\n return runtimeRequire(load.resolve(dir))\n}\n\nload.resolve = load.path = function (dir) {\n dir = path.resolve(dir || '.')\n\n try {\n var name = runtimeRequire(path.join(dir, 'package.json')).name.toUpperCase().replace(/-/g, '_')\n if (process.env[name + '_PREBUILD']) dir = process.env[name + '_PREBUILD']\n } catch (err) {}\n\n if (!prebuildsOnly) {\n var release = getFirst(path.join(dir, 'build/Release'), matchBuild)\n if (release) return release\n\n var debug = getFirst(path.join(dir, 'build/Debug'), matchBuild)\n if (debug) return debug\n }\n\n var prebuild = resolve(dir)\n if (prebuild) return prebuild\n\n var nearby = resolve(path.dirname(process.execPath))\n if (nearby) return nearby\n\n var target = [\n 'platform=' + platform,\n 'arch=' + arch,\n 'runtime=' + runtime,\n 'abi=' + abi,\n 'uv=' + uv,\n armv ? 'armv=' + armv : '',\n 'libc=' + libc,\n 'node=' + process.versions.node,\n process.versions.electron ? 'electron=' + process.versions.electron : '',\n typeof __webpack_require__ === 'function' ? 'webpack=true' : '' // eslint-disable-line\n ].filter(Boolean).join(' ')\n\n throw new Error('No native build was found for ' + target + '\\n loaded from: ' + dir + '\\n')\n\n function resolve (dir) {\n // Find matching \"prebuilds/<platform>-<arch>\" directory\n var tuples = readdirSync(path.join(dir, 'prebuilds')).map(parseTuple)\n var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0]\n if (!tuple) return\n\n // Find most specific flavor first\n var prebuilds = path.join(dir, 'prebuilds', tuple.name)\n var parsed = readdirSync(prebuilds).map(parseTags)\n var candidates = parsed.filter(matchTags(runtime, abi))\n var winner = candidates.sort(compareTags(runtime))[0]\n if (winner) return path.join(prebuilds, winner.file)\n }\n}\n\nfunction readdirSync (dir) {\n try {\n return fs.readdirSync(dir)\n } catch (err) {\n return []\n }\n}\n\nfunction getFirst (dir, filter) {\n var files = readdirSync(dir).filter(filter)\n return files[0] && path.join(dir, files[0])\n}\n\nfunction matchBuild (name) {\n return /\\.node$/.test(name)\n}\n\nfunction parseTuple (name) {\n // Example: darwin-x64+arm64\n var arr = name.split('-')\n if (arr.length !== 2) return\n\n var platform = arr[0]\n var architectures = arr[1].split('+')\n\n if (!platform) return\n if (!architectures.length) return\n if (!architectures.every(Boolean)) return\n\n return { name, platform, architectures }\n}\n\nfunction matchTuple (platform, arch) {\n return function (tuple) {\n if (tuple == null) return false\n if (tuple.platform !== platform) return false\n return tuple.architectures.includes(arch)\n }\n}\n\nfunction compareTuples (a, b) {\n // Prefer single-arch prebuilds over multi-arch\n return a.architectures.length - b.architectures.length\n}\n\nfunction parseTags (file) {\n var arr = file.split('.')\n var extension = arr.pop()\n var tags = { file: file, specificity: 0 }\n\n if (extension !== 'node') return\n\n for (var i = 0; i < arr.length; i++) {\n var tag = arr[i]\n\n if (tag === 'node' || tag === 'electron' || tag === 'node-webkit') {\n tags.runtime = tag\n } else if (tag === 'napi') {\n tags.napi = true\n } else if (tag.slice(0, 3) === 'abi') {\n tags.abi = tag.slice(3)\n } else if (tag.slice(0, 2) === 'uv') {\n tags.uv = tag.slice(2)\n } else if (tag.slice(0, 4) === 'armv') {\n tags.armv = tag.slice(4)\n } else if (tag === 'glibc' || tag === 'musl') {\n tags.libc = tag\n } else {\n continue\n }\n\n tags.specificity++\n }\n\n return tags\n}\n\nfunction matchTags (runtime, abi) {\n return function (tags) {\n if (tags == null) return false\n if (tags.runtime && tags.runtime !== runtime && !runtimeAgnostic(tags)) return false\n if (tags.abi && tags.abi !== abi && !tags.napi) return false\n if (tags.uv && tags.uv !== uv) return false\n if (tags.armv && tags.armv !== armv) return false\n if (tags.libc && tags.libc !== libc) return false\n\n return true\n }\n}\n\nfunction runtimeAgnostic (tags) {\n return tags.runtime === 'node' && tags.napi\n}\n\nfunction compareTags (runtime) {\n // Precedence: non-agnostic runtime, abi over napi, then by specificity.\n return function (a, b) {\n if (a.runtime !== b.runtime) {\n return a.runtime === runtime ? -1 : 1\n } else if (a.abi !== b.abi) {\n return a.abi ? -1 : 1\n } else if (a.specificity !== b.specificity) {\n return a.specificity > b.specificity ? -1 : 1\n } else {\n return 0\n }\n }\n}\n\nfunction isNwjs () {\n return !!(process.versions && process.versions.nw)\n}\n\nfunction isElectron () {\n if (process.versions && process.versions.electron) return true\n if (process.env.ELECTRON_RUN_AS_NODE) return true\n return typeof window !== 'undefined' && window.process && window.process.type === 'renderer'\n}\n\nfunction isAlpine (platform) {\n return platform === 'linux' && fs.existsSync('/etc/alpine-release')\n}\n\n// Exposed for unit tests\n// TODO: move to lib\nload.parseTags = parseTags\nload.matchTags = matchTags\nload.compareTags = compareTags\nload.parseTuple = parseTuple\nload.matchTuple = matchTuple\nload.compareTuples = compareTuples\n","const runtimeRequire = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require // eslint-disable-line\nif (typeof runtimeRequire.addon === 'function') { // if the platform supports native resolving prefer that\n module.exports = runtimeRequire.addon.bind(runtimeRequire)\n} else { // else use the runtime version here\n module.exports = require('./node-gyp-build.js')\n}\n","'use strict';\n\n/**\n * Masks a buffer using the given mask.\n *\n * @param {Buffer} source The buffer to mask\n * @param {Buffer} mask The mask to use\n * @param {Buffer} output The buffer where to store the result\n * @param {Number} offset The offset at which to start writing\n * @param {Number} length The number of bytes to mask.\n * @public\n */\nconst mask = (source, mask, output, offset, length) => {\n for (var i = 0; i < length; i++) {\n output[offset + i] = source[i] ^ mask[i & 3];\n }\n};\n\n/**\n * Unmasks a buffer using the given mask.\n *\n * @param {Buffer} buffer The buffer to unmask\n * @param {Buffer} mask The mask to use\n * @public\n */\nconst unmask = (buffer, mask) => {\n // Required until https://github.com/nodejs/node/issues/9006 is resolved.\n const length = buffer.length;\n for (var i = 0; i < length; i++) {\n buffer[i] ^= mask[i & 3];\n }\n};\n\nmodule.exports = { mask, unmask };\n","'use strict';\n\ntry {\n module.exports = require('node-gyp-build')(__dirname);\n} catch (e) {\n module.exports = require('./fallback');\n}\n","'use strict';\n\nconst { EMPTY_BUFFER } = require('./constants');\n\nconst FastBuffer = Buffer[Symbol.species];\n\n/**\n * Merges an array of buffers into a new buffer.\n *\n * @param {Buffer[]} list The array of buffers to concat\n * @param {Number} totalLength The total length of buffers in the list\n * @return {Buffer} The resulting buffer\n * @public\n */\nfunction concat(list, totalLength) {\n if (list.length === 0) return EMPTY_BUFFER;\n if (list.length === 1) return list[0];\n\n const target = Buffer.allocUnsafe(totalLength);\n let offset = 0;\n\n for (let i = 0; i < list.length; i++) {\n const buf = list[i];\n target.set(buf, offset);\n offset += buf.length;\n }\n\n if (offset < totalLength) {\n return new FastBuffer(target.buffer, target.byteOffset, offset);\n }\n\n return target;\n}\n\n/**\n * Masks a buffer using the given mask.\n *\n * @param {Buffer} source The buffer to mask\n * @param {Buffer} mask The mask to use\n * @param {Buffer} output The buffer where to store the result\n * @param {Number} offset The offset at which to start writing\n * @param {Number} length The number of bytes to mask.\n * @public\n */\nfunction _mask(source, mask, output, offset, length) {\n for (let i = 0; i < length; i++) {\n output[offset + i] = source[i] ^ mask[i & 3];\n }\n}\n\n/**\n * Unmasks a buffer using the given mask.\n *\n * @param {Buffer} buffer The buffer to unmask\n * @param {Buffer} mask The mask to use\n * @public\n */\nfunction _unmask(buffer, mask) {\n for (let i = 0; i < buffer.length; i++) {\n buffer[i] ^= mask[i & 3];\n }\n}\n\n/**\n * Converts a buffer to an `ArrayBuffer`.\n *\n * @param {Buffer} buf The buffer to convert\n * @return {ArrayBuffer} Converted buffer\n * @public\n */\nfunction toArrayBuffer(buf) {\n if (buf.length === buf.buffer.byteLength) {\n return buf.buffer;\n }\n\n return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);\n}\n\n/**\n * Converts `data` to a `Buffer`.\n *\n * @param {*} data The data to convert\n * @return {Buffer} The buffer\n * @throws {TypeError}\n * @public\n */\nfunction toBuffer(data) {\n toBuffer.readOnly = true;\n\n if (Buffer.isBuffer(data)) return data;\n\n let buf;\n\n if (data instanceof ArrayBuffer) {\n buf = new FastBuffer(data);\n } else if (ArrayBuffer.isView(data)) {\n buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength);\n } else {\n buf = Buffer.from(data);\n toBuffer.readOnly = false;\n }\n\n return buf;\n}\n\nmodule.exports = {\n concat,\n mask: _mask,\n toArrayBuffer,\n toBuffer,\n unmask: _unmask\n};\n\n/* istanbul ignore else */\nif (!process.env.WS_NO_BUFFER_UTIL) {\n try {\n const bufferUtil = require('bufferutil');\n\n module.exports.mask = function (source, mask, output, offset, length) {\n if (length < 48) _mask(source, mask, output, offset, length);\n else bufferUtil.mask(source, mask, output, offset, length);\n };\n\n module.exports.unmask = function (buffer, mask) {\n if (buffer.length < 32) _unmask(buffer, mask);\n else bufferUtil.unmask(buffer, mask);\n };\n } catch (e) {\n // Continue regardless of the error.\n }\n}\n","'use strict';\n\nconst kDone = Symbol('kDone');\nconst kRun = Symbol('kRun');\n\n/**\n * A very simple job queue with adjustable concurrency. Adapted from\n * https://github.com/STRML/async-limiter\n */\nclass Limiter {\n /**\n * Creates a new `Limiter`.\n *\n * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed\n * to run concurrently\n */\n constructor(concurrency) {\n this[kDone] = () => {\n this.pending--;\n this[kRun]();\n };\n this.concurrency = concurrency || Infinity;\n this.jobs = [];\n this.pending = 0;\n }\n\n /**\n * Adds a job to the queue.\n *\n * @param {Function} job The job to run\n * @public\n */\n add(job) {\n this.jobs.push(job);\n this[kRun]();\n }\n\n /**\n * Removes a job from the queue and runs it if possible.\n *\n * @private\n */\n [kRun]() {\n if (this.pending === this.concurrency) return;\n\n if (this.jobs.length) {\n const job = this.jobs.shift();\n\n this.pending++;\n job(this[kDone]);\n }\n }\n}\n\nmodule.exports = Limiter;\n","'use strict';\n\nconst zlib = require('zlib');\n\nconst bufferUtil = require('./buffer-util');\nconst Limiter = require('./limiter');\nconst { kStatusCode } = require('./constants');\n\nconst FastBuffer = Buffer[Symbol.species];\nconst TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]);\nconst kPerMessageDeflate = Symbol('permessage-deflate');\nconst kTotalLength = Symbol('total-length');\nconst kCallback = Symbol('callback');\nconst kBuffers = Symbol('buffers');\nconst kError = Symbol('error');\n\n//\n// We limit zlib concurrency, which prevents severe memory fragmentation\n// as documented in https://github.com/nodejs/node/issues/8871#issuecomment-250915913\n// and https://github.com/websockets/ws/issues/1202\n//\n// Intentionally global; it's the global thread pool that's an issue.\n//\nlet zlibLimiter;\n\n/**\n * permessage-deflate implementation.\n */\nclass PerMessageDeflate {\n /**\n * Creates a PerMessageDeflate instance.\n *\n * @param {Object} [options] Configuration options\n * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support\n * for, or request, a custom client window size\n * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/\n * acknowledge disabling of client context takeover\n * @param {Number} [options.concurrencyLimit=10] The number of concurrent\n * calls to zlib\n * @param {Boolean} [options.isServer=false] Create the instance in either\n * server or client mode\n * @param {Number} [options.maxPayload=0] The maximum allowed message length\n * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the\n * use of a custom server window size\n * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept\n * disabling of server context takeover\n * @param {Number} [options.threshold=1024] Size (in bytes) below which\n * messages should not be compressed if context takeover is disabled\n * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on\n * deflate\n * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on\n * inflate\n */\n constructor(options) {\n this._options = options || {};\n this._threshold =\n this._options.threshold !== undefined ? this._options.threshold : 1024;\n this._maxPayload = this._options.maxPayload | 0;\n this._isServer = !!this._options.isServer;\n this._deflate = null;\n this._inflate = null;\n\n this.params = null;\n\n if (!zlibLimiter) {\n const concurrency =\n this._options.concurrencyLimit !== undefined\n ? this._options.concurrencyLimit\n : 10;\n zlibLimiter = new Limiter(concurrency);\n }\n }\n\n /**\n * @type {String}\n */\n static get extensionName() {\n return 'permessage-deflate';\n }\n\n /**\n * Create an extension negotiation offer.\n *\n * @return {Object} Extension parameters\n * @public\n */\n offer() {\n const params = {};\n\n if (this._options.serverNoContextTakeover) {\n params.server_no_context_takeover = true;\n }\n if (this._options.clientNoContextTakeover) {\n params.client_no_context_takeover = true;\n }\n if (this._options.serverMaxWindowBits) {\n params.server_max_window_bits = this._options.serverMaxWindowBits;\n }\n if (this._options.clientMaxWindowBits) {\n params.client_max_window_bits = this._options.clientMaxWindowBits;\n } else if (this._options.clientMaxWindowBits == null) {\n params.client_max_window_bits = true;\n }\n\n return params;\n }\n\n /**\n * Accept an extension negotiation offer/response.\n *\n * @param {Array} configurations The extension negotiation offers/reponse\n * @return {Object} Accepted configuration\n * @public\n */\n accept(configurations) {\n configurations = this.normalizeParams(configurations);\n\n this.params = this._isServer\n ? this.acceptAsServer(configurations)\n : this.acceptAsClient(configurations);\n\n return this.params;\n }\n\n /**\n * Releases all resources used by the extension.\n *\n * @public\n */\n cleanup() {\n if (this._inflate) {\n this._inflate.close();\n this._inflate = null;\n }\n\n if (this._deflate) {\n const callback = this._deflate[kCallback];\n\n this._deflate.close();\n this._deflate = null;\n\n if (callback) {\n callback(\n new Error(\n 'The deflate stream was closed while data was being processed'\n )\n );\n }\n }\n }\n\n /**\n * Accept an extension negotiation offer.\n *\n * @param {Array} offers The extension negotiation offers\n * @return {Object} Accepted configuration\n * @private\n */\n acceptAsServer(offers) {\n const opts = this._options;\n const accepted = offers.find((params) => {\n if (\n (opts.serverNoContextTakeover === false &&\n params.server_no_context_takeover) ||\n (params.server_max_window_bits &&\n (opts.serverMaxWindowBits === false ||\n (typeof opts.serverMaxWindowBits === 'number' &&\n opts.serverMaxWindowBits > params.server_max_window_bits))) ||\n (typeof opts.clientMaxWindowBits === 'number' &&\n !params.client_max_window_bits)\n ) {\n return false;\n }\n\n return true;\n });\n\n if (!accepted) {\n throw new Error('None of the extension offers can be accepted');\n }\n\n if (opts.serverNoContextTakeover) {\n accepted.server_no_context_takeover = true;\n }\n if (opts.clientNoContextTakeover) {\n accepted.client_no_context_takeover = true;\n }\n if (typeof opts.serverMaxWindowBits === 'number') {\n accepted.server_max_window_bits = opts.serverMaxWindowBits;\n }\n if (typeof opts.clientMaxWindowBits === 'number') {\n accepted.client_max_window_bits = opts.clientMaxWindowBits;\n } else if (\n accepted.client_max_window_bits === true ||\n opts.clientMaxWindowBits === false\n ) {\n delete accepted.client_max_window_bits;\n }\n\n return accepted;\n }\n\n /**\n * Accept the extension negotiation response.\n *\n * @param {Array} response The extension negotiation response\n * @return {Object} Accepted configuration\n * @private\n */\n acceptAsClient(response) {\n const params = response[0];\n\n if (\n this._options.clientNoContextTakeover === false &&\n params.client_no_context_takeover\n ) {\n throw new Error('Unexpected parameter \"client_no_context_takeover\"');\n }\n\n if (!params.client_max_window_bits) {\n if (typeof this._options.clientMaxWindowBits === 'number') {\n params.client_max_window_bits = this._options.clientMaxWindowBits;\n }\n } else if (\n this._options.clientMaxWindowBits === false ||\n (typeof this._options.clientMaxWindowBits === 'number' &&\n params.client_max_window_bits > this._options.clientMaxWindowBits)\n ) {\n throw new Error(\n 'Unexpected or invalid parameter \"client_max_window_bits\"'\n );\n }\n\n return params;\n }\n\n /**\n * Normalize parameters.\n *\n * @param {Array} configurations The extension negotiation offers/reponse\n * @return {Array} The offers/response with normalized parameters\n * @private\n */\n normalizeParams(configurations) {\n configurations.forEach((params) => {\n Object.keys(params).forEach((key) => {\n let value = params[key];\n\n if (value.length > 1) {\n throw new Error(`Parameter \"${key}\" must have only a single value`);\n }\n\n value = value[0];\n\n if (key === 'client_max_window_bits') {\n if (value !== true) {\n const num = +value;\n if (!Number.isInteger(num) || num < 8 || num > 15) {\n throw new TypeError(\n `Invalid value for parameter \"${key}\": ${value}`\n );\n }\n value = num;\n } else if (!this._isServer) {\n throw new TypeError(\n `Invalid value for parameter \"${key}\": ${value}`\n );\n }\n } else if (key === 'server_max_window_bits') {\n const num = +value;\n if (!Number.isInteger(num) || num < 8 || num > 15) {\n throw new TypeError(\n `Invalid value for parameter \"${key}\": ${value}`\n );\n }\n value = num;\n } else if (\n key === 'client_no_context_takeover' ||\n key === 'server_no_context_takeover'\n ) {\n if (value !== true) {\n throw new TypeError(\n `Invalid value for parameter \"${key}\": ${value}`\n );\n }\n } else {\n throw new Error(`Unknown parameter \"${key}\"`);\n }\n\n params[key] = value;\n });\n });\n\n return configurations;\n }\n\n /**\n * Decompress data. Concurrency limited.\n *\n * @param {Buffer} data Compressed data\n * @param {Boolean} fin Specifies whether or not this is the last fragment\n * @param {Function} callback Callback\n * @public\n */\n decompress(data, fin, callback) {\n zlibLimiter.add((done) => {\n this._decompress(data, fin, (err, result) => {\n done();\n callback(err, result);\n });\n });\n }\n\n /**\n * Compress data. Concurrency limited.\n *\n * @param {(Buffer|String)} data Data to compress\n * @param {Boolean} fin Specifies whether or not this is the last fragment\n * @param {Function} callback Callback\n * @public\n */\n compress(data, fin, callback) {\n zlibLimiter.add((done) => {\n this._compress(data, fin, (err, result) => {\n done();\n callback(err, result);\n });\n });\n }\n\n /**\n * Decompress data.\n *\n * @param {Buffer} data Compressed data\n * @param {Boolean} fin Specifies whether or not this is the last fragment\n * @param {Function} callback Callback\n * @private\n */\n _decompress(data, fin, callback) {\n const endpoint = this._isServer ? 'client' : 'server';\n\n if (!this._inflate) {\n const key = `${endpoint}_max_window_bits`;\n const windowBits =\n typeof this.params[key] !== 'number'\n ? zlib.Z_DEFAULT_WINDOWBITS\n : this.params[key];\n\n this._inflate = zlib.createInflateRaw({\n ...this._options.zlibInflateOptions,\n windowBits\n });\n this._inflate[kPerMessageDeflate] = this;\n this._inflate[kTotalLength] = 0;\n this._inflate[kBuffers] = [];\n this._inflate.on('error', inflateOnError);\n this._inflate.on('data', inflateOnData);\n }\n\n this._inflate[kCallback] = callback;\n\n this._inflate.write(data);\n if (fin) this._inflate.write(TRAILER);\n\n this._inflate.flush(() => {\n const err = this._inflate[kError];\n\n if (err) {\n this._inflate.close();\n this._inflate = null;\n callback(err);\n return;\n }\n\n const data = bufferUtil.concat(\n this._inflate[kBuffers],\n this._inflate[kTotalLength]\n );\n\n if (this._inflate._readableState.endEmitted) {\n this._inflate.close();\n this._inflate = null;\n } else {\n this._inflate[kTotalLength] = 0;\n this._inflate[kBuffers] = [];\n\n if (fin && this.params[`${endpoint}_no_context_takeover`]) {\n this._inflate.reset();\n }\n }\n\n callback(null, data);\n });\n }\n\n /**\n * Compress data.\n *\n * @param {(Buffer|String)} data Data to compress\n * @param {Boolean} fin Specifies whether or not this is the last fragment\n * @param {Function} callback Callback\n * @private\n */\n _compress(data, fin, callback) {\n const endpoint = this._isServer ? 'server' : 'client';\n\n if (!this._deflate) {\n const key = `${endpoint}_max_window_bits`;\n const windowBits =\n typeof this.params[key] !== 'number'\n ? zlib.Z_DEFAULT_WINDOWBITS\n : this.params[key];\n\n this._deflate = zlib.createDeflateRaw({\n ...this._options.zlibDeflateOptions,\n windowBits\n });\n\n this._deflate[kTotalLength] = 0;\n this._deflate[kBuffers] = [];\n\n this._deflate.on('data', deflateOnData);\n }\n\n this._deflate[kCallback] = callback;\n\n this._deflate.write(data);\n this._deflate.flush(zlib.Z_SYNC_FLUSH, () => {\n if (!this._deflate) {\n //\n // The deflate stream was closed while data was being processed.\n //\n return;\n }\n\n let data = bufferUtil.concat(\n this._deflate[kBuffers],\n this._deflate[kTotalLength]\n );\n\n if (fin) {\n data = new FastBuffer(data.buffer, data.byteOffset, data.length - 4);\n }\n\n //\n // Ensure that the callback will not be called again in\n // `PerMessageDeflate#cleanup()`.\n //\n this._deflate[kCallback] = null;\n\n this._deflate[kTotalLength] = 0;\n this._deflate[kBuffers] = [];\n\n if (fin && this.params[`${endpoint}_no_context_takeover`]) {\n this._deflate.reset();\n }\n\n callback(null, data);\n });\n }\n}\n\nmodule.exports = PerMessageDeflate;\n\n/**\n * The listener of the `zlib.DeflateRaw` stream `'data'` event.\n *\n * @param {Buffer} chunk A chunk of data\n * @private\n */\nfunction deflateOnData(chunk) {\n this[kBuffers].push(chunk);\n this[kTotalLength] += chunk.length;\n}\n\n/**\n * The listener of the `zlib.InflateRaw` stream `'data'` event.\n *\n * @param {Buffer} chunk A chunk of data\n * @private\n */\nfunction inflateOnData(chunk) {\n this[kTotalLength] += chunk.length;\n\n if (\n this[kPerMessageDeflate]._maxPayload < 1 ||\n this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload\n ) {\n this[kBuffers].push(chunk);\n return;\n }\n\n this[kError] = new RangeError('Max payload size exceeded');\n this[kError].code = 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH';\n this[kError][kStatusCode] = 1009;\n this.removeListener('data', inflateOnData);\n\n //\n // The choice to employ `zlib.reset()` over `zlib.close()` is dictated by the\n // fact that in Node.js versions prior to 13.10.0, the callback for\n // `zlib.flush()` is not called if `zlib.close()` is used. Utilizing\n // `zlib.reset()` ensures that either the callback is invoked or an error is\n // emitted.\n //\n this.reset();\n}\n\n/**\n * The listener of the `zlib.InflateRaw` stream `'error'` event.\n *\n * @param {Error} err The emitted error\n * @private\n */\nfunction inflateOnError(err) {\n //\n // There is no need to call `Zlib#close()` as the handle is automatically\n // closed when an error is emitted.\n //\n this[kPerMessageDeflate]._inflate = null;\n\n if (this[kError]) {\n this[kCallback](this[kError]);\n return;\n }\n\n err[kStatusCode] = 1007;\n this[kCallback](err);\n}\n","'use strict';\n\n/**\n * Checks if a given buffer contains only correct UTF-8.\n * Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by\n * Markus Kuhn.\n *\n * @param {Buffer} buf The buffer to check\n * @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false`\n * @public\n */\nfunction isValidUTF8(buf) {\n const len = buf.length;\n let i = 0;\n\n while (i < len) {\n if ((buf[i] & 0x80) === 0x00) { // 0xxxxxxx\n i++;\n } else if ((buf[i] & 0xe0) === 0xc0) { // 110xxxxx 10xxxxxx\n if (\n i + 1 === len ||\n (buf[i + 1] & 0xc0) !== 0x80 ||\n (buf[i] & 0xfe) === 0xc0 // overlong\n ) {\n return false;\n }\n\n i += 2;\n } else if ((buf[i] & 0xf0) === 0xe0) { // 1110xxxx 10xxxxxx 10xxxxxx\n if (\n i + 2 >= len ||\n (buf[i + 1] & 0xc0) !== 0x80 ||\n (buf[i + 2] & 0xc0) !== 0x80 ||\n buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80 || // overlong\n buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0 // surrogate (U+D800 - U+DFFF)\n ) {\n return false;\n }\n\n i += 3;\n } else if ((buf[i] & 0xf8) === 0xf0) { // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx\n if (\n i + 3 >= len ||\n (buf[i + 1] & 0xc0) !== 0x80 ||\n (buf[i + 2] & 0xc0) !== 0x80 ||\n (buf[i + 3] & 0xc0) !== 0x80 ||\n buf[i] === 0xf0 && (buf[i + 1] & 0xf0) === 0x80 || // overlong\n buf[i] === 0xf4 && buf[i + 1] > 0x8f || buf[i] > 0xf4 // > U+10FFFF\n ) {\n return false;\n }\n\n i += 4;\n } else {\n return false;\n }\n }\n\n return true;\n}\n\nmodule.exports = isValidUTF8;\n","'use strict';\n\ntry {\n module.exports = require('node-gyp-build')(__dirname);\n} catch (e) {\n module.exports = require('./fallback');\n}\n","'use strict';\n\nconst { isUtf8 } = require('buffer');\n\nconst { hasBlob } = require('./constants');\n\n//\n// Allowed token characters:\n//\n// '!', '#', '$', '%', '&', ''', '*', '+', '-',\n// '.', 0-9, A-Z, '^', '_', '`', a-z, '|', '~'\n//\n// tokenChars[32] === 0 // ' '\n// tokenChars[33] === 1 // '!'\n// tokenChars[34] === 0 // '\"'\n// ...\n//\n// prettier-ignore\nconst tokenChars = [\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31\n 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63\n 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 // 112 - 127\n];\n\n/**\n * Checks if a status code is allowed in a close frame.\n *\n * @param {Number} code The status code\n * @return {Boolean} `true` if the status code is valid, else `false`\n * @public\n */\nfunction isValidStatusCode(code) {\n return (\n (code >= 1000 &&\n code <= 1014 &&\n code !== 1004 &&\n code !== 1005 &&\n code !== 1006) ||\n (code >= 3000 && code <= 4999)\n );\n}\n\n/**\n * Checks if a given buffer contains only correct UTF-8.\n * Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by\n * Markus Kuhn.\n *\n * @param {Buffer} buf The buffer to check\n * @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false`\n * @public\n */\nfunction _isValidUTF8(buf) {\n const len = buf.length;\n let i = 0;\n\n while (i < len) {\n if ((buf[i] & 0x80) === 0) {\n // 0xxxxxxx\n i++;\n } else if ((buf[i] & 0xe0) === 0xc0) {\n // 110xxxxx 10xxxxxx\n if (\n i + 1 === len ||\n (buf[i + 1] & 0xc0) !== 0x80 ||\n (buf[i] & 0xfe) === 0xc0 // Overlong\n ) {\n return false;\n }\n\n i += 2;\n } else if ((buf[i] & 0xf0) === 0xe0) {\n // 1110xxxx 10xxxxxx 10xxxxxx\n if (\n i + 2 >= len ||\n (buf[i + 1] & 0xc0) !== 0x80 ||\n (buf[i + 2] & 0xc0) !== 0x80 ||\n (buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80) || // Overlong\n (buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0) // Surrogate (U+D800 - U+DFFF)\n ) {\n return false;\n }\n\n i += 3;\n } else if ((buf[i] & 0xf8) === 0xf0) {\n // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx\n if (\n i + 3 >= len ||\n (buf[i + 1] & 0xc0) !== 0x80 ||\n (buf[i + 2] & 0xc0) !== 0x80 ||\n (buf[i + 3] & 0xc0) !== 0x80 ||\n (buf[i] === 0xf0 && (buf[i + 1] & 0xf0) === 0x80) || // Overlong\n (buf[i] === 0xf4 && buf[i + 1] > 0x8f) ||\n buf[i] > 0xf4 // > U+10FFFF\n ) {\n return false;\n }\n\n i += 4;\n } else {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Determines whether a value is a `Blob`.\n *\n * @param {*} value The value to be tested\n * @return {Boolean} `true` if `value` is a `Blob`, else `false`\n * @private\n */\nfunction isBlob(value) {\n return (\n hasBlob &&\n typeof value === 'object' &&\n typeof value.arrayBuffer === 'function' &&\n typeof value.type === 'string' &&\n typeof value.stream === 'function' &&\n (value[Symbol.toStringTag] === 'Blob' ||\n value[Symbol.toStringTag] === 'File')\n );\n}\n\nmodule.exports = {\n isBlob,\n isValidStatusCode,\n isValidUTF8: _isValidUTF8,\n tokenChars\n};\n\nif (isUtf8) {\n module.exports.isValidUTF8 = function (buf) {\n return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);\n };\n} /* istanbul ignore else */ else if (!process.env.WS_NO_UTF_8_VALIDATE) {\n try {\n const isValidUTF8 = require('utf-8-validate');\n\n module.exports.isValidUTF8 = function (buf) {\n return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);\n };\n } catch (e) {\n // Continue regardless of the error.\n }\n}\n","'use strict';\n\nconst { Writable } = require('stream');\n\nconst PerMessageDeflate = require('./permessage-deflate');\nconst {\n BINARY_TYPES,\n EMPTY_BUFFER,\n kStatusCode,\n kWebSocket\n} = require('./constants');\nconst { concat, toArrayBuffer, unmask } = require('./buffer-util');\nconst { isValidStatusCode, isValidUTF8 } = require('./validation');\n\nconst FastBuffer = Buffer[Symbol.species];\n\nconst GET_INFO = 0;\nconst GET_PAYLOAD_LENGTH_16 = 1;\nconst GET_PAYLOAD_LENGTH_64 = 2;\nconst GET_MASK = 3;\nconst GET_DATA = 4;\nconst INFLATING = 5;\nconst DEFER_EVENT = 6;\n\n/**\n * HyBi Receiver implementation.\n *\n * @extends Writable\n */\nclass Receiver extends Writable {\n /**\n * Creates a Receiver instance.\n *\n * @param {Object} [options] Options object\n * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether\n * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted\n * multiple times in the same tick\n * @param {String} [options.binaryType=nodebuffer] The type for binary data\n * @param {Object} [options.extensions] An object containing the negotiated\n * extensions\n * @param {Boolean} [options.isServer=false] Specifies whether to operate in\n * client or server mode\n * @param {Number} [options.maxBufferedChunks=0] The maximum number of\n * buffered data chunks\n * @param {Number} [options.maxFragments=0] The maximum number of message\n * fragments\n * @param {Number} [options.maxPayload=0] The maximum allowed message length\n * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or\n * not to skip UTF-8 validation for text and close messages\n */\n constructor(options = {}) {\n super();\n\n this._allowSynchronousEvents =\n options.allowSynchronousEvents !== undefined\n ? options.allowSynchronousEvents\n : true;\n this._binaryType = options.binaryType || BINARY_TYPES[0];\n this._extensions = options.extensions || {};\n this._isServer = !!options.isServer;\n this._maxBufferedChunks = options.maxBufferedChunks | 0;\n this._maxFragments = options.maxFragments | 0;\n this._maxPayload = options.maxPayload | 0;\n this._skipUTF8Validation = !!options.skipUTF8Validation;\n this[kWebSocket] = undefined;\n\n this._bufferedBytes = 0;\n this._buffers = [];\n\n this._compressed = false;\n this._payloadLength = 0;\n this._mask = undefined;\n this._fragmented = 0;\n this._masked = false;\n this._fin = false;\n this._opcode = 0;\n\n this._totalPayloadLength = 0;\n this._messageLength = 0;\n this._numFragments = 0;\n this._fragments = [];\n\n this._errored = false;\n this._loop = false;\n this._state = GET_INFO;\n }\n\n /**\n * Implements `Writable.prototype._write()`.\n *\n * @param {Buffer} chunk The chunk of data to write\n * @param {String} encoding The character encoding of `chunk`\n * @param {Function} cb Callback\n * @private\n */\n _write(chunk, encoding, cb) {\n if (this._opcode === 0x08 && this._state == GET_INFO) return cb();\n\n if (\n this._maxBufferedChunks > 0 &&\n this._buffers.length >= this._maxBufferedChunks\n ) {\n cb(\n this.createError(\n RangeError,\n 'Too many buffered chunks',\n false,\n 1008,\n 'WS_ERR_TOO_MANY_BUFFERED_PARTS'\n )\n );\n return;\n }\n\n this._bufferedBytes += chunk.length;\n this._buffers.push(chunk);\n this.startLoop(cb);\n }\n\n /**\n * Consumes `n` bytes from the buffered data.\n *\n * @param {Number} n The number of bytes to consume\n * @return {Buffer} The consumed bytes\n * @private\n */\n consume(n) {\n this._bufferedBytes -= n;\n\n if (n === this._buffers[0].length) return this._buffers.shift();\n\n if (n < this._buffers[0].length) {\n const buf = this._buffers[0];\n this._buffers[0] = new FastBuffer(\n buf.buffer,\n buf.byteOffset + n,\n buf.length - n\n );\n\n return new FastBuffer(buf.buffer, buf.byteOffset, n);\n }\n\n const dst = Buffer.allocUnsafe(n);\n\n do {\n const buf = this._buffers[0];\n const offset = dst.length - n;\n\n if (n >= buf.length) {\n dst.set(this._buffers.shift(), offset);\n } else {\n dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset);\n this._buffers[0] = new FastBuffer(\n buf.buffer,\n buf.byteOffset + n,\n buf.length - n\n );\n }\n\n n -= buf.length;\n } while (n > 0);\n\n return dst;\n }\n\n /**\n * Starts the parsing loop.\n *\n * @param {Function} cb Callback\n * @private\n */\n startLoop(cb) {\n this._loop = true;\n\n do {\n switch (this._state) {\n case GET_INFO:\n this.getInfo(cb);\n break;\n case GET_PAYLOAD_LENGTH_16:\n this.getPayloadLength16(cb);\n break;\n case GET_PAYLOAD_LENGTH_64:\n this.getPayloadLength64(cb);\n break;\n case GET_MASK:\n this.getMask();\n break;\n case GET_DATA:\n this.getData(cb);\n break;\n case INFLATING:\n case DEFER_EVENT:\n this._loop = false;\n return;\n }\n } while (this._loop);\n\n if (!this._errored) cb();\n }\n\n /**\n * Reads the first two bytes of a frame.\n *\n * @param {Function} cb Callback\n * @private\n */\n getInfo(cb) {\n if (this._bufferedBytes < 2) {\n this._loop = false;\n return;\n }\n\n const buf = this.consume(2);\n\n if ((buf[0] & 0x30) !== 0x00) {\n const error = this.createError(\n RangeError,\n 'RSV2 and RSV3 must be clear',\n true,\n 1002,\n 'WS_ERR_UNEXPECTED_RSV_2_3'\n );\n\n cb(error);\n return;\n }\n\n const compressed = (buf[0] & 0x40) === 0x40;\n\n if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {\n const error = this.createError(\n RangeError,\n 'RSV1 must be clear',\n true,\n 1002,\n 'WS_ERR_UNEXPECTED_RSV_1'\n );\n\n cb(error);\n return;\n }\n\n this._fin = (buf[0] & 0x80) === 0x80;\n this._opcode = buf[0] & 0x0f;\n this._payloadLength = buf[1] & 0x7f;\n\n if (this._opcode === 0x00) {\n if (compressed) {\n const error = this.createError(\n RangeError,\n 'RSV1 must be clear',\n true,\n 1002,\n 'WS_ERR_UNEXPECTED_RSV_1'\n );\n\n cb(error);\n return;\n }\n\n if (!this._fragmented) {\n const error = this.createError(\n RangeError,\n 'invalid opcode 0',\n true,\n 1002,\n 'WS_ERR_INVALID_OPCODE'\n );\n\n cb(error);\n return;\n }\n\n this._opcode = this._fragmented;\n } else if (this._opcode === 0x01 || this._opcode === 0x02) {\n if (this._fragmented) {\n const error = this.createError(\n RangeError,\n `invalid opcode ${this._opcode}`,\n true,\n 1002,\n 'WS_ERR_INVALID_OPCODE'\n );\n\n cb(error);\n return;\n }\n\n this._compressed = compressed;\n } else if (this._opcode > 0x07 && this._opcode < 0x0b) {\n if (!this._fin) {\n const error = this.createError(\n RangeError,\n 'FIN must be set',\n true,\n 1002,\n 'WS_ERR_EXPECTED_FIN'\n );\n\n cb(error);\n return;\n }\n\n if (compressed) {\n const error = this.createError(\n RangeError,\n 'RSV1 must be clear',\n true,\n 1002,\n 'WS_ERR_UNEXPECTED_RSV_1'\n );\n\n cb(error);\n return;\n }\n\n if (\n this._payloadLength > 0x7d ||\n (this._opcode === 0x08 && this._payloadLength === 1)\n ) {\n const error = this.createError(\n RangeError,\n `invalid payload length ${this._payloadLength}`,\n true,\n 1002,\n 'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH'\n );\n\n cb(error);\n return;\n }\n } else {\n const error = this.createError(\n RangeError,\n `invalid opcode ${this._opcode}`,\n true,\n 1002,\n 'WS_ERR_INVALID_OPCODE'\n );\n\n cb(error);\n return;\n }\n\n if (!this._fin && !this._fragmented) this._fragmented = this._opcode;\n this._masked = (buf[1] & 0x80) === 0x80;\n\n if (this._isServer) {\n if (!this._masked) {\n const error = this.createError(\n RangeError,\n 'MASK must be set',\n true,\n 1002,\n 'WS_ERR_EXPECTED_MASK'\n );\n\n cb(error);\n return;\n }\n } else if (this._masked) {\n const error = this.createError(\n RangeError,\n 'MASK must be clear',\n true,\n 1002,\n 'WS_ERR_UNEXPECTED_MASK'\n );\n\n cb(error);\n return;\n }\n\n if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;\n else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64;\n else this.haveLength(cb);\n }\n\n /**\n * Gets extended payload length (7+16).\n *\n * @param {Function} cb Callback\n * @private\n */\n getPayloadLength16(cb) {\n if (this._bufferedBytes < 2) {\n this._loop = false;\n return;\n }\n\n this._payloadLength = this.consume(2).readUInt16BE(0);\n this.haveLength(cb);\n }\n\n /**\n * Gets extended payload length (7+64).\n *\n * @param {Function} cb Callback\n * @private\n */\n getPayloadLength64(cb) {\n if (this._bufferedBytes < 8) {\n this._loop = false;\n return;\n }\n\n const buf = this.consume(8);\n const num = buf.readUInt32BE(0);\n\n //\n // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned\n // if payload length is greater than this number.\n //\n if (num > Math.pow(2, 53 - 32) - 1) {\n const error = this.createError(\n RangeError,\n 'Unsupported WebSocket frame: payload length > 2^53 - 1',\n false,\n 1009,\n 'WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH'\n );\n\n cb(error);\n return;\n }\n\n this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);\n this.haveLength(cb);\n }\n\n /**\n * Payload length has been read.\n *\n * @param {Function} cb Callback\n * @private\n */\n haveLength(cb) {\n if (this._payloadLength && this._opcode < 0x08) {\n this._totalPayloadLength += this._payloadLength;\n if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {\n const error = this.createError(\n RangeError,\n 'Max payload size exceeded',\n false,\n 1009,\n 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'\n );\n\n cb(error);\n return;\n }\n }\n\n if (this._masked) this._state = GET_MASK;\n else this._state = GET_DATA;\n }\n\n /**\n * Reads mask bytes.\n *\n * @private\n */\n getMask() {\n if (this._bufferedBytes < 4) {\n this._loop = false;\n return;\n }\n\n this._mask = this.consume(4);\n this._state = GET_DATA;\n }\n\n /**\n * Reads data bytes.\n *\n * @param {Function} cb Callback\n * @private\n */\n getData(cb) {\n let data = EMPTY_BUFFER;\n\n if (this._payloadLength) {\n if (this._bufferedBytes < this._payloadLength) {\n this._loop = false;\n return;\n }\n\n data = this.consume(this._payloadLength);\n\n if (\n this._masked &&\n (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0\n ) {\n unmask(data, this._mask);\n }\n }\n\n if (this._opcode > 0x07) {\n this.controlMessage(data, cb);\n return;\n }\n\n if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) {\n const error = this.createError(\n RangeError,\n 'Too many message fragments',\n false,\n 1008,\n 'WS_ERR_TOO_MANY_BUFFERED_PARTS'\n );\n\n cb(error);\n return;\n }\n\n if (this._compressed) {\n this._state = INFLATING;\n this.decompress(data, cb);\n return;\n }\n\n if (data.length) {\n //\n // This message is not compressed so its length is the sum of the payload\n // length of all fragments.\n //\n this._messageLength = this._totalPayloadLength;\n this._fragments.push(data);\n }\n\n this.dataMessage(cb);\n }\n\n /**\n * Decompresses data.\n *\n * @param {Buffer} data Compressed data\n * @param {Function} cb Callback\n * @private\n */\n decompress(data, cb) {\n const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];\n\n perMessageDeflate.decompress(data, this._fin, (err, buf) => {\n if (err) return cb(err);\n\n if (buf.length) {\n this._messageLength += buf.length;\n if (this._messageLength > this._maxPayload && this._maxPayload > 0) {\n const error = this.createError(\n RangeError,\n 'Max payload size exceeded',\n false,\n 1009,\n 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'\n );\n\n cb(error);\n return;\n }\n\n this._fragments.push(buf);\n }\n\n this.dataMessage(cb);\n if (this._state === GET_INFO) this.startLoop(cb);\n });\n }\n\n /**\n * Handles a data message.\n *\n * @param {Function} cb Callback\n * @private\n */\n dataMessage(cb) {\n if (!this._fin) {\n this._state = GET_INFO;\n return;\n }\n\n const messageLength = this._messageLength;\n const fragments = this._fragments;\n\n this._totalPayloadLength = 0;\n this._messageLength = 0;\n this._fragmented = 0;\n this._numFragments = 0;\n this._fragments = [];\n\n if (this._opcode === 2) {\n let data;\n\n if (this._binaryType === 'nodebuffer') {\n data = concat(fragments, messageLength);\n } else if (this._binaryType === 'arraybuffer') {\n data = toArrayBuffer(concat(fragments, messageLength));\n } else if (this._binaryType === 'blob') {\n data = new Blob(fragments);\n } else {\n data = fragments;\n }\n\n if (this._allowSynchronousEvents) {\n this.emit('message', data, true);\n this._state = GET_INFO;\n } else {\n this._state = DEFER_EVENT;\n setImmediate(() => {\n this.emit('message', data, true);\n this._state = GET_INFO;\n this.startLoop(cb);\n });\n }\n } else {\n const buf = concat(fragments, messageLength);\n\n if (!this._skipUTF8Validation && !isValidUTF8(buf)) {\n const error = this.createError(\n Error,\n 'invalid UTF-8 sequence',\n true,\n 1007,\n 'WS_ERR_INVALID_UTF8'\n );\n\n cb(error);\n return;\n }\n\n if (this._state === INFLATING || this._allowSynchronousEvents) {\n this.emit('message', buf, false);\n this._state = GET_INFO;\n } else {\n this._state = DEFER_EVENT;\n setImmediate(() => {\n this.emit('message', buf, false);\n this._state = GET_INFO;\n this.startLoop(cb);\n });\n }\n }\n }\n\n /**\n * Handles a control message.\n *\n * @param {Buffer} data Data to handle\n * @return {(Error|RangeError|undefined)} A possible error\n * @private\n */\n controlMessage(data, cb) {\n if (this._opcode === 0x08) {\n if (data.length === 0) {\n this._loop = false;\n this.emit('conclude', 1005, EMPTY_BUFFER);\n this.end();\n } else {\n const code = data.readUInt16BE(0);\n\n if (!isValidStatusCode(code)) {\n const error = this.createError(\n RangeError,\n `invalid status code ${code}`,\n true,\n 1002,\n 'WS_ERR_INVALID_CLOSE_CODE'\n );\n\n cb(error);\n return;\n }\n\n const buf = new FastBuffer(\n data.buffer,\n data.byteOffset + 2,\n data.length - 2\n );\n\n if (!this._skipUTF8Validation && !isValidUTF8(buf)) {\n const error = this.createError(\n Error,\n 'invalid UTF-8 sequence',\n true,\n 1007,\n 'WS_ERR_INVALID_UTF8'\n );\n\n cb(error);\n return;\n }\n\n this._loop = false;\n this.emit('conclude', code, buf);\n this.end();\n }\n\n this._state = GET_INFO;\n return;\n }\n\n if (this._allowSynchronousEvents) {\n this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data);\n this._state = GET_INFO;\n } else {\n this._state = DEFER_EVENT;\n setImmediate(() => {\n this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data);\n this._state = GET_INFO;\n this.startLoop(cb);\n });\n }\n }\n\n /**\n * Builds an error object.\n *\n * @param {function(new:Error|RangeError)} ErrorCtor The error constructor\n * @param {String} message The error message\n * @param {Boolean} prefix Specifies whether or not to add a default prefix to\n * `message`\n * @param {Number} statusCode The status code\n * @param {String} errorCode The exposed error code\n * @return {(Error|RangeError)} The error\n * @private\n */\n createError(ErrorCtor, message, prefix, statusCode, errorCode) {\n this._loop = false;\n this._errored = true;\n\n const err = new ErrorCtor(\n prefix ? `Invalid WebSocket frame: ${message}` : message\n );\n\n Error.captureStackTrace(err, this.createError);\n err.code = errorCode;\n err[kStatusCode] = statusCode;\n return err;\n }\n}\n\nmodule.exports = Receiver;\n","/* eslint no-unused-vars: [\"error\", { \"varsIgnorePattern\": \"^Duplex\" }] */\n\n'use strict';\n\nconst { Duplex } = require('stream');\nconst { randomFillSync } = require('crypto');\nconst {\n types: { isUint8Array }\n} = require('util');\n\nconst PerMessageDeflate = require('./permessage-deflate');\nconst { EMPTY_BUFFER, kWebSocket, NOOP } = require('./constants');\nconst { isBlob, isValidStatusCode } = require('./validation');\nconst { mask: applyMask, toBuffer } = require('./buffer-util');\n\nconst kByteLength = Symbol('kByteLength');\nconst maskBuffer = Buffer.alloc(4);\nconst RANDOM_POOL_SIZE = 8 * 1024;\nlet randomPool;\nlet randomPoolPointer = RANDOM_POOL_SIZE;\n\nconst DEFAULT = 0;\nconst DEFLATING = 1;\nconst GET_BLOB_DATA = 2;\n\n/**\n * HyBi Sender implementation.\n */\nclass Sender {\n /**\n * Creates a Sender instance.\n *\n * @param {Duplex} socket The connection socket\n * @param {Object} [extensions] An object containing the negotiated extensions\n * @param {Function} [generateMask] The function used to generate the masking\n * key\n */\n constructor(socket, extensions, generateMask) {\n this._extensions = extensions || {};\n\n if (generateMask) {\n this._generateMask = generateMask;\n this._maskBuffer = Buffer.alloc(4);\n }\n\n this._socket = socket;\n\n this._firstFragment = true;\n this._compress = false;\n\n this._bufferedBytes = 0;\n this._queue = [];\n this._state = DEFAULT;\n this.onerror = NOOP;\n this[kWebSocket] = undefined;\n }\n\n /**\n * Frames a piece of data according to the HyBi WebSocket protocol.\n *\n * @param {(Buffer|String)} data The data to frame\n * @param {Object} options Options object\n * @param {Boolean} [options.fin=false] Specifies whether or not to set the\n * FIN bit\n * @param {Function} [options.generateMask] The function used to generate the\n * masking key\n * @param {Boolean} [options.mask=false] Specifies whether or not to mask\n * `data`\n * @param {Buffer} [options.maskBuffer] The buffer used to store the masking\n * key\n * @param {Number} options.opcode The opcode\n * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be\n * modified\n * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the\n * RSV1 bit\n * @return {(Buffer|String)[]} The framed data\n * @public\n */\n static frame(data, options) {\n let mask;\n let merge = false;\n let offset = 2;\n let skipMasking = false;\n\n if (options.mask) {\n mask = options.maskBuffer || maskBuffer;\n\n if (options.generateMask) {\n options.generateMask(mask);\n } else {\n if (randomPoolPointer === RANDOM_POOL_SIZE) {\n /* istanbul ignore else */\n if (randomPool === undefined) {\n //\n // This is lazily initialized because server-sent frames must not\n // be masked so it may never be used.\n //\n randomPool = Buffer.alloc(RANDOM_POOL_SIZE);\n }\n\n randomFillSync(randomPool, 0, RANDOM_POOL_SIZE);\n randomPoolPointer = 0;\n }\n\n mask[0] = randomPool[randomPoolPointer++];\n mask[1] = randomPool[randomPoolPointer++];\n mask[2] = randomPool[randomPoolPointer++];\n mask[3] = randomPool[randomPoolPointer++];\n }\n\n skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;\n offset = 6;\n }\n\n let dataLength;\n\n if (typeof data === 'string') {\n if (\n (!options.mask || skipMasking) &&\n options[kByteLength] !== undefined\n ) {\n dataLength = options[kByteLength];\n } else {\n data = Buffer.from(data);\n dataLength = data.length;\n }\n } else {\n dataLength = data.length;\n merge = options.mask && options.readOnly && !skipMasking;\n }\n\n let payloadLength = dataLength;\n\n if (dataLength >= 65536) {\n offset += 8;\n payloadLength = 127;\n } else if (dataLength > 125) {\n offset += 2;\n payloadLength = 126;\n }\n\n const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset);\n\n target[0] = options.fin ? options.opcode | 0x80 : options.opcode;\n if (options.rsv1) target[0] |= 0x40;\n\n target[1] = payloadLength;\n\n if (payloadLength === 126) {\n target.writeUInt16BE(dataLength, 2);\n } else if (payloadLength === 127) {\n target[2] = target[3] = 0;\n target.writeUIntBE(dataLength, 4, 6);\n }\n\n if (!options.mask) return [target, data];\n\n target[1] |= 0x80;\n target[offset - 4] = mask[0];\n target[offset - 3] = mask[1];\n target[offset - 2] = mask[2];\n target[offset - 1] = mask[3];\n\n if (skipMasking) return [target, data];\n\n if (merge) {\n applyMask(data, mask, target, offset, dataLength);\n return [target];\n }\n\n applyMask(data, mask, data, 0, dataLength);\n return [target, data];\n }\n\n /**\n * Sends a close message to the other peer.\n *\n * @param {Number} [code] The status code component of the body\n * @param {(String|Buffer)} [data] The message component of the body\n * @param {Boolean} [mask=false] Specifies whether or not to mask the message\n * @param {Function} [cb] Callback\n * @public\n */\n close(code, data, mask, cb) {\n let buf;\n\n if (code === undefined) {\n buf = EMPTY_BUFFER;\n } else if (typeof code !== 'number' || !isValidStatusCode(code)) {\n throw new TypeError('First argument must be a valid error code number');\n } else if (data === undefined || !data.length) {\n buf = Buffer.allocUnsafe(2);\n buf.writeUInt16BE(code, 0);\n } else {\n const length = Buffer.byteLength(data);\n\n if (length > 123) {\n throw new RangeError('The message must not be greater than 123 bytes');\n }\n\n buf = Buffer.allocUnsafe(2 + length);\n buf.writeUInt16BE(code, 0);\n\n if (typeof data === 'string') {\n buf.write(data, 2);\n } else if (isUint8Array(data)) {\n buf.set(data, 2);\n } else {\n throw new TypeError('Second argument must be a string or a Uint8Array');\n }\n }\n\n const options = {\n [kByteLength]: buf.length,\n fin: true,\n generateMask: this._generateMask,\n mask,\n maskBuffer: this._maskBuffer,\n opcode: 0x08,\n readOnly: false,\n rsv1: false\n };\n\n if (this._state !== DEFAULT) {\n this.enqueue([this.dispatch, buf, false, options, cb]);\n } else {\n this.sendFrame(Sender.frame(buf, options), cb);\n }\n }\n\n /**\n * Sends a ping message to the other peer.\n *\n * @param {*} data The message to send\n * @param {Boolean} [mask=false] Specifies whether or not to mask `data`\n * @param {Function} [cb] Callback\n * @public\n */\n ping(data, mask, cb) {\n let byteLength;\n let readOnly;\n\n if (typeof data === 'string') {\n byteLength = Buffer.byteLength(data);\n readOnly = false;\n } else if (isBlob(data)) {\n byteLength = data.size;\n readOnly = false;\n } else {\n data = toBuffer(data);\n byteLength = data.length;\n readOnly = toBuffer.readOnly;\n }\n\n if (byteLength > 125) {\n throw new RangeError('The data size must not be greater than 125 bytes');\n }\n\n const options = {\n [kByteLength]: byteLength,\n fin: true,\n generateMask: this._generateMask,\n mask,\n maskBuffer: this._maskBuffer,\n opcode: 0x09,\n readOnly,\n rsv1: false\n };\n\n if (isBlob(data)) {\n if (this._state !== DEFAULT) {\n this.enqueue([this.getBlobData, data, false, options, cb]);\n } else {\n this.getBlobData(data, false, options, cb);\n }\n } else if (this._state !== DEFAULT) {\n this.enqueue([this.dispatch, data, false, options, cb]);\n } else {\n this.sendFrame(Sender.frame(data, options), cb);\n }\n }\n\n /**\n * Sends a pong message to the other peer.\n *\n * @param {*} data The message to send\n * @param {Boolean} [mask=false] Specifies whether or not to mask `data`\n * @param {Function} [cb] Callback\n * @public\n */\n pong(data, mask, cb) {\n let byteLength;\n let readOnly;\n\n if (typeof data === 'string') {\n byteLength = Buffer.byteLength(data);\n readOnly = false;\n } else if (isBlob(data)) {\n byteLength = data.size;\n readOnly = false;\n } else {\n data = toBuffer(data);\n byteLength = data.length;\n readOnly = toBuffer.readOnly;\n }\n\n if (byteLength > 125) {\n throw new RangeError('The data size must not be greater than 125 bytes');\n }\n\n const options = {\n [kByteLength]: byteLength,\n fin: true,\n generateMask: this._generateMask,\n mask,\n maskBuffer: this._maskBuffer,\n opcode: 0x0a,\n readOnly,\n rsv1: false\n };\n\n if (isBlob(data)) {\n if (this._state !== DEFAULT) {\n this.enqueue([this.getBlobData, data, false, options, cb]);\n } else {\n this.getBlobData(data, false, options, cb);\n }\n } else if (this._state !== DEFAULT) {\n this.enqueue([this.dispatch, data, false, options, cb]);\n } else {\n this.sendFrame(Sender.frame(data, options), cb);\n }\n }\n\n /**\n * Sends a data message to the other peer.\n *\n * @param {*} data The message to send\n * @param {Object} options Options object\n * @param {Boolean} [options.binary=false] Specifies whether `data` is binary\n * or text\n * @param {Boolean} [options.compress=false] Specifies whether or not to\n * compress `data`\n * @param {Boolean} [options.fin=false] Specifies whether the fragment is the\n * last one\n * @param {Boolean} [options.mask=false] Specifies whether or not to mask\n * `data`\n * @param {Function} [cb] Callback\n * @public\n */\n send(data, options, cb) {\n const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];\n let opcode = options.binary ? 2 : 1;\n let rsv1 = options.compress;\n\n let byteLength;\n let readOnly;\n\n if (typeof data === 'string') {\n byteLength = Buffer.byteLength(data);\n readOnly = false;\n } else if (isBlob(data)) {\n byteLength = data.size;\n readOnly = false;\n } else {\n data = toBuffer(data);\n byteLength = data.length;\n readOnly = toBuffer.readOnly;\n }\n\n if (this._firstFragment) {\n this._firstFragment = false;\n if (\n rsv1 &&\n perMessageDeflate &&\n perMessageDeflate.params[\n perMessageDeflate._isServer\n ? 'server_no_context_takeover'\n : 'client_no_context_takeover'\n ]\n ) {\n rsv1 = byteLength >= perMessageDeflate._threshold;\n }\n this._compress = rsv1;\n } else {\n rsv1 = false;\n opcode = 0;\n }\n\n if (options.fin) this._firstFragment = true;\n\n const opts = {\n [kByteLength]: byteLength,\n fin: options.fin,\n generateMask: this._generateMask,\n mask: options.mask,\n maskBuffer: this._maskBuffer,\n opcode,\n readOnly,\n rsv1\n };\n\n if (isBlob(data)) {\n if (this._state !== DEFAULT) {\n this.enqueue([this.getBlobData, data, this._compress, opts, cb]);\n } else {\n this.getBlobData(data, this._compress, opts, cb);\n }\n } else if (this._state !== DEFAULT) {\n this.enqueue([this.dispatch, data, this._compress, opts, cb]);\n } else {\n this.dispatch(data, this._compress, opts, cb);\n }\n }\n\n /**\n * Gets the contents of a blob as binary data.\n *\n * @param {Blob} blob The blob\n * @param {Boolean} [compress=false] Specifies whether or not to compress\n * the data\n * @param {Object} options Options object\n * @param {Boolean} [options.fin=false] Specifies whether or not to set the\n * FIN bit\n * @param {Function} [options.generateMask] The function used to generate the\n * masking key\n * @param {Boolean} [options.mask=false] Specifies whether or not to mask\n * `data`\n * @param {Buffer} [options.maskBuffer] The buffer used to store the masking\n * key\n * @param {Number} options.opcode The opcode\n * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be\n * modified\n * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the\n * RSV1 bit\n * @param {Function} [cb] Callback\n * @private\n */\n getBlobData(blob, compress, options, cb) {\n this._bufferedBytes += options[kByteLength];\n this._state = GET_BLOB_DATA;\n\n blob\n .arrayBuffer()\n .then((arrayBuffer) => {\n if (this._socket.destroyed) {\n const err = new Error(\n 'The socket was closed while the blob was being read'\n );\n\n //\n // `callCallbacks` is called in the next tick to ensure that errors\n // that might be thrown in the callbacks behave like errors thrown\n // outside the promise chain.\n //\n process.nextTick(callCallbacks, this, err, cb);\n return;\n }\n\n this._bufferedBytes -= options[kByteLength];\n const data = toBuffer(arrayBuffer);\n\n if (!compress) {\n this._state = DEFAULT;\n this.sendFrame(Sender.frame(data, options), cb);\n this.dequeue();\n } else {\n this.dispatch(data, compress, options, cb);\n }\n })\n .catch((err) => {\n //\n // `onError` is called in the next tick for the same reason that\n // `callCallbacks` above is.\n //\n process.nextTick(onError, this, err, cb);\n });\n }\n\n /**\n * Dispatches a message.\n *\n * @param {(Buffer|String)} data The message to send\n * @param {Boolean} [compress=false] Specifies whether or not to compress\n * `data`\n * @param {Object} options Options object\n * @param {Boolean} [options.fin=false] Specifies whether or not to set the\n * FIN bit\n * @param {Function} [options.generateMask] The function used to generate the\n * masking key\n * @param {Boolean} [options.mask=false] Specifies whether or not to mask\n * `data`\n * @param {Buffer} [options.maskBuffer] The buffer used to store the masking\n * key\n * @param {Number} options.opcode The opcode\n * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be\n * modified\n * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the\n * RSV1 bit\n * @param {Function} [cb] Callback\n * @private\n */\n dispatch(data, compress, options, cb) {\n if (!compress) {\n this.sendFrame(Sender.frame(data, options), cb);\n return;\n }\n\n const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];\n\n this._bufferedBytes += options[kByteLength];\n this._state = DEFLATING;\n perMessageDeflate.compress(data, options.fin, (_, buf) => {\n if (this._socket.destroyed) {\n const err = new Error(\n 'The socket was closed while data was being compressed'\n );\n\n callCallbacks(this, err, cb);\n return;\n }\n\n this._bufferedBytes -= options[kByteLength];\n this._state = DEFAULT;\n options.readOnly = false;\n this.sendFrame(Sender.frame(buf, options), cb);\n this.dequeue();\n });\n }\n\n /**\n * Executes queued send operations.\n *\n * @private\n */\n dequeue() {\n while (this._state === DEFAULT && this._queue.length) {\n const params = this._queue.shift();\n\n this._bufferedBytes -= params[3][kByteLength];\n Reflect.apply(params[0], this, params.slice(1));\n }\n }\n\n /**\n * Enqueues a send operation.\n *\n * @param {Array} params Send operation parameters.\n * @private\n */\n enqueue(params) {\n this._bufferedBytes += params[3][kByteLength];\n this._queue.push(params);\n }\n\n /**\n * Sends a frame.\n *\n * @param {(Buffer | String)[]} list The frame to send\n * @param {Function} [cb] Callback\n * @private\n */\n sendFrame(list, cb) {\n if (list.length === 2) {\n this._socket.cork();\n this._socket.write(list[0]);\n this._socket.write(list[1], cb);\n this._socket.uncork();\n } else {\n this._socket.write(list[0], cb);\n }\n }\n}\n\nmodule.exports = Sender;\n\n/**\n * Calls queued callbacks with an error.\n *\n * @param {Sender} sender The `Sender` instance\n * @param {Error} err The error to call the callbacks with\n * @param {Function} [cb] The first callback\n * @private\n */\nfunction callCallbacks(sender, err, cb) {\n if (typeof cb === 'function') cb(err);\n\n for (let i = 0; i < sender._queue.length; i++) {\n const params = sender._queue[i];\n const callback = params[params.length - 1];\n\n if (typeof callback === 'function') callback(err);\n }\n}\n\n/**\n * Handles a `Sender` error.\n *\n * @param {Sender} sender The `Sender` instance\n * @param {Error} err The error\n * @param {Function} [cb] The first pending callback\n * @private\n */\nfunction onError(sender, err, cb) {\n callCallbacks(sender, err, cb);\n sender.onerror(err);\n}\n","'use strict';\n\nconst { kForOnEventAttribute, kListener } = require('./constants');\n\nconst kCode = Symbol('kCode');\nconst kData = Symbol('kData');\nconst kError = Symbol('kError');\nconst kMessage = Symbol('kMessage');\nconst kReason = Symbol('kReason');\nconst kTarget = Symbol('kTarget');\nconst kType = Symbol('kType');\nconst kWasClean = Symbol('kWasClean');\n\n/**\n * Class representing an event.\n */\nclass Event {\n /**\n * Create a new `Event`.\n *\n * @param {String} type The name of the event\n * @throws {TypeError} If the `type` argument is not specified\n */\n constructor(type) {\n this[kTarget] = null;\n this[kType] = type;\n }\n\n /**\n * @type {*}\n */\n get target() {\n return this[kTarget];\n }\n\n /**\n * @type {String}\n */\n get type() {\n return this[kType];\n }\n}\n\nObject.defineProperty(Event.prototype, 'target', { enumerable: true });\nObject.defineProperty(Event.prototype, 'type', { enumerable: true });\n\n/**\n * Class representing a close event.\n *\n * @extends Event\n */\nclass CloseEvent extends Event {\n /**\n * Create a new `CloseEvent`.\n *\n * @param {String} type The name of the event\n * @param {Object} [options] A dictionary object that allows for setting\n * attributes via object members of the same name\n * @param {Number} [options.code=0] The status code explaining why the\n * connection was closed\n * @param {String} [options.reason=''] A human-readable string explaining why\n * the connection was closed\n * @param {Boolean} [options.wasClean=false] Indicates whether or not the\n * connection was cleanly closed\n */\n constructor(type, options = {}) {\n super(type);\n\n this[kCode] = options.code === undefined ? 0 : options.code;\n this[kReason] = options.reason === undefined ? '' : options.reason;\n this[kWasClean] = options.wasClean === undefined ? false : options.wasClean;\n }\n\n /**\n * @type {Number}\n */\n get code() {\n return this[kCode];\n }\n\n /**\n * @type {String}\n */\n get reason() {\n return this[kReason];\n }\n\n /**\n * @type {Boolean}\n */\n get wasClean() {\n return this[kWasClean];\n }\n}\n\nObject.defineProperty(CloseEvent.prototype, 'code', { enumerable: true });\nObject.defineProperty(CloseEvent.prototype, 'reason', { enumerable: true });\nObject.defineProperty(CloseEvent.prototype, 'wasClean', { enumerable: true });\n\n/**\n * Class representing an error event.\n *\n * @extends Event\n */\nclass ErrorEvent extends Event {\n /**\n * Create a new `ErrorEvent`.\n *\n * @param {String} type The name of the event\n * @param {Object} [options] A dictionary object that allows for setting\n * attributes via object members of the same name\n * @param {*} [options.error=null] The error that generated this event\n * @param {String} [options.message=''] The error message\n */\n constructor(type, options = {}) {\n super(type);\n\n this[kError] = options.error === undefined ? null : options.error;\n this[kMessage] = options.message === undefined ? '' : options.message;\n }\n\n /**\n * @type {*}\n */\n get error() {\n return this[kError];\n }\n\n /**\n * @type {String}\n */\n get message() {\n return this[kMessage];\n }\n}\n\nObject.defineProperty(ErrorEvent.prototype, 'error', { enumerable: true });\nObject.defineProperty(ErrorEvent.prototype, 'message', { enumerable: true });\n\n/**\n * Class representing a message event.\n *\n * @extends Event\n */\nclass MessageEvent extends Event {\n /**\n * Create a new `MessageEvent`.\n *\n * @param {String} type The name of the event\n * @param {Object} [options] A dictionary object that allows for setting\n * attributes via object members of the same name\n * @param {*} [options.data=null] The message content\n */\n constructor(type, options = {}) {\n super(type);\n\n this[kData] = options.data === undefined ? null : options.data;\n }\n\n /**\n * @type {*}\n */\n get data() {\n return this[kData];\n }\n}\n\nObject.defineProperty(MessageEvent.prototype, 'data', { enumerable: true });\n\n/**\n * This provides methods for emulating the `EventTarget` interface. It's not\n * meant to be used directly.\n *\n * @mixin\n */\nconst EventTarget = {\n /**\n * Register an event listener.\n *\n * @param {String} type A string representing the event type to listen for\n * @param {(Function|Object)} handler The listener to add\n * @param {Object} [options] An options object specifies characteristics about\n * the event listener\n * @param {Boolean} [options.once=false] A `Boolean` indicating that the\n * listener should be invoked at most once after being added. If `true`,\n * the listener would be automatically removed when invoked.\n * @public\n */\n addEventListener(type, handler, options = {}) {\n for (const listener of this.listeners(type)) {\n if (\n !options[kForOnEventAttribute] &&\n listener[kListener] === handler &&\n !listener[kForOnEventAttribute]\n ) {\n return;\n }\n }\n\n let wrapper;\n\n if (type === 'message') {\n wrapper = function onMessage(data, isBinary) {\n const event = new MessageEvent('message', {\n data: isBinary ? data : data.toString()\n });\n\n event[kTarget] = this;\n callListener(handler, this, event);\n };\n } else if (type === 'close') {\n wrapper = function onClose(code, message) {\n const event = new CloseEvent('close', {\n code,\n reason: message.toString(),\n wasClean: this._closeFrameReceived && this._closeFrameSent\n });\n\n event[kTarget] = this;\n callListener(handler, this, event);\n };\n } else if (type === 'error') {\n wrapper = function onError(error) {\n const event = new ErrorEvent('error', {\n error,\n message: error.message\n });\n\n event[kTarget] = this;\n callListener(handler, this, event);\n };\n } else if (type === 'open') {\n wrapper = function onOpen() {\n const event = new Event('open');\n\n event[kTarget] = this;\n callListener(handler, this, event);\n };\n } else {\n return;\n }\n\n wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];\n wrapper[kListener] = handler;\n\n if (options.once) {\n this.once(type, wrapper);\n } else {\n this.on(type, wrapper);\n }\n },\n\n /**\n * Remove an event listener.\n *\n * @param {String} type A string representing the event type to remove\n * @param {(Function|Object)} handler The listener to remove\n * @public\n */\n removeEventListener(type, handler) {\n for (const listener of this.listeners(type)) {\n if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {\n this.removeListener(type, listener);\n break;\n }\n }\n }\n};\n\nmodule.exports = {\n CloseEvent,\n ErrorEvent,\n Event,\n EventTarget,\n MessageEvent\n};\n\n/**\n * Call an event listener\n *\n * @param {(Function|Object)} listener The listener to call\n * @param {*} thisArg The value to use as `this`` when calling the listener\n * @param {Event} event The event to pass to the listener\n * @private\n */\nfunction callListener(listener, thisArg, event) {\n if (typeof listener === 'object' && listener.handleEvent) {\n listener.handleEvent.call(listener, event);\n } else {\n listener.call(thisArg, event);\n }\n}\n","'use strict';\n\nconst { tokenChars } = require('./validation');\n\n/**\n * Adds an offer to the map of extension offers or a parameter to the map of\n * parameters.\n *\n * @param {Object} dest The map of extension offers or parameters\n * @param {String} name The extension or parameter name\n * @param {(Object|Boolean|String)} elem The extension parameters or the\n * parameter value\n * @private\n */\nfunction push(dest, name, elem) {\n if (dest[name] === undefined) dest[name] = [elem];\n else dest[name].push(elem);\n}\n\n/**\n * Parses the `Sec-WebSocket-Extensions` header into an object.\n *\n * @param {String} header The field value of the header\n * @return {Object} The parsed object\n * @public\n */\nfunction parse(header) {\n const offers = Object.create(null);\n let params = Object.create(null);\n let mustUnescape = false;\n let isEscaping = false;\n let inQuotes = false;\n let extensionName;\n let paramName;\n let start = -1;\n let code = -1;\n let end = -1;\n let i = 0;\n\n for (; i < header.length; i++) {\n code = header.charCodeAt(i);\n\n if (extensionName === undefined) {\n if (end === -1 && tokenChars[code] === 1) {\n if (start === -1) start = i;\n } else if (\n i !== 0 &&\n (code === 0x20 /* ' ' */ || code === 0x09) /* '\\t' */\n ) {\n if (end === -1 && start !== -1) end = i;\n } else if (code === 0x3b /* ';' */ || code === 0x2c /* ',' */) {\n if (start === -1) {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n\n if (end === -1) end = i;\n const name = header.slice(start, end);\n if (code === 0x2c) {\n push(offers, name, params);\n params = Object.create(null);\n } else {\n extensionName = name;\n }\n\n start = end = -1;\n } else {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n } else if (paramName === undefined) {\n if (end === -1 && tokenChars[code] === 1) {\n if (start === -1) start = i;\n } else if (code === 0x20 || code === 0x09) {\n if (end === -1 && start !== -1) end = i;\n } else if (code === 0x3b || code === 0x2c) {\n if (start === -1) {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n\n if (end === -1) end = i;\n push(params, header.slice(start, end), true);\n if (code === 0x2c) {\n push(offers, extensionName, params);\n params = Object.create(null);\n extensionName = undefined;\n }\n\n start = end = -1;\n } else if (code === 0x3d /* '=' */ && start !== -1 && end === -1) {\n paramName = header.slice(start, i);\n start = end = -1;\n } else {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n } else {\n //\n // The value of a quoted-string after unescaping must conform to the\n // token ABNF, so only token characters are valid.\n // Ref: https://tools.ietf.org/html/rfc6455#section-9.1\n //\n if (isEscaping) {\n if (tokenChars[code] !== 1) {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n if (start === -1) start = i;\n else if (!mustUnescape) mustUnescape = true;\n isEscaping = false;\n } else if (inQuotes) {\n if (tokenChars[code] === 1) {\n if (start === -1) start = i;\n } else if (code === 0x22 /* '\"' */ && start !== -1) {\n inQuotes = false;\n end = i;\n } else if (code === 0x5c /* '\\' */) {\n isEscaping = true;\n } else {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n } else if (code === 0x22 && header.charCodeAt(i - 1) === 0x3d) {\n inQuotes = true;\n } else if (end === -1 && tokenChars[code] === 1) {\n if (start === -1) start = i;\n } else if (start !== -1 && (code === 0x20 || code === 0x09)) {\n if (end === -1) end = i;\n } else if (code === 0x3b || code === 0x2c) {\n if (start === -1) {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n\n if (end === -1) end = i;\n let value = header.slice(start, end);\n if (mustUnescape) {\n value = value.replace(/\\\\/g, '');\n mustUnescape = false;\n }\n push(params, paramName, value);\n if (code === 0x2c) {\n push(offers, extensionName, params);\n params = Object.create(null);\n extensionName = undefined;\n }\n\n paramName = undefined;\n start = end = -1;\n } else {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n }\n }\n\n if (start === -1 || inQuotes || code === 0x20 || code === 0x09) {\n throw new SyntaxError('Unexpected end of input');\n }\n\n if (end === -1) end = i;\n const token = header.slice(start, end);\n if (extensionName === undefined) {\n push(offers, token, params);\n } else {\n if (paramName === undefined) {\n push(params, token, true);\n } else if (mustUnescape) {\n push(params, paramName, token.replace(/\\\\/g, ''));\n } else {\n push(params, paramName, token);\n }\n push(offers, extensionName, params);\n }\n\n return offers;\n}\n\n/**\n * Builds the `Sec-WebSocket-Extensions` header field value.\n *\n * @param {Object} extensions The map of extensions and parameters to format\n * @return {String} A string representing the given object\n * @public\n */\nfunction format(extensions) {\n return Object.keys(extensions)\n .map((extension) => {\n let configurations = extensions[extension];\n if (!Array.isArray(configurations)) configurations = [configurations];\n return configurations\n .map((params) => {\n return [extension]\n .concat(\n Object.keys(params).map((k) => {\n let values = params[k];\n if (!Array.isArray(values)) values = [values];\n return values\n .map((v) => (v === true ? k : `${k}=${v}`))\n .join('; ');\n })\n )\n .join('; ');\n })\n .join(', ');\n })\n .join(', ');\n}\n\nmodule.exports = { format, parse };\n","/* eslint no-unused-vars: [\"error\", { \"varsIgnorePattern\": \"^Duplex|Readable$\", \"caughtErrors\": \"none\" }] */\n\n'use strict';\n\nconst EventEmitter = require('events');\nconst https = require('https');\nconst http = require('http');\nconst net = require('net');\nconst tls = require('tls');\nconst { randomBytes, createHash } = require('crypto');\nconst { Duplex, Readable } = require('stream');\nconst { URL } = require('url');\n\nconst PerMessageDeflate = require('./permessage-deflate');\nconst Receiver = require('./receiver');\nconst Sender = require('./sender');\nconst { isBlob } = require('./validation');\n\nconst {\n BINARY_TYPES,\n CLOSE_TIMEOUT,\n EMPTY_BUFFER,\n GUID,\n kForOnEventAttribute,\n kListener,\n kStatusCode,\n kWebSocket,\n NOOP\n} = require('./constants');\nconst {\n EventTarget: { addEventListener, removeEventListener }\n} = require('./event-target');\nconst { format, parse } = require('./extension');\nconst { toBuffer } = require('./buffer-util');\n\nconst kAborted = Symbol('kAborted');\nconst protocolVersions = [8, 13];\nconst readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];\nconst subprotocolRegex = /^[!#$%&'*+\\-.0-9A-Z^_`|a-z~]+$/;\n\n/**\n * Class representing a WebSocket.\n *\n * @extends EventEmitter\n */\nclass WebSocket extends EventEmitter {\n /**\n * Create a new `WebSocket`.\n *\n * @param {(String|URL)} address The URL to which to connect\n * @param {(String|String[])} [protocols] The subprotocols\n * @param {Object} [options] Connection options\n */\n constructor(address, protocols, options) {\n super();\n\n this._binaryType = BINARY_TYPES[0];\n this._closeCode = 1006;\n this._closeFrameReceived = false;\n this._closeFrameSent = false;\n this._closeMessage = EMPTY_BUFFER;\n this._closeTimer = null;\n this._errorEmitted = false;\n this._extensions = {};\n this._paused = false;\n this._protocol = '';\n this._readyState = WebSocket.CONNECTING;\n this._receiver = null;\n this._sender = null;\n this._socket = null;\n\n if (address !== null) {\n this._bufferedAmount = 0;\n this._isServer = false;\n this._redirects = 0;\n\n if (protocols === undefined) {\n protocols = [];\n } else if (!Array.isArray(protocols)) {\n if (typeof protocols === 'object' && protocols !== null) {\n options = protocols;\n protocols = [];\n } else {\n protocols = [protocols];\n }\n }\n\n initAsClient(this, address, protocols, options);\n } else {\n this._autoPong = options.autoPong;\n this._closeTimeout = options.closeTimeout;\n this._isServer = true;\n }\n }\n\n /**\n * For historical reasons, the custom \"nodebuffer\" type is used by the default\n * instead of \"blob\".\n *\n * @type {String}\n */\n get binaryType() {\n return this._binaryType;\n }\n\n set binaryType(type) {\n if (!BINARY_TYPES.includes(type)) return;\n\n this._binaryType = type;\n\n //\n // Allow to change `binaryType` on the fly.\n //\n if (this._receiver) this._receiver._binaryType = type;\n }\n\n /**\n * @type {Number}\n */\n get bufferedAmount() {\n if (!this._socket) return this._bufferedAmount;\n\n return this._socket._writableState.length + this._sender._bufferedBytes;\n }\n\n /**\n * @type {String}\n */\n get extensions() {\n return Object.keys(this._extensions).join();\n }\n\n /**\n * @type {Boolean}\n */\n get isPaused() {\n return this._paused;\n }\n\n /**\n * @type {Function}\n */\n /* istanbul ignore next */\n get onclose() {\n return null;\n }\n\n /**\n * @type {Function}\n */\n /* istanbul ignore next */\n get onerror() {\n return null;\n }\n\n /**\n * @type {Function}\n */\n /* istanbul ignore next */\n get onopen() {\n return null;\n }\n\n /**\n * @type {Function}\n */\n /* istanbul ignore next */\n get onmessage() {\n return null;\n }\n\n /**\n * @type {String}\n */\n get protocol() {\n return this._protocol;\n }\n\n /**\n * @type {Number}\n */\n get readyState() {\n return this._readyState;\n }\n\n /**\n * @type {String}\n */\n get url() {\n return this._url;\n }\n\n /**\n * Set up the socket and the internal resources.\n *\n * @param {Duplex} socket The network socket between the server and client\n * @param {Buffer} head The first packet of the upgraded stream\n * @param {Object} options Options object\n * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether\n * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted\n * multiple times in the same tick\n * @param {Function} [options.generateMask] The function used to generate the\n * masking key\n * @param {Number} [options.maxBufferedChunks=0] The maximum number of\n * buffered data chunks\n * @param {Number} [options.maxFragments=0] The maximum number of message\n * fragments\n * @param {Number} [options.maxPayload=0] The maximum allowed message size\n * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or\n * not to skip UTF-8 validation for text and close messages\n * @private\n */\n setSocket(socket, head, options) {\n const receiver = new Receiver({\n allowSynchronousEvents: options.allowSynchronousEvents,\n binaryType: this.binaryType,\n extensions: this._extensions,\n isServer: this._isServer,\n maxBufferedChunks: options.maxBufferedChunks,\n maxFragments: options.maxFragments,\n maxPayload: options.maxPayload,\n skipUTF8Validation: options.skipUTF8Validation\n });\n\n const sender = new Sender(socket, this._extensions, options.generateMask);\n\n this._receiver = receiver;\n this._sender = sender;\n this._socket = socket;\n\n receiver[kWebSocket] = this;\n sender[kWebSocket] = this;\n socket[kWebSocket] = this;\n\n receiver.on('conclude', receiverOnConclude);\n receiver.on('drain', receiverOnDrain);\n receiver.on('error', receiverOnError);\n receiver.on('message', receiverOnMessage);\n receiver.on('ping', receiverOnPing);\n receiver.on('pong', receiverOnPong);\n\n sender.onerror = senderOnError;\n\n //\n // These methods may not be available if `socket` is just a `Duplex`.\n //\n if (socket.setTimeout) socket.setTimeout(0);\n if (socket.setNoDelay) socket.setNoDelay();\n\n if (head.length > 0) socket.unshift(head);\n\n socket.on('close', socketOnClose);\n socket.on('data', socketOnData);\n socket.on('end', socketOnEnd);\n socket.on('error', socketOnError);\n\n this._readyState = WebSocket.OPEN;\n this.emit('open');\n }\n\n /**\n * Emit the `'close'` event.\n *\n * @private\n */\n emitClose() {\n if (!this._socket) {\n this._readyState = WebSocket.CLOSED;\n this.emit('close', this._closeCode, this._closeMessage);\n return;\n }\n\n if (this._extensions[PerMessageDeflate.extensionName]) {\n this._extensions[PerMessageDeflate.extensionName].cleanup();\n }\n\n this._receiver.removeAllListeners();\n this._readyState = WebSocket.CLOSED;\n this.emit('close', this._closeCode, this._closeMessage);\n }\n\n /**\n * Start a closing handshake.\n *\n * +----------+ +-----------+ +----------+\n * - - -|ws.close()|-->|close frame|-->|ws.close()|- - -\n * | +----------+ +-----------+ +----------+ |\n * +----------+ +-----------+ |\n * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING\n * +----------+ +-----------+ |\n * | | | +---+ |\n * +------------------------+-->|fin| - - - -\n * | +---+ | +---+\n * - - - - -|fin|<---------------------+\n * +---+\n *\n * @param {Number} [code] Status code explaining why the connection is closing\n * @param {(String|Buffer)} [data] The reason why the connection is\n * closing\n * @public\n */\n close(code, data) {\n if (this.readyState === WebSocket.CLOSED) return;\n if (this.readyState === WebSocket.CONNECTING) {\n const msg = 'WebSocket was closed before the connection was established';\n abortHandshake(this, this._req, msg);\n return;\n }\n\n if (this.readyState === WebSocket.CLOSING) {\n if (\n this._closeFrameSent &&\n (this._closeFrameReceived || this._receiver._writableState.errorEmitted)\n ) {\n this._socket.end();\n }\n\n return;\n }\n\n this._readyState = WebSocket.CLOSING;\n this._sender.close(code, data, !this._isServer, (err) => {\n //\n // This error is handled by the `'error'` listener on the socket. We only\n // want to know if the close frame has been sent here.\n //\n if (err) return;\n\n this._closeFrameSent = true;\n\n if (\n this._closeFrameReceived ||\n this._receiver._writableState.errorEmitted\n ) {\n this._socket.end();\n }\n });\n\n setCloseTimer(this);\n }\n\n /**\n * Pause the socket.\n *\n * @public\n */\n pause() {\n if (\n this.readyState === WebSocket.CONNECTING ||\n this.readyState === WebSocket.CLOSED\n ) {\n return;\n }\n\n this._paused = true;\n this._socket.pause();\n }\n\n /**\n * Send a ping.\n *\n * @param {*} [data] The data to send\n * @param {Boolean} [mask] Indicates whether or not to mask `data`\n * @param {Function} [cb] Callback which is executed when the ping is sent\n * @public\n */\n ping(data, mask, cb) {\n if (this.readyState === WebSocket.CONNECTING) {\n throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');\n }\n\n if (typeof data === 'function') {\n cb = data;\n data = mask = undefined;\n } else if (typeof mask === 'function') {\n cb = mask;\n mask = undefined;\n }\n\n if (typeof data === 'number') data = data.toString();\n\n if (this.readyState !== WebSocket.OPEN) {\n sendAfterClose(this, data, cb);\n return;\n }\n\n if (mask === undefined) mask = !this._isServer;\n this._sender.ping(data || EMPTY_BUFFER, mask, cb);\n }\n\n /**\n * Send a pong.\n *\n * @param {*} [data] The data to send\n * @param {Boolean} [mask] Indicates whether or not to mask `data`\n * @param {Function} [cb] Callback which is executed when the pong is sent\n * @public\n */\n pong(data, mask, cb) {\n if (this.readyState === WebSocket.CONNECTING) {\n throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');\n }\n\n if (typeof data === 'function') {\n cb = data;\n data = mask = undefined;\n } else if (typeof mask === 'function') {\n cb = mask;\n mask = undefined;\n }\n\n if (typeof data === 'number') data = data.toString();\n\n if (this.readyState !== WebSocket.OPEN) {\n sendAfterClose(this, data, cb);\n return;\n }\n\n if (mask === undefined) mask = !this._isServer;\n this._sender.pong(data || EMPTY_BUFFER, mask, cb);\n }\n\n /**\n * Resume the socket.\n *\n * @public\n */\n resume() {\n if (\n this.readyState === WebSocket.CONNECTING ||\n this.readyState === WebSocket.CLOSED\n ) {\n return;\n }\n\n this._paused = false;\n if (!this._receiver._writableState.needDrain) this._socket.resume();\n }\n\n /**\n * Send a data message.\n *\n * @param {*} data The message to send\n * @param {Object} [options] Options object\n * @param {Boolean} [options.binary] Specifies whether `data` is binary or\n * text\n * @param {Boolean} [options.compress] Specifies whether or not to compress\n * `data`\n * @param {Boolean} [options.fin=true] Specifies whether the fragment is the\n * last one\n * @param {Boolean} [options.mask] Specifies whether or not to mask `data`\n * @param {Function} [cb] Callback which is executed when data is written out\n * @public\n */\n send(data, options, cb) {\n if (this.readyState === WebSocket.CONNECTING) {\n throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');\n }\n\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n if (typeof data === 'number') data = data.toString();\n\n if (this.readyState !== WebSocket.OPEN) {\n sendAfterClose(this, data, cb);\n return;\n }\n\n const opts = {\n binary: typeof data !== 'string',\n mask: !this._isServer,\n compress: true,\n fin: true,\n ...options\n };\n\n if (!this._extensions[PerMessageDeflate.extensionName]) {\n opts.compress = false;\n }\n\n this._sender.send(data || EMPTY_BUFFER, opts, cb);\n }\n\n /**\n * Forcibly close the connection.\n *\n * @public\n */\n terminate() {\n if (this.readyState === WebSocket.CLOSED) return;\n if (this.readyState === WebSocket.CONNECTING) {\n const msg = 'WebSocket was closed before the connection was established';\n abortHandshake(this, this._req, msg);\n return;\n }\n\n if (this._socket) {\n this._readyState = WebSocket.CLOSING;\n this._socket.destroy();\n }\n }\n}\n\n/**\n * @constant {Number} CONNECTING\n * @memberof WebSocket\n */\nObject.defineProperty(WebSocket, 'CONNECTING', {\n enumerable: true,\n value: readyStates.indexOf('CONNECTING')\n});\n\n/**\n * @constant {Number} CONNECTING\n * @memberof WebSocket.prototype\n */\nObject.defineProperty(WebSocket.prototype, 'CONNECTING', {\n enumerable: true,\n value: readyStates.indexOf('CONNECTING')\n});\n\n/**\n * @constant {Number} OPEN\n * @memberof WebSocket\n */\nObject.defineProperty(WebSocket, 'OPEN', {\n enumerable: true,\n value: readyStates.indexOf('OPEN')\n});\n\n/**\n * @constant {Number} OPEN\n * @memberof WebSocket.prototype\n */\nObject.defineProperty(WebSocket.prototype, 'OPEN', {\n enumerable: true,\n value: readyStates.indexOf('OPEN')\n});\n\n/**\n * @constant {Number} CLOSING\n * @memberof WebSocket\n */\nObject.defineProperty(WebSocket, 'CLOSING', {\n enumerable: true,\n value: readyStates.indexOf('CLOSING')\n});\n\n/**\n * @constant {Number} CLOSING\n * @memberof WebSocket.prototype\n */\nObject.defineProperty(WebSocket.prototype, 'CLOSING', {\n enumerable: true,\n value: readyStates.indexOf('CLOSING')\n});\n\n/**\n * @constant {Number} CLOSED\n * @memberof WebSocket\n */\nObject.defineProperty(WebSocket, 'CLOSED', {\n enumerable: true,\n value: readyStates.indexOf('CLOSED')\n});\n\n/**\n * @constant {Number} CLOSED\n * @memberof WebSocket.prototype\n */\nObject.defineProperty(WebSocket.prototype, 'CLOSED', {\n enumerable: true,\n value: readyStates.indexOf('CLOSED')\n});\n\n[\n 'binaryType',\n 'bufferedAmount',\n 'extensions',\n 'isPaused',\n 'protocol',\n 'readyState',\n 'url'\n].forEach((property) => {\n Object.defineProperty(WebSocket.prototype, property, { enumerable: true });\n});\n\n//\n// Add the `onopen`, `onerror`, `onclose`, and `onmessage` attributes.\n// See https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface\n//\n['open', 'error', 'close', 'message'].forEach((method) => {\n Object.defineProperty(WebSocket.prototype, `on${method}`, {\n enumerable: true,\n get() {\n for (const listener of this.listeners(method)) {\n if (listener[kForOnEventAttribute]) return listener[kListener];\n }\n\n return null;\n },\n set(handler) {\n for (const listener of this.listeners(method)) {\n if (listener[kForOnEventAttribute]) {\n this.removeListener(method, listener);\n break;\n }\n }\n\n if (typeof handler !== 'function') return;\n\n this.addEventListener(method, handler, {\n [kForOnEventAttribute]: true\n });\n }\n });\n});\n\nWebSocket.prototype.addEventListener = addEventListener;\nWebSocket.prototype.removeEventListener = removeEventListener;\n\nmodule.exports = WebSocket;\n\n/**\n * Initialize a WebSocket client.\n *\n * @param {WebSocket} websocket The client to initialize\n * @param {(String|URL)} address The URL to which to connect\n * @param {Array} protocols The subprotocols\n * @param {Object} [options] Connection options\n * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether any\n * of the `'message'`, `'ping'`, and `'pong'` events can be emitted multiple\n * times in the same tick\n * @param {Boolean} [options.autoPong=true] Specifies whether or not to\n * automatically send a pong in response to a ping\n * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to wait\n * for the closing handshake to finish after `websocket.close()` is called\n * @param {Function} [options.finishRequest] A function which can be used to\n * customize the headers of each http request before it is sent\n * @param {Boolean} [options.followRedirects=false] Whether or not to follow\n * redirects\n * @param {Function} [options.generateMask] The function used to generate the\n * masking key\n * @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the\n * handshake request\n * @param {Number} [options.maxBufferedChunks=262144] The maximum number of\n * buffered data chunks\n * @param {Number} [options.maxFragments=16384] The maximum number of message\n * fragments\n * @param {Number} [options.maxPayload=104857600] The maximum allowed message\n * size\n * @param {Number} [options.maxRedirects=10] The maximum number of redirects\n * allowed\n * @param {String} [options.origin] Value of the `Origin` or\n * `Sec-WebSocket-Origin` header\n * @param {(Boolean|Object)} [options.perMessageDeflate=true] Enable/disable\n * permessage-deflate\n * @param {Number} [options.protocolVersion=13] Value of the\n * `Sec-WebSocket-Version` header\n * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or\n * not to skip UTF-8 validation for text and close messages\n * @private\n */\nfunction initAsClient(websocket, address, protocols, options) {\n const opts = {\n allowSynchronousEvents: true,\n autoPong: true,\n closeTimeout: CLOSE_TIMEOUT,\n protocolVersion: protocolVersions[1],\n maxBufferedChunks: 256 * 1024,\n maxFragments: 16 * 1024,\n maxPayload: 100 * 1024 * 1024,\n skipUTF8Validation: false,\n perMessageDeflate: true,\n followRedirects: false,\n maxRedirects: 10,\n ...options,\n socketPath: undefined,\n hostname: undefined,\n protocol: undefined,\n timeout: undefined,\n method: 'GET',\n host: undefined,\n path: undefined,\n port: undefined\n };\n\n websocket._autoPong = opts.autoPong;\n websocket._closeTimeout = opts.closeTimeout;\n\n if (!protocolVersions.includes(opts.protocolVersion)) {\n throw new RangeError(\n `Unsupported protocol version: ${opts.protocolVersion} ` +\n `(supported versions: ${protocolVersions.join(', ')})`\n );\n }\n\n let parsedUrl;\n\n if (address instanceof URL) {\n parsedUrl = address;\n } else {\n try {\n parsedUrl = new URL(address);\n } catch {\n throw new SyntaxError(`Invalid URL: ${address}`);\n }\n }\n\n if (parsedUrl.protocol === 'http:') {\n parsedUrl.protocol = 'ws:';\n } else if (parsedUrl.protocol === 'https:') {\n parsedUrl.protocol = 'wss:';\n }\n\n websocket._url = parsedUrl.href;\n\n const isSecure = parsedUrl.protocol === 'wss:';\n const isIpcUrl = parsedUrl.protocol === 'ws+unix:';\n let invalidUrlMessage;\n\n if (parsedUrl.protocol !== 'ws:' && !isSecure && !isIpcUrl) {\n invalidUrlMessage =\n 'The URL\\'s protocol must be one of \"ws:\", \"wss:\", ' +\n '\"http:\", \"https:\", or \"ws+unix:\"';\n } else if (isIpcUrl && !parsedUrl.pathname) {\n invalidUrlMessage = \"The URL's pathname is empty\";\n } else if (parsedUrl.hash) {\n invalidUrlMessage = 'The URL contains a fragment identifier';\n }\n\n if (invalidUrlMessage) {\n const err = new SyntaxError(invalidUrlMessage);\n\n if (websocket._redirects === 0) {\n throw err;\n } else {\n emitErrorAndClose(websocket, err);\n return;\n }\n }\n\n const defaultPort = isSecure ? 443 : 80;\n const key = randomBytes(16).toString('base64');\n const request = isSecure ? https.request : http.request;\n const protocolSet = new Set();\n let perMessageDeflate;\n\n opts.createConnection =\n opts.createConnection || (isSecure ? tlsConnect : netConnect);\n opts.defaultPort = opts.defaultPort || defaultPort;\n opts.port = parsedUrl.port || defaultPort;\n opts.host = parsedUrl.hostname.startsWith('[')\n ? parsedUrl.hostname.slice(1, -1)\n : parsedUrl.hostname;\n opts.headers = {\n ...opts.headers,\n 'Sec-WebSocket-Version': opts.protocolVersion,\n 'Sec-WebSocket-Key': key,\n Connection: 'Upgrade',\n Upgrade: 'websocket'\n };\n opts.path = parsedUrl.pathname + parsedUrl.search;\n opts.timeout = opts.handshakeTimeout;\n\n if (opts.perMessageDeflate) {\n perMessageDeflate = new PerMessageDeflate({\n ...opts.perMessageDeflate,\n isServer: false,\n maxPayload: opts.maxPayload\n });\n opts.headers['Sec-WebSocket-Extensions'] = format({\n [PerMessageDeflate.extensionName]: perMessageDeflate.offer()\n });\n }\n if (protocols.length) {\n for (const protocol of protocols) {\n if (\n typeof protocol !== 'string' ||\n !subprotocolRegex.test(protocol) ||\n protocolSet.has(protocol)\n ) {\n throw new SyntaxError(\n 'An invalid or duplicated subprotocol was specified'\n );\n }\n\n protocolSet.add(protocol);\n }\n\n opts.headers['Sec-WebSocket-Protocol'] = protocols.join(',');\n }\n if (opts.origin) {\n if (opts.protocolVersion < 13) {\n opts.headers['Sec-WebSocket-Origin'] = opts.origin;\n } else {\n opts.headers.Origin = opts.origin;\n }\n }\n if (parsedUrl.username || parsedUrl.password) {\n opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;\n }\n\n if (isIpcUrl) {\n const parts = opts.path.split(':');\n\n opts.socketPath = parts[0];\n opts.path = parts[1];\n }\n\n let req;\n\n if (opts.followRedirects) {\n if (websocket._redirects === 0) {\n websocket._originalIpc = isIpcUrl;\n websocket._originalSecure = isSecure;\n websocket._originalHostOrSocketPath = isIpcUrl\n ? opts.socketPath\n : parsedUrl.host;\n\n const headers = options && options.headers;\n\n //\n // Shallow copy the user provided options so that headers can be changed\n // without mutating the original object.\n //\n options = { ...options, headers: {} };\n\n if (headers) {\n for (const [key, value] of Object.entries(headers)) {\n options.headers[key.toLowerCase()] = value;\n }\n }\n } else if (websocket.listenerCount('redirect') === 0) {\n const isSameHost = isIpcUrl\n ? websocket._originalIpc\n ? opts.socketPath === websocket._originalHostOrSocketPath\n : false\n : websocket._originalIpc\n ? false\n : parsedUrl.host === websocket._originalHostOrSocketPath;\n\n if (!isSameHost || (websocket._originalSecure && !isSecure)) {\n //\n // Match curl 7.77.0 behavior and drop the following headers. These\n // headers are also dropped when following a redirect to a subdomain.\n //\n delete opts.headers.authorization;\n delete opts.headers.cookie;\n\n if (!isSameHost) delete opts.headers.host;\n\n opts.auth = undefined;\n }\n }\n\n //\n // Match curl 7.77.0 behavior and make the first `Authorization` header win.\n // If the `Authorization` header is set, then there is nothing to do as it\n // will take precedence.\n //\n if (opts.auth && !options.headers.authorization) {\n options.headers.authorization =\n 'Basic ' + Buffer.from(opts.auth).toString('base64');\n }\n\n req = websocket._req = request(opts);\n\n if (websocket._redirects) {\n //\n // Unlike what is done for the `'upgrade'` event, no early exit is\n // triggered here if the user calls `websocket.close()` or\n // `websocket.terminate()` from a listener of the `'redirect'` event. This\n // is because the user can also call `request.destroy()` with an error\n // before calling `websocket.close()` or `websocket.terminate()` and this\n // would result in an error being emitted on the `request` object with no\n // `'error'` event listeners attached.\n //\n websocket.emit('redirect', websocket.url, req);\n }\n } else {\n req = websocket._req = request(opts);\n }\n\n if (opts.timeout) {\n req.on('timeout', () => {\n abortHandshake(websocket, req, 'Opening handshake has timed out');\n });\n }\n\n req.on('error', (err) => {\n if (req === null || req[kAborted]) return;\n\n req = websocket._req = null;\n emitErrorAndClose(websocket, err);\n });\n\n req.on('response', (res) => {\n const location = res.headers.location;\n const statusCode = res.statusCode;\n\n if (\n location &&\n opts.followRedirects &&\n statusCode >= 300 &&\n statusCode < 400\n ) {\n if (++websocket._redirects > opts.maxRedirects) {\n abortHandshake(websocket, req, 'Maximum redirects exceeded');\n return;\n }\n\n req.abort();\n\n let addr;\n\n try {\n addr = new URL(location, address);\n } catch (e) {\n const err = new SyntaxError(`Invalid URL: ${location}`);\n emitErrorAndClose(websocket, err);\n return;\n }\n\n initAsClient(websocket, addr, protocols, options);\n } else if (!websocket.emit('unexpected-response', req, res)) {\n abortHandshake(\n websocket,\n req,\n `Unexpected server response: ${res.statusCode}`\n );\n }\n });\n\n req.on('upgrade', (res, socket, head) => {\n websocket.emit('upgrade', res);\n\n //\n // The user may have closed the connection from a listener of the\n // `'upgrade'` event.\n //\n if (websocket.readyState !== WebSocket.CONNECTING) return;\n\n req = websocket._req = null;\n\n const upgrade = res.headers.upgrade;\n\n if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') {\n abortHandshake(websocket, socket, 'Invalid Upgrade header');\n return;\n }\n\n const digest = createHash('sha1')\n .update(key + GUID)\n .digest('base64');\n\n if (res.headers['sec-websocket-accept'] !== digest) {\n abortHandshake(websocket, socket, 'Invalid Sec-WebSocket-Accept header');\n return;\n }\n\n const serverProt = res.headers['sec-websocket-protocol'];\n let protError;\n\n if (serverProt !== undefined) {\n if (!protocolSet.size) {\n protError = 'Server sent a subprotocol but none was requested';\n } else if (!protocolSet.has(serverProt)) {\n protError = 'Server sent an invalid subprotocol';\n }\n } else if (protocolSet.size) {\n protError = 'Server sent no subprotocol';\n }\n\n if (protError) {\n abortHandshake(websocket, socket, protError);\n return;\n }\n\n if (serverProt) websocket._protocol = serverProt;\n\n const secWebSocketExtensions = res.headers['sec-websocket-extensions'];\n\n if (secWebSocketExtensions !== undefined) {\n if (!perMessageDeflate) {\n const message =\n 'Server sent a Sec-WebSocket-Extensions header but no extension ' +\n 'was requested';\n abortHandshake(websocket, socket, message);\n return;\n }\n\n let extensions;\n\n try {\n extensions = parse(secWebSocketExtensions);\n } catch (err) {\n const message = 'Invalid Sec-WebSocket-Extensions header';\n abortHandshake(websocket, socket, message);\n return;\n }\n\n const extensionNames = Object.keys(extensions);\n\n if (\n extensionNames.length !== 1 ||\n extensionNames[0] !== PerMessageDeflate.extensionName\n ) {\n const message = 'Server indicated an extension that was not requested';\n abortHandshake(websocket, socket, message);\n return;\n }\n\n try {\n perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]);\n } catch (err) {\n const message = 'Invalid Sec-WebSocket-Extensions header';\n abortHandshake(websocket, socket, message);\n return;\n }\n\n websocket._extensions[PerMessageDeflate.extensionName] =\n perMessageDeflate;\n }\n\n websocket.setSocket(socket, head, {\n allowSynchronousEvents: opts.allowSynchronousEvents,\n generateMask: opts.generateMask,\n maxBufferedChunks: opts.maxBufferedChunks,\n maxFragments: opts.maxFragments,\n maxPayload: opts.maxPayload,\n skipUTF8Validation: opts.skipUTF8Validation\n });\n });\n\n if (opts.finishRequest) {\n opts.finishRequest(req, websocket);\n } else {\n req.end();\n }\n}\n\n/**\n * Emit the `'error'` and `'close'` events.\n *\n * @param {WebSocket} websocket The WebSocket instance\n * @param {Error} The error to emit\n * @private\n */\nfunction emitErrorAndClose(websocket, err) {\n websocket._readyState = WebSocket.CLOSING;\n //\n // The following assignment is practically useless and is done only for\n // consistency.\n //\n websocket._errorEmitted = true;\n websocket.emit('error', err);\n websocket.emitClose();\n}\n\n/**\n * Create a `net.Socket` and initiate a connection.\n *\n * @param {Object} options Connection options\n * @return {net.Socket} The newly created socket used to start the connection\n * @private\n */\nfunction netConnect(options) {\n options.path = options.socketPath;\n return net.connect(options);\n}\n\n/**\n * Create a `tls.TLSSocket` and initiate a connection.\n *\n * @param {Object} options Connection options\n * @return {tls.TLSSocket} The newly created socket used to start the connection\n * @private\n */\nfunction tlsConnect(options) {\n options.path = undefined;\n\n if (!options.servername && options.servername !== '') {\n options.servername = net.isIP(options.host) ? '' : options.host;\n }\n\n return tls.connect(options);\n}\n\n/**\n * Abort the handshake and emit an error.\n *\n * @param {WebSocket} websocket The WebSocket instance\n * @param {(http.ClientRequest|net.Socket|tls.Socket)} stream The request to\n * abort or the socket to destroy\n * @param {String} message The error message\n * @private\n */\nfunction abortHandshake(websocket, stream, message) {\n websocket._readyState = WebSocket.CLOSING;\n\n const err = new Error(message);\n Error.captureStackTrace(err, abortHandshake);\n\n if (stream.setHeader) {\n stream[kAborted] = true;\n stream.abort();\n\n if (stream.socket && !stream.socket.destroyed) {\n //\n // On Node.js >= 14.3.0 `request.abort()` does not destroy the socket if\n // called after the request completed. See\n // https://github.com/websockets/ws/issues/1869.\n //\n stream.socket.destroy();\n }\n\n process.nextTick(emitErrorAndClose, websocket, err);\n } else {\n stream.destroy(err);\n stream.once('error', websocket.emit.bind(websocket, 'error'));\n stream.once('close', websocket.emitClose.bind(websocket));\n }\n}\n\n/**\n * Handle cases where the `ping()`, `pong()`, or `send()` methods are called\n * when the `readyState` attribute is `CLOSING` or `CLOSED`.\n *\n * @param {WebSocket} websocket The WebSocket instance\n * @param {*} [data] The data to send\n * @param {Function} [cb] Callback\n * @private\n */\nfunction sendAfterClose(websocket, data, cb) {\n if (data) {\n const length = isBlob(data) ? data.size : toBuffer(data).length;\n\n //\n // The `_bufferedAmount` property is used only when the peer is a client and\n // the opening handshake fails. Under these circumstances, in fact, the\n // `setSocket()` method is not called, so the `_socket` and `_sender`\n // properties are set to `null`.\n //\n if (websocket._socket) websocket._sender._bufferedBytes += length;\n else websocket._bufferedAmount += length;\n }\n\n if (cb) {\n const err = new Error(\n `WebSocket is not open: readyState ${websocket.readyState} ` +\n `(${readyStates[websocket.readyState]})`\n );\n process.nextTick(cb, err);\n }\n}\n\n/**\n * The listener of the `Receiver` `'conclude'` event.\n *\n * @param {Number} code The status code\n * @param {Buffer} reason The reason for closing\n * @private\n */\nfunction receiverOnConclude(code, reason) {\n const websocket = this[kWebSocket];\n\n websocket._closeFrameReceived = true;\n websocket._closeMessage = reason;\n websocket._closeCode = code;\n\n if (websocket._socket[kWebSocket] === undefined) return;\n\n websocket._socket.removeListener('data', socketOnData);\n process.nextTick(resume, websocket._socket);\n\n if (code === 1005) websocket.close();\n else websocket.close(code, reason);\n}\n\n/**\n * The listener of the `Receiver` `'drain'` event.\n *\n * @private\n */\nfunction receiverOnDrain() {\n const websocket = this[kWebSocket];\n\n if (!websocket.isPaused) websocket._socket.resume();\n}\n\n/**\n * The listener of the `Receiver` `'error'` event.\n *\n * @param {(RangeError|Error)} err The emitted error\n * @private\n */\nfunction receiverOnError(err) {\n const websocket = this[kWebSocket];\n\n if (websocket._socket[kWebSocket] !== undefined) {\n websocket._socket.removeListener('data', socketOnData);\n\n //\n // On Node.js < 14.0.0 the `'error'` event is emitted synchronously. See\n // https://github.com/websockets/ws/issues/1940.\n //\n process.nextTick(resume, websocket._socket);\n\n websocket.close(err[kStatusCode]);\n }\n\n if (!websocket._errorEmitted) {\n websocket._errorEmitted = true;\n websocket.emit('error', err);\n }\n}\n\n/**\n * The listener of the `Receiver` `'finish'` event.\n *\n * @private\n */\nfunction receiverOnFinish() {\n this[kWebSocket].emitClose();\n}\n\n/**\n * The listener of the `Receiver` `'message'` event.\n *\n * @param {Buffer|ArrayBuffer|Buffer[])} data The message\n * @param {Boolean} isBinary Specifies whether the message is binary or not\n * @private\n */\nfunction receiverOnMessage(data, isBinary) {\n this[kWebSocket].emit('message', data, isBinary);\n}\n\n/**\n * The listener of the `Receiver` `'ping'` event.\n *\n * @param {Buffer} data The data included in the ping frame\n * @private\n */\nfunction receiverOnPing(data) {\n const websocket = this[kWebSocket];\n\n if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);\n websocket.emit('ping', data);\n}\n\n/**\n * The listener of the `Receiver` `'pong'` event.\n *\n * @param {Buffer} data The data included in the pong frame\n * @private\n */\nfunction receiverOnPong(data) {\n this[kWebSocket].emit('pong', data);\n}\n\n/**\n * Resume a readable stream\n *\n * @param {Readable} stream The readable stream\n * @private\n */\nfunction resume(stream) {\n stream.resume();\n}\n\n/**\n * The `Sender` error event handler.\n *\n * @param {Error} The error\n * @private\n */\nfunction senderOnError(err) {\n const websocket = this[kWebSocket];\n\n if (websocket.readyState === WebSocket.CLOSED) return;\n if (websocket.readyState === WebSocket.OPEN) {\n websocket._readyState = WebSocket.CLOSING;\n setCloseTimer(websocket);\n }\n\n //\n // `socket.end()` is used instead of `socket.destroy()` to allow the other\n // peer to finish sending queued data. There is no need to set a timer here\n // because `CLOSING` means that it is already set or not needed.\n //\n this._socket.end();\n\n if (!websocket._errorEmitted) {\n websocket._errorEmitted = true;\n websocket.emit('error', err);\n }\n}\n\n/**\n * Set a timer to destroy the underlying raw socket of a WebSocket.\n *\n * @param {WebSocket} websocket The WebSocket instance\n * @private\n */\nfunction setCloseTimer(websocket) {\n websocket._closeTimer = setTimeout(\n websocket._socket.destroy.bind(websocket._socket),\n websocket._closeTimeout\n );\n}\n\n/**\n * The listener of the socket `'close'` event.\n *\n * @private\n */\nfunction socketOnClose() {\n const websocket = this[kWebSocket];\n\n this.removeListener('close', socketOnClose);\n this.removeListener('data', socketOnData);\n this.removeListener('end', socketOnEnd);\n\n websocket._readyState = WebSocket.CLOSING;\n\n //\n // The close frame might not have been received or the `'end'` event emitted,\n // for example, if the socket was destroyed due to an error. Ensure that the\n // `receiver` stream is closed after writing any remaining buffered data to\n // it. If the readable side of the socket is in flowing mode then there is no\n // buffered data as everything has been already written. If instead, the\n // socket is paused, any possible buffered data will be read as a single\n // chunk.\n //\n if (\n !this._readableState.endEmitted &&\n !websocket._closeFrameReceived &&\n !websocket._receiver._writableState.errorEmitted &&\n this._readableState.length !== 0\n ) {\n const chunk = this.read(this._readableState.length);\n\n websocket._receiver.write(chunk);\n }\n\n websocket._receiver.end();\n\n this[kWebSocket] = undefined;\n\n clearTimeout(websocket._closeTimer);\n\n if (\n websocket._receiver._writableState.finished ||\n websocket._receiver._writableState.errorEmitted\n ) {\n websocket.emitClose();\n } else {\n websocket._receiver.on('error', receiverOnFinish);\n websocket._receiver.on('finish', receiverOnFinish);\n }\n}\n\n/**\n * The listener of the socket `'data'` event.\n *\n * @param {Buffer} chunk A chunk of data\n * @private\n */\nfunction socketOnData(chunk) {\n if (!this[kWebSocket]._receiver.write(chunk)) {\n this.pause();\n }\n}\n\n/**\n * The listener of the socket `'end'` event.\n *\n * @private\n */\nfunction socketOnEnd() {\n const websocket = this[kWebSocket];\n\n websocket._readyState = WebSocket.CLOSING;\n websocket._receiver.end();\n this.end();\n}\n\n/**\n * The listener of the socket `'error'` event.\n *\n * @private\n */\nfunction socketOnError() {\n const websocket = this[kWebSocket];\n\n this.removeListener('error', socketOnError);\n this.on('error', NOOP);\n\n if (websocket) {\n websocket._readyState = WebSocket.CLOSING;\n this.destroy();\n }\n}\n","/* eslint no-unused-vars: [\"error\", { \"varsIgnorePattern\": \"^WebSocket$\" }] */\n'use strict';\n\nconst WebSocket = require('./websocket');\nconst { Duplex } = require('stream');\n\n/**\n * Emits the `'close'` event on a stream.\n *\n * @param {Duplex} stream The stream.\n * @private\n */\nfunction emitClose(stream) {\n stream.emit('close');\n}\n\n/**\n * The listener of the `'end'` event.\n *\n * @private\n */\nfunction duplexOnEnd() {\n if (!this.destroyed && this._writableState.finished) {\n this.destroy();\n }\n}\n\n/**\n * The listener of the `'error'` event.\n *\n * @param {Error} err The error\n * @private\n */\nfunction duplexOnError(err) {\n this.removeListener('error', duplexOnError);\n this.destroy();\n if (this.listenerCount('error') === 0) {\n // Do not suppress the throwing behavior.\n this.emit('error', err);\n }\n}\n\n/**\n * Wraps a `WebSocket` in a duplex stream.\n *\n * @param {WebSocket} ws The `WebSocket` to wrap\n * @param {Object} [options] The options for the `Duplex` constructor\n * @return {Duplex} The duplex stream\n * @public\n */\nfunction createWebSocketStream(ws, options) {\n let terminateOnDestroy = true;\n\n const duplex = new Duplex({\n ...options,\n autoDestroy: false,\n emitClose: false,\n objectMode: false,\n writableObjectMode: false\n });\n\n ws.on('message', function message(msg, isBinary) {\n const data =\n !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;\n\n if (!duplex.push(data)) ws.pause();\n });\n\n ws.once('error', function error(err) {\n if (duplex.destroyed) return;\n\n // Prevent `ws.terminate()` from being called by `duplex._destroy()`.\n //\n // - If the `'error'` event is emitted before the `'open'` event, then\n // `ws.terminate()` is a noop as no socket is assigned.\n // - Otherwise, the error is re-emitted by the listener of the `'error'`\n // event of the `Receiver` object. The listener already closes the\n // connection by calling `ws.close()`. This allows a close frame to be\n // sent to the other peer. If `ws.terminate()` is called right after this,\n // then the close frame might not be sent.\n terminateOnDestroy = false;\n duplex.destroy(err);\n });\n\n ws.once('close', function close() {\n if (duplex.destroyed) return;\n\n duplex.push(null);\n });\n\n duplex._destroy = function (err, callback) {\n if (ws.readyState === ws.CLOSED) {\n callback(err);\n process.nextTick(emitClose, duplex);\n return;\n }\n\n let called = false;\n\n ws.once('error', function error(err) {\n called = true;\n callback(err);\n });\n\n ws.once('close', function close() {\n if (!called) callback(err);\n process.nextTick(emitClose, duplex);\n });\n\n if (terminateOnDestroy) ws.terminate();\n };\n\n duplex._final = function (callback) {\n if (ws.readyState === ws.CONNECTING) {\n ws.once('open', function open() {\n duplex._final(callback);\n });\n return;\n }\n\n // If the value of the `_socket` property is `null` it means that `ws` is a\n // client websocket and the handshake failed. In fact, when this happens, a\n // socket is never assigned to the websocket. Wait for the `'error'` event\n // that will be emitted by the websocket.\n if (ws._socket === null) return;\n\n if (ws._socket._writableState.finished) {\n callback();\n if (duplex._readableState.endEmitted) duplex.destroy();\n } else {\n ws._socket.once('finish', function finish() {\n // `duplex` is not destroyed here because the `'end'` event will be\n // emitted on `duplex` after this `'finish'` event. The EOF signaling\n // `null` chunk is, in fact, pushed when the websocket emits `'close'`.\n callback();\n });\n ws.close();\n }\n };\n\n duplex._read = function () {\n if (ws.isPaused) ws.resume();\n };\n\n duplex._write = function (chunk, encoding, callback) {\n if (ws.readyState === ws.CONNECTING) {\n ws.once('open', function open() {\n duplex._write(chunk, encoding, callback);\n });\n return;\n }\n\n ws.send(chunk, callback);\n };\n\n duplex.on('end', duplexOnEnd);\n duplex.on('error', duplexOnError);\n return duplex;\n}\n\nmodule.exports = createWebSocketStream;\n","'use strict';\n\nconst { tokenChars } = require('./validation');\n\n/**\n * Parses the `Sec-WebSocket-Protocol` header into a set of subprotocol names.\n *\n * @param {String} header The field value of the header\n * @return {Set} The subprotocol names\n * @public\n */\nfunction parse(header) {\n const protocols = new Set();\n let start = -1;\n let end = -1;\n let i = 0;\n\n for (i; i < header.length; i++) {\n const code = header.charCodeAt(i);\n\n if (end === -1 && tokenChars[code] === 1) {\n if (start === -1) start = i;\n } else if (\n i !== 0 &&\n (code === 0x20 /* ' ' */ || code === 0x09) /* '\\t' */\n ) {\n if (end === -1 && start !== -1) end = i;\n } else if (code === 0x2c /* ',' */) {\n if (start === -1) {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n\n if (end === -1) end = i;\n\n const protocol = header.slice(start, end);\n\n if (protocols.has(protocol)) {\n throw new SyntaxError(`The \"${protocol}\" subprotocol is duplicated`);\n }\n\n protocols.add(protocol);\n start = end = -1;\n } else {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n }\n\n if (start === -1 || end !== -1) {\n throw new SyntaxError('Unexpected end of input');\n }\n\n const protocol = header.slice(start, i);\n\n if (protocols.has(protocol)) {\n throw new SyntaxError(`The \"${protocol}\" subprotocol is duplicated`);\n }\n\n protocols.add(protocol);\n return protocols;\n}\n\nmodule.exports = { parse };\n","/* eslint no-unused-vars: [\"error\", { \"varsIgnorePattern\": \"^Duplex$\", \"caughtErrors\": \"none\" }] */\n\n'use strict';\n\nconst EventEmitter = require('events');\nconst http = require('http');\nconst { Duplex } = require('stream');\nconst { createHash } = require('crypto');\n\nconst extension = require('./extension');\nconst PerMessageDeflate = require('./permessage-deflate');\nconst subprotocol = require('./subprotocol');\nconst WebSocket = require('./websocket');\nconst { CLOSE_TIMEOUT, GUID, kWebSocket } = require('./constants');\n\nconst keyRegex = /^[+/0-9A-Za-z]{22}==$/;\n\nconst RUNNING = 0;\nconst CLOSING = 1;\nconst CLOSED = 2;\n\n/**\n * Class representing a WebSocket server.\n *\n * @extends EventEmitter\n */\nclass WebSocketServer extends EventEmitter {\n /**\n * Create a `WebSocketServer` instance.\n *\n * @param {Object} options Configuration options\n * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether\n * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted\n * multiple times in the same tick\n * @param {Boolean} [options.autoPong=true] Specifies whether or not to\n * automatically send a pong in response to a ping\n * @param {Number} [options.backlog=511] The maximum length of the queue of\n * pending connections\n * @param {Boolean} [options.clientTracking=true] Specifies whether or not to\n * track clients\n * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to\n * wait for the closing handshake to finish after `websocket.close()` is\n * called\n * @param {Function} [options.handleProtocols] A hook to handle protocols\n * @param {String} [options.host] The hostname where to bind the server\n * @param {Number} [options.maxBufferedChunks=262144] The maximum number of\n * buffered data chunks\n * @param {Number} [options.maxFragments=16384] The maximum number of message\n * fragments\n * @param {Number} [options.maxPayload=104857600] The maximum allowed message\n * size\n * @param {Boolean} [options.noServer=false] Enable no server mode\n * @param {String} [options.path] Accept only connections matching this path\n * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable\n * permessage-deflate\n * @param {Number} [options.port] The port where to bind the server\n * @param {(http.Server|https.Server)} [options.server] A pre-created HTTP/S\n * server to use\n * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or\n * not to skip UTF-8 validation for text and close messages\n * @param {Function} [options.verifyClient] A hook to reject connections\n * @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket`\n * class to use. It must be the `WebSocket` class or class that extends it\n * @param {Function} [callback] A listener for the `listening` event\n */\n constructor(options, callback) {\n super();\n\n options = {\n allowSynchronousEvents: true,\n autoPong: true,\n maxBufferedChunks: 256 * 1024,\n maxFragments: 16 * 1024,\n maxPayload: 100 * 1024 * 1024,\n skipUTF8Validation: false,\n perMessageDeflate: false,\n handleProtocols: null,\n clientTracking: true,\n closeTimeout: CLOSE_TIMEOUT,\n verifyClient: null,\n noServer: false,\n backlog: null, // use default (511 as implemented in net.js)\n server: null,\n host: null,\n path: null,\n port: null,\n WebSocket,\n ...options\n };\n\n if (\n (options.port == null && !options.server && !options.noServer) ||\n (options.port != null && (options.server || options.noServer)) ||\n (options.server && options.noServer)\n ) {\n throw new TypeError(\n 'One and only one of the \"port\", \"server\", or \"noServer\" options ' +\n 'must be specified'\n );\n }\n\n if (options.port != null) {\n this._server = http.createServer((req, res) => {\n const body = http.STATUS_CODES[426];\n\n res.writeHead(426, {\n 'Content-Length': body.length,\n 'Content-Type': 'text/plain'\n });\n res.end(body);\n });\n this._server.listen(\n options.port,\n options.host,\n options.backlog,\n callback\n );\n } else if (options.server) {\n this._server = options.server;\n }\n\n if (this._server) {\n const emitConnection = this.emit.bind(this, 'connection');\n\n this._removeListeners = addListeners(this._server, {\n listening: this.emit.bind(this, 'listening'),\n error: this.emit.bind(this, 'error'),\n upgrade: (req, socket, head) => {\n this.handleUpgrade(req, socket, head, emitConnection);\n }\n });\n }\n\n if (options.perMessageDeflate === true) options.perMessageDeflate = {};\n if (options.clientTracking) {\n this.clients = new Set();\n this._shouldEmitClose = false;\n }\n\n this.options = options;\n this._state = RUNNING;\n }\n\n /**\n * Returns the bound address, the address family name, and port of the server\n * as reported by the operating system if listening on an IP socket.\n * If the server is listening on a pipe or UNIX domain socket, the name is\n * returned as a string.\n *\n * @return {(Object|String|null)} The address of the server\n * @public\n */\n address() {\n if (this.options.noServer) {\n throw new Error('The server is operating in \"noServer\" mode');\n }\n\n if (!this._server) return null;\n return this._server.address();\n }\n\n /**\n * Stop the server from accepting new connections and emit the `'close'` event\n * when all existing connections are closed.\n *\n * @param {Function} [cb] A one-time listener for the `'close'` event\n * @public\n */\n close(cb) {\n if (this._state === CLOSED) {\n if (cb) {\n this.once('close', () => {\n cb(new Error('The server is not running'));\n });\n }\n\n process.nextTick(emitClose, this);\n return;\n }\n\n if (cb) this.once('close', cb);\n\n if (this._state === CLOSING) return;\n this._state = CLOSING;\n\n if (this.options.noServer || this.options.server) {\n if (this._server) {\n this._removeListeners();\n this._removeListeners = this._server = null;\n }\n\n if (this.clients) {\n if (!this.clients.size) {\n process.nextTick(emitClose, this);\n } else {\n this._shouldEmitClose = true;\n }\n } else {\n process.nextTick(emitClose, this);\n }\n } else {\n const server = this._server;\n\n this._removeListeners();\n this._removeListeners = this._server = null;\n\n //\n // The HTTP/S server was created internally. Close it, and rely on its\n // `'close'` event.\n //\n server.close(() => {\n emitClose(this);\n });\n }\n }\n\n /**\n * See if a given request should be handled by this server instance.\n *\n * @param {http.IncomingMessage} req Request object to inspect\n * @return {Boolean} `true` if the request is valid, else `false`\n * @public\n */\n shouldHandle(req) {\n if (this.options.path) {\n const index = req.url.indexOf('?');\n const pathname = index !== -1 ? req.url.slice(0, index) : req.url;\n\n if (pathname !== this.options.path) return false;\n }\n\n return true;\n }\n\n /**\n * Handle a HTTP Upgrade request.\n *\n * @param {http.IncomingMessage} req The request object\n * @param {Duplex} socket The network socket between the server and client\n * @param {Buffer} head The first packet of the upgraded stream\n * @param {Function} cb Callback\n * @public\n */\n handleUpgrade(req, socket, head, cb) {\n socket.on('error', socketOnError);\n\n const key = req.headers['sec-websocket-key'];\n const upgrade = req.headers.upgrade;\n const version = +req.headers['sec-websocket-version'];\n\n if (req.method !== 'GET') {\n const message = 'Invalid HTTP method';\n abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);\n return;\n }\n\n if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') {\n const message = 'Invalid Upgrade header';\n abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);\n return;\n }\n\n if (key === undefined || !keyRegex.test(key)) {\n const message = 'Missing or invalid Sec-WebSocket-Key header';\n abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);\n return;\n }\n\n if (version !== 13 && version !== 8) {\n const message = 'Missing or invalid Sec-WebSocket-Version header';\n abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {\n 'Sec-WebSocket-Version': '13, 8'\n });\n return;\n }\n\n if (!this.shouldHandle(req)) {\n abortHandshake(socket, 400);\n return;\n }\n\n const secWebSocketProtocol = req.headers['sec-websocket-protocol'];\n let protocols = new Set();\n\n if (secWebSocketProtocol !== undefined) {\n try {\n protocols = subprotocol.parse(secWebSocketProtocol);\n } catch (err) {\n const message = 'Invalid Sec-WebSocket-Protocol header';\n abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);\n return;\n }\n }\n\n const secWebSocketExtensions = req.headers['sec-websocket-extensions'];\n const extensions = {};\n\n if (\n this.options.perMessageDeflate &&\n secWebSocketExtensions !== undefined\n ) {\n const perMessageDeflate = new PerMessageDeflate({\n ...this.options.perMessageDeflate,\n isServer: true,\n maxPayload: this.options.maxPayload\n });\n\n try {\n const offers = extension.parse(secWebSocketExtensions);\n\n if (offers[PerMessageDeflate.extensionName]) {\n perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]);\n extensions[PerMessageDeflate.extensionName] = perMessageDeflate;\n }\n } catch (err) {\n const message =\n 'Invalid or unacceptable Sec-WebSocket-Extensions header';\n abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);\n return;\n }\n }\n\n //\n // Optionally call external client verification handler.\n //\n if (this.options.verifyClient) {\n const info = {\n origin:\n req.headers[`${version === 8 ? 'sec-websocket-origin' : 'origin'}`],\n secure: !!(req.socket.authorized || req.socket.encrypted),\n req\n };\n\n if (this.options.verifyClient.length === 2) {\n this.options.verifyClient(info, (verified, code, message, headers) => {\n if (!verified) {\n return abortHandshake(socket, code || 401, message, headers);\n }\n\n this.completeUpgrade(\n extensions,\n key,\n protocols,\n req,\n socket,\n head,\n cb\n );\n });\n return;\n }\n\n if (!this.options.verifyClient(info)) return abortHandshake(socket, 401);\n }\n\n this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);\n }\n\n /**\n * Upgrade the connection to WebSocket.\n *\n * @param {Object} extensions The accepted extensions\n * @param {String} key The value of the `Sec-WebSocket-Key` header\n * @param {Set} protocols The subprotocols\n * @param {http.IncomingMessage} req The request object\n * @param {Duplex} socket The network socket between the server and client\n * @param {Buffer} head The first packet of the upgraded stream\n * @param {Function} cb Callback\n * @throws {Error} If called more than once with the same socket\n * @private\n */\n completeUpgrade(extensions, key, protocols, req, socket, head, cb) {\n //\n // Destroy the socket if the client has already sent a FIN packet.\n //\n if (!socket.readable || !socket.writable) return socket.destroy();\n\n if (socket[kWebSocket]) {\n throw new Error(\n 'server.handleUpgrade() was called more than once with the same ' +\n 'socket, possibly due to a misconfiguration'\n );\n }\n\n if (this._state > RUNNING) return abortHandshake(socket, 503);\n\n const digest = createHash('sha1')\n .update(key + GUID)\n .digest('base64');\n\n const headers = [\n 'HTTP/1.1 101 Switching Protocols',\n 'Upgrade: websocket',\n 'Connection: Upgrade',\n `Sec-WebSocket-Accept: ${digest}`\n ];\n\n const ws = new this.options.WebSocket(null, undefined, this.options);\n\n if (protocols.size) {\n //\n // Optionally call external protocol selection handler.\n //\n const protocol = this.options.handleProtocols\n ? this.options.handleProtocols(protocols, req)\n : protocols.values().next().value;\n\n if (protocol) {\n headers.push(`Sec-WebSocket-Protocol: ${protocol}`);\n ws._protocol = protocol;\n }\n }\n\n if (extensions[PerMessageDeflate.extensionName]) {\n const params = extensions[PerMessageDeflate.extensionName].params;\n const value = extension.format({\n [PerMessageDeflate.extensionName]: [params]\n });\n headers.push(`Sec-WebSocket-Extensions: ${value}`);\n ws._extensions = extensions;\n }\n\n //\n // Allow external modification/inspection of handshake headers.\n //\n this.emit('headers', headers, req);\n\n socket.write(headers.concat('\\r\\n').join('\\r\\n'));\n socket.removeListener('error', socketOnError);\n\n ws.setSocket(socket, head, {\n allowSynchronousEvents: this.options.allowSynchronousEvents,\n maxBufferedChunks: this.options.maxBufferedChunks,\n maxFragments: this.options.maxFragments,\n maxPayload: this.options.maxPayload,\n skipUTF8Validation: this.options.skipUTF8Validation\n });\n\n if (this.clients) {\n this.clients.add(ws);\n ws.on('close', () => {\n this.clients.delete(ws);\n\n if (this._shouldEmitClose && !this.clients.size) {\n process.nextTick(emitClose, this);\n }\n });\n }\n\n cb(ws, req);\n }\n}\n\nmodule.exports = WebSocketServer;\n\n/**\n * Add event listeners on an `EventEmitter` using a map of <event, listener>\n * pairs.\n *\n * @param {EventEmitter} server The event emitter\n * @param {Object.<String, Function>} map The listeners to add\n * @return {Function} A function that will remove the added listeners when\n * called\n * @private\n */\nfunction addListeners(server, map) {\n for (const event of Object.keys(map)) server.on(event, map[event]);\n\n return function removeListeners() {\n for (const event of Object.keys(map)) {\n server.removeListener(event, map[event]);\n }\n };\n}\n\n/**\n * Emit a `'close'` event on an `EventEmitter`.\n *\n * @param {EventEmitter} server The event emitter\n * @private\n */\nfunction emitClose(server) {\n server._state = CLOSED;\n server.emit('close');\n}\n\n/**\n * Handle socket errors.\n *\n * @private\n */\nfunction socketOnError() {\n this.destroy();\n}\n\n/**\n * Close the connection when preconditions are not fulfilled.\n *\n * @param {Duplex} socket The socket of the upgrade request\n * @param {Number} code The HTTP response status code\n * @param {String} [message] The HTTP response body\n * @param {Object} [headers] Additional HTTP response headers\n * @private\n */\nfunction abortHandshake(socket, code, message, headers) {\n //\n // The socket is writable unless the user destroyed or ended it before calling\n // `server.handleUpgrade()` or in the `verifyClient` function, which is a user\n // error. Handling this does not make much sense as the worst that can happen\n // is that some of the data written by the user might be discarded due to the\n // call to `socket.end()` below, which triggers an `'error'` event that in\n // turn causes the socket to be destroyed.\n //\n message = message || http.STATUS_CODES[code];\n headers = {\n Connection: 'close',\n 'Content-Type': 'text/html',\n 'Content-Length': Buffer.byteLength(message),\n ...headers\n };\n\n socket.once('finish', socket.destroy);\n\n socket.end(\n `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\\r\\n` +\n Object.keys(headers)\n .map((h) => `${h}: ${headers[h]}`)\n .join('\\r\\n') +\n '\\r\\n\\r\\n' +\n message\n );\n}\n\n/**\n * Emit a `'wsClientError'` event on a `WebSocketServer` if there is at least\n * one listener for it, otherwise call `abortHandshake()`.\n *\n * @param {WebSocketServer} server The WebSocket server\n * @param {http.IncomingMessage} req The request object\n * @param {Duplex} socket The socket of the upgrade request\n * @param {Number} code The HTTP response status code\n * @param {String} message The HTTP response body\n * @param {Object} [headers] The HTTP response headers\n * @private\n */\nfunction abortHandshakeOrEmitwsClientError(\n server,\n req,\n socket,\n code,\n message,\n headers\n) {\n if (server.listenerCount('wsClientError')) {\n const err = new Error(message);\n Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);\n\n server.emit('wsClientError', err, socket, req);\n } else {\n abortHandshake(socket, code, message, headers);\n }\n}\n","import createWebSocketStream from './lib/stream.js';\nimport extension from './lib/extension.js';\nimport PerMessageDeflate from './lib/permessage-deflate.js';\nimport Receiver from './lib/receiver.js';\nimport Sender from './lib/sender.js';\nimport subprotocol from './lib/subprotocol.js';\nimport WebSocket from './lib/websocket.js';\nimport WebSocketServer from './lib/websocket-server.js';\n\nexport {\n createWebSocketStream,\n extension,\n PerMessageDeflate,\n Receiver,\n Sender,\n subprotocol,\n WebSocket,\n WebSocketServer\n};\n\nexport default WebSocket;\n","/**\n * Node.js socket constructors and layers for Effect sockets.\n *\n * This module re-exports the shared Node socket support for TCP connections,\n * Unix domain socket connections, and Node `Duplex` streams. It also provides\n * WebSocket constructor layers: one that uses `globalThis.WebSocket` when\n * present and falls back to `ws`, one that always uses `ws`, and one that\n * creates a `Socket.Socket` layer for a WebSocket URL.\n *\n * @since 4.0.0\n */\nimport { NodeWS as WS } from \"@effect/platform-node-shared/NodeSocket\";\nimport { flow } from \"effect/Function\";\nimport * as Layer from \"effect/Layer\";\nimport * as Socket from \"effect/unstable/socket/Socket\";\n/**\n * @since 4.0.0\n */\nexport * from \"@effect/platform-node-shared/NodeSocket\";\n/**\n * Provides a `Socket.WebSocketConstructor`, using `globalThis.WebSocket` when\n * available and falling back to the `ws` package otherwise.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWebSocketConstructor = /*#__PURE__*/Layer.sync(Socket.WebSocketConstructor)(() => {\n if (\"WebSocket\" in globalThis) {\n return (url, protocols) => new globalThis.WebSocket(url, protocols);\n }\n return (url, protocols) => new WS.WebSocket(url, protocols);\n});\n/**\n * Provides a `Socket.WebSocketConstructor` backed explicitly by the `ws`\n * package.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWebSocketConstructorWS = /*#__PURE__*/Layer.succeed(Socket.WebSocketConstructor)((url, protocols) => new WS.WebSocket(url, protocols));\n/**\n * Creates a `Socket.Socket` layer for a WebSocket URL using the Node WebSocket\n * constructor layer, honoring protocol, open-timeout, and close-code error\n * options.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWebSocket = /*#__PURE__*/flow(Socket.makeWebSocket, /*#__PURE__*/Layer.effect(Socket.Socket), /*#__PURE__*/Layer.provide(layerWebSocketConstructor));\n//# sourceMappingURL=NodeSocket.js.map"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,MAAmB,mBAAK,IAAI,MAAM,MAAM,SAAS,KAAA,IAAY,KAAA,IAAY,EAAE,IAAI,CAAC;;;;;;;;;;;;;;;;;;;ACZ7F,MAAa,WAAU,WAAU,WAAW,SAAS,WAAW,UAAU,WAAW,aAAa,WAAW;;;;;;;;;;;;;AAyB7G,MAAa,WAAW;CAAC,CAAC,OAAO,KAAK;CAAG,CAAC,QAAQ,MAAM;CAAG,CAAC,OAAO,KAAK;CAAG,CAAC,UAAU,KAAK;CAAG,CAAC,SAAS,OAAO;CAAG,CAAC,QAAQ,MAAM;CAAG,CAAC,WAAW,SAAS;CAAG,CAAC,SAAS,OAAO;AAAC;;;;;;;;;;;;;ACjB9K,MAAMA,YAAS;;;;;;;AAOf,MAAa,eAAc,MAAK,YAAY,GAAGA,SAAM;AACrD,MAAMC,UAAQ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