import { __exports as stream } from '../../../../../../../_virtual/stream3.mjs';
import { merge2_1 } from '../../../../../merge2@1.4.1/node_modules/merge2/index.mjs';

Object.defineProperty(stream, "__esModule", {
  value: true
});
stream.merge = void 0;
const merge2 = merge2_1;
function merge(streams) {
  const mergedStream = merge2(streams);
  streams.forEach(stream => {
    stream.once('error', error => mergedStream.emit('error', error));
  });
  mergedStream.once('close', () => propagateCloseEventToSources(streams));
  mergedStream.once('end', () => propagateCloseEventToSources(streams));
  return mergedStream;
}
stream.merge = merge;
function propagateCloseEventToSources(streams) {
  streams.forEach(stream => stream.emit('close'));
}

export { stream as default };
