 wState || rState;
  return !!(stream.destroyed || stream[kIsDestroyed] || state?.destroyed);
}
function isWritableEnded(stream) {
  if (!isWritableNodeStream(stream))
    return null;
  if (stream.writableEnded === !0)
    return !0;
  let wState = stream._writableState;
  if (wState?.errored)
    return !1;
  if (typeof wState?.ended !== "boolean")
    return null;
  return wState.ended;
}
function isWritableFinished(stream, strict) {
  if (!isWritableNodeStream(stream))
    return null;
  if (stream.writableFinished === !0)
    return !0;
  let wState = stream._writableState;
  if (wState?.errored)
    return !1;
  if (typeof wState?.finished !== "boolean")
    return null;
  return !!(wState.finished || strict === !1 && wState.ended === !0 && wState.length === 0);
}
function isReadableEnded(stream) {
  if (!isReadableNodeStream(stream))
    return null;
  if (stream.readableEnded === !0)
    return !0;
  let rState = stream._readableState;
  if (!rState || rState.errored)
    return !1;
  if (typeof rState?.ended !== "boolean")
    return null;
  return rState.ended;
}
function isReadableFinished(stream, strict) {
  if (!isReadableNodeStream(stream))
    return null;
  let rState = stream._readableState;
  if (rState?.errored)
    return !1;
  if (typeof rState?.endEmitted !== "boolean")
    return null;
  return !!(rState.endEmitted || strict === !1 && rState.ended === !0 && rState.length === 0);
}
function isReadable(stream) {
  if (stream && stream[kIsReadable] != null)
    return stream[kIsReadable];
  if (typeof stream?.readable !== "boolean")
    return null;
  if (isDestroyed(stream))
    return !1;
  return isReadableNodeStream(stream) && stream.readable && !isReadableFinished(stream);
}
function isWritable(stream) {
  if (stream && stream[kIsWritable] != null)
    return stream[kIsWritable];
  if (typeof stream?.writable !== "boolean")
    return null;
  if (isDestroyed(stream))
    return !1;
  return isWritableNodeStream(stream) && stream.writable && !isWritableEnded(stream);
}
function isFinished(stream, opts) {
  if (!isNodeStream(stream))
    return null;
  if (isDestroyed(stream))
    return !0;
  if (opts?.readable !== !1 && isReadable(stream))
    return !1;
  if (opts?.writable !== !1 && isWritable(stream))
    return !1;
  return !0;
}
function isWritableErrored(stream) {
  if (!isNodeStream(stream))
    return null;
  if (stream.writableErrored)
    return stream.writableErrored;
  return stream._writableState?.errored ?? null;
}
function isReadableErrored(stream) {
  if (!isNodeStream(stream))
    return null;
  if (stream.readableErrored)
    return stream.readableErrored;
  return stream._readableState?.errored ?? null;
}
function isClosed(stream) {
  if (!isNodeStream(stream))
    return null;
  if (typeof stream.closed === "boolean")
    return stream.closed;
  let { _writableState: wState, _readableState: rState } = stream;
  if (typeof wState?.closed === "boolean" || typeof rState?.closed === "boolean")
    return wState?.closed || rState?.closed;
  if (typeof stream._closed === "boolean" && isOutgoingMessage(stream))
    return stream._closed;
  return null;
}
function isOutgoingMessage(stream) {
  return typeof stream._closed === "boolean" && typeof stream._defaultKeepAlive === "boolean" && typeof stream._removedConnection === "boolean" && typeof stream._removedContLen === "boolean";
}
function isServerResponse(stream) {
  return typeof stream._sent100 === "boolean" && isOutgoingMessage(stream);
}
function isServerRequest(stream) {
  return typeof stream._consuming === "boolean" && typeof stream._dumped === "boolean" && stream.req?.upgradeOrConnect === @undefined;
}
function willEmitClose(stream) {
  if (!isNodeStream(stream))
    return null;
  let { _writableState: wState, _readableState: rState } = stream, state = wState || rState;
  return !state && isServerResponse(stream) || !!(state?.autoDestroy && state.emitClose && state.closed === !1);
}
function isDisturbed(stream) {
  return !!(stream && (stream[kIsDisturbed] ?? (stream.readableDidRead || stream.readableAborted)));
}
function isErrored(stream) {
  return !!(stream && (stream[kIsErrored] ?? stream.readableErrored ?? stream.writableErrored ?? stream._readableState?.errorEmitted ?? stream._writableState?.errorEmitted ?? stream._readableState?.errored ?? stream._writableState?.errored));
}
$ = {
  kOnConstructed,
  isDestroyed,
  kIsDestroyed,
  isDisturbed,
  kIsDisturbed,
  isErrored,
  kIsErrored,
  isReadable,
  kIsReadable,
  kIsClosedPromise,
  kControllerErrorFunction,
  kIsWritable,
  isClosed,
  isDuplexNodeStream,
  isFinished,
  isIterable,
  isReadableNodeStream,
  isReadableStream,
  isReadableEnded,
  isReadableFinished,
  isReadableErrored,
  isNodeStream,
  isWebStream,
  isWritable,
  isWritableNodeStream,
  isWritableStream,
  isWritableEnded,
  isWritableFinished,
  isWritableErrored,
  isServerRequest,
  isServerResponse,
  willEmitClose,
  isTransformStream,
  kState,
  kObjectMode,
  kErrorEmitted,
  kAutoDestroy,
  kEmitClose,
  kDestroyed,
  kClosed,
  kCloseEmitted,
  kErrored,
  kConstructed
};
return $})

