{"version":3,"file":"NodeServices-bbWjF5St.mjs","names":["TypeId","make","Effect.withFiber","Context.get","Scope.Scope","Duration.fromInputUnsafe","Effect.as","Scope.addFinalizerExit","close","Scope.close","Exit.void","Effect.void","Effect.uninterruptibleMask","Effect.interrupt","Fiber.interrupt","Effect.succeed","Scope.makeUnsafe","Effect.suspend","Effect.provideContext","Context.add","Effect.map","Effect.onExit","Exit.isFailure","get","scope","Effect.scope","isFinite","Duration.isFinite","Effect.sleep","Effect.flatMap","Effect.ensuring","Effect.sync","Effect.runForkWith","Fiber.runIn","make","internal.make","internal.get","Option.some","Result.succeed","Inspectable.BaseProto","make","Effect.map","Stream.decodeText","Stream.unwrap","Stream.splitLines","Effect.scoped","Effect.flatMap","Stream.runCollect","Stream.mkString","Context.Service","TypeId","Context.getUnsafe","make","PlatformError.systemError","Sink.fromChannel","Channel.mapDone","Channel.fromTransform","Effect.succeed","Effect.flatMap","Effect.callback","Effect.void","Effect.forever","Effect.raceFirst","Effect.fail","Effect.sync","Pull.catchDone","Cause.done","Stream.fromChannel","Channel.fromTransform","MutableRef.make","Effect.catchCause","Pull.isDoneCause","Effect.void","Exit.failCause","Effect.forkIn","Effect.flatMap","Stream.pipeThroughChannelOrFail","Effect.callback","Effect.fail","Effect.succeed","Effect.sync","Effect.map","Latch.makeUnsafe","Exit.fail","Cause.Done","Effect.suspend","Arr.of","Effect.as","Scope.addFinalizer","Cause.UnknownError","make","FileSystem.FileSystem","Path.Path","Effect.fnUntraced","Predicate.isUndefined","Stream.isStream","Sink.isSink","ChildProcess.parseFdName","Predicate.isNotUndefined","Sink.drain","Stream.empty","NodeSink.fromWritable","Effect.forkScoped","Stream.run","NodeStream.fromReadable","Stream.transduce","Effect.suspend","Predicate.isNotNull","Effect.as","Effect.succeed","Stream.merge","Effect.callback","Deferred.makeUnsafe","Effect.fail","Exit.succeed","Effect.sync","Effect.void","Effect.try","Effect.timeoutOrElse","Effect.acquireRelease","Deferred.isDone","Deferred.await","Effect.ignore","Effect.catch","Effect.andThen","Effect.map","Effect.flatMap","Effect.asVoid","Stream.unwrap","ChildProcess.make","fdName","ChildProcess.fdName","Effect.forEach","Effect.gen","makeSpawner","layer","TypeId","make","Effect.map","Effect.sync","Uuid.v4String","Effect.clockWith","Effect.succeed","Uuid.v7String","Effect.fail","PlatformError.badArgument","Effect.try","PlatformError.systemError","make","layer","EffectCrypto.Crypto","layer","NodeCrypto.layer","Error.badArgument","Effect.suspend","Effect.acquireRelease","Effect.orDie","Effect.map","FileSystem.FileTypeId","FileSystem.Size","Effect.sync","Option.none","Option.some","Effect.flatMap","Effect.fail","Error.systemError","Effect.void","Effect.fnUntraced","Crypto","Effect.tryPromise","Effect.callback","Effect.succeed","Option.fromNullishOr","Stream.callback","Effect.matchEffect","Queue.offer","Cause.fail","Option.flatMap","Option.getOrElse","Stream.unwrap","FileSystem.WatchBackend","FileSystem.make","layer","FileSystem.FileSystem","layer","NodeFileSystem.layer","Effect.try","Path","TypeId","NodePath","layer","layer","NodePath.layer","TypeId","make","Effect.succeed","layer","Stdio.Stdio","layer","NodeStdio.layer","Schema.Error","Predicate.hasProperty","make","Queue.make","Effect.addFinalizer","Effect.sync","RcRef.make","Effect.acquireRelease","Queue.offerUnsafe","Effect.gen","Option.fromUndefinedOr","RcRef.get","Effect.suspend","Queue.poll","Effect.flatMap","Option.match","Effect.scoped","Effect.andThen","Queue.take","Effect.succeed","Effect.mapError","Terminal.QuitError","Effect.uninterruptible","Effect.callback","Predicate.isNullish","Effect.void","Effect.fail","Terminal.make","layer","Terminal.Terminal","layer","NodeTerminal.layer","NodeChildProcessSpawner.layer","NodeFileSystem.layer","NodeCrypto.layer","NodePath.layer","NodeStdio.layer","NodeTerminal.layer"],"sources":["../../../node_modules/.pnpm/effect@4.0.0-rc.112_patch_hash=8bef799f35729cf3465eb428196f617b434a7c9f658d56acb2874d74b21b98b2/node_modules/effect/dist/internal/rcRef.js","../../../node_modules/.pnpm/effect@4.0.0-rc.112_patch_hash=8bef799f35729cf3465eb428196f617b434a7c9f658d56acb2874d74b21b98b2/node_modules/effect/dist/RcRef.js","../../../node_modules/.pnpm/effect@4.0.0-rc.112_patch_hash=8bef799f35729cf3465eb428196f617b434a7c9f658d56acb2874d74b21b98b2/node_modules/effect/dist/Brand.js","../../../node_modules/.pnpm/effect@4.0.0-rc.112_patch_hash=8bef799f35729cf3465eb428196f617b434a7c9f658d56acb2874d74b21b98b2/node_modules/effect/dist/unstable/process/ChildProcessSpawner.js","../../../node_modules/.pnpm/effect@4.0.0-rc.112_patch_hash=8bef799f35729cf3465eb428196f617b434a7c9f658d56acb2874d74b21b98b2/node_modules/effect/dist/unstable/process/ChildProcess.js","../../../node_modules/.pnpm/@effect+platform-node-shared@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_ha_f227416e91d9f18a76e702826cc2a463/node_modules/@effect/platform-node-shared/dist/internal/nodeChildProcessSpawner.js","../../../node_modules/.pnpm/@effect+platform-node-shared@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_ha_f227416e91d9f18a76e702826cc2a463/node_modules/@effect/platform-node-shared/dist/internal/utils.js","../../../node_modules/.pnpm/@effect+platform-node-shared@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_ha_f227416e91d9f18a76e702826cc2a463/node_modules/@effect/platform-node-shared/dist/NodeSink.js","../../../node_modules/.pnpm/@effect+platform-node-shared@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_ha_f227416e91d9f18a76e702826cc2a463/node_modules/@effect/platform-node-shared/dist/NodeStream.js","../../../node_modules/.pnpm/@effect+platform-node-shared@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_ha_f227416e91d9f18a76e702826cc2a463/node_modules/@effect/platform-node-shared/dist/NodeChildProcessSpawner.js","../../../node_modules/.pnpm/effect@4.0.0-rc.112_patch_hash=8bef799f35729cf3465eb428196f617b434a7c9f658d56acb2874d74b21b98b2/node_modules/effect/dist/internal/uuid.js","../../../node_modules/.pnpm/effect@4.0.0-rc.112_patch_hash=8bef799f35729cf3465eb428196f617b434a7c9f658d56acb2874d74b21b98b2/node_modules/effect/dist/Crypto.js","../../../node_modules/.pnpm/@effect+platform-node-shared@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_ha_f227416e91d9f18a76e702826cc2a463/node_modules/@effect/platform-node-shared/dist/NodeCrypto.js","../../../node_modules/.pnpm/@effect+platform-node@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_hash=8bef_a93cb720d6f1314c840b9fbc1f646c0d/node_modules/@effect/platform-node/dist/NodeCrypto.js","../../../node_modules/.pnpm/@effect+platform-node-shared@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_ha_f227416e91d9f18a76e702826cc2a463/node_modules/@effect/platform-node-shared/dist/NodeFileSystem.js","../../../node_modules/.pnpm/@effect+platform-node@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_hash=8bef_a93cb720d6f1314c840b9fbc1f646c0d/node_modules/@effect/platform-node/dist/NodeFileSystem.js","../../../node_modules/.pnpm/@effect+platform-node-shared@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_ha_f227416e91d9f18a76e702826cc2a463/node_modules/@effect/platform-node-shared/dist/NodePath.js","../../../node_modules/.pnpm/@effect+platform-node@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_hash=8bef_a93cb720d6f1314c840b9fbc1f646c0d/node_modules/@effect/platform-node/dist/NodePath.js","../../../node_modules/.pnpm/effect@4.0.0-rc.112_patch_hash=8bef799f35729cf3465eb428196f617b434a7c9f658d56acb2874d74b21b98b2/node_modules/effect/dist/Stdio.js","../../../node_modules/.pnpm/@effect+platform-node-shared@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_ha_f227416e91d9f18a76e702826cc2a463/node_modules/@effect/platform-node-shared/dist/NodeStdio.js","../../../node_modules/.pnpm/@effect+platform-node@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_hash=8bef_a93cb720d6f1314c840b9fbc1f646c0d/node_modules/@effect/platform-node/dist/NodeStdio.js","../../../node_modules/.pnpm/effect@4.0.0-rc.112_patch_hash=8bef799f35729cf3465eb428196f617b434a7c9f658d56acb2874d74b21b98b2/node_modules/effect/dist/Terminal.js","../../../node_modules/.pnpm/@effect+platform-node-shared@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_ha_f227416e91d9f18a76e702826cc2a463/node_modules/@effect/platform-node-shared/dist/NodeTerminal.js","../../../node_modules/.pnpm/@effect+platform-node@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_hash=8bef_a93cb720d6f1314c840b9fbc1f646c0d/node_modules/@effect/platform-node/dist/NodeTerminal.js","../../../node_modules/.pnpm/@effect+platform-node@4.0.0-rc.112_bufferutil@4.1.0_effect@4.0.0-rc.112_patch_hash=8bef_a93cb720d6f1314c840b9fbc1f646c0d/node_modules/@effect/platform-node/dist/NodeServices.js"],"sourcesContent":["import * as Context from \"../Context.js\";\nimport * as Duration from \"../Duration.js\";\nimport * as Effect from \"../Effect.js\";\nimport * as Exit from \"../Exit.js\";\nimport * as Fiber from \"../Fiber.js\";\nimport { identity } from \"../Function.js\";\nimport { pipeArguments } from \"../Pipeable.js\";\nimport * as Scope from \"../Scope.js\";\nimport * as Semaphore from \"../Semaphore.js\";\nconst TypeId = \"~effect/RcRef\";\nconst stateEmpty = {\n  _tag: \"Empty\"\n};\nconst stateClosed = {\n  _tag: \"Closed\"\n};\nconst variance = {\n  _A: identity,\n  _E: identity\n};\nclass RcRefImpl {\n  [TypeId] = variance;\n  pipe() {\n    return pipeArguments(this, arguments);\n  }\n  state = stateEmpty;\n  semaphore = /*#__PURE__*/Semaphore.makeUnsafe(1);\n  acquire;\n  context;\n  scope;\n  idleTimeToLive;\n  constructor(acquire, context, scope, idleTimeToLive) {\n    this.acquire = acquire;\n    this.context = context;\n    this.scope = scope;\n    this.idleTimeToLive = idleTimeToLive;\n  }\n}\n/** @internal */\nexport const make = options => Effect.withFiber(fiber => {\n  const context = fiber.context;\n  const scope = Context.get(context, Scope.Scope);\n  const ref = new RcRefImpl(options.acquire, context, scope, options.idleTimeToLive ? Duration.fromInputUnsafe(options.idleTimeToLive) : undefined);\n  return Effect.as(Scope.addFinalizerExit(scope, () => {\n    const close = ref.state._tag === \"Acquired\" ? Scope.close(ref.state.scope, Exit.void) : Effect.void;\n    ref.state = stateClosed;\n    return close;\n  }), ref);\n});\nconst getState = self => Effect.uninterruptibleMask(function loop(restore) {\n  switch (self.state._tag) {\n    case \"Closed\":\n      {\n        return Effect.interrupt;\n      }\n    case \"Acquired\":\n      {\n        self.state.refCount++;\n        return self.state.fiber ? Effect.as(Fiber.interrupt(self.state.fiber), self.state) : Effect.succeed(self.state);\n      }\n    case \"Empty\":\n      {\n        const scope = Scope.makeUnsafe();\n        return self.semaphore.withPermit(Effect.suspend(() => {\n          if (self.state._tag !== \"Empty\") {\n            return loop(restore);\n          }\n          return restore(Effect.provideContext(self.acquire, Context.add(self.context, Scope.Scope, scope))).pipe(Effect.map(value => {\n            const state = {\n              _tag: \"Acquired\",\n              value,\n              scope,\n              fiber: undefined,\n              refCount: 1,\n              invalidated: false\n            };\n            self.state = state;\n            return state;\n          }), Effect.onExit(exit => Exit.isFailure(exit) ? Scope.close(scope, exit) : Effect.void));\n        }));\n      }\n  }\n});\n/** @internal */\nexport const get = /*#__PURE__*/Effect.fnUntraced(function* (self_) {\n  const self = self_;\n  const state = yield* getState(self);\n  const scope = yield* Effect.scope;\n  const isFinite = self.idleTimeToLive !== undefined && Duration.isFinite(self.idleTimeToLive);\n  yield* Scope.addFinalizerExit(scope, () => {\n    state.refCount--;\n    if (state.refCount > 0) {\n      return Effect.void;\n    }\n    if (self.idleTimeToLive === undefined) {\n      self.state = stateEmpty;\n      return Scope.close(state.scope, Exit.void);\n    } else if (state.invalidated) {\n      return Scope.close(state.scope, Exit.void);\n    } else if (!isFinite) {\n      return Effect.void;\n    }\n    state.fiber = Effect.sleep(self.idleTimeToLive).pipe(Effect.flatMap(() => {\n      if (self.state._tag === \"Acquired\" && self.state.refCount === 0) {\n        self.state = stateEmpty;\n        return Scope.close(state.scope, Exit.void);\n      }\n      return Effect.void;\n    }), Effect.ensuring(Effect.sync(() => {\n      state.fiber = undefined;\n    })), Effect.runForkWith(self.context), Fiber.runIn(self.scope));\n    return Effect.void;\n  });\n  return state.value;\n});\n/** @internal */\nexport const invalidate = self_ => {\n  const self = self_;\n  return Effect.uninterruptible(Effect.suspend(() => {\n    if (self.state._tag !== \"Acquired\") {\n      return Effect.void;\n    }\n    const state = self.state;\n    self.state = stateEmpty;\n    state.invalidated = true;\n    if (state.refCount > 0) {\n      return Effect.void;\n    }\n    state.fiber?.interruptUnsafe();\n    return Scope.close(state.scope, Exit.void);\n  }));\n};\n//# sourceMappingURL=rcRef.js.map","import * as internal from \"./internal/rcRef.js\";\nconst TypeId = \"~effect/RcRef\";\n/**\n * Creates an `RcRef` from an acquire effect.\n *\n * **When to use**\n *\n * Use to create a lazily acquired, reference-counted resource from an acquire\n * effect.\n *\n * **Details**\n *\n * The resource is acquired lazily on the first `get` and shared by subsequent\n * gets while it remains cached. Each `get` adds a reference to the current\n * `Scope`. When the last reference is released, the resource is closed\n * immediately by default, or after `idleTimeToLive` when that option is\n * provided.\n *\n * **Example** (Creating a reference-counted resource)\n *\n * ```ts import.meta.vitest\n * import { Effect, RcRef } from \"effect\"\n *\n * const events: Array<string> = []\n *\n * const program = Effect.gen(function*() {\n *   const ref = yield* RcRef.make({\n *     acquire: Effect.acquireRelease(\n *       Effect.succeed(\"foo\"),\n *       () => Effect.sync(() => events.push(\"released foo\"))\n *     )\n *   })\n *\n *   // will only acquire the resource once, and release it\n *   // when the scope is closed\n *   yield* RcRef.get(ref).pipe(\n *     Effect.andThen(RcRef.get(ref)),\n *     Effect.scoped\n *   )\n * })\n *\n * await Effect.runPromise(Effect.scoped(program))\n * events // => [\"released foo\"]\n * ```\n *\n * @category constructors\n * @since 3.5.0\n */\nexport const make = internal.make;\n/**\n * Gets the value from an `RcRef`, acquiring it first if needed.\n *\n * **When to use**\n *\n * Use to borrow the current resource within a `Scope`, acquiring it first if\n * necessary.\n *\n * **Details**\n *\n * The reference count is incremented for the current `Scope`, and a release\n * finalizer is added to that scope. When the current scope closes, the\n * reference is released; the resource is closed when the final reference is\n * released, subject to any configured idle time-to-live.\n *\n * **Example** (Sharing one acquired value)\n *\n * ```ts import.meta.vitest\n * import { Effect, RcRef } from \"effect\"\n *\n * const events: Array<string> = []\n *\n * const program = Effect.gen(function*() {\n *   // Create an RcRef with a resource\n *   const ref = yield* RcRef.make({\n *     acquire: Effect.acquireRelease(\n *       Effect.succeed(\"shared resource\"),\n *       (resource) => Effect.sync(() => events.push(`released ${resource}`))\n *     )\n *   })\n *\n *   // Get the value from the RcRef\n *   const value1 = yield* RcRef.get(ref)\n *   const value2 = yield* RcRef.get(ref)\n *\n *   return [value1 === value2, events] as const\n * })\n *\n * await Effect.runPromise(Effect.scoped(program)) // => [true, [\"released shared resource\"]]\n * ```\n *\n * @category combinators\n * @since 3.5.0\n */\nexport const get = internal.get;\n/**\n * Invalidates the currently cached resource, if one has been acquired.\n *\n * **When to use**\n *\n * Use to force future `RcRef.get` calls to acquire a fresh resource when the\n * currently cached resource should no longer be reused.\n *\n * **Details**\n *\n * After invalidation, the next `get` acquires a fresh resource.\n *\n * **Gotchas**\n *\n * Invalidation does not revoke resources already borrowed by active scopes;\n * those remain usable until their scopes close.\n *\n * @see {@link get} for acquiring the current cached resource or the fresh resource after invalidation\n *\n * @category combinators\n * @since 3.19.6\n */\nexport const invalidate = internal.invalidate;\n//# sourceMappingURL=RcRef.js.map","/**\n * The `Brand` module adds compile-time names to ordinary TypeScript values so\n * structurally identical values cannot be mixed accidentally. A branded value\n * has the same runtime representation as its unbranded value; the extra\n * information lives in the type system unless you choose a validating\n * constructor.\n *\n * @since 2.0.0\n */\nimport * as Arr from \"./Array.js\";\nimport * as Option from \"./Option.js\";\nimport * as Result from \"./Result.js\";\nimport * as SchemaAST from \"./SchemaAST.js\";\nimport * as SchemaIssue from \"./SchemaIssue.js\";\nconst TypeId = \"~effect/Brand\";\n/**\n * Error returned when a branded type is constructed from an invalid value.\n *\n * **Details**\n *\n * The error wraps a `SchemaIssue.Issue`, renders `message` with the default\n * schema issue formatter, and formats as `BrandError(<message>)`.\n *\n * **Gotchas**\n *\n * `BrandError` is an error-like model with `_tag`, `name`, `message`, and\n * `toString`; it does not extend JavaScript `Error`.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class BrandError {\n  constructor(issue) {\n    this.issue = issue;\n  }\n  /**\n   * Discriminant used to identify brand construction failures.\n   *\n   * @since 4.0.0\n   */\n  _tag = \"BrandError\";\n  /**\n   * Error name used by tools that inspect JavaScript error-like objects.\n   *\n   * @since 4.0.0\n   */\n  name = \"BrandError\";\n  /**\n   * Schema issue describing why brand validation failed.\n   *\n   * @since 4.0.0\n   */\n  issue;\n  /**\n   * Human-readable rendering of the validation issue.\n   *\n   * @since 4.0.0\n   */\n  get message() {\n    return SchemaIssue.defaultFormatter(this.issue);\n  }\n  /**\n   * Formats the brand error together with its validation message.\n   *\n   * @since 4.0.0\n   */\n  toString() {\n    return `BrandError(${this.message})`;\n  }\n}\n/**\n * Returns a `Constructor` that **does not apply any runtime checks** and just\n * returns the provided value.\n *\n * **When to use**\n *\n * Use to create nominal types that allow distinguishing between two values\n * of the same type but with different meanings.\n *\n * @see {@link make} for constructing branded values with validation.\n * @see {@link check} for constructing branded values from schema checks.\n *\n * @category constructors\n * @since 2.0.0\n */\nexport function nominal() {\n  return Object.assign(input => input, {\n    option: input => Option.some(input),\n    result: input => Result.succeed(input),\n    is: _ => true\n  });\n}\n/**\n * Returns a `Constructor` that can construct a branded type from an unbranded\n * value using the provided `filter` predicate as validation of the input data.\n *\n * **When to use**\n *\n * Use when you want validation while constructing the branded type.\n *\n * @see {@link nominal} for a brand constructor that performs no validation.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function make(filter) {\n  return check(SchemaAST.makeFilter(filter));\n}\n/**\n * Creates a branded type `Constructor` from one or more schema checks.\n *\n * **When to use**\n *\n * Use when you need a branded type constructor that performs runtime validation\n * via schema checks.\n *\n * **Details**\n *\n * Calling the returned constructor validates the unbranded value and throws on\n * failure. Use the returned `option`, `result`, or `is` methods for\n * non-throwing validation.\n *\n * @see {@link nominal} for a brand constructor without runtime validation\n * @see {@link all} for combining multiple brand constructors\n * @category constructors\n * @since 4.0.0\n */\nexport function check(...checks) {\n  const result = input => {\n    return Result.mapError(SchemaAST.runChecks(checks, input), issue => new BrandError(issue));\n  };\n  return Object.assign(input => Result.getOrThrow(result(input)), {\n    option: input => Option.getSuccess(result(input)),\n    result,\n    is: input => Result.isSuccess(result(input)),\n    checks\n  });\n}\n/**\n * Combines one or more brand constructors to form a single branded type.\n *\n * **When to use**\n *\n * Use to require an input to satisfy every runtime check collected by the\n * provided brand constructors.\n *\n * **Details**\n *\n * If the provided constructors contain runtime checks, the combined\n * constructor succeeds only when all checks pass. If no runtime checks are\n * present, it behaves as a nominal constructor.\n *\n * @category combining\n * @since 2.0.0\n */\nexport function all(...brands) {\n  const checks = brands.flatMap(brand => brand.checks ?? []);\n  return Arr.isArrayNonEmpty(checks) ? check(...checks) : nominal();\n}\n//# sourceMappingURL=Brand.js.map","/**\n * Service boundary for starting and controlling child processes.\n *\n * `ChildProcessSpawner` is the service used by `ChildProcess` commands to start\n * operating-system processes. A spawner turns a command description into a\n * handle that can write to stdin, read stdout and stderr, wait for exit, kill\n * the process, and manage whether the process keeps its parent alive. Platform\n * backends implement this service, while most application code uses the higher\n * level `ChildProcess` module.\n *\n * @since 4.0.0\n */\nimport * as Brand from \"../../Brand.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Stream from \"../../Stream.js\";\n/**\n * Constructs branded child process `ExitCode` values.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const ExitCode = /*#__PURE__*/Brand.nominal();\n/**\n * Constructs branded child process `ProcessId` values.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const ProcessId = /*#__PURE__*/Brand.nominal();\nconst HandleTypeId = \"~effect/ChildProcessSpawner/ChildProcessHandle\";\nconst HandleProto = {\n  [HandleTypeId]: HandleTypeId,\n  ...Inspectable.BaseProto,\n  toJSON() {\n    return {\n      _id: \"ChildProcessHandle\",\n      pid: this.pid\n    };\n  }\n};\n/**\n * Constructs a new `ChildProcessHandle`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeHandle = params => Object.setPrototypeOf({\n  ...params\n}, HandleProto);\n/**\n * Creates a `ChildProcessSpawner` service from a `spawn` function, deriving\n * helpers for exit codes and output collection from that implementation.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = spawn => {\n  const streamString = (command, options) => spawn(command).pipe(Effect.map(handle => Stream.decodeText(options?.includeStderr === true ? handle.all : handle.stdout)), Stream.unwrap);\n  const streamLines = (command, options) => Stream.splitLines(streamString(command, options));\n  return ChildProcessSpawner.of({\n    spawn,\n    exitCode: command => Effect.scoped(Effect.flatMap(spawn(command), handle => handle.exitCode)),\n    streamString,\n    streamLines,\n    lines: (command, options) => Stream.runCollect(streamLines(command, options)),\n    string: (command, options) => Stream.mkString(streamString(command, options))\n  });\n};\n/**\n * Service tag for child process spawning.\n *\n * @category services\n * @since 4.0.0\n */\nexport class ChildProcessSpawner extends /*#__PURE__*/Context.Service()(\"effect/process/ChildProcessSpawner\") {}\n//# sourceMappingURL=ChildProcessSpawner.js.map","/**\n * Describes child processes before they are started.\n *\n * A `Command` stores the executable, arguments, environment, standard streams,\n * working directory, and other process options. Commands can also be piped\n * together. A command is an `Effect`; running it asks the\n * `ChildProcessSpawner` service to start the process and returns a\n * `ChildProcessHandle`.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effectable from \"../../Effectable.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport { ChildProcessSpawner } from \"./ChildProcessSpawner.js\";\nconst TypeId = \"~effect/unstable/process/ChildProcess\";\n// =============================================================================\n// Constructors\n// =============================================================================\nconst Proto = {\n  ... /*#__PURE__*/Effectable.Prototype({\n    label: \"Command\",\n    evaluate(fiber) {\n      return Context.getUnsafe(fiber.context, ChildProcessSpawner).spawn(this);\n    }\n  }),\n  [TypeId]: TypeId\n};\n/**\n * Checks whether a value is a `Command`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isCommand = u => Predicate.hasProperty(u, TypeId);\n/**\n * Checks whether a command is a `StandardCommand`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isStandardCommand = command => command._tag === \"StandardCommand\";\n/**\n * Checks whether a command is a `PipedCommand`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isPipedCommand = command => command._tag === \"PipedCommand\";\nconst makeStandardCommand = (command, args, options) => Object.assign(Object.create(Proto), {\n  _tag: \"StandardCommand\",\n  command,\n  args,\n  options\n});\nconst makePipedCommand = (left, right, options = {}) => Object.assign(Object.create(Proto), {\n  _tag: \"PipedCommand\",\n  left,\n  right,\n  options\n});\n/**\n * Create a command from a template literal, options + template, or array form.\n *\n * **Details**\n *\n * This function supports three calling conventions:\n * 1. Template literal: `make\\`npm run build\\``\n * 2. Options + template literal: `make({ cwd: \"/app\" })\\`npm run build\\``\n * 3. Array form: `make(\"npm\", [\"run\", \"build\"], options?)`\n *\n * Template literals are not parsed until execution time, allowing parsing\n * errors to flow through Effect's error channel.\n *\n * **Example** (Creating commands)\n *\n * ```ts import.meta.vitest\n * import { ChildProcess } from \"effect/unstable/process\"\n *\n * // Template literal form\n * const cmd1 = ChildProcess.make`echo \"hello\"`\n *\n * // With options\n * const cmd2 = ChildProcess.make({ cwd: \"/tmp\" })`ls -la`\n *\n * // Array form\n * const cmd3 = ChildProcess.make(\"git\", [\"status\"])\n *\n * const result = [cmd1.command, cmd2.options.cwd, cmd3.args[0]] // => [\"echo\", \"/tmp\", \"status\"]\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = function make(...args) {\n  // Template literal form: make`command`\n  if (isTemplateString(args[0])) {\n    const [templates, ...expressions] = args;\n    const tokens = parseTemplates(templates, expressions);\n    return makeStandardCommand(tokens[0] ?? \"\", tokens.slice(1), {});\n  }\n  // Options form: make({ cwd: \"/tmp\" })`command`\n  if (typeof args[0] === \"object\" && !Array.isArray(args[0]) && !isTemplateString(args[0])) {\n    const options = args[0];\n    return function (templates, ...expressions) {\n      const tokens = parseTemplates(templates, expressions);\n      return makeStandardCommand(tokens[0] ?? \"\", tokens.slice(1), options);\n    };\n  }\n  // Standard form without arguments: make(\"command\", options?)\n  if (typeof args[0] === \"string\" && !Array.isArray(args[1])) {\n    const [command, options = {}] = args;\n    return makeStandardCommand(command, [], options);\n  }\n  // Standard form with arguments: make(\"command\", [\"arg1\", \"arg2\"], options?)\n  const [command, cmdArgs = [], options = {}] = args;\n  return makeStandardCommand(command, cmdArgs, options);\n};\n/**\n * Pipes the output of one command to the input of another.\n *\n * **Details**\n *\n * By default, pipes `stdout` from the source to `stdin` of the destination.\n * Use the `options` parameter to customize which streams are connected.\n *\n * **Example** (Piping command output)\n *\n * ```ts import.meta.vitest\n * import { ChildProcess } from \"effect/unstable/process\"\n *\n * // Pipe stdout (default)\n * const pipeline1 = ChildProcess.make`cat file.txt`.pipe(\n *   ChildProcess.pipeTo(ChildProcess.make`grep pattern`)\n * )\n *\n * // Pipe stderr instead of stdout\n * const pipeline2 = ChildProcess.make`my-program`.pipe(\n *   ChildProcess.pipeTo(ChildProcess.make`grep error`, { from: \"stderr\" })\n * )\n *\n * // Pipe combined stdout and stderr\n * const pipeline3 = ChildProcess.make`my-program`.pipe(\n *   ChildProcess.pipeTo(ChildProcess.make`tee output.log`, { from: \"all\" })\n * )\n *\n * const result = [pipeline1._tag, pipeline2.options.from, pipeline3.options.from]\n * result // => [\"PipedCommand\", \"stderr\", \"all\"]\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const pipeTo = /*#__PURE__*/dual(args => isCommand(args[0]) && isCommand(args[1]), (self, that, options) => makePipedCommand(self, that, options ?? {}));\n/**\n * Prepends another command to a command.\n *\n * **Details**\n *\n * For pipelines, only the leftmost command is prefixed.\n *\n * **Example** (Prefixing commands)\n *\n * ```ts import.meta.vitest\n * import { ChildProcess } from \"effect/unstable/process\"\n *\n * const command = ChildProcess.make`echo \"foo\"`\n *\n * const prefixed = command.pipe(\n *   ChildProcess.prefix`time`\n * )\n *\n * // now prefixed will execute `time echo \"foo\"`\n * const result = prefixed._tag === \"StandardCommand\" ? `${prefixed.command} ${prefixed.args[0]}` : prefixed._tag\n * result // => \"time echo\"\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const prefix = function prefix(...args) {\n  if (isCommand(args[0]) && args.length > 1) {\n    const [self, ...rest] = args;\n    const prefixSpec = parsePrefixArgs(rest);\n    return applyPrefix(self, prefixSpec);\n  }\n  const prefixSpec = parsePrefixArgs(args);\n  return self => applyPrefix(self, prefixSpec);\n};\nconst parsePrefixArgs = args => {\n  if (isTemplateString(args[0])) {\n    const [templates, ...expressions] = args;\n    const tokens = parseTemplates(templates, expressions);\n    return {\n      command: tokens[0] ?? \"\",\n      args: tokens.slice(1)\n    };\n  }\n  const [command, cmdArgs = []] = args;\n  return {\n    command,\n    args: cmdArgs\n  };\n};\nconst applyPrefix = (self, prefixSpec) => {\n  switch (self._tag) {\n    case \"StandardCommand\":\n      {\n        return makeStandardCommand(prefixSpec.command, [...prefixSpec.args, self.command, ...self.args], self.options);\n      }\n    case \"PipedCommand\":\n      {\n        return makePipedCommand(applyPrefix(self.left, prefixSpec), self.right, self.options);\n      }\n  }\n};\n/**\n * Sets the current working directory for a command.\n *\n * **Details**\n *\n * For pipelines, applies to each command in the pipeline.\n *\n * **Example** (Setting command working directories)\n *\n * ```ts import.meta.vitest\n * import { ChildProcess } from \"effect/unstable/process\"\n *\n * const cmd = ChildProcess.make`ls -la`.pipe(\n *   ChildProcess.setCwd(\"/tmp\")\n * )\n * const result = cmd._tag === \"StandardCommand\" && cmd.options.cwd // => \"/tmp\"\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCwd = /*#__PURE__*/dual(2, (self, cwd) => {\n  switch (self._tag) {\n    case \"StandardCommand\":\n      {\n        return makeStandardCommand(self.command, self.args, {\n          ...self.options,\n          cwd\n        });\n      }\n    case \"PipedCommand\":\n      {\n        return makePipedCommand(setCwd(self.left, cwd), setCwd(self.right, cwd), self.options);\n      }\n  }\n});\n/**\n * Adds environment variables to a command, merging them with any existing\n * command environment and overriding duplicate keys.\n *\n * **Details**\n *\n * For pipelines, applies to each command in the pipeline.\n *\n * **Example** (Setting command environment variables)\n *\n * ```ts import.meta.vitest\n * import { ChildProcess } from \"effect/unstable/process\"\n *\n * const cmd = ChildProcess.make`node script.js`.pipe(\n *   ChildProcess.setEnv({ NODE_ENV: \"test\" })\n * )\n * const result = cmd._tag === \"StandardCommand\" && cmd.options.env?.NODE_ENV // => \"test\"\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setEnv = /*#__PURE__*/dual(2, (self, env) => {\n  switch (self._tag) {\n    case \"StandardCommand\":\n      {\n        const nextEnv = self.options.env === undefined ? env : {\n          ...self.options.env,\n          ...env\n        };\n        return makeStandardCommand(self.command, self.args, {\n          ...self.options,\n          env: nextEnv\n        });\n      }\n    case \"PipedCommand\":\n      {\n        return makePipedCommand(setEnv(self.left, env), setEnv(self.right, env), self.options);\n      }\n  }\n});\nconst isTemplateString = u => Array.isArray(u) && \"raw\" in u && Array.isArray(u.raw);\n// =============================================================================\n// Utilities\n// =============================================================================\n/**\n * Parses an fd name like \"fd3\" to its numeric index.\n * Returns undefined if the name is invalid.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const parseFdName = name => {\n  const match = /^fd(\\d+)$/.exec(name);\n  if (match === null) return undefined;\n  const fd = parseInt(match[1], 10);\n  return fd >= 3 ? fd : undefined;\n};\n/**\n * Create an fd name from its numeric index.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fdName = fd => `fd${fd}`;\n// =============================================================================\n// Template Parsing\n// =============================================================================\nconst parseTemplates = (templates, expressions) => {\n  let tokens = [];\n  for (const [index, template] of templates.entries()) {\n    tokens = parseTemplate(templates, expressions, tokens, template, index);\n  }\n  return tokens;\n};\nconst parseTemplate = (templates, expressions, prevTokens, template, index) => {\n  const rawTemplate = templates.raw[index];\n  if (rawTemplate === undefined) {\n    throw new Error(`Invalid backslash sequence: ${templates.raw[index]}`);\n  }\n  const {\n    hasLeadingWhitespace,\n    hasTrailingWhitespace,\n    tokens\n  } = splitByWhitespaces(template, rawTemplate);\n  const nextTokens = concatTokens(prevTokens, tokens, hasLeadingWhitespace);\n  if (index === expressions.length) {\n    return nextTokens;\n  }\n  const expression = expressions[index];\n  const expressionTokens = Array.isArray(expression) ? expression.map(expression => parseExpression(expression)) : [parseExpression(expression)];\n  return concatTokens(nextTokens, expressionTokens, hasTrailingWhitespace);\n};\n/**\n * Convert valid expressions defined in a template string command (i.e. using\n * `${expression}` into strings.\n */\nconst parseExpression = expression => {\n  const type = typeof expression;\n  if (type === \"string\") {\n    return expression; // Return strings directly\n  }\n  return String(expression); // Convert numbers to strings\n};\nconst DELIMITERS = /*#__PURE__*/new Set([\" \", \"\\t\", \"\\r\", \"\\n\"]);\n/**\n * Number of characters in backslash escape sequences: \\0 \\xXX or \\uXXXX\n * \\cX is allowed in RegExps but not in strings\n * Octal sequences are not allowed in strict mode\n */\nconst ESCAPE_LENGTH = {\n  x: 3,\n  u: 5\n};\n/**\n * Splits a template string by whitespace while also properly handling escape\n * sequences.\n *\n * As an example, let's review the following valid commands:\n *\n * ```ts\n * ChildProcess.exec`echo foo\\n bar`\n * // We should run `[\"echo\", \"foo\\n\", \"bar\"]`\n *\n * ChildProcess.exec`echo foo\n *  bar`\n * // We should run `[\"echo\", \"foo\", \"bar]`\n * ```\n *\n * The problem is that when we evaluate the template string for both of the above\n * commands, we will end up with the same string \"echo foo\\n bar\".\n *\n * What we really want is to include the escaped character in the arguments for\n * the first command, since it was written explicitly by the user.\n *\n * This is why also having access to the raw template string is useful - in a\n * template string, there are two representations of the same string:\n * 1. `template`     - The processed string (escape sequences are evaluated).\n * 2. `template.raw` - The raw string (escape sequences are literal).\n */\nconst splitByWhitespaces = (template, rawTemplate) => {\n  if (rawTemplate.length === 0) {\n    return {\n      tokens: [],\n      hasLeadingWhitespace: false,\n      hasTrailingWhitespace: false\n    };\n  }\n  const hasLeadingWhitespace = DELIMITERS.has(rawTemplate[0]);\n  const tokens = [];\n  // Given that escape sequences will have different lengths in the template\n  // versus the raw template, we must maintain two indices:\n  // - One for the index into the template string\n  // - One for the index into the raw template string\n  // We also maintain the current cursor position for where we are in the template\n  let templateCursor = 0;\n  for (let templateIndex = 0, rawIndex = 0; templateIndex < template.length; templateIndex += 1, rawIndex += 1) {\n    // Use the raw template character to check for actual whitespace\n    const rawCharacter = rawTemplate[rawIndex];\n    if (DELIMITERS.has(rawCharacter)) {\n      // Whitespace found, extract token from template if necessary\n      if (templateCursor !== templateIndex) {\n        tokens.push(template.slice(templateCursor, templateIndex));\n      }\n      // Advance the template start index to the current position\n      templateCursor = templateIndex + 1;\n    } else if (rawCharacter === \"\\\\\") {\n      // Escape sequence detected, check the next raw character\n      const nextRawCharacter = rawTemplate[rawIndex + 1];\n      if (nextRawCharacter === \"\\n\") {\n        // Handle `\\` character followed by a newline (i.e. a line continuation) by:\n        // - Reversing the template index (backslash-newline is erased in template)\n        // - Advancing the raw template index past the line continuation\n        templateIndex -= 1;\n        rawIndex += 1;\n      } else if (nextRawCharacter === \"u\" && rawTemplate[rawIndex + 2] === \"{\") {\n        // Handle variable-length unicode escape sequences (i.e. `\\u{1F600}`) by:\n        // - Advancing the raw template index past the unicode escape sequence\n        rawIndex = rawTemplate.indexOf(\"}\", rawIndex + 3);\n      } else {\n        // Advance raw template index past fixed-length escape sequences:\n        // - \\n    → 2 chars (backslash + n)\n        // - \\t    → 2 chars (backslash + t)\n        // - \\xHH  → 4 chars (backslash + x + H + H)\n        // - \\uHHHH → 6 chars (backslash + u + H + H + H + H)\n        rawIndex += ESCAPE_LENGTH[nextRawCharacter] ?? 1;\n      }\n    }\n  }\n  // Trailing whitespace only exists if the template cursor is equivalent to the\n  // length of the template\n  const hasTrailingWhitespace = templateCursor === template.length;\n  // If we did not end with trailing whitespace, ensure the final token is added\n  if (!hasTrailingWhitespace) {\n    tokens.push(template.slice(templateCursor));\n  }\n  return {\n    tokens,\n    hasLeadingWhitespace,\n    hasTrailingWhitespace\n  };\n};\n/**\n * Concatenates two separate sets of string tokens together.\n *\n * If either set is empty or `isSeparated=false`, the last element of `prevTokens`\n * and the first element of `nextTokens` will be joined into a single token.\n */\nconst concatTokens = (prevTokens, nextTokens, isSeparated) => isSeparated || prevTokens.length === 0 || nextTokens.length === 0\n// Keep the previous and next tokens separate from one another\n? [...prevTokens, ...nextTokens]\n// Join the last token from the previous set and the first token from the next set\n: [...prevTokens.slice(0, -1), `${prevTokens.at(-1)}${nextTokens.at(0)}`, ...nextTokens.slice(1)];\n//# sourceMappingURL=ChildProcess.js.map","export const buildSpawnOptions = (options, base, platform) => {\n  const detached = options.detached ?? platform !== \"win32\";\n  return {\n    ...base,\n    detached,\n    shell: options.shell,\n    windowsHide: options.windowsHide ?? !detached\n  };\n};\n//# sourceMappingURL=nodeChildProcessSpawner.js.map","import * as PlatformError from \"effect/PlatformError\";\n/** @internal */\nexport const handleErrnoException = (module, method) => (err, [path]) => {\n  let reason = \"Unknown\";\n  switch (err.code) {\n    case \"ENOENT\":\n      reason = \"NotFound\";\n      break;\n    case \"EACCES\":\n      reason = \"PermissionDenied\";\n      break;\n    case \"EEXIST\":\n      reason = \"AlreadyExists\";\n      break;\n    case \"EISDIR\":\n      reason = \"BadResource\";\n      break;\n    case \"ENOTDIR\":\n      reason = \"BadResource\";\n      break;\n    case \"EBUSY\":\n      reason = \"Busy\";\n      break;\n    case \"ELOOP\":\n      reason = \"BadResource\";\n      break;\n  }\n  return PlatformError.systemError({\n    _tag: reason,\n    module,\n    method,\n    pathOrDescriptor: path,\n    syscall: err.syscall,\n    cause: err\n  });\n};\n//# sourceMappingURL=utils.js.map","import * as Cause from \"effect/Cause\";\nimport * as Channel from \"effect/Channel\";\nimport * as Effect from \"effect/Effect\";\nimport { identity } from \"effect/Function\";\nimport * as Pull from \"effect/Pull\";\nimport * as Sink from \"effect/Sink\";\n/**\n * Creates a `Sink` that writes chunks to a Node writable stream, respecting\n * backpressure, mapping writable errors with `onError`, and ending the stream\n * on completion unless `endOnDone` is `false`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromWritable = options => Sink.fromChannel(Channel.mapDone(fromWritableChannel(options), _ => [_]));\n/**\n * Creates a `Channel` that pulls chunks from upstream and writes them to a\n * Node writable stream, respecting backpressure and optionally ending the\n * writable when upstream is done.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromWritableChannel = options => Channel.fromTransform(pull => {\n  const writable = options.evaluate();\n  return Effect.succeed(pullIntoWritable({\n    ...options,\n    writable,\n    pull\n  }));\n});\n/**\n * Writes Effect chunks into a Node writable stream.\n *\n * **When to use**\n *\n * Use to implement custom Node stream adapters that already have an upstream\n * pull and need direct control over a writable stream.\n *\n * **Details**\n *\n * The loop waits for `drain` when needed, fails on writable errors, and ends\n * the writable on upstream completion unless `endOnDone` is `false`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const pullIntoWritable = options => options.pull.pipe(Effect.flatMap(chunk => {\n  let i = 0;\n  return Effect.callback(function loop(resume) {\n    for (; i < chunk.length;) {\n      const success = options.writable.write(chunk[i++], options.encoding);\n      if (!success) {\n        options.writable.once(\"drain\", () => loop(resume));\n        return;\n      }\n    }\n    resume(Effect.void);\n  });\n}), Effect.forever({\n  disableYield: true\n}), Effect.raceFirst(Effect.callback(resume => {\n  const onError = error => resume(Effect.fail(options.onError(error)));\n  options.writable.once(\"error\", onError);\n  return Effect.sync(() => {\n    options.writable.off(\"error\", onError);\n  });\n})), options.endOnDone !== false ? Pull.catchDone(_ => {\n  if (\"closed\" in options.writable && options.writable.closed) {\n    return Cause.done(_);\n  }\n  return Effect.callback(resume => {\n    options.writable.once(\"finish\", () => resume(Cause.done(_)));\n    options.writable.end();\n  });\n}) : identity);\n//# sourceMappingURL=NodeSink.js.map","/**\n * Adapters between Node streams and Effect streams, channels, and readables.\n *\n * This module is the stream boundary for Node APIs. It wraps `Readable` and\n * `Duplex` values as Effect `Stream`s and `Channel`s, pipes Effect streams\n * through Node duplex streams, exposes an Effect `Stream` back to Node as a\n * `Readable`, and collects readable payloads into strings, array buffers, or\n * `Uint8Array`s with optional byte limits.\n *\n * @since 4.0.0\n */\nimport * as Arr from \"effect/Array\";\nimport * as Cause from \"effect/Cause\";\nimport * as Channel from \"effect/Channel\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Exit from \"effect/Exit\";\nimport * as Fiber from \"effect/Fiber\";\nimport { dual } from \"effect/Function\";\nimport * as Latch from \"effect/Latch\";\nimport * as MutableRef from \"effect/MutableRef\";\nimport * as Pull from \"effect/Pull\";\nimport * as Scope from \"effect/Scope\";\nimport * as Stream from \"effect/Stream\";\nimport { Readable } from \"node:stream\";\nimport { pullIntoWritable } from \"./NodeSink.js\";\n/**\n * Converts a Node readable stream into an Effect `Stream`, reading chunks with\n * an optional chunk size, mapping stream errors with `onError`, and destroying\n * the readable on completion unless `closeOnDone` is `false`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromReadable = options => Stream.fromChannel(fromReadableChannel(options));\n/**\n * Creates a `Channel` that pulls chunks from a Node readable stream, mapping\n * errors with `onError` and destroying the readable on completion unless\n * `closeOnDone` is `false`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromReadableChannel = options => Channel.fromTransform((_, scope) => readableToPullUnsafe({\n  scope,\n  readable: options.evaluate(),\n  onError: options.onError ?? defaultOnError,\n  chunkSize: options.chunkSize,\n  closeOnDone: options.closeOnDone\n}));\n/**\n * Creates a `Channel` over a Node `Duplex`, writing upstream chunks with\n * backpressure while emitting chunks read from the duplex and optionally ending\n * the writable side when upstream completes.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromDuplex = options => Channel.fromTransform((upstream, scope) => {\n  const duplex = options.evaluate();\n  const exit = MutableRef.make(undefined);\n  return pullIntoWritable({\n    pull: upstream,\n    writable: duplex,\n    onError: options.onError ?? defaultOnError,\n    endOnDone: options.endOnDone,\n    encoding: options.encoding\n  }).pipe(Effect.catchCause(cause => {\n    if (Pull.isDoneCause(cause)) return Effect.void;\n    exit.current = Exit.failCause(cause);\n    return Effect.void;\n  }), Effect.forkIn(scope), Effect.flatMap(() => readableToPullUnsafe({\n    scope,\n    exit,\n    readable: duplex,\n    onError: options.onError ?? defaultOnError,\n    chunkSize: options.chunkSize\n  })));\n});\n/**\n * Pipes an Effect `Stream` through a Node `Duplex`, writing the stream's\n * chunks to the duplex and emitting chunks read back from it.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const pipeThroughDuplex = /*#__PURE__*/dual(2, (self, options) => Stream.pipeThroughChannelOrFail(self, fromDuplex(options)));\n/**\n * Pipes a stream of strings or bytes through a Node `Duplex` using default\n * options and `Cause.UnknownError` for stream failures.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const pipeThroughSimple = /*#__PURE__*/dual(2, (self, duplex) => pipeThroughDuplex(self, {\n  evaluate: duplex\n}));\n/**\n * Converts an Effect `Stream` into a Node `Readable`, using the caller's\n * Effect context to run the stream and destroying the readable if the stream\n * fails.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toReadable = stream => Effect.map(Effect.context(), context => new StreamAdapter(context, stream));\n/**\n * Converts a service-free Effect `Stream` into a Node `Readable` using an\n * empty Effect context.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toReadableNever = stream => new StreamAdapter(Context.empty(), stream);\n/**\n * Consumes a Node readable stream into a string using the selected encoding,\n * failing through `onError` on stream errors or when `maxBytes` is exceeded\n * and destroying the stream on interruption or failure.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toString = (readable, options) => {\n  const maxBytesNumber = options?.maxBytes !== undefined ? Number(options.maxBytes) : undefined;\n  const onError = options?.onError ?? defaultOnError;\n  const encoding = options?.encoding ?? \"utf8\";\n  return Effect.callback(resume => {\n    const stream = readable();\n    stream.setEncoding(encoding);\n    stream.once(\"error\", err => {\n      if (\"closed\" in stream && !stream.closed) {\n        stream.destroy();\n      }\n      resume(Effect.fail(onError(err)));\n    });\n    let string = \"\";\n    let bytes = 0;\n    stream.once(\"end\", () => {\n      resume(Effect.succeed(string));\n    });\n    stream.on(\"data\", chunk => {\n      string += chunk;\n      bytes += Buffer.byteLength(chunk);\n      if (maxBytesNumber !== undefined && bytes > maxBytesNumber) {\n        if (\"closed\" in stream && !stream.closed) {\n          stream.destroy();\n        }\n        resume(Effect.fail(onError(new Error(\"maxBytes exceeded\"))));\n      }\n    });\n    return Effect.sync(() => {\n      if (\"closed\" in stream && !stream.closed) {\n        stream.destroy();\n      }\n    });\n  });\n};\n/**\n * Consumes a Node readable stream into an `ArrayBuffer`, failing through\n * `onError` on stream errors or when `maxBytes` is exceeded and destroying the\n * stream on interruption or failure.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toArrayBuffer = (readable, options) => {\n  const maxBytesNumber = options?.maxBytes !== undefined ? Number(options.maxBytes) : undefined;\n  const onError = options?.onError ?? defaultOnError;\n  return Effect.callback(resume => {\n    const stream = readable();\n    const buffers = [];\n    let bytes = 0;\n    stream.once(\"error\", err => {\n      if (\"closed\" in stream && !stream.closed) {\n        stream.destroy();\n      }\n      resume(Effect.fail(onError(err)));\n    });\n    stream.once(\"end\", () => {\n      const buffer = buffers.length === 1 ? buffers[0] : Buffer.concat(buffers);\n      if (buffer.byteOffset === 0 && buffer.buffer.byteLength === buffer.byteLength) {\n        return resume(Effect.succeed(buffer.buffer));\n      }\n      resume(Effect.succeed(buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength)));\n    });\n    stream.on(\"data\", chunk => {\n      buffers.push(chunk);\n      bytes += chunk.length;\n      if (maxBytesNumber !== undefined && bytes > maxBytesNumber) {\n        if (\"closed\" in stream && !stream.closed) {\n          stream.destroy();\n        }\n        resume(Effect.fail(onError(new Error(\"maxBytes exceeded\"))));\n      }\n    });\n    return Effect.sync(() => {\n      if (\"closed\" in stream && !stream.closed) {\n        stream.destroy();\n      }\n    });\n  });\n};\n/**\n * Consumes a Node readable stream into a `Uint8Array`, using the same error\n * mapping and `maxBytes` handling as `toArrayBuffer`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toUint8Array = (readable, options) => Effect.map(toArrayBuffer(readable, options), buffer => new Uint8Array(buffer));\n// ----------------------------------------------------------------------------\n// internal\n// ----------------------------------------------------------------------------\nconst readableToPullUnsafe = options => {\n  const readable = options.readable;\n  const closeOnDone = options.closeOnDone ?? true;\n  const exit = options.exit ?? MutableRef.make(undefined);\n  const latch = Latch.makeUnsafe(false);\n  function onReadable() {\n    latch.openUnsafe();\n  }\n  function onError(error) {\n    exit.current = Exit.fail(options.onError(error));\n    latch.openUnsafe();\n  }\n  function onEnd() {\n    exit.current = Exit.fail(Cause.Done());\n    latch.openUnsafe();\n  }\n  readable.on(\"readable\", onReadable);\n  readable.once(\"error\", onError);\n  readable.once(\"end\", onEnd);\n  const pull = Effect.suspend(function loop() {\n    let item = options.readable.read(options.chunkSize);\n    if (item === null) {\n      if (exit.current) {\n        return exit.current;\n      }\n      if (readable.readableEnded) {\n        return Effect.fail(Cause.Done());\n      }\n      latch.closeUnsafe();\n      return Effect.flatMap(latch.await, loop);\n    }\n    const chunk = Arr.of(item);\n    while (true) {\n      item = options.readable.read(options.chunkSize);\n      if (item === null) break;\n      chunk.push(item);\n    }\n    return Effect.succeed(chunk);\n  });\n  return Effect.as(Scope.addFinalizer(options.scope, Effect.sync(() => {\n    readable.off(\"readable\", onReadable);\n    readable.off(\"error\", onError);\n    readable.off(\"end\", onEnd);\n    if (closeOnDone && \"closed\" in options.readable && !options.readable.closed) {\n      options.readable.destroy();\n    }\n  })), pull);\n};\nclass StreamAdapter extends Readable {\n  readLatch;\n  fiber = undefined;\n  constructor(context, stream) {\n    super({});\n    this.readLatch = Latch.makeUnsafe(false);\n    this.fiber = Stream.runForEachArray(stream, chunk => this.readLatch.whenOpen(Effect.sync(() => {\n      this.readLatch.closeUnsafe();\n      for (let i = 0; i < chunk.length; i++) {\n        const item = chunk[i];\n        if (typeof item === \"string\") {\n          this.push(item, \"utf8\");\n        } else {\n          this.push(item);\n        }\n      }\n    }))).pipe(this.readLatch.whenOpen, Effect.provideContext(context), Effect.runFork);\n    this.fiber.addObserver(exit => {\n      this.fiber = undefined;\n      if (Exit.isSuccess(exit)) {\n        this.push(null);\n      } else {\n        this.destroy(Cause.squash(exit.cause));\n      }\n    });\n  }\n  _read(_size) {\n    this.readLatch.openUnsafe();\n  }\n  _destroy(error, callback) {\n    if (!this.fiber) {\n      return callback(error);\n    }\n    Effect.runFork(Fiber.interrupt(this.fiber)).addObserver(exit => {\n      callback(exit._tag === \"Failure\" ? Cause.squash(exit.cause) : error);\n    });\n  }\n}\nconst defaultOnError = error => new Cause.UnknownError(error);\n//# sourceMappingURL=NodeStream.js.map","import * as Deferred from \"effect/Deferred\";\nimport * as Effect from \"effect/Effect\";\nimport * as Exit from \"effect/Exit\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Path from \"effect/Path\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Sink from \"effect/Sink\";\nimport * as Stream from \"effect/Stream\";\nimport * as ChildProcess from \"effect/unstable/process/ChildProcess\";\nimport { ChildProcessSpawner, ExitCode, make as makeSpawner, makeHandle, ProcessId } from \"effect/unstable/process/ChildProcessSpawner\";\nimport * as NodeChildProcess from \"node:child_process\";\nimport { PassThrough } from \"node:stream\";\nimport { buildSpawnOptions } from \"./internal/nodeChildProcessSpawner.js\";\nimport { handleErrnoException } from \"./internal/utils.js\";\nimport * as NodeSink from \"./NodeSink.js\";\nimport * as NodeStream from \"./NodeStream.js\";\nconst toError = error => error instanceof globalThis.Error ? error : new globalThis.Error(String(error));\nconst toPlatformError = (method, error, command) => {\n  const {\n    commands\n  } = flattenCommand(command);\n  const commandStr = commands.reduce((acc, curr) => {\n    const cmd = `${curr.command} ${curr.args.join(\" \")}`;\n    return acc.length === 0 ? cmd : `${acc} | ${cmd}`;\n  }, \"\");\n  return handleErrnoException(\"ChildProcess\", method)(error, [commandStr]);\n};\nconst taskkill = (childProcess, onExit = () => {}) => NodeChildProcess.execFile(\"taskkill\", [\"/pid\", String(childProcess.pid), \"/T\", \"/F\"], {\n  windowsHide: true\n}, onExit);\nconst make = /*#__PURE__*/Effect.gen(function* () {\n  const fs = yield* FileSystem.FileSystem;\n  const path = yield* Path.Path;\n  const resolveWorkingDirectory = Effect.fnUntraced(function* (options) {\n    if (Predicate.isUndefined(options.cwd)) return undefined;\n    // Validate that the specified directory is accessible\n    yield* fs.access(options.cwd);\n    return path.resolve(options.cwd);\n  });\n  const resolveEnvironment = options => {\n    return options.extendEnv ? {\n      ...globalThis.process.env,\n      ...options.env\n    } : options.env;\n  };\n  const inputToStdioOption = input => Stream.isStream(input) ? \"pipe\" : input;\n  const outputToStdioOption = input => Sink.isSink(input) ? \"pipe\" : input;\n  const resolveStdinOption = options => {\n    const defaultConfig = {\n      stream: \"pipe\",\n      encoding: \"utf-8\",\n      endOnDone: true\n    };\n    if (Predicate.isUndefined(options.stdin)) {\n      return defaultConfig;\n    }\n    if (typeof options.stdin === \"string\") {\n      return {\n        ...defaultConfig,\n        stream: options.stdin\n      };\n    }\n    if (Stream.isStream(options.stdin)) {\n      return {\n        ...defaultConfig,\n        stream: options.stdin\n      };\n    }\n    return {\n      stream: options.stdin.stream,\n      encoding: options.stdin.encoding ?? defaultConfig.encoding,\n      endOnDone: options.stdin.endOnDone ?? defaultConfig.endOnDone\n    };\n  };\n  const resolveOutputOption = (options, streamName) => {\n    const option = options[streamName];\n    if (Predicate.isUndefined(option)) {\n      return {\n        stream: \"pipe\"\n      };\n    }\n    if (typeof option === \"string\") {\n      return {\n        stream: option\n      };\n    }\n    if (Sink.isSink(option)) {\n      return {\n        stream: option\n      };\n    }\n    return {\n      stream: option.stream\n    };\n  };\n  const resolveAdditionalFds = options => {\n    if (Predicate.isUndefined(options.additionalFds)) {\n      return [];\n    }\n    const result = [];\n    for (const [name, config] of Object.entries(options.additionalFds)) {\n      const fd = ChildProcess.parseFdName(name);\n      if (Predicate.isNotUndefined(fd)) {\n        result.push({\n          fd,\n          config\n        });\n      }\n    }\n    // Sort by fd number to ensure correct ordering\n    return result.sort((a, b) => a.fd - b.fd);\n  };\n  const buildStdioArray = (stdinConfig, stdoutConfig, stderrConfig, additionalFds) => {\n    const stdio = [inputToStdioOption(stdinConfig.stream), outputToStdioOption(stdoutConfig.stream), outputToStdioOption(stderrConfig.stream)];\n    if (additionalFds.length === 0) {\n      return stdio;\n    }\n    // Find the maximum fd number to size the array correctly\n    const maxFd = additionalFds.reduce((max, {\n      fd\n    }) => Math.max(max, fd), 2);\n    // Fill gaps with \"ignore\"\n    for (let i = 3; i <= maxFd; i++) {\n      stdio[i] = \"ignore\";\n    }\n    // Set up additional fds as \"pipe\"\n    for (const {\n      fd\n    } of additionalFds) {\n      stdio[fd] = \"pipe\";\n    }\n    return stdio;\n  };\n  const setupAdditionalFds = Effect.fnUntraced(function* (command, childProcess, additionalFds) {\n    if (additionalFds.length === 0) {\n      return {\n        getInputFd: () => Sink.drain,\n        getOutputFd: () => Stream.empty\n      };\n    }\n    const inputSinks = new Map();\n    const outputStreams = new Map();\n    for (const {\n      config,\n      fd\n    } of additionalFds) {\n      const nodeStream = childProcess.stdio[fd];\n      switch (config.type) {\n        case \"input\":\n          {\n            // Create a sink to write to for input file descriptors\n            let sink = Sink.drain;\n            if (nodeStream && \"write\" in nodeStream) {\n              sink = NodeSink.fromWritable({\n                evaluate: () => nodeStream,\n                onError: error => toPlatformError(`fromWritable(fd${fd})`, toError(error), command)\n              });\n            }\n            // If user provided a stream, pipe it into the sink\n            if (config.stream) {\n              yield* Effect.forkScoped(Stream.run(config.stream, sink));\n            }\n            inputSinks.set(fd, sink);\n            break;\n          }\n        case \"output\":\n          {\n            // Create a stream to read from for output file descriptors\n            let stream = Stream.empty;\n            if (nodeStream && \"read\" in nodeStream) {\n              const passThrough = new PassThrough();\n              nodeStream.on(\"error\", error => passThrough.destroy(error));\n              nodeStream.pipe(passThrough);\n              stream = NodeStream.fromReadable({\n                evaluate: () => passThrough,\n                onError: error => toPlatformError(`fromReadable(fd${fd})`, toError(error), command)\n              });\n            }\n            // If user provided a sink, transduce the stream through it\n            if (config.sink) {\n              stream = Stream.transduce(stream, config.sink);\n            }\n            outputStreams.set(fd, stream);\n            break;\n          }\n      }\n    }\n    return {\n      getInputFd: fd => inputSinks.get(fd) ?? Sink.drain,\n      getOutputFd: fd => outputStreams.get(fd) ?? Stream.empty\n    };\n  });\n  const setupChildStdin = (command, childProcess, config) => Effect.suspend(() => {\n    // If the child process has a standard input stream, connect it to the\n    // sink that will attached to the process handle\n    let sink = Sink.drain;\n    if (Predicate.isNotNull(childProcess.stdin)) {\n      sink = NodeSink.fromWritable({\n        evaluate: () => childProcess.stdin,\n        onError: error => toPlatformError(\"fromWritable(stdin)\", toError(error), command),\n        endOnDone: config.endOnDone,\n        encoding: config.encoding\n      });\n    }\n    // If the user provided a `Stream`, run it into the stdin sink\n    if (Stream.isStream(config.stream)) {\n      return Effect.as(Effect.forkScoped(Stream.run(config.stream, sink)), sink);\n    }\n    return Effect.succeed(sink);\n  });\n  const setupChildOutputStreams = (command, childProcess, stdoutConfig, stderrConfig) => {\n    let stdout = childProcess.stdout ? (() => {\n      const passThrough = new PassThrough();\n      childProcess.stdout.on(\"error\", error => passThrough.destroy(error));\n      childProcess.stdout.pipe(passThrough);\n      return NodeStream.fromReadable({\n        evaluate: () => passThrough,\n        onError: error => toPlatformError(\"fromReadable(stdout)\", toError(error), command)\n      });\n    })() : Stream.empty;\n    let stderr = childProcess.stderr ? (() => {\n      const passThrough = new PassThrough();\n      childProcess.stderr.on(\"error\", error => passThrough.destroy(error));\n      childProcess.stderr.pipe(passThrough);\n      return NodeStream.fromReadable({\n        evaluate: () => passThrough,\n        onError: error => toPlatformError(\"fromReadable(stderr)\", toError(error), command)\n      });\n    })() : Stream.empty;\n    if (Sink.isSink(stdoutConfig.stream)) {\n      stdout = Stream.transduce(stdout, stdoutConfig.stream);\n    }\n    if (Sink.isSink(stderrConfig.stream)) {\n      stderr = Stream.transduce(stderr, stderrConfig.stream);\n    }\n    const all = Stream.merge(stdout, stderr);\n    return {\n      stdout,\n      stderr,\n      all\n    };\n  };\n  const spawn = (command, spawnOptions) => Effect.callback(resume => {\n    const deferred = Deferred.makeUnsafe();\n    const handle = NodeChildProcess.spawn(command.command, command.args, spawnOptions);\n    handle.on(\"error\", error => {\n      resume(Effect.fail(toPlatformError(\"spawn\", error, command)));\n    });\n    handle.on(\"exit\", (...args) => {\n      Deferred.doneUnsafe(deferred, Exit.succeed(args));\n    });\n    handle.on(\"spawn\", () => {\n      resume(Effect.succeed([handle, deferred]));\n    });\n    return Effect.sync(() => {\n      handle.kill(\"SIGTERM\");\n    });\n  });\n  const killProcessGroup = (command, childProcess, signal) => {\n    if (globalThis.process.platform === \"win32\") {\n      return Effect.callback(resume => {\n        taskkill(childProcess, error => {\n          if (error) {\n            resume(Effect.fail(toPlatformError(\"kill\", toError(error), command)));\n          } else {\n            resume(Effect.void);\n          }\n        });\n      });\n    }\n    return Effect.try({\n      try: () => {\n        globalThis.process.kill(-childProcess.pid, signal);\n      },\n      catch: error => toPlatformError(\"kill\", toError(error), command)\n    });\n  };\n  const killProcessGroupOnExit = (childProcess, signal) => {\n    if (globalThis.process.platform === \"win32\") {\n      // ignore errors during best-effort cleanup\n      taskkill(childProcess);\n      return;\n    }\n    try {\n      globalThis.process.kill(-childProcess.pid, signal);\n    } catch {\n      // ignore errors during best-effort cleanup\n    }\n  };\n  const killProcess = (command, childProcess, signal) => Effect.suspend(() => {\n    const killed = childProcess.kill(signal);\n    if (!killed) {\n      const error = new globalThis.Error(\"Failed to kill child process\");\n      return Effect.fail(toPlatformError(\"kill\", error, command));\n    }\n    return Effect.void;\n  });\n  const withTimeout = (childProcess, command, options) => kill => {\n    const killSignal = options?.killSignal ?? \"SIGTERM\";\n    return Predicate.isUndefined(options?.forceKillAfter) ? kill(command, childProcess, killSignal) : Effect.timeoutOrElse(kill(command, childProcess, killSignal), {\n      duration: options.forceKillAfter,\n      orElse: () => kill(command, childProcess, \"SIGKILL\")\n    });\n  };\n  /**\n   * Get the appropriate source stream from a process handle based on the\n   * `from` pipe option.\n   */\n  const getSourceStream = (handle, from) => {\n    const fromOption = from ?? \"stdout\";\n    switch (fromOption) {\n      case \"stdout\":\n        return handle.stdout;\n      case \"stderr\":\n        return handle.stderr;\n      case \"all\":\n        return handle.all;\n      default:\n        {\n          // Handle fd3, fd4, etc.\n          const fd = ChildProcess.parseFdName(fromOption);\n          if (Predicate.isNotUndefined(fd)) {\n            return handle.getOutputFd(fd);\n          }\n          // Fallback to stdout for invalid fd names\n          return handle.stdout;\n        }\n    }\n  };\n  const spawnCommand = Effect.fnUntraced(function* (cmd) {\n    switch (cmd._tag) {\n      case \"StandardCommand\":\n        {\n          const stdinConfig = resolveStdinOption(cmd.options);\n          const stdoutConfig = resolveOutputOption(cmd.options, \"stdout\");\n          const stderrConfig = resolveOutputOption(cmd.options, \"stderr\");\n          const resolvedAdditionalFds = resolveAdditionalFds(cmd.options);\n          let isReferenced = true;\n          const cwd = yield* resolveWorkingDirectory(cmd.options);\n          const env = resolveEnvironment(cmd.options);\n          const stdio = buildStdioArray(stdinConfig, stdoutConfig, stderrConfig, resolvedAdditionalFds);\n          const [childProcess, exitSignal] = yield* Effect.acquireRelease(spawn(cmd, buildSpawnOptions(cmd.options, {\n            cwd,\n            env,\n            stdio\n          }, process.platform)), Effect.fnUntraced(function* ([childProcess, exitSignal]) {\n            const exited = yield* Deferred.isDone(exitSignal);\n            const killWithTimeout = withTimeout(childProcess, cmd, cmd.options);\n            if (exited) {\n              // Process already exited, check if children need cleanup\n              const [code] = yield* Deferred.await(exitSignal);\n              if (code !== 0 && Predicate.isNotNull(code)) {\n                // Non-zero exit code ,attempt to clean up process group\n                return yield* Effect.ignore(killWithTimeout(killProcessGroup));\n              }\n              return yield* Effect.void;\n            }\n            if (!isReferenced) {\n              return yield* Effect.void;\n            }\n            // Process is still running, kill it\n            return yield* killWithTimeout((command, childProcess, signal) => killProcessGroup(command, childProcess, signal).pipe(Effect.catch(() => killProcess(command, childProcess, signal)), Effect.andThen(Deferred.await(exitSignal)))).pipe(Effect.ignore);\n          }));\n          const pid = ProcessId(childProcess.pid);\n          childProcess.on(\"exit\", code => {\n            if (code !== 0 && Predicate.isNotNull(code)) {\n              killProcessGroupOnExit(childProcess, cmd.options.killSignal ?? \"SIGTERM\");\n            }\n          });\n          const reref = Effect.sync(() => {\n            if (!isReferenced) {\n              childProcess.ref();\n              isReferenced = true;\n            }\n          });\n          const unref = Effect.sync(() => {\n            if (isReferenced) {\n              childProcess.unref();\n              isReferenced = false;\n            }\n            return reref;\n          });\n          const stdin = yield* setupChildStdin(cmd, childProcess, stdinConfig);\n          const {\n            all,\n            stderr,\n            stdout\n          } = setupChildOutputStreams(cmd, childProcess, stdoutConfig, stderrConfig);\n          const {\n            getInputFd,\n            getOutputFd\n          } = yield* setupAdditionalFds(cmd, childProcess, resolvedAdditionalFds);\n          const isRunning = Effect.map(Deferred.isDone(exitSignal), done => !done);\n          const exitCode = Effect.flatMap(Deferred.await(exitSignal), ([code, signal]) => {\n            if (Predicate.isNotNull(code)) {\n              return Effect.succeed(ExitCode(code));\n            }\n            // If code is `null`, then `signal` must be defined. See the NodeJS\n            // documentation for the `\"exit\"` event on a `child_process`.\n            // https://nodejs.org/api/child_process.html#child_process_event_exit\n            const error = new globalThis.Error(`Process interrupted due to receipt of signal: '${signal}'`);\n            return Effect.fail(toPlatformError(\"exitCode\", error, cmd));\n          });\n          const kill = options => {\n            const killWithTimeout = withTimeout(childProcess, cmd, options);\n            return killWithTimeout((command, childProcess, signal) => killProcessGroup(command, childProcess, signal).pipe(Effect.catch(() => killProcess(command, childProcess, signal)), Effect.andThen(Deferred.await(exitSignal)))).pipe(Effect.asVoid);\n          };\n          return makeHandle({\n            pid,\n            exitCode,\n            isRunning,\n            kill,\n            stdin,\n            stdout,\n            stderr,\n            all,\n            getInputFd,\n            getOutputFd,\n            unref\n          });\n        }\n      case \"PipedCommand\":\n        {\n          const {\n            commands,\n            pipeOptions\n          } = flattenCommand(cmd);\n          const [root, ...pipeline] = commands;\n          const handles = [yield* spawnCommand(root)];\n          for (let i = 0; i < pipeline.length; i++) {\n            const command = pipeline[i];\n            const options = pipeOptions[i] ?? {};\n            const stdinConfig = resolveStdinOption(command.options);\n            // Get the appropriate stream from the source based on `from` option\n            const sourceStream = Stream.unwrap(Effect.succeed(getSourceStream(handles[handles.length - 1], options.from)));\n            // Determine where to pipe: stdin or custom fd\n            const toOption = options.to ?? \"stdin\";\n            if (toOption === \"stdin\") {\n              // Pipe to stdin (default behavior)\n              handles.push(yield* spawnCommand(ChildProcess.make(command.command, command.args, {\n                ...command.options,\n                stdin: {\n                  ...stdinConfig,\n                  stream: sourceStream\n                }\n              })));\n            } else {\n              // Pipe to custom fd (fd3, fd4, etc.)\n              const fd = ChildProcess.parseFdName(toOption);\n              if (Predicate.isNotUndefined(fd)) {\n                const fdName = ChildProcess.fdName(fd);\n                const existingFds = command.options.additionalFds ?? {};\n                handles.push(yield* spawnCommand(ChildProcess.make(command.command, command.args, {\n                  ...command.options,\n                  additionalFds: {\n                    ...existingFds,\n                    [fdName]: {\n                      type: \"input\",\n                      stream: sourceStream\n                    }\n                  }\n                })));\n              } else {\n                // Invalid fd name, fall back to stdin\n                handles.push(yield* spawnCommand(ChildProcess.make(command.command, command.args, {\n                  ...command.options,\n                  stdin: {\n                    ...stdinConfig,\n                    stream: sourceStream\n                  }\n                })));\n              }\n            }\n          }\n          const handle = handles[handles.length - 1];\n          const kill = options => Effect.forEach([...handles].reverse(), handle => Effect.ignore(handle.kill(options)), {\n            discard: true\n          });\n          const unref = Effect.gen(function* () {\n            const rerefs = [];\n            for (const handle of handles) {\n              rerefs.push(yield* handle.unref);\n            }\n            return Effect.forEach([...rerefs].reverse(), reref => reref, {\n              discard: true\n            });\n          });\n          return makeHandle({\n            pid: handle.pid,\n            exitCode: handle.exitCode,\n            isRunning: handle.isRunning,\n            kill,\n            stdin: handle.stdin,\n            stdout: handle.stdout,\n            stderr: handle.stderr,\n            all: handle.all,\n            getInputFd: handle.getInputFd,\n            getOutputFd: handle.getOutputFd,\n            unref\n          });\n        }\n    }\n  });\n  return makeSpawner(spawnCommand);\n});\n/**\n * Layer that provides the `NodeChildProcessSpawner` implementation.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.effect(ChildProcessSpawner, make);\n/**\n * Flattens a `Command` into an array of `StandardCommand`s along with pipe\n * options for each connection.\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const flattenCommand = command => {\n  const commands = [];\n  const pipeOptions = [];\n  const flatten = cmd => {\n    switch (cmd._tag) {\n      case \"StandardCommand\":\n        {\n          commands.push(cmd);\n          break;\n        }\n      case \"PipedCommand\":\n        {\n          // Recursively flatten left side first\n          flatten(cmd.left);\n          // Store the pipe options for this connection\n          pipeOptions.push(cmd.options);\n          // Then flatten right side\n          flatten(cmd.right);\n          break;\n        }\n    }\n  };\n  flatten(command);\n  // The commands array is guaranteed to be non-empty since we always have at\n  // least one command in the input. We validate this at runtime and return a\n  // properly typed tuple.\n  if (commands.length === 0) {\n    // This should never happen given a valid Command input\n    throw new Error(\"flattenCommand produced empty commands array\");\n  }\n  const [first, ...rest] = commands;\n  const nonEmptyCommands = [first, ...rest];\n  return {\n    commands: nonEmptyCommands,\n    pipeOptions\n  };\n};\n//# sourceMappingURL=NodeChildProcessSpawner.js.map","const hex = byte => byte.toString(16).padStart(2, \"0\");\n/** @internal */\nexport const stringify = bytes => {\n  const segments = [bytes.subarray(0, 4), bytes.subarray(4, 6), bytes.subarray(6, 8), bytes.subarray(8, 10), bytes.subarray(10, 16)];\n  return segments.map(segment => Array.from(segment, hex).join(\"\")).join(\"-\");\n};\nconst randomBytes = () => globalThis.crypto.getRandomValues(new Uint8Array(16));\nexport function v4Bytes(bytes = randomBytes()) {\n  bytes[6] = bytes[6] & 0x0f | 0x40;\n  bytes[8] = bytes[8] & 0x3f | 0x80;\n  return bytes;\n}\n/** @internal */\nexport const v4String = bytes => stringify(bytes === undefined ? v4Bytes() : v4Bytes(bytes));\nconst maxV7Timestamp = 2 ** 48 - 1;\nexport function v7Bytes(timestampMillis, bytes = randomBytes()) {\n  const timestamp = Math.min(Math.max(0, Math.trunc(timestampMillis)), maxV7Timestamp);\n  bytes[0] = Math.floor(timestamp / 2 ** 40);\n  bytes[1] = Math.floor(timestamp / 2 ** 32) & 0xff;\n  bytes[2] = Math.floor(timestamp / 2 ** 24) & 0xff;\n  bytes[3] = Math.floor(timestamp / 2 ** 16) & 0xff;\n  bytes[4] = Math.floor(timestamp / 2 ** 8) & 0xff;\n  bytes[5] = timestamp & 0xff;\n  bytes[6] = bytes[6] & 0x0f | 0x70;\n  bytes[8] = bytes[8] & 0x3f | 0x80;\n  return bytes;\n}\n/** @internal */\nexport const v7String = (timestampMillis, bytes) => stringify(bytes === undefined ? v7Bytes(timestampMillis) : v7Bytes(timestampMillis, bytes));\n//# sourceMappingURL=uuid.js.map","/**\n * Defines a platform-independent service for cryptographic operations.\n *\n * Runtime packages provide concrete implementations backed by the host\n * platform's cryptography APIs. This module defines the service interface and a\n * constructor from random-byte and digest primitives. The service provides\n * secure random bytes and numbers, UUIDv4 and UUIDv7 generation, shuffling, and\n * SHA message digests.\n *\n * @since 4.0.0\n */\nimport * as Context from \"./Context.js\";\nimport * as Effect from \"./Effect.js\";\nimport * as Uuid from \"./internal/uuid.js\";\nimport * as PlatformError from \"./PlatformError.js\";\nconst TypeId = \"~effect/platform/Crypto\";\n/**\n * Service tag for platform cryptography.\n *\n * **When to use**\n *\n * Use when you need to provide or retrieve the full platform cryptography\n * service from an effect's context.\n *\n * **Details**\n *\n * Providing this service supplies platform-agnostic cryptographic operations\n * such as hashing, UUID generation, and secure random values.\n *\n * @see {@link make} for constructing a Crypto service from primitive operations\n *\n * @category services\n * @since 4.0.0\n */\nexport const Crypto = /*#__PURE__*/Context.Service(\"effect/Crypto\");\n/**\n * Creates a `Crypto` service from the primitive implementation, deriving the\n * random generator helpers and UUID generation from those primitives.\n *\n * **When to use**\n *\n * Use to build a Crypto service for a platform integration, test layer, or\n * custom runtime from primitive random-byte and digest operations.\n *\n * **Details**\n *\n * The constructor derives random numbers, booleans, integer ranges, shuffling,\n * and UUID generation from `impl.randomBytes`. Digest operations delegate to\n * `impl.digest`.\n *\n * **Gotchas**\n *\n * `impl.randomBytes` must return cryptographically secure bytes of the\n * requested length. UUID formatting mutates the byte array returned for UUID\n * generation, so the implementation should return a fresh array for each call.\n *\n * **Example** (Creating a Crypto service)\n *\n * ```ts import.meta.vitest\n * import { Crypto, Effect } from \"effect\"\n *\n * const testCrypto = Crypto.make({\n *   randomBytes: (size) => new Uint8Array(size),\n *   digest: (_algorithm, data) => Effect.succeed(data)\n * })\n *\n * await Effect.runPromise(testCrypto.randomBytes(4)) // => new Uint8Array([0, 0, 0, 0])\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = impl => {\n  const randomBytesUnsafe = impl.randomBytes;\n  const randomBytes = size => Effect.map(validateSize(\"randomBytes\", size), randomBytesUnsafe);\n  const readUint53 = bytes => (bytes[0] & 0x1f) * 2 ** 48 + bytes[1] * 2 ** 40 + bytes[2] * 2 ** 32 + bytes[3] * 2 ** 24 + bytes[4] * 2 ** 16 + bytes[5] * 2 ** 8 + bytes[6];\n  const nextDoubleUnsafe = () => readUint53(randomBytesUnsafe(7)) / 2 ** 53;\n  const nextIntUnsafe = () => {\n    while (true) {\n      const bytes = randomBytesUnsafe(7);\n      const value = readUint53(bytes);\n      if ((bytes[0] & 0x20) === 0) {\n        return value + Number.MIN_SAFE_INTEGER;\n      }\n      if (value < Number.MAX_SAFE_INTEGER) {\n        return value + 1;\n      }\n    }\n  };\n  return Crypto.of({\n    [TypeId]: TypeId,\n    randomBytes,\n    nextDoubleUnsafe,\n    nextIntUnsafe,\n    digest: impl.digest,\n    random: Effect.sync(() => nextDoubleUnsafe()),\n    randomBoolean: Effect.sync(() => nextDoubleUnsafe() > 0.5),\n    randomInt: Effect.sync(() => nextIntUnsafe()),\n    randomBetween: (min, max) => Effect.sync(() => nextDoubleUnsafe() * (max - min) + min),\n    randomIntBetween(min, max, options) {\n      const extra = options?.halfOpen === true ? 0 : 1;\n      return Effect.sync(() => {\n        const minInt = Math.ceil(min);\n        const maxInt = Math.floor(max);\n        return Math.floor(nextDoubleUnsafe() * (maxInt - minInt + extra)) + minInt;\n      });\n    },\n    randomShuffle: elements => Effect.sync(() => {\n      const buffer = Array.from(elements);\n      for (let i = buffer.length - 1; i >= 1; i = i - 1) {\n        const index = Math.min(i, Math.floor(nextDoubleUnsafe() * (i + 1)));\n        const value = buffer[i];\n        buffer[i] = buffer[index];\n        buffer[index] = value;\n      }\n      return buffer;\n    }),\n    randomUUIDv4: Effect.sync(() => Uuid.v4String(randomBytesUnsafe(16))),\n    randomUUIDv7: Effect.clockWith(clock => Effect.succeed(Uuid.v7String(clock.currentTimeMillisUnsafe(), randomBytesUnsafe(16))))\n  });\n};\nconst validateSize = (method, size) => Number.isSafeInteger(size) && size >= 0 ? Effect.succeed(size) : Effect.fail(PlatformError.badArgument({\n  module: \"Crypto\",\n  method,\n  description: \"size must be a non-negative safe integer\"\n}));\n//# sourceMappingURL=Crypto.js.map","/**\n * Node-compatible implementation of Effect's `Crypto` service.\n *\n * This module builds the service from `node:crypto`, using `randomBytes` for\n * random data and `createHash` for supported digest algorithms. It exports\n * `make` as the concrete service value and `layer` for providing it through\n * Effect context.\n *\n * @since 1.0.0\n */\nimport * as EffectCrypto from \"effect/Crypto\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as PlatformError from \"effect/PlatformError\";\nimport * as NodeCrypto from \"node:crypto\";\nconst toHashAlgorithm = algorithm => {\n  switch (algorithm) {\n    case \"SHA-1\":\n      return \"sha1\";\n    case \"SHA-256\":\n      return \"sha256\";\n    case \"SHA-384\":\n      return \"sha384\";\n    case \"SHA-512\":\n      return \"sha512\";\n  }\n};\nconst digest = (algorithm, data) => Effect.try({\n  try: () => Uint8Array.from(NodeCrypto.createHash(toHashAlgorithm(algorithm)).update(data).digest()),\n  catch: cause => PlatformError.systemError({\n    module: \"Crypto\",\n    method: \"digest\",\n    _tag: \"Unknown\",\n    description: \"Could not compute digest\",\n    cause\n  })\n});\n/**\n * The default Node.js Crypto service implementation.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const make = /*#__PURE__*/EffectCrypto.make({\n  randomBytes: NodeCrypto.randomBytes,\n  digest\n});\n/**\n * Layer that provides the Node.js Crypto service implementation.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layer = /*#__PURE__*/Layer.succeed(EffectCrypto.Crypto, make);\n//# sourceMappingURL=NodeCrypto.js.map","/**\n * The `NodeCrypto` module provides the Node.js `Crypto` service layer for\n * Effect programs. Provide {@link layer} at the edge of a Node application,\n * CLI, script, or test to satisfy `effect/Crypto` with Node's `node:crypto`\n * implementation for secure random bytes, UUID generation, random values, and\n * SHA digest operations.\n *\n * This module is the public Node adapter around the shared Node-compatible\n * implementation. Digest failures are reported as platform errors, and SHA-1\n * remains available only for interoperability with existing protocols.\n *\n * @since 1.0.0\n */\nimport * as NodeCrypto from \"@effect/platform-node-shared/NodeCrypto\";\n/**\n * Layer that provides the Node.js Crypto service implementation.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layer = NodeCrypto.layer;\n//# sourceMappingURL=NodeCrypto.js.map","/**\n * Shared Node-compatible implementation of Effect's `FileSystem` service.\n *\n * This module adapts Node's `node:fs`, `node:os`, and `node:path` APIs into a\n * `FileSystem` layer for Effect programs running on Node-compatible runtimes.\n * Platform packages use it to provide file and directory I/O, permissions,\n * links, metadata, temporary files and directories, and file watching through\n * the shared `FileSystem` service.\n *\n * @since 4.0.0\n */\nimport * as Cause from \"effect/Cause\";\nimport * as Effect from \"effect/Effect\";\nimport { effectify } from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport { pipe } from \"effect/Function\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Error from \"effect/PlatformError\";\nimport * as Queue from \"effect/Queue\";\nimport * as Stream from \"effect/Stream\";\nimport * as Crypto from \"node:crypto\";\nimport * as NFS from \"node:fs\";\nimport * as OS from \"node:os\";\nimport * as Path from \"node:path\";\nimport { handleErrnoException } from \"./internal/utils.js\";\nconst handleBadArgument = method => err => Error.badArgument({\n  module: \"FileSystem\",\n  method,\n  description: err.message ?? String(err)\n});\n// == access\nconst access = /*#__PURE__*/(() => {\n  const nodeAccess = /*#__PURE__*/effectify(NFS.access, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"access\"), /*#__PURE__*/handleBadArgument(\"access\"));\n  return (path, options) => {\n    let mode = NFS.constants.F_OK;\n    if (options?.readable) {\n      mode |= NFS.constants.R_OK;\n    }\n    if (options?.writable) {\n      mode |= NFS.constants.W_OK;\n    }\n    return nodeAccess(path, mode);\n  };\n})();\n// == copy\nconst copy = /*#__PURE__*/(() => {\n  const nodeCp = /*#__PURE__*/effectify(NFS.cp, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"copy\"), /*#__PURE__*/handleBadArgument(\"copy\"));\n  return (fromPath, toPath, options) => nodeCp(fromPath, toPath, {\n    force: options?.overwrite ?? false,\n    preserveTimestamps: options?.preserveTimestamps ?? false,\n    recursive: true\n  });\n})();\n// == copyFile\nconst copyFile = /*#__PURE__*/(() => {\n  const nodeCopyFile = /*#__PURE__*/effectify(NFS.copyFile, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"copyFile\"), /*#__PURE__*/handleBadArgument(\"copyFile\"));\n  return (fromPath, toPath) => nodeCopyFile(fromPath, toPath);\n})();\n// == chmod\nconst chmod = /*#__PURE__*/(() => {\n  const nodeChmod = /*#__PURE__*/effectify(NFS.chmod, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"chmod\"), /*#__PURE__*/handleBadArgument(\"chmod\"));\n  return (path, mode) => nodeChmod(path, mode);\n})();\n// == chown\nconst chown = /*#__PURE__*/(() => {\n  const nodeChown = /*#__PURE__*/effectify(NFS.chown, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"chown\"), /*#__PURE__*/handleBadArgument(\"chown\"));\n  return (path, uid, gid) => nodeChown(path, uid, gid);\n})();\n// == glob\nconst glob = /*#__PURE__*/(() => {\n  const nodeGlob = /*#__PURE__*/effectify(NFS.glob, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"glob\"), /*#__PURE__*/handleBadArgument(\"glob\"));\n  return (pattern, options) => nodeGlob(pattern, {\n    cwd: options?.root,\n    exclude: options?.exclude\n  });\n})();\n// == link\nconst link = /*#__PURE__*/(() => {\n  const nodeLink = /*#__PURE__*/effectify(NFS.link, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"link\"), /*#__PURE__*/handleBadArgument(\"link\"));\n  return (existingPath, newPath) => nodeLink(existingPath, newPath);\n})();\n// == makeDirectory\nconst makeDirectory = /*#__PURE__*/(() => {\n  const nodeMkdir = /*#__PURE__*/effectify(NFS.mkdir, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"makeDirectory\"), /*#__PURE__*/handleBadArgument(\"makeDirectory\"));\n  return (path, options) => nodeMkdir(path, {\n    recursive: options?.recursive ?? false,\n    mode: options?.mode\n  });\n})();\n// == makeTempDirectory\nconst makeTempDirectoryFactory = method => {\n  const nodeMkdtemp = effectify(NFS.mkdtemp, handleErrnoException(\"FileSystem\", method), handleBadArgument(method));\n  return options => Effect.suspend(() => {\n    const prefix = options?.prefix ?? \"\";\n    const directory = typeof options?.directory === \"string\" ? Path.join(options.directory, \".\") : OS.tmpdir();\n    return nodeMkdtemp(prefix ? Path.join(directory, prefix) : directory + \"/\");\n  });\n};\nconst makeTempDirectory = /*#__PURE__*/makeTempDirectoryFactory(\"makeTempDirectory\");\n// == remove\nconst removeFactory = method => {\n  const nodeRm = effectify(NFS.rm, handleErrnoException(\"FileSystem\", method), handleBadArgument(method));\n  return (path, options) => nodeRm(path, {\n    recursive: options?.recursive ?? false,\n    force: options?.force ?? false\n  });\n};\nconst remove = /*#__PURE__*/removeFactory(\"remove\");\n// == makeTempDirectoryScoped\nconst makeTempDirectoryScoped = /*#__PURE__*/(() => {\n  const makeDirectory = /*#__PURE__*/makeTempDirectoryFactory(\"makeTempDirectoryScoped\");\n  const removeDirectory = /*#__PURE__*/removeFactory(\"makeTempDirectoryScoped\");\n  return options => Effect.acquireRelease(makeDirectory(options), directory => Effect.orDie(removeDirectory(directory, {\n    recursive: true\n  })));\n})();\n// == open\nconst openFactory = method => {\n  const nodeOpen = effectify(NFS.open, handleErrnoException(\"FileSystem\", method), handleBadArgument(method));\n  const nodeClose = effectify(NFS.close, handleErrnoException(\"FileSystem\", method), handleBadArgument(method));\n  return (path, options) => pipe(Effect.acquireRelease(nodeOpen(path, options?.flag ?? \"r\", options?.mode), fd => Effect.orDie(nodeClose(fd))), Effect.map(fd => makeFile(fd, options?.flag?.startsWith(\"a\") ?? false)));\n};\nconst open = /*#__PURE__*/openFactory(\"open\");\nconst makeFile = /*#__PURE__*/(() => {\n  const nodeReadFactory = method => effectify(NFS.read, handleErrnoException(\"FileSystem\", method), handleBadArgument(method));\n  const nodeRead = /*#__PURE__*/nodeReadFactory(\"read\");\n  const nodeReadAlloc = /*#__PURE__*/nodeReadFactory(\"readAlloc\");\n  const nodeStat = /*#__PURE__*/effectify(NFS.fstat, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"stat\"), /*#__PURE__*/handleBadArgument(\"stat\"));\n  const nodeTruncate = /*#__PURE__*/effectify(NFS.ftruncate, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"truncate\"), /*#__PURE__*/handleBadArgument(\"truncate\"));\n  const nodeSync = /*#__PURE__*/effectify(NFS.fsync, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"sync\"), /*#__PURE__*/handleBadArgument(\"sync\"));\n  const nodeWriteFactory = method => effectify(NFS.write, handleErrnoException(\"FileSystem\", method), handleBadArgument(method));\n  const nodeWrite = /*#__PURE__*/nodeWriteFactory(\"write\");\n  const nodeWriteAll = /*#__PURE__*/nodeWriteFactory(\"writeAll\");\n  class FileImpl {\n    [FileSystem.FileTypeId];\n    fd;\n    append;\n    position = /*#__PURE__*/BigInt(0);\n    constructor(fd, append) {\n      this[FileSystem.FileTypeId] = FileSystem.FileTypeId;\n      this.fd = fd;\n      this.append = append;\n    }\n    get stat() {\n      return Effect.map(nodeStat(this.fd), makeFileInfo);\n    }\n    get sync() {\n      return nodeSync(this.fd);\n    }\n    seek(offset, from) {\n      const offsetSize = FileSystem.Size(offset);\n      return Effect.sync(() => {\n        if (from === \"start\") {\n          this.position = offsetSize;\n        } else if (from === \"current\") {\n          this.position = this.position + offsetSize;\n        }\n        return FileSystem.Size(this.position);\n      });\n    }\n    read(buffer) {\n      return Effect.suspend(() => {\n        const position = this.position;\n        return Effect.map(nodeRead(this.fd, {\n          buffer,\n          position\n        }), bytesRead => {\n          const sizeRead = FileSystem.Size(bytesRead);\n          this.position = position + sizeRead;\n          return sizeRead;\n        });\n      });\n    }\n    readAlloc(size) {\n      const sizeNumber = Number(size);\n      return Effect.suspend(() => {\n        const buffer = Buffer.allocUnsafeSlow(sizeNumber);\n        const position = this.position;\n        return Effect.map(nodeReadAlloc(this.fd, {\n          buffer,\n          position\n        }), bytesRead => {\n          if (bytesRead === 0) {\n            return Option.none();\n          }\n          this.position = position + BigInt(bytesRead);\n          if (bytesRead === sizeNumber) {\n            return Option.some(buffer);\n          }\n          const dst = Buffer.allocUnsafeSlow(bytesRead);\n          buffer.copy(dst, 0, 0, bytesRead);\n          return Option.some(dst);\n        });\n      });\n    }\n    truncate(length) {\n      return Effect.map(nodeTruncate(this.fd, length ? Number(length) : undefined), () => {\n        if (!this.append) {\n          const len = BigInt(length ?? 0);\n          if (this.position > len) {\n            this.position = len;\n          }\n        }\n      });\n    }\n    write(buffer) {\n      return Effect.suspend(() => {\n        const position = this.position;\n        return Effect.map(nodeWrite(this.fd, buffer, undefined, undefined, this.append ? undefined : Number(position)), bytesWritten => {\n          const sizeWritten = FileSystem.Size(bytesWritten);\n          if (!this.append) {\n            this.position = position + sizeWritten;\n          }\n          return sizeWritten;\n        });\n      });\n    }\n    writeAllChunk(buffer) {\n      return Effect.suspend(() => {\n        const position = this.position;\n        return Effect.flatMap(nodeWriteAll(this.fd, buffer, undefined, undefined, this.append ? undefined : Number(position)), bytesWritten => {\n          if (bytesWritten === 0) {\n            return Effect.fail(Error.systemError({\n              module: \"FileSystem\",\n              method: \"writeAll\",\n              _tag: \"WriteZero\",\n              pathOrDescriptor: this.fd,\n              description: \"write returned 0 bytes written\"\n            }));\n          }\n          if (!this.append) {\n            this.position = position + BigInt(bytesWritten);\n          }\n          return bytesWritten < buffer.length ? this.writeAllChunk(buffer.subarray(bytesWritten)) : Effect.void;\n        });\n      });\n    }\n    writeAll(buffer) {\n      return this.writeAllChunk(buffer);\n    }\n  }\n  return (fd, append) => new FileImpl(fd, append);\n})();\n// == makeTempFile\nconst makeTempFileFactory = method => {\n  const makeDirectory = makeTempDirectoryFactory(method);\n  return Effect.fnUntraced(function* (options) {\n    const directory = yield* makeDirectory(options);\n    const random = Crypto.randomBytes(6).toString(\"hex\");\n    const name = Path.join(directory, options?.suffix ? `${random}${options.suffix}` : random);\n    yield* writeFile(name, new Uint8Array(0));\n    return name;\n  });\n};\nconst makeTempFile = /*#__PURE__*/makeTempFileFactory(\"makeTempFile\");\n// == makeTempFileScoped\nconst makeTempFileScoped = /*#__PURE__*/(() => {\n  const makeFile = /*#__PURE__*/makeTempFileFactory(\"makeTempFileScoped\");\n  const removeDirectory = /*#__PURE__*/removeFactory(\"makeTempFileScoped\");\n  return options => Effect.acquireRelease(makeFile(options), file => Effect.orDie(removeDirectory(Path.dirname(file), {\n    recursive: true\n  })));\n})();\n// == readDirectory\nconst readDirectory = (path, options) => Effect.tryPromise({\n  try: () => NFS.promises.readdir(path, options),\n  catch: err => handleErrnoException(\"FileSystem\", \"readDirectory\")(err, [path])\n});\n// == readFile\nconst readFile = path => Effect.callback((resume, signal) => {\n  try {\n    NFS.readFile(path, {\n      signal\n    }, (err, data) => {\n      if (err) {\n        resume(Effect.fail(handleErrnoException(\"FileSystem\", \"readFile\")(err, [path])));\n      } else {\n        resume(Effect.succeed(data));\n      }\n    });\n  } catch (err) {\n    resume(Effect.fail(handleBadArgument(\"readFile\")(err)));\n  }\n});\n// == readLink\nconst readLink = /*#__PURE__*/(() => {\n  const nodeReadLink = /*#__PURE__*/effectify(NFS.readlink, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"readLink\"), /*#__PURE__*/handleBadArgument(\"readLink\"));\n  return path => nodeReadLink(path);\n})();\n// == realPath\nconst realPath = /*#__PURE__*/(() => {\n  const nodeRealPath = /*#__PURE__*/effectify(NFS.realpath, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"realPath\"), /*#__PURE__*/handleBadArgument(\"realPath\"));\n  return path => nodeRealPath(path);\n})();\n// == rename\nconst rename = /*#__PURE__*/(() => {\n  const nodeRename = /*#__PURE__*/effectify(NFS.rename, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"rename\"), /*#__PURE__*/handleBadArgument(\"rename\"));\n  return (oldPath, newPath) => nodeRename(oldPath, newPath);\n})();\n// == stat\nconst makeFileInfo = stat => ({\n  type: stat.isFile() ? \"File\" : stat.isDirectory() ? \"Directory\" : stat.isSymbolicLink() ? \"SymbolicLink\" : stat.isBlockDevice() ? \"BlockDevice\" : stat.isCharacterDevice() ? \"CharacterDevice\" : stat.isFIFO() ? \"FIFO\" : stat.isSocket() ? \"Socket\" : \"Unknown\",\n  mtime: Option.fromNullishOr(stat.mtime),\n  atime: Option.fromNullishOr(stat.atime),\n  birthtime: Option.fromNullishOr(stat.birthtime),\n  dev: stat.dev,\n  rdev: Option.fromNullishOr(stat.rdev),\n  ino: Option.fromNullishOr(stat.ino),\n  mode: stat.mode,\n  nlink: Option.fromNullishOr(stat.nlink),\n  uid: Option.fromNullishOr(stat.uid),\n  gid: Option.fromNullishOr(stat.gid),\n  size: FileSystem.Size(stat.size),\n  blksize: stat.blksize !== undefined ? Option.some(FileSystem.Size(stat.blksize)) : Option.none(),\n  blocks: Option.fromNullishOr(stat.blocks)\n});\nconst stat = /*#__PURE__*/(() => {\n  const nodeStat = /*#__PURE__*/effectify(NFS.stat, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"stat\"), /*#__PURE__*/handleBadArgument(\"stat\"));\n  return path => Effect.map(nodeStat(path), makeFileInfo);\n})();\n// == symlink\nconst symlink = /*#__PURE__*/(() => {\n  const nodeSymlink = /*#__PURE__*/effectify(NFS.symlink, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"symlink\"), /*#__PURE__*/handleBadArgument(\"symlink\"));\n  return (target, path) => nodeSymlink(target, path);\n})();\n// == truncate\nconst truncate = /*#__PURE__*/(() => {\n  const nodeTruncate = /*#__PURE__*/effectify(NFS.truncate, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"truncate\"), /*#__PURE__*/handleBadArgument(\"truncate\"));\n  return (path, length) => nodeTruncate(path, length !== undefined ? Number(length) : undefined);\n})();\n// == utimes\nconst utimes = /*#__PURE__*/(() => {\n  const nodeUtimes = /*#__PURE__*/effectify(NFS.utimes, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"utime\"), /*#__PURE__*/handleBadArgument(\"utime\"));\n  return (path, atime, mtime) => nodeUtimes(path, atime, mtime);\n})();\n// == watch\nconst watchNode = (path, options) => Stream.callback(queue => Effect.acquireRelease(Effect.sync(() => {\n  const watcher = NFS.watch(path, {\n    recursive: options?.recursive ?? false\n  }, (event, path) => {\n    if (!path) return;\n    switch (event) {\n      case \"rename\":\n        {\n          Effect.runFork(Effect.matchEffect(stat(path), {\n            onSuccess: _ => Queue.offer(queue, {\n              _tag: \"Create\",\n              path\n            }),\n            onFailure: _ => Queue.offer(queue, {\n              _tag: \"Remove\",\n              path\n            })\n          }));\n          return;\n        }\n      case \"change\":\n        {\n          Queue.offerUnsafe(queue, {\n            _tag: \"Update\",\n            path\n          });\n          return;\n        }\n    }\n  });\n  watcher.on(\"error\", error => {\n    Queue.failCauseUnsafe(queue, Cause.fail(Error.systemError({\n      module: \"FileSystem\",\n      _tag: \"Unknown\",\n      method: \"watch\",\n      pathOrDescriptor: path,\n      cause: error\n    })));\n  });\n  watcher.on(\"close\", () => {\n    Queue.endUnsafe(queue);\n  });\n  return watcher;\n}), watcher => Effect.sync(() => watcher.close())));\nconst watch = (backend, path, options) => stat(path).pipe(Effect.map(stat => backend.pipe(Option.flatMap(_ => _.register(path, stat, options)), Option.getOrElse(() => watchNode(path, options)))), Stream.unwrap);\n// == writeFile\nconst writeFile = (path, data, options) => Effect.callback((resume, signal) => {\n  try {\n    NFS.writeFile(path, data, {\n      signal,\n      flag: options?.flag,\n      mode: options?.mode\n    }, err => {\n      if (err) {\n        resume(Effect.fail(handleErrnoException(\"FileSystem\", \"writeFile\")(err, [path])));\n      } else {\n        resume(Effect.void);\n      }\n    });\n  } catch (err) {\n    resume(Effect.fail(handleBadArgument(\"writeFile\")(err)));\n  }\n});\nconst makeFileSystem = /*#__PURE__*/Effect.map(/*#__PURE__*/Effect.serviceOption(FileSystem.WatchBackend), backend => FileSystem.make({\n  access,\n  chmod,\n  chown,\n  copy,\n  copyFile,\n  glob,\n  link,\n  makeDirectory,\n  makeTempDirectory,\n  makeTempDirectoryScoped,\n  makeTempFile,\n  makeTempFileScoped,\n  open,\n  readDirectory,\n  readFile,\n  readLink,\n  realPath,\n  remove,\n  rename,\n  stat,\n  symlink,\n  truncate,\n  utimes,\n  watch(path, options) {\n    return watch(backend, path, options);\n  },\n  writeFile\n}));\n/**\n * Provides the `FileSystem` service backed by Node filesystem APIs, including\n * file operations, directory operations, links, metadata, and file watching.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.effect(FileSystem.FileSystem)(makeFileSystem);\n//# sourceMappingURL=NodeFileSystem.js.map","/**\n * Node.js `FileSystem` layer for programs that perform real filesystem I/O.\n *\n * The exported layer satisfies the platform-independent `FileSystem` service\n * with Node-backed operations for files, directories, metadata, permissions,\n * links, temporary paths, and path watching. Effects still call the service from\n * `effect/FileSystem`; this module only chooses the Node implementation.\n *\n * @since 4.0.0\n */\nimport * as NodeFileSystem from \"@effect/platform-node-shared/NodeFileSystem\";\n/**\n * Provides the `FileSystem` service backed by Node filesystem APIs.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = NodeFileSystem.layer;\n//# sourceMappingURL=NodeFileSystem.js.map","/**\n * Node-backed provider for Effect's `Path` service.\n *\n * This module turns Node's `node:path` and `node:url` APIs into `Path` layers.\n * `layer` uses the host platform path implementation, while `layerPosix` and\n * `layerWin32` provide fixed POSIX and Windows variants. All three layers also\n * include helpers for converting between file paths and file URLs.\n *\n * @since 4.0.0\n */\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { Path, TypeId } from \"effect/Path\";\nimport { BadArgument } from \"effect/PlatformError\";\nimport * as NodePath from \"node:path\";\nimport * as NodeUrl from \"node:url\";\nconst fileUrlOps = windows => ({\n  fromFileUrl: url => Effect.try({\n    try: () => NodeUrl.fileURLToPath(url, {\n      windows\n    }),\n    catch: cause => new BadArgument({\n      module: \"Path\",\n      method: \"fromFileUrl\",\n      cause\n    })\n  }),\n  toFileUrl: path => Effect.try({\n    try: () => NodeUrl.pathToFileURL(path, {\n      windows\n    }),\n    catch: cause => new BadArgument({\n      module: \"Path\",\n      method: \"toFileUrl\",\n      cause\n    })\n  })\n});\n/**\n * Provides the `Path` service using Node's POSIX path implementation plus\n * file URL conversion helpers.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerPosix = /*#__PURE__*/Layer.succeed(Path)({\n  [TypeId]: TypeId,\n  ...NodePath.posix,\n  ... /*#__PURE__*/fileUrlOps(false)\n});\n/**\n * Provides the `Path` service using Node's Windows path implementation plus\n * file URL conversion helpers.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWin32 = /*#__PURE__*/Layer.succeed(Path)({\n  [TypeId]: TypeId,\n  ...NodePath.win32,\n  ... /*#__PURE__*/fileUrlOps(true)\n});\n/**\n * Provides the default `Path` service using the host platform's Node path\n * implementation plus file URL conversion helpers.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.succeed(Path)({\n  [TypeId]: TypeId,\n  ...NodePath,\n  ... /*#__PURE__*/fileUrlOps(undefined)\n});\n//# sourceMappingURL=NodePath.js.map","/**\n * Node.js layers for Effect's `Path` service.\n *\n * This module provides the default, POSIX, and Windows variants of the\n * platform-independent `Path` service by reusing the shared Node path\n * implementation. The provided path services include Node file URL conversion\n * behavior.\n *\n * @since 4.0.0\n */\nimport * as NodePath from \"@effect/platform-node-shared/NodePath\";\n/**\n * Provides the default Node `Path` service using the platform's `node:path`\n * implementation.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = NodePath.layer;\n/**\n * Provides the `Path` service using Node's POSIX path implementation,\n * regardless of the host platform.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerPosix = NodePath.layerPosix;\n/**\n * Provides the `Path` service using Node's Windows path implementation,\n * regardless of the host platform.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWin32 = NodePath.layerWin32;\n//# sourceMappingURL=NodePath.js.map","/**\n * Service contract for command-line arguments and standard input, output, and\n * error output. It lets programs depend on standard I/O through the Effect\n * environment instead of reading from or writing to global process handles\n * directly.\n *\n * The service exposes arguments as an `Effect`, stdout and stderr as `Sink`s\n * that accept strings or bytes, and stdin as a byte `Stream`. This module also\n * provides a constructor for service values and a small test layer with\n * overridable defaults.\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 Sink from \"./Sink.js\";\nimport * as Stream from \"./Stream.js\";\n/**\n * Runtime identifier stored on `Stdio` service implementations.\n *\n * **Details**\n *\n * This marker is part of the runtime representation of `Stdio` service\n * implementations.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/Stdio\";\n/**\n * Service tag for process standard I/O.\n *\n * **When to use**\n *\n * Use when you need command-line arguments or standard I/O streams supplied by\n * an effect's environment.\n *\n * @see {@link make} for constructing a `Stdio` service directly\n * @see {@link layerTest} for a test layer with defaults and overrides\n *\n * @category services\n * @since 4.0.0\n */\nexport const Stdio = /*#__PURE__*/Context.Service(TypeId);\n/**\n * Creates a `Stdio` service implementation from the provided fields and\n * attaches the `Stdio` type identifier.\n *\n * **When to use**\n *\n * Use when you need to assemble a concrete `Stdio` service from command-line\n * arguments and standard I/O implementations.\n *\n * **Details**\n *\n * The returned service reuses the supplied fields unchanged and adds the\n * `Stdio` type identifier. Omitted terminal-detection fields default to\n * effects that succeed with `false`.\n *\n * @see {@link layerTest} for a test layer with default fields that can be overridden\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = options => ({\n  [TypeId]: TypeId,\n  stdinIsTerminal: Effect.succeed(false),\n  stdoutIsTerminal: Effect.succeed(false),\n  ...options\n});\n/**\n * Creates a test layer for `Stdio`.\n *\n * **When to use**\n *\n * Use to provide deterministic standard I/O in tests while overriding only the\n * command-line arguments, input stream, or output sinks relevant to the case.\n *\n * **Details**\n *\n * Any provided fields override defaults. By default, arguments are empty,\n * standard output and error are draining sinks, and standard input is an empty\n * stream, and terminal-detection effects succeed with `false`.\n *\n * @see {@link make} for constructing a `Stdio` service directly without a `Layer` or defaults\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerTest = impl => Layer.succeed(Stdio, make({\n  args: Effect.succeed([]),\n  stdout: () => Sink.drain,\n  stderr: () => Sink.drain,\n  stdin: Stream.empty,\n  ...impl\n}));\n//# sourceMappingURL=Stdio.js.map","/**\n * Shared Node.js implementation of the Effect `Stdio` service.\n *\n * `NodeStdio` provides {@link Stdio.Stdio} from the current Node process. The\n * exported {@link layer} reads command-line arguments from `process.argv`,\n * consumes input from `process.stdin`, and writes normal and error output to\n * `process.stdout` and `process.stderr`. Standard input remains open, and\n * standard output and error output are not ended unless requested.\n *\n * @since 4.0.0\n */\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { systemError } from \"effect/PlatformError\";\nimport * as Stdio from \"effect/Stdio\";\nimport { fromWritable } from \"./NodeSink.js\";\nimport { fromReadable } from \"./NodeStream.js\";\n/**\n * Provides `Stdio` from `process.argv`, `process.stdin`, `process.stdout`,\n * and `process.stderr`; stdin remains open and stdout/stderr are not ended by\n * default.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.succeed(Stdio.Stdio, /*#__PURE__*/Stdio.make({\n  args: /*#__PURE__*/Effect.sync(() => process.argv.slice(2)),\n  stdinIsTerminal: /*#__PURE__*/Effect.sync(() => process.stdin.isTTY === true),\n  stdoutIsTerminal: /*#__PURE__*/Effect.sync(() => process.stdout.isTTY === true),\n  stdout: options => fromWritable({\n    evaluate: () => process.stdout,\n    onError: cause => systemError({\n      module: \"Stdio\",\n      method: \"stdout\",\n      _tag: \"Unknown\",\n      cause\n    }),\n    endOnDone: options?.endOnDone ?? false\n  }),\n  stderr: options => fromWritable({\n    evaluate: () => process.stderr,\n    onError: cause => systemError({\n      module: \"Stdio\",\n      method: \"stderr\",\n      _tag: \"Unknown\",\n      cause\n    }),\n    endOnDone: options?.endOnDone ?? false\n  }),\n  stdin: /*#__PURE__*/fromReadable({\n    evaluate: () => process.stdin,\n    onError: cause => systemError({\n      module: \"Stdio\",\n      method: \"stdin\",\n      _tag: \"Unknown\",\n      cause\n    }),\n    closeOnDone: false\n  })\n}));\n//# sourceMappingURL=NodeStdio.js.map","/**\n * Node.js `Stdio` layer for the current process.\n *\n * The exported layer reuses the shared Node stdio implementation. It satisfies\n * the platform-independent `Stdio` service by reading command-line arguments\n * from `process.argv`, consuming input from `process.stdin`, and writing output\n * streams to `process.stdout` and `process.stderr`.\n *\n * @since 4.0.0\n */\nimport * as NodeStdio from \"@effect/platform-node-shared/NodeStdio\";\n/**\n * Provides the `Stdio` service backed by the current process arguments,\n * stdin, stdout, and stderr streams.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = NodeStdio.layer;\n//# sourceMappingURL=NodeStdio.js.map","import * as Context from \"./Context.js\";\nimport * as Predicate from \"./Predicate.js\";\nimport * as Schema from \"./Schema.js\";\nconst TypeId = \"~effect/platform/Terminal\";\nconst QuitErrorTypeId = \"effect/platform/Terminal/QuitError\";\n/**\n * Represents an error that occurs when a user attempts to\n * quit out of a `Terminal` prompt for input (usually by entering `ctrl`+`c`).\n *\n * **When to use**\n *\n * Use when implementing terminal input or prompts that need to signal\n * user-requested cancellation through the typed error channel.\n *\n * @see {@link isQuitError} for checking unknown errors when handling terminal cancellation\n *\n * @category errors\n * @since 4.0.0\n */\nexport class QuitError extends /*#__PURE__*/Schema.Error(\"QuitError\")({\n  _tag: /*#__PURE__*/Schema.tag(\"QuitError\")\n}) {\n  /**\n   * Marks this value as a terminal quit error for runtime guards.\n   *\n   * @since 4.0.0\n   */\n  [QuitErrorTypeId] = QuitErrorTypeId;\n}\n/**\n * Returns `true` if the provided value is a `Terminal.QuitError`.\n *\n * **When to use**\n *\n * Use to narrow unknown failures to `QuitError` when handling terminal input\n * cancellation.\n *\n * **Details**\n *\n * Returns `true` when the value carries the `QuitError` runtime marker and\n * narrows it to `QuitError`.\n *\n * @see {@link QuitError} for the error value produced when terminal input is quit\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isQuitError = u => Predicate.hasProperty(u, QuitErrorTypeId);\n/**\n * Service tag for command-line input and output services.\n *\n * **When to use**\n *\n * Use to access or provide platform terminal capabilities such as reading\n * input, writing output, and inspecting terminal dimensions.\n *\n * @category services\n * @since 4.0.0\n */\nexport const Terminal = /*#__PURE__*/Context.Service(\"effect/platform/Terminal\");\n/**\n * Creates a `Terminal` service implementation.\n *\n * **When to use**\n *\n * Use to construct a custom `Terminal` service implementation from concrete\n * terminal capabilities when writing a platform adapter, test implementation,\n * or custom runtime service.\n *\n * **Details**\n *\n * The implementation object supplies `columns`, `rows`, `readInput`,\n * `readLine`, and `display`; `make` attaches the `Terminal` service marker so\n * the result can be provided through the `Terminal` context service.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = impl => Terminal.of({\n  ...impl,\n  [TypeId]: TypeId\n});\n//# sourceMappingURL=Terminal.js.map","import * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport { badArgument } from \"effect/PlatformError\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Queue from \"effect/Queue\";\nimport * as RcRef from \"effect/RcRef\";\nimport * as Terminal from \"effect/Terminal\";\nimport * as readline from \"node:readline\";\n/**\n * Creates a scoped process-backed `Terminal` using Node `readline`, enabling\n * TTY raw mode while in scope and using the supplied predicate to decide when\n * key input should end.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = /*#__PURE__*/Effect.fnUntraced(function* (shouldQuit = defaultShouldQuit) {\n  const stdin = process.stdin;\n  const stdout = process.stdout;\n  const lines = yield* Queue.make();\n  // stdin \"end\" fires once per process, so remember end-of-input for readers\n  // created after the event (Bun never sets `readableEnded`).\n  let inputEnded = stdin.readableEnded;\n  let readlineActive = false;\n  const onStdinEnd = () => {\n    inputEnded = true;\n    if (!readlineActive) {\n      Queue.endUnsafe(lines);\n    }\n  };\n  stdin.once(\"end\", onStdinEnd);\n  yield* Effect.addFinalizer(() => Effect.sync(() => stdin.off(\"end\", onStdinEnd)));\n  const rlRef = yield* RcRef.make({\n    acquire: Effect.acquireRelease(Effect.sync(() => {\n      const rl = readline.createInterface({\n        input: stdin,\n        escapeCodeTimeout: 50\n      });\n      const onLine = line => Queue.offerUnsafe(lines, line);\n      const onClose = () => {\n        readlineActive = false;\n        Queue.endUnsafe(lines);\n      };\n      readlineActive = true;\n      readline.emitKeypressEvents(stdin, rl);\n      rl.on(\"line\", onLine);\n      rl.once(\"close\", onClose);\n      if (stdin.isTTY) {\n        stdin.setRawMode(true);\n      }\n      return {\n        rl,\n        onClose,\n        onLine\n      };\n    }), ({\n      rl,\n      onClose,\n      onLine\n    }) => Effect.sync(() => {\n      readlineActive = false;\n      rl.off(\"line\", onLine);\n      rl.off(\"close\", onClose);\n      if (stdin.isTTY) {\n        stdin.setRawMode(false);\n      }\n      rl.close();\n      if (inputEnded) {\n        Queue.endUnsafe(lines);\n      }\n    })),\n    idleTimeToLive: \"10 millis\"\n  });\n  const columns = Effect.sync(() => stdout.columns ?? 0);\n  const rows = Effect.sync(() => stdout.rows ?? 0);\n  const readInput = Effect.gen(function* () {\n    const queue = yield* Queue.make();\n    const handleKeypress = (s, k) => {\n      const userInput = {\n        input: Option.fromUndefinedOr(s),\n        key: {\n          name: k.name ?? \"\",\n          ctrl: !!k.ctrl,\n          meta: !!k.meta,\n          shift: !!k.shift\n        }\n      };\n      Queue.offerUnsafe(queue, userInput);\n      if (shouldQuit(userInput)) {\n        Queue.endUnsafe(queue);\n      }\n    };\n    // Deno's `process.stdin` shim does not keep the event loop alive, so a\n    // program blocked on input can exit before `end` is ever delivered. A\n    // timer holds the loop open for as long as this reader is active.\n    const keepAlive = setInterval(() => {}, 2147483647);\n    // Without this, consumers (e.g. `Prompt.run`) hang forever on closed stdin.\n    const handleEnd = () => {\n      clearInterval(keepAlive);\n      Queue.endUnsafe(queue);\n    };\n    yield* Effect.addFinalizer(() => Effect.sync(() => {\n      clearInterval(keepAlive);\n      stdin.off(\"keypress\", handleKeypress);\n      stdin.off(\"end\", handleEnd);\n    }));\n    stdin.on(\"keypress\", handleKeypress);\n    if (inputEnded) {\n      handleEnd();\n    } else {\n      yield* RcRef.get(rlRef);\n      stdin.once(\"end\", handleEnd);\n    }\n    return queue;\n  });\n  const readLine = Effect.suspend(() => Queue.poll(lines).pipe(Effect.flatMap(Option.match({\n    onNone: () => Effect.scoped(Effect.andThen(RcRef.get(rlRef), Queue.take(lines))),\n    onSome: Effect.succeed\n  })), Effect.mapError(() => new Terminal.QuitError({}))));\n  const display = prompt => Effect.uninterruptible(Effect.callback(resume => {\n    stdout.write(prompt, err => Predicate.isNullish(err) ? resume(Effect.void) : resume(Effect.fail(badArgument({\n      module: \"Terminal\",\n      method: \"display\",\n      description: \"Failed to write prompt to stdout\",\n      cause: err\n    }))));\n  }));\n  return Terminal.make({\n    columns,\n    rows,\n    readInput,\n    readLine,\n    display\n  });\n});\n/**\n * Provides the default process-backed `Terminal` service, ending key input on\n * Ctrl+C or Ctrl+D.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.effect(Terminal.Terminal, /*#__PURE__*/make(defaultShouldQuit));\nfunction defaultShouldQuit(input) {\n  return input.key.ctrl && (input.key.name === \"c\" || input.key.name === \"d\");\n}\n//# sourceMappingURL=NodeTerminal.js.map","/**\n * Node.js implementation of the Effect `Terminal` service.\n *\n * This module reuses the shared Node terminal implementation. `make` creates a\n * scoped process-backed `Terminal` service, and `layer` provides the default\n * service with the standard quit behavior for key input.\n *\n * @since 4.0.0\n */\nimport * as NodeTerminal from \"@effect/platform-node-shared/NodeTerminal\";\n/**\n * Creates a scoped `Terminal` service backed by process stdin/stdout, using the\n * optional predicate to decide when key input should end the input stream.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = NodeTerminal.make;\n/**\n * Provides the default process-backed `Terminal` service, ending key input on\n * the default quit keys.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = NodeTerminal.layer;\n//# sourceMappingURL=NodeTerminal.js.map","import * as Layer from \"effect/Layer\";\nimport * as NodeChildProcessSpawner from \"./NodeChildProcessSpawner.js\";\nimport * as NodeCrypto from \"./NodeCrypto.js\";\nimport * as NodeFileSystem from \"./NodeFileSystem.js\";\nimport * as NodePath from \"./NodePath.js\";\nimport * as NodeStdio from \"./NodeStdio.js\";\nimport * as NodeTerminal from \"./NodeTerminal.js\";\n/**\n * Provides the default Node implementations for child process spawning,\n * filesystem, path, stdio, and terminal services.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.provideMerge(NodeChildProcessSpawner.layer, /*#__PURE__*/Layer.mergeAll(NodeFileSystem.layer, NodeCrypto.layer, NodePath.layer, NodeStdio.layer, NodeTerminal.layer));\n//# sourceMappingURL=NodeServices.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],"mappings":";;;;;;;;;;;;;;;AASA,MAAMA,WAAS;AACf,MAAM,aAAa,EACjB,MAAM,QACR;AACA,MAAM,cAAc,EAClB,MAAM,SACR;AACA,MAAM,WAAW;CACf,IAAI;CACJ,IAAI;AACN;AACA,IAAM,YAAN,MAAgB;CACd,CAACA,YAAU;CACX,OAAO;EACL,OAAO,cAAc,MAAM,SAAS;CACtC;CACA,QAAQ;CACR,YAAyB,2BAAqB,CAAC;CAC/C;CACA;CACA;CACA;CACA,YAAY,SAAS,SAAS,OAAO,gBAAgB;EACnD,KAAK,UAAU;EACf,KAAK,UAAU;EACf,KAAK,QAAQ;EACb,KAAK,iBAAiB;CACxB;AACF;;AAEA,MAAaC,UAAO,YAAWC,WAAiB,UAAS;CACvD,MAAM,UAAU,MAAM;CACtB,MAAM,QAAQC,MAAY,SAASC,KAAW;CAC9C,MAAM,MAAM,IAAI,UAAU,QAAQ,SAAS,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